<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wikiti.brandonw.net/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wikiti.brandonw.net/index.php?action=history&amp;feed=atom&amp;title=83Plus%3ASoftware%3Ausb8x%2FAsm_Interface%2FMSD%2FmsdDetect</id>
		<title>83Plus:Software:usb8x/Asm Interface/MSD/msdDetect - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wikiti.brandonw.net/index.php?action=history&amp;feed=atom&amp;title=83Plus%3ASoftware%3Ausb8x%2FAsm_Interface%2FMSD%2FmsdDetect"/>
		<link rel="alternate" type="text/html" href="https://wikiti.brandonw.net/index.php?title=83Plus:Software:usb8x/Asm_Interface/MSD/msdDetect&amp;action=history"/>
		<updated>2026-05-22T04:22:29Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.5</generator>

	<entry>
		<id>https://wikiti.brandonw.net/index.php?title=83Plus:Software:usb8x/Asm_Interface/MSD/msdDetect&amp;diff=5527&amp;oldid=prev</id>
		<title>Brandonw: msdDetect entry point</title>
		<link rel="alternate" type="text/html" href="https://wikiti.brandonw.net/index.php?title=83Plus:Software:usb8x/Asm_Interface/MSD/msdDetect&amp;diff=5527&amp;oldid=prev"/>
				<updated>2006-11-19T15:16:23Z</updated>
		
		<summary type="html">&lt;p&gt;msdDetect entry point&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Synopsis ==&lt;br /&gt;
'''Name:''' msdDetect&lt;br /&gt;
&lt;br /&gt;
'''Minimum usb8x version:''' 0.12&lt;br /&gt;
&lt;br /&gt;
Detects and loads 83P/8XP levels from specified directory based on detection string. This is the mass storage version of ionDetect.&lt;br /&gt;
&lt;br /&gt;
=== Inputs ===&lt;br /&gt;
* HL is starting cluster of directory to search (obtained with [[../FAT_getStartingCluster|FAT_getStartingCluster]])&lt;br /&gt;
* BC is entry number of level (pass -1 on first call to this entry point)&lt;br /&gt;
* DE points to zero-terminated detection string&lt;br /&gt;
&lt;br /&gt;
=== Outputs ===&lt;br /&gt;
* Level/variable data is loaded into temporary RAM&lt;br /&gt;
* BC is entry number of this variable (to be passed in subsequent calls to this function)&lt;br /&gt;
* HL points to variable data (just beyond detection string)&lt;br /&gt;
* C set if problems&lt;br /&gt;
* A contains error code&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;  cellspacing=&amp;quot;0&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
|0 || No more 83P/8XP files in specified directory&lt;br /&gt;
|-&lt;br /&gt;
|1 || Not enough free memory to load level (for found level; subsequent calls may succeed)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Destroys ===&lt;br /&gt;
* AF, BC, DE, HL, IX&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
This is the mass storage version of ionDetect. It works exactly the same in that it loads the current level to (tempMem) if possible.&lt;br /&gt;
&lt;br /&gt;
Pass -1 in BC on first call to this entry point, and then its BC output on future calls. When the carry flag is set and A = 0, you have gone through all the variables in that directory.&lt;br /&gt;
&lt;br /&gt;
Example code to search for first BYTES level in the &amp;quot;\FILES\&amp;quot; subdirectory:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
     ld hl,sDir&lt;br /&gt;
     rst 20h&lt;br /&gt;
     ld hl,OP1&lt;br /&gt;
     U_CALL FAT_getStartingCluster ;get starting cluster of this directory&lt;br /&gt;
     push hl&lt;br /&gt;
     ld hl,sDetectString&lt;br /&gt;
     rst 20h&lt;br /&gt;
     pop hl&lt;br /&gt;
     ld bc,-1&lt;br /&gt;
     ld de,OP1&lt;br /&gt;
     U_CALL msdDetect&lt;br /&gt;
     ret c ;no variables found&lt;br /&gt;
 ;HL now points to level data&lt;br /&gt;
 ...&lt;br /&gt;
 sDir:&lt;br /&gt;
     DB &amp;quot;\FILES&amp;quot;,0&lt;br /&gt;
 sDetectString:&lt;br /&gt;
     DB &amp;quot;BY1JW&amp;quot;,0 ;detection string for BYTES levels&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Strings are copied to RAM first so they can be seen from usb8x.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[../MSD_Initialize|MSD_Initialize]] - Initialize mass storage driver&lt;/div&gt;</summary>
		<author><name>Brandonw</name></author>	</entry>

	</feed>