Index: trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm	(revision 193)
+++ trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm	(revision 200)
@@ -124,2 +124,24 @@
 .ReturnPointerToDRVPARAMS:
 	ret
+
+;--------------------------------------------------------------------
+; AccessDPT_GetUnshiftedAddressModeToALZF
+;	Parameters:
+;		DS:DI:	Ptr to Disk Parameter Table
+;	Returns:
+;		AL:		Addressing Mode (L-CHS, P-CHS, LBA28, LBA48) 
+;               unshifted (still shifted where it is in bFlagsLow)
+;       ZF:     Set based on value in AL
+;	Corrupts registers:
+;		AL
+;--------------------------------------------------------------------
+; 
+; Converted to a macro since only called in two places, and the call/ret overhead 
+; is not worth it for these two instructions (4 bytes total)
+;
+%macro AccessDPT_GetUnshiftedAddressModeToALZF 0
+	mov		al, [di+DPT.bFlagsLow]
+	and		al, MASKL_DPT_ADDRESSING_MODE
+%endmacro
+
+		
Index: trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm	(revision 193)
+++ trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm	(revision 200)
@@ -50,5 +50,4 @@
 	ret
 
-
 ;--------------------------------------------------------------------
 ; Finds Disk Parameter Table for
@@ -67,15 +66,20 @@
 ;	Corrupts registers:
 ;		SI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-FindDPT_ToDSDIForIdeMasterAtPortDX:
+;
+; Converted to macros since there is only once call site for each of these
+;
+;--------------------------------------------------------------------
+	
+%macro FindDPT_ToDSDIForIdeMasterAtPortDX 0
 	mov		si, IterateToMasterAtPortCallback
-	jmp		SHORT IterateAllDPTs
-
-ALIGN JUMP_ALIGN
-FindDPT_ToDSDIForIdeSlaveAtPortDX:
+	call	IterateAllDPTs
+%endmacro
+
+%macro FindDPT_ToDSDIForIdeSlaveAtPortDX 0
 	mov		si, IterateToSlaveAtPortCallback
-	jmp		SHORT IterateAllDPTs
-
+	call	IterateAllDPTs
+%endmacro
+
+		
 ;--------------------------------------------------------------------
 ; Iteration callback for finding DPT using
@@ -113,4 +117,6 @@
 	jne		SHORT ReturnWrongDPT
 	mov		dl, ch								; Return drive number in DL
+
+ReturnRightDPT:
 	stc											; Set CF since wanted DPT
 	ret
@@ -118,7 +124,8 @@
 
 ;--------------------------------------------------------------------
-; IterateToDptWithInterruptInServiceFlagSet
+; IterateToDptWithFlagsHighSet:
 ;	Parameters:
 ;		DS:DI:	Ptr to DPT to examine
+;       AL:     Bit in bFlagsHigh to test
 ;	Returns:
 ;		CF:		Set if wanted DPT found
@@ -128,16 +135,15 @@
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
-IterateToDptWithInterruptInServiceFlagSet:
-	test	BYTE [di+DPT.bFlagsHigh], FLGH_DPT_INTERRUPT_IN_SERVICE
-	jz		SHORT ReturnWrongDPT
-	stc										; Set CF since wanted DPT
-	ret
+IterateToDptWithFlagsHighSet:
+	test	BYTE [di+DPT.bFlagsHigh], al	; Clears CF (but we need the clc below anyway callers above)
+	jnz		SHORT ReturnRightDPT
+
 ReturnWrongDPT:
 	clc										; Clear CF since wrong DPT
 	ret
 
-
 ;--------------------------------------------------------------------
 ; FindDPT_ToDSDIforInterruptInService
+; FindDPT_ToDSDIforSerialDevice
 ;	Parameters:
 ;		DS:		RAMVARS segment
@@ -147,11 +153,21 @@
 ;				Cleared if DPT not found
 ;	Corrupts registers:
-;		SI
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
+;		SI, AX, BX (for SerialDevice only)
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+		
+%ifdef MODULE_SERIAL
+FindDPT_ToDSDIforSerialDevice:	
+	mov		al, FLGH_DPT_SERIAL_DEVICE
+
+	SKIP2B	bx
+%endif
+		
+; do not align due to SKIP2B above
 FindDPT_ToDSDIforInterruptInService:
-	mov		si, IterateToDptWithInterruptInServiceFlagSet
+	mov		al, FLGH_DPT_INTERRUPT_IN_SERVICE
+
+	mov		si, IterateToDptWithFlagsHighSet
 	; Fall to IterateAllDPTs
-
 
 ;--------------------------------------------------------------------
@@ -166,6 +182,5 @@
 ;		DS:DI:		Ptr to wanted DPT (if found)
 ;		CF:			Set if wanted DPT found
-;					Cleared if DPT not found
-;					Unchanged if no drives
+;					Cleared if DPT not found, or no DPTs present
 ;	Corrupts registers:
 ;		Nothing unless corrupted by callback function
@@ -175,5 +190,5 @@
 	push	cx
 	mov		cx, [RAMVARS.wDrvCntAndFirst]
-	jcxz	.AllDptsIterated			; Return if no drives
+	jcxz	.NotFound					; Return if no drives
 	mov		di, RAMVARS_size			; Point DS:DI to first DPT
 ALIGN JUMP_ALIGN
@@ -185,4 +200,5 @@
 	dec		cl							; Decrement drives left
 	jnz		SHORT .LoopWhileDPTsLeft
+.NotFound:		
 	clc									; Clear CF since DPT not found
 ALIGN JUMP_ALIGN
