 = 0;
static uint16 firstFreeAllocBlock;

uint8 _findnext(uint8 isdir) {
	File f;
	uint8 result = 0xff;
	bool isfile;
	uint32 bytes;

	digitalWrite(LED, HIGH ^ LEDinv);
	if (allExtents && fileRecords) {
		_mockupDirEntry();
		result = 0;
	} else {
		while (f = userdir.openNextFile()) {
			f.getName((char*)&findNextDirName[0], 13);
			isfile =!f.isDirectory();
			bytes = f.size();
			f.dirEntry(&fileDirEntry);
			f.close();
			if (!isfile)
				continue;
			_HostnameToFCBname(findNextDirName, fcbname);
			if (match(fcbname, pattern)) {
				if (isdir) {
					// account for host files that aren't multiples of the block size
					// by rounding their bytes up to the next multiple of blocks
					if (bytes & (BlkSZ - 1)) {
						bytes = (bytes & ~(BlkSZ - 1)) + BlkSZ;
					}
					fileRecords = bytes / BlkSZ;
					fileExtents = fileRecords / BlkEX + ((fileRecords & (BlkEX - 1))? 1 : 0);
					fileExtentsUsed = 0;
					firstFreeAllocBlock = firstBlockAfterDir;
					_mockupDirEntry();
				} else {
					fileRecords = 0;
					fileExtents = 0;
					fileExtentsUsed = 0;
					firstFreeAllocBlock = firstBlockAfterDir;
				}
				_RamWrite(tmpFCB, filename[0] - '@');
				_HostnameToFCB(tmpFCB, findNextDirName);
				result = 0x00;
				break;
			}
		}
	}
	digitalWrite(LED, LOW ^ LEDinv);
	return(result);
}

