Index: trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm	(revision 277)
+++ trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm	(revision 294)
@@ -8,5 +8,5 @@
 ; Checks if drive is handled by this BIOS, and return DPT pointer.
 ;
-; FindDPT_ForDriveNumberInDL		
+; FindDPT_ForDriveNumberInDL
 ;	Parameters:
 ;		DL:		Drive number
@@ -21,8 +21,8 @@
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
-FindDPT_ForDriveNumberInDL:		
+FindDPT_ForDriveNumberInDL:
 	xchg	di, ax								; Save the contents of AX in DI
 
-; 
+;
 ; Check Our Hard Disks
 ;
@@ -33,16 +33,16 @@
 	cmp		dl, ah								; Above last supported?
 	jae		SHORT .HardDiskNotHandledByThisBIOS
-		
+
 	cmp		dl, al								; Below first supported?
 	jae		SHORT .CalcDPTForDriveNumber
 
-ALIGN JUMP_ALIGN				
-.HardDiskNotHandledByThisBIOS:	
+ALIGN JUMP_ALIGN
+.HardDiskNotHandledByThisBIOS:
 ;
 ; Check Our Floppy Disks
-; 
+;
 	call	RamVars_UnpackFlopCntAndFirstToAL
 	js		SHORT .DiskIsNotHandledByThisBIOS
-				
+
 	cbw											; Always 0h (no floppy drive covered above)
 	adc		ah, al								; Add in first drive number and number of drives
@@ -51,11 +51,11 @@
 	jz		SHORT .CalcDPTForDriveNumber
 	cmp		al, dl								; Check first drive in all cases, redundant but OK to repeat
-	jnz		SHORT .DiskIsNotHandledByThisBIOS			
+	jnz		SHORT .DiskIsNotHandledByThisBIOS
 %else
-	cmp		dl, ah								; Above last supported?		
+	cmp		dl, ah								; Above last supported?
 	jae		SHORT .DiskIsNotHandledByThisBIOS
-		
+
 	cmp		dl, al								; Below first supported?
-	jb		SHORT .DiskIsNotHandledByThisBIOS			
+	jb		SHORT .DiskIsNotHandledByThisBIOS
 %endif
 	; fall-through to CalcDPTForDriveNumber
@@ -63,5 +63,5 @@
 ;--------------------------------------------------------------------
 ; Finds Disk Parameter Table for drive number.
-; Note intended to be called except by FindDPT_ForDriveNumber
+; Not intended to be called except by FindDPT_ForDriveNumberInDL
 ;
 ; CalcDPTForDriveNumber
@@ -69,5 +69,5 @@
 ;		DL:		Drive number
 ;		DS:		RAMVARS segment
-;       DI:     Saved copy of AX from entry at FindDPT_ForDriveNumber
+;       DI:     Saved copy of AX from entry at FindDPT_ForDriveNumberInDL
 ;	Returns:
 ;		DS:DI:	Ptr to DPT
@@ -82,5 +82,5 @@
 %ifdef MODULE_SERIAL_FLOPPY
 	mov		ax, [RAMVARS.wDrvCntAndFirst]
-		
+
 	test	dl, dl
 	js		.harddisk
@@ -88,6 +88,6 @@
 	call	RamVars_UnpackFlopCntAndFirstToAL
 	add		dl, ah						; add in end of hard disk DPT list, floppies start immediately after
-		
-ALIGN JUMP_ALIGN				
+
+ALIGN JUMP_ALIGN
 .harddisk:
 	sub		dl, al						; subtract off beginning of either hard disk or floppy list (as appropriate)
@@ -96,9 +96,9 @@
 %endif
 
-.CalcDPTForNewDrive:				
+.CalcDPTForNewDrive:
 	mov		al, LARGEST_DPT_SIZE
-		
+
 	mul		dl
-	add		ax, BYTE RAMVARS_size		; Clears CF (will not oveflow)
+	add		ax, BYTE RAMVARS_size		; Clears CF (will not overflow)
 
 	pop		dx