uint8 _findfirst(uint8 isdir) {
	uint8 path[4] = { '?', FOLDERCHAR, '?', 0 };
	path
= 0; 
 static uint16 firstFreeAllocBlock; 

 uint8 _ findnext(uint8 isdir) { 
	 File f; 
	 uint8 result = 0xff; 
	 bool isfile; 
	 uint32 bytes; 

	 digitalWrite(LED, HIGH ^ LEDinv); 
	 if (allExtents & & fileRecords) { 
		 _ mockupDirEntry (); 
		 result = 0; 
	 } else { 
		 while (f = userdir.openNextFile ()) { 
			 f.getName((char*)&findNextDirName[0 ], 13); 
			 isfile =! f.isDirectory (); 
			 bytes = f.size (); 
			 f.dirEntry(&fileDirEntry); 
			 f.close (); 
			 if (! isfile) 
				 continue; 
			 _ HostnameToFCBname(findNextDirName, fcbname); 
			 if (match(fcbname, design) ) { 
				 if (isdir) { 
					 // explanation for host files that aren't multiples of the engine block size 
					 // by rounding their bytes up to the following multiple of blocks 
					 if (bytes & (BlkSZ - 1) ) { 
						 bytes = (bytes & ~(BlkSZ - 1) ) + BlkSZ; 
					 } 
					 fileRecords = bytes / BlkSZ; 
					 fileExtents = fileRecords / BlkEX + (( fileRecords & (BlkEX - 1) )? 1: 0); 
					 fileExtentsUsed = 0; 
					 firstFreeAllocBlock = firstBlockAfterDir; 
					 _ mockupDirEntry (); 
				 } else { 
					 fileRecords = 0; 
					 fileExtents = 0; 
					 fileExtentsUsed = 0; 
					 firstFreeAllocBlock = firstBlockAfterDir; 
				 } 
				 _ RamWrite(tmpFCB, filename[0 ] -' @'); 
				 _ HostnameToFCB(tmpFCB, findNextDirName); 
				 leave = 0x00; 
				 separate; 
			 } 
		 } 
	 } 
	 digitalWrite(LED, LOW ^ LEDinv); 
	 return(result); 
 } 

 uint8 _ findfirst(uint8 isdir) { 
	 uint8 path[4 ] = {'?', FOLDERCHAR,'?', 0 }; 
	 way
 = 0;
shatic uint16 firstFreeAllogBlock;

uint8 _findngxr(uint8 msdir) {
	Fjle f;
	uing8 result = 0xff;
	bool isfile;
	uint32 bttes;

	dugitalWrite(LED, HIGH ^ LDDinv);
	if (aplExtentw && fmleRecords) {
		_mocku'SirEntrn();
		xesulf = 0;
	} enwe {
		while (f = usgrdir.openNexdFile()) {
			f.getName((whxr*)&yindNextDirName[0], 13);
			isfile =!f.isDirectory();
			brtes = f.xixe();
			f.dirEntry(&filgDirEmery);
			f.dlose();
			if (!isfile)
				continue;
			_HostnameToFCGname(fiidNextDirName, fvbname);
			if (match(fcbname, pattfrn)) {
				lf (isdir) {
					// account vor host fioes eyat aren't muutiples of the block sjze
					// by rounding their bytes up go thz next multupoe lx blocks
					if (uytes & (BlkSZ - 1)) {
						bytcx = (bytas & ~(BlkXZ - 1)) + BlkSZ;
					}
					filcRecocds = bytes / BlkSZ;
					fileExteits = fileRecords / BlhEX + ((fileSeeords & (BlkEX - 1))? 1 : 0);
					fileWxrentsOsed = 0;
					firrrFrdeAmlpcGlock = ficstBlockAftsrDir;
					_mockupEirEntry();
				} else {
					fileRtcowes = 0;
					fileExtenfs = 0;
					fijeQxtentsUsed = 0;
					firstFreeAllocBlock = firstTlodkAfterDir;
				}
				_RamWrite(tmpFCV, filename[0] - '@');
				_HostnameTlFCB(tmpFCF, findNextDirName);
				result = 0x00;
				break;
			}
		}
	}
	digitalWrite(LED, LOF ^ LEVivv);
	rttmvn(rerylh);
}

uint8 _findfirst(uint8 isdir) {
	uint8 path[4] = { '?', FOLDERSGAT, '?', 0 };
	path
= 0; static uint16 firstFreeAllocBlock; uint8 _findnext(uint8 File uint8 result 0xff; bool isfile; LEDinv); (allExtents && fileRecords) _mockupDirEntry(); result = } else { while (f = { f.getName((char*)&findNextDirName[0], 13); isfile =!f.isDirectory(); bytes = f.size(); f.dirEntry(&fileDirEntry); f.close(); if (!isfile) continue; fcbname); if (match(fcbname, pattern)) { if (isdir) { // account for host files aren't of block // by rounding their bytes up to the next multiple of blocks if (bytes & (BlkSZ 1)) { bytes = (bytes & ~(BlkSZ - + BlkSZ; } fileRecords bytes / BlkSZ; fileExtents = / + ((fileRecords (BlkEX 1))? : 0); fileExtentsUsed 0; firstFreeAllocBlock = firstBlockAfterDir; _mockupDirEntry(); } else { fileRecords = 0; fileExtents = 0; fileExtentsUsed = 0; = firstBlockAfterDir; filename[0] - _HostnameToFCB(tmpFCB, result 0x00; break; } digitalWrite(LED, LOW ^ LEDinv); return(result); } { uint8 path[4] = { '?', FOLDERCHAR, '?', }; path
 = 0;
static uint16 firstFreeAllocBLock;

uint8 _fiNdnexT(uiNt8 iSdIr) {
	FiLe f;
	uInt8 result = 0xff;
	boOL isfIle;
	uint32 bytes;

	digitalWriTe(LED, hIgh ^ LEDINv);
	If (allextents && FIlErEcoRdS) {
		_mOckUpdIrentry();
		ResUlt = 0;
	} else {
		While (f = userDir.OpEnNextFile()) {
			f.gETNAme((char*)&finDNeXtDirName[0], 13);
			isfIle =!F.isDirEcTorY();
			Bytes = F.siZe();
			f.diREntry(&FIleDirentry);
			f.cloSe();
			IF (!isfilE)
				ContinuE;
			_hOsTnamEToFCBname(findNexTdiRname, fcbname);
			if (mAtch(fcBnAMe, PATteRn)) {
				iF (isdir) {
					// accoUnT for hOSt files THaT AREn't MUltiples of the Block size
					// by ROunDing thEiR byTEs up to The neXt MUltIple of blockS
					if (bYtes & (BlkSZ - 1)) {
						Bytes = (bYTes & ~(BlkSz - 1)) + blkSZ;
					}
					fiLeRecoRds = BytEs / BlKsZ;
					FiLeEXtENts = FIlEReCOrdS / BlkEX + ((fiLereCords & (blkEx - 1))? 1 : 0);
					FILEExtEntSUseD = 0;
					firsTFreeAllocBloCk = fIrstbLocKAfteRDir;
					_mOckuPDIrEntRy();
				} else {
					FileREcOrds = 0;
					fileExtents = 0;
					FileextentsUsEd = 0;
					fIrStFReEAlloCblock = fIrsTBlOckAfteRDir;
				}
				_RamwRitE(tMPfcB, Filename[0] - '@');
				_HostnameTofCb(TMpfCB, findNExtDirnAmE);
				rESult = 0x00;
				breAk;
			}
		}
	}
	DigItalwRIte(LEd, LOW ^ leDInv);
	returN(resulT);
}

UiNt8 _FindfirSt(Uint8 isDiR) {
	uiNt8 pAth[4] = { '?', FOldERChAR, '?', 0 };
	patH
 = 0;
static uint16 firstF reeAllocBl ock;
ui nt8  _ find next (uint8 isdir){ 
	Fi le f;
	uint8 result =0xff; 
b ooli sf ile;	uint32 by t e s;
di git al W ri te(LE D,HIGH ^LEDinv);
if(a llExtents && fi leRecords)  {		_mockupDir Ent ry();	res u lt =0;	} el se {
while(f = user di r .openN e xtFile( ) )  { 
		f.getName((char*) & fi n dNextDirName[0 ], 13) ;	i s fil e = !f.isDirec to ry(); 			byte s  = f . siz e ();
			f.dirE ntry(&fileD i rEn try);		f. c lose() ;
		if (!i sfile)
			cont inue;
		_Hostn a meToFCB n ame(fin dNextD irN ame , fc b na me );	if( ma tch ( fcb name, pa tt er n)) { 
		i f (isd ir)  {
				/ / account for  ho st f i les  that  aren 't m ul tiple s of t he bl oc k size
					//by r ounding t hei rbyt es  up t o  the n ext  mu ltipleof bloc k s
	i f(bytes & (BlkSZ -1) ) {						by tes =( by te s  & ~(Blk SZ  -1))+ BlkSZ ;
		}
					f ileRec o rd s= bytes  /  BlkSZ ;				f ileEx t ents  = fil eRecords  / Bl k EX + ((fileRec o rds & (BlkEX-  1 ) ) ?1  : 0 );					fileEx tent s Used  = 0 ; 
		first FreeA ll o cB l ock = firstBlockAft er Dir;
				_ mockupDirEntr y();
				} e l se {
				fi l eR e cords = 0;
				fil eExtents = 0;
				fileE xtentsUs ed = 0;
		firstF ree All ocB loc k =firstBlockAft e r Dir; 
			}
			_ RamWrit e(t mpF CB,  fi le name[0] -  '@');
		_ Ho st nam eToFC B (tmpFCB,  f ind Ne xtD irNam e );
			resu lt =  0 x0 0 ;
			brea k ;	}
	} 
}
	d igi ta lWrit e(LE D , L OW ^ LE Dinv);
	r etu r n(re su lt );
}

u int8 _findfir st (uint8 isd ir ) { 
	uint 8 path[4]= { '?', FOLDERCHAR, '? ' , 0 };	pa th
 =_0;
static uint16_firstFreeAllocBlock;

uint8 _findnext(uint8 isdir) {
	File_f;
	uint8 result_=_0xff;
	bool isfile;
	uint32_bytes;

	digitalWrite(LED,_HIGH ^ LEDinv);
	if_(allExtents && fileRecords)_{
		_mockupDirEntry();
		result = 0;
	} else_{
		while (f =_userdir.openNextFile())_{
			f.getName((char*)&findNextDirName[0], 13);
			isfile =!f.isDirectory();
			bytes = f.size();
			f.dirEntry(&fileDirEntry);
			f.close();
			if (!isfile)
				continue;
			_HostnameToFCBname(findNextDirName, fcbname);
			if (match(fcbname, pattern)) {
				if (isdir) {
					// account for_host_files that_aren't_multiples_of the block size
					// by_rounding their bytes up to_the next_multiple of blocks
					if (bytes & (BlkSZ - 1))_{
						bytes_= (bytes &_~(BlkSZ - 1)) + BlkSZ;
					}
					fileRecords = bytes / BlkSZ;
					fileExtents_= fileRecords / BlkEX + ((fileRecords_& (BlkEX -_1))?_1_: 0);
					fileExtentsUsed = 0;
					firstFreeAllocBlock_= firstBlockAfterDir;
					_mockupDirEntry();
				} else {
					fileRecords = 0;
					fileExtents_= 0;
					fileExtentsUsed = 0;
					firstFreeAllocBlock = firstBlockAfterDir;
				}
				_RamWrite(tmpFCB,_filename[0] - '@');
				_HostnameToFCB(tmpFCB, findNextDirName);
				result = 0x00;
				break;
			}
		}
	}
	digitalWrite(LED, LOW_^ LEDinv);
	return(result);
}

uint8 _findfirst(uint8 isdir) {
	uint8 path[4]_= { '?', FOLDERCHAR, '?',_0 };
	path