@@ -107,12 +107,12 @@
 	ret
 
-ALIGN JUMP_ALIGN		
-.DiskIsNotHandledByThisBIOS:			
+ALIGN JUMP_ALIGN
+.DiskIsNotHandledByThisBIOS:
 ;
 ; Drive not found...
 ;
 	xor		ax, ax								; Clear DPT pointer
-	stc											; Is not supported by our BIOS		
-		
+	stc											; Is not supported by our BIOS
+
 	xchg	di, ax								; Restore AX from save at top
 	ret
@@ -136,7 +136,7 @@
 
 ;--------------------------------------------------------------------
-; Iteration routine for FindDPT_ForIdevarsOffsetInDL, 
+; Iteration routine for FindDPT_ForIdevarsOffsetInDL,
 ; for use with IterateAllDPTs
-; 
+;
 ; Returns when DPT is found on the controller with Idevars offset in DL
 ;
@@ -148,9 +148,9 @@
 ;				Set if wrong DPT
 ;--------------------------------------------------------------------
-IterateFindFirstDPTforIdevars:		
+IterateFindFirstDPTforIdevars:
 	cmp		dl, [di+DPT.bIdevarsOffset]			; Clears CF if matched
 	je		.done
 	stc											; Set CF for not found
-.done:	
+.done:
 	ret
 
@@ -171,5 +171,5 @@
 FindDPT_ForNewDriveToDSDI:
 	push	dx
-		
+
 %ifdef MODULE_SERIAL_FLOPPY
 	mov		dx, [RAMVARS.wDrvCntAndFlopCnt]
@@ -178,5 +178,5 @@
 	mov		dl, [RAMVARS.bDrvCnt]
 %endif
-		
+
 	jmp		short FindDPT_ForDriveNumberInDL.CalcDPTForNewDrive
 
@@ -185,5 +185,5 @@
 ;	Parameters:
 ;		DS:DI:	Ptr to DPT to examine
-;       BL:		Bit(s) to test in DPT.bFlagsHigh 
+;       BL:		Bit(s) to test in DPT.bFlagsHigh
 ;	Returns:
 ;		CF:		Clear if wanted DPT found
@@ -193,9 +193,9 @@
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
-IterateToDptWithFlagsHighInBL:		
-	test	BYTE [di+DPT.bFlagsHigh], bl		; Clears CF
+IterateToDptWithFlagsHighInBL:
+	test	[di+DPT.bFlagsHigh], bl				; Clears CF
 	jnz		SHORT .ReturnRightDPT
 	stc
-.ReturnRightDPT:		
+.ReturnRightDPT:
 	ret
 
@@ -212,10 +212,10 @@
 ;--------------------------------------------------------------------
 %ifdef MODULE_SERIAL
-ALIGN JUMP_ALIGN		
-FindDPT_ToDSDIforSerialDevice:			
+ALIGN JUMP_ALIGN
+FindDPT_ToDSDIforSerialDevice:
 	mov		bl, FLGH_DPT_SERIAL_DEVICE
 ; fall-through
 %endif
-				
+
 ;--------------------------------------------------------------------
 ; FindDPT_ToDSDIforFlagsHigh
@@ -231,5 +231,5 @@
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
-FindDPT_ToDSDIforFlagsHighInBL:		
+FindDPT_ToDSDIforFlagsHighInBL:
 	mov		si, IterateToDptWithFlagsHighInBL
 	; Fall to IterateAllDPTs
@@ -257,10 +257,7 @@
 
 	mov		di, RAMVARS_size			; Point DS:DI to first DPT
-		
-	mov		cl, [RAMVARS.bDrvCnt]
-	xor		ch, ch						; Clears CF  
-		
+	eMOVZX	cx, [RAMVARS.bDrvCnt]
 	jcxz	.NotFound					; Return if no drives
-		
+
 ALIGN JUMP_ALIGN
 .LoopWhileDPTsLeft:
