Index: trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm	(revision 180)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm	(revision 181)
@@ -16,14 +16,16 @@
 ;		AX, BX, CX, DX
 ;--------------------------------------------------------------------
+%ifdef MODULE_SERIAL
 Device_FinalizeDPT:
-%ifdef MODULE_SERIAL
 	test	BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
 	jnz		SHORT .FinalizeDptForSerialPortDevice
+	jmp		IdeDPT_Finalize
+
+.FinalizeDptForSerialPortDevice:
+	jmp		SerialDPT_Finalize
+%else
+	Device_FinalizeDPT EQU IdeDPT_Finalize
 %endif
-	jmp		IdeDPT_Finalize
-%ifdef MODULE_SERIAL
-.FinalizeDptForSerialPortDevice:
-	jmp		SerialDPT_Finalize		
-%endif
+
 
 ;--------------------------------------------------------------------
@@ -37,10 +39,12 @@
 ;		AL, BX, CX, DX
 ;--------------------------------------------------------------------
+%ifdef MODULE_SERIAL
 Device_ResetMasterAndSlaveController:
-%ifdef MODULE_SERIAL
 	test	BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
 	jnz		SHORT ReturnSuccessForSerialPort
+	jmp		IdeCommand_ResetMasterAndSlaveController
+%else
+	Device_ResetMasterAndSlaveController EQU IdeCommand_ResetMasterAndSlaveController
 %endif
-	jmp		IdeCommand_ResetMasterAndSlaveController
 
 
@@ -58,14 +62,16 @@
 ;		AL, BL, CX, DX, SI, DI, ES
 ;--------------------------------------------------------------------
+%ifdef MODULE_SERIAL
 Device_IdentifyToBufferInESSIwithDriveSelectByteInBH:
-%ifdef MODULE_SERIAL
 	cmp		BYTE [cs:bp+IDEVARS.bDevice], DEVICE_SERIAL_PORT
 	je		SHORT .IdentifyDriveFromSerialPort
-%endif
 	jmp		IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
-%ifdef MODULE_SERIAL
+
 .IdentifyDriveFromSerialPort:
 	jmp		SerialCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
+%else
+	Device_IdentifyToBufferInESSIwithDriveSelectByteInBH EQU IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
 %endif
+
 
 ;--------------------------------------------------------------------
@@ -83,16 +89,18 @@
 ;		AL, BX, CX, DX, (ES:SI for data transfer commands)
 ;--------------------------------------------------------------------
+%ifdef MODULE_SERIAL
 ALIGN JUMP_ALIGN
 Device_OutputCommandWithParameters:
-%ifdef MODULE_SERIAL
 	test	BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
 	jnz		SHORT .OutputCommandToSerialPort
-%endif
 	jmp		IdeCommand_OutputWithParameters
-%ifdef MODULE_SERIAL
+
 ALIGN JUMP_ALIGN
 .OutputCommandToSerialPort:
 	jmp		SerialCommand_OutputWithParameters
+%else
+	Device_OutputCommandWithParameters EQU IdeCommand_OutputWithParameters
 %endif
+
 
 ;--------------------------------------------------------------------
@@ -107,14 +115,16 @@
 ;		AL, BX, CX, DX
 ;--------------------------------------------------------------------
+%ifdef MODULE_SERIAL
 ALIGN JUMP_ALIGN
 Device_SelectDrive:
-%ifdef MODULE_SERIAL
 	test	BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
 	jnz		SHORT ReturnSuccessForSerialPort
-%endif
 	jmp		IdeCommand_SelectDrive
-%ifdef MODULE_SERIAL
+
 ReturnSuccessForSerialPort:
 	xor		ax, ax
 	ret
+%else
+	Device_SelectDrive EQU IdeCommand_SelectDrive
 %endif
+
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm	(revision 180)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm	(revision 181)
@@ -7,7 +7,9 @@
 ;--------------------------------------------------------------------
 ; IdeIO_OutputALtoIdeRegisterInDL
+; IdeIO_OutputALtoIdeControlBlockRegisterInDL
 ;	Parameters:
 ;		AL:		Byte to output
-;		DL:		IDE Register
+;		DL:		IDE Register				(IdeIO_OutputALtoIdeRegisterInDL)
+;				IDE Control Block Register	(IdeIO_OutputALtoIdeControlBlockRegisterInDL)
 ;		DS:DI:	Ptr to DPT (in RAMVARS segment)
 ;	Returns:
@@ -18,24 +20,10 @@
 ALIGN JUMP_ALIGN
 IdeIO_OutputALtoIdeRegisterInDL:
-	mov		bx, IDEVARS.wPort
-	call	GetPortToDXandTranslateA0andA3ifNecessary
-	out		dx, al
-	ret
+	mov		bl, IDEVARS.wPort
+	SKIP2B	f	; cmp ax, <next instruction>
+	; Fall to IdeIO_OutputALtoIdeControlBlockRegisterInDL
 
-
-;--------------------------------------------------------------------
-; IdeIO_OutputALtoIdeControlBlockRegisterInDL
-;	Parameters:
-;		AL:		Byte to output
-;		DL:		IDE Control Block Register
-;		DS:DI:	Ptr to DPT (in RAMVARS segment)
-;	Returns:
-;		Nothing
-;	Corrupts registers:
-;		BX, DX
-;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
 IdeIO_OutputALtoIdeControlBlockRegisterInDL:
-	mov		bx, IDEVARS.wPortCtrl
+	mov		bl, IDEVARS.wPortCtrl
 	call	GetPortToDXandTranslateA0andA3ifNecessary
 	out		dx, al
@@ -55,5 +43,5 @@
 ALIGN JUMP_ALIGN
 IdeIO_InputToALfromIdeRegisterInDL:
-	mov		bx, IDEVARS.wPort
+	mov		bl, IDEVARS.wPort
 	call	GetPortToDXandTranslateA0andA3ifNecessary
 	in		al, dx
@@ -64,5 +52,5 @@
 ; GetPortToDXandTranslateA0andA3ifNecessary
 ;	Parameters:
-;		BX:		Offset to port in IDEVARS (IDEVARS.wPort or IDEVARS.wPortCtrl)
+;		BL:		Offset to port in IDEVARS (IDEVARS.wPort or IDEVARS.wPortCtrl)
 ;		DL:		IDE Register
 ;		DS:DI:	Ptr to DPT (in RAMVARS segment)
@@ -74,4 +62,5 @@
 ALIGN JUMP_ALIGN
 GetPortToDXandTranslateA0andA3ifNecessary:
+	xor		bh, bh
 	xor		dh, dh							; DX now has IDE register offset
 	add		bl, [di+DPT.bIdevarsOffset]		; CS:BX now points port address
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm	(revision 180)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm	(revision 181)
@@ -230,9 +230,5 @@
 ALIGN JUMP_ALIGN
 DualByteReadForXtide:
-%ifdef USE_186
-	shr		cx, 2		; Smaller but slower on 186/286
-%else
-	times 2	shr	cx, 1	; Loop unrolling
-%endif
+	eSHR_IM	cx, 2		; Loop unrolling
 	mov		bx, 8		; Bit mask for toggling data low/high reg
 ALIGN JUMP_ALIGN
@@ -322,9 +318,5 @@
 	push	ds
 	push	bx
-%ifdef USE_186
-	shr		cx, 2		; Smaller but slower on 186/286
-%else
-	times 2	shr	cx, 1	; Loop unrolling
-%endif
+	eSHR_IM	cx, 2		; Loop unrolling
 	mov		bx, 8		; Bit mask for toggling data low/high reg
 	push	es			; Copy ES...
@@ -372,9 +364,5 @@
 WordWriteForXTIDEmod:
 	push	ds
-%ifdef USE_186
-	shr		cx, 2		; Smaller but slower on 186/286
-%else
-	times 2	shr	cx, 1	; Loop unrolling
-%endif
+	eSHR_IM	cx, 2		; Loop unrolling
 	push	es			; Copy ES...
 	pop		ds			; ...to DS
Index: trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm	(revision 180)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm	(revision 181)
@@ -20,5 +20,5 @@
 	jmp		ax
 
-%ifdef MODULE_EBIOS
+
 ;--------------------------------------------------------------------
 ; Idepack_ConvertDapToIdepackAndIssueCommandFromAH
@@ -36,4 +36,5 @@
 ;		AL, BX, CX, DX, SI, ES
 ;--------------------------------------------------------------------
+%ifdef MODULE_EBIOS
 ALIGN JUMP_ALIGN
 Idepack_ConvertDapToIdepackAndIssueCommandFromAH:
@@ -60,4 +61,5 @@
 %endif
 
+
 ;--------------------------------------------------------------------
 ; Idepack_TranslateOldInt13hAddressAndIssueCommandFromAH
@@ -83,6 +85,10 @@
 Idepack_TranslateOldInt13hAddressAndIssueCommandFromAH:
 	mov		[bp+IDEPACK.bCommand], ah
-	test	al, al
-	eCSETZ	ah
+
+	xor		ah, ah
+	cmp		ah, al
+	cmc
+	adc		ah, ah
+
 	mov		[bp+IDEPACK.bSectorCount], al
 	mov		[bp+IDEPACK.bSectorCountHighExt], ah
@@ -100,5 +106,5 @@
 	call	AccessDPT_GetDeviceControlByteToAL
 	mov		[bp+IDEPACK.bDeviceControl], al
-	jmp		Device_OutputCommandWithParameters	
+	jmp		Device_OutputCommandWithParameters
 
 
Index: trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm	(revision 180)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm	(revision 181)
@@ -10,10 +10,10 @@
 ;    http://en.wikibooks.org/wiki/Serial_Programming
 ;
-		
+
 SerialCommand_UART_base							EQU		0
 SerialCommand_UART_transmitByte					EQU		0
 SerialCommand_UART_receiveByte					EQU		0
 SerialCommand_UART_divisorLow					EQU		0
-; Values for UART_divisorLow:	
+; Values for UART_divisorLow:
 ; 60h = 1200, 30h = 2400, 18h = 4800, 0ch = 9600, 6 = 19200, 3 = 38400, 2 = 57600, 1 = 115200
 
@@ -23,5 +23,5 @@
 ; Note: hardware baud multipliers (2x, 4x) will impact the final baud rate and are not known at this level
 
-SerialCommand_UART_interruptEnable				EQU		1				
+SerialCommand_UART_interruptEnable				EQU		1
 SerialCommand_UART_divisorHigh					EQU		1
 ; UART_divisorHigh is zero for all speeds including and above 1200 baud
@@ -31,5 +31,5 @@
 
 SerialCommand_UART_lineControl					EQU		3
-		
+
 SerialCommand_UART_modemControl					EQU		4
 
@@ -40,5 +40,5 @@
 SerialCommand_UART_scratch						EQU		7
 
-SerialCommand_PackedPortAndBaud_StartingPort	EQU		240h    
+SerialCommand_PackedPortAndBaud_StartingPort	EQU		240h
 SerialCommand_PackedPortAndBaud_PortMask		EQU		0fch    ; upper 6 bits - 240h through 438h
 SerialCommand_PackedPortAndBaud_BaudMask		EQU		3       ; lower 2 bits - 4 baud rates
@@ -48,5 +48,5 @@
 SerialCommand_Protocol_Inquire					EQU		0
 SerialCommand_Protocol_Header					EQU		0a0h
-		
+
 ;--------------------------------------------------------------------
 ; SerialCommand_OutputWithParameters
@@ -65,10 +65,9 @@
 ;		AL, BX, CX, DX, (ES:SI for data transfer commands)
 ;--------------------------------------------------------------------
-
 ALIGN JUMP_ALIGN
 SerialCommand_OutputWithParameters:
-		
+
 		mov		ah,(SerialCommand_Protocol_Header | SerialCommand_Protocol_Read)
-		
+
 		mov		al,[bp+IDEPACK.bCommand]
 
@@ -78,15 +77,15 @@
 		cmp		al,30h			; Write Sectors IDE command
 		jz		.readOrWrite
-		
+
 ;  all other commands return success
 ;  including function 0ech which should return drive information, this is handled with the identify functions
 		xor		ah,ah			;  also clears carry
 		ret
-		
-.readOrWrite:	
+
+.readOrWrite:
 		mov		[bp+IDEPACK.bFeatures],ah		; store protocol command
-		
-		mov		dl, byte [ds:di+DPT.bSerialPortAndBaud]
-		
+
+		mov		dl, byte [di+DPT.bSerialPortAndBaud]
+
 ; fall-through
 
@@ -94,5 +93,5 @@
 ; SerialCommand_OutputWithParameters_DeviceInDL
 ;	Parameters:
-;       AH:		Protocol Command 
+;       AH:		Protocol Command
 ;       DL:		Packed I/O port and baud rate
 ;		ES:SI:	Ptr to buffer (for data transfer commands)
@@ -103,7 +102,7 @@
 ;	Corrupts registers:
 ;		AL, BX, CX, DX, (ES:SI for data transfer commands)
-;--------------------------------------------------------------------		
+;--------------------------------------------------------------------
 SerialCommand_OutputWithParameters_DeviceInDL:
-		
+
 		push	si
 		push	di
@@ -111,5 +110,5 @@
 		push	es
 
-; 
+;
 ; Unpack I/O port and baud from DPT
 ;		Port to DX more or less for the remainder of the routine
@@ -117,5 +116,5 @@
 ;
 		mov		cl, dl
-		
+
 		and		cl, SerialCommand_PackedPortAndBaud_BaudMask
 		shl		cl, 1
@@ -125,5 +124,5 @@
 
 		and		dl, SerialCommand_PackedPortAndBaud_PortMask
-		mov		dh, 0		
+		mov		dh, 0
 		shl		dx, 1
 		add		dx, SerialCommand_PackedPortAndBaud_StartingPort
@@ -131,5 +130,5 @@
 ;
 ; Buffer is referenced through ES:DI throughout, since we need to store faster than we read
-; 
+;
 		mov		di,si
 
@@ -138,8 +137,8 @@
 ;
 ; Command byte and sector count live at the top of the stack, pop/push are used to access
-; 
+;
 		push	ax
-		
-		cld
+
+;		cld		; Shouldn't be needed. DF has already been cleared (line 24, Int13h.asm)
 
 ;----------------------------------------------------------------------
@@ -147,9 +146,9 @@
 ; Initialize UART
 ;
-; We do this each time since DOS (at boot) or another program may have 
+; We do this each time since DOS (at boot) or another program may have
 ; decided to reprogram the UART
 ;
 		push	dx
-		
+
 		mov		al,83h
 		add		dl,SerialCommand_UART_lineControl
@@ -167,5 +166,5 @@
 		mov		al,047h
 		inc		dx				;  fifo
-		out		dx,al		
+		out		dx,al
 
 		mov		al,03h
@@ -192,15 +191,15 @@
 		push	es				; save off real buffer location
 		push	di
-		
-		mov		di,bp			; point to IDEREGS for command dispatch; 		
+
+		mov		di,bp			; point to IDEREGS for command dispatch;
 		push	ss
 		pop		es
 
 		xor		si,si			; initialize checksum for write
-		dec		si		
+		dec		si
 		mov		bp,si
 
 		mov		bl,03h		; writing 3 words
-		
+
 		call	SerialCommand_WriteProtocol
 
@@ -213,5 +212,5 @@
 ;
 ; Top of the read/write loop, one iteration per sector
-; 
+;
 .nextSector:
 		xor		si,si			; initialize checksum for read or write
@@ -220,9 +219,9 @@
 
 		mov		bx,0100h
-		
+
 		shr		ah,1			; command byte, are we doing a write?
 		jnc		.readSector
 		call	SerialCommand_WriteProtocol
-		
+
 		xor		bx,bx
 
@@ -230,5 +229,5 @@
 		mov		cx,bx
 		inc		cx
-		
+
 		mov		bl,dl			; setup bl with proper values for read loop (bh comes later)
 
@@ -246,5 +245,5 @@
 		push	cx
 		xor		cx,cx
-.readTimeoutLoop:	
+.readTimeoutLoop:
 		push	dx
 		or		dl,SerialCommand_UART_lineStatus
@@ -257,9 +256,9 @@
 		mov		bh,1
 		call	SerialCommand_WaitAndPoll_Init
-		cli		
+		cli
 .readTimeoutComplete:
 		mov		bh,bl
 		or		bh,SerialCommand_UART_lineStatus
-		
+
 		pop		cx
 		test	dl,1
@@ -271,10 +270,12 @@
 ; Read Block (without interrupts, used when there is a FIFO, high speed)
 ;
-; NOTE: This loop is very time sensitive.  Literally, another instruction 
+; NOTE: This loop is very time sensitive.  Literally, another instruction
 ; cannot be inserted into this loop without us falling behind at high
-; speed (460.8K baud) on a 4.77Mhz 8088, making it hard to receive 
+; speed (460.8K baud) on a 4.77Mhz 8088, making it hard to receive
 ; a full 512 byte block.
 ;
-.readLoop:		
+.readLoop:
+		stosw					; store word in caller's data buffer
+
 		add		bp, ax			; update Fletcher's checksum
 		adc		bp, 0
@@ -282,79 +283,78 @@
 		adc		si, 0
 
-		stosw					; store word in caller's data buffer
-
-		mov		dl,bh			
-		in		al,dx			
+		mov		dl,bh
+		in		al,dx
 		shr		al,1			; data ready (byte 1)?
-		mov		dl,bl			; get ready to read data			
+		mov		dl,bl			; get ready to read data
 		jnc		.readTimeout	; nope not ready, update timeouts
-		
-; 
+
+;
 ; Entry point after initial timeout.  We enter here so that the checksum word
 ; is not stored (and is left in AX after the loop is complete).
-; 
-.readByte1Ready:		
+;
+.readByte1Ready:
 		in		al, dx			; read data byte 1
 
 		mov		ah, al			; store byte in ah for now
-		
-;
-; note the placement of this reset of dl to bh, and that it is 
-; before the return, which is assymetric with where this is done 
-; above for byte 1.  The value of dl is used by the timeout routine 
-; to know which byte to return to (.read_byte1_ready or 
+
+;
+; note the placement of this reset of dl to bh, and that it is
+; before the return, which is assymetric with where this is done
+; above for byte 1.  The value of dl is used by the timeout routine
+; to know which byte to return to (.read_byte1_ready or
 ; .read_byte2_ready)
 ;
-		mov		dl,bh			
-								
+		mov		dl,bh
+
 		in		al,dx
 		shr		al,1			; data ready (byte 2)?
 		jnc		.readTimeout
-.readByte2Ready:						
-		mov		dl,bl		
+.readByte2Ready:
+		mov		dl,bl
 		in		al, dx			; read data byte 2
 
 		xchg	al, ah			; ah was holding byte 1, reverse byte order
-		
+
 		loop	.readLoop
 
+		sti						; interrupts back on ASAP, if we turned them off
+
 ;
 ; Compare checksums
-; 
+;
 		xor		bp,si
 		cmp		ax,bp
 		jnz		SerialCommand_OutputWithParameters_Error
 
-		sti					; interrupts back on ASAP, if we turned them off
-		
+
 ;----------------------------------------------------------------------
-; 
+;
 ; Clear read buffer
 ;
 ; In case there are extra characters or an error in the FIFO, clear it out.
-; In theory the initialization of the UART registers above should have 
+; In theory the initialization of the UART registers above should have
 ; taken care of this, but I have seen cases where this is not true.
 ;
 .clearBuffer:
-		mov		dl,bh		
+		mov		dl,bh
 		in		al,dx
-		mov		dl,bl				
+		mov		dl,bl
 		test	al,08fh
 		jz		.clearBufferComplete
 		shr		al,1
-		in		al,dx		
+		in		al,dx
 		jc		.clearBuffer	; note CF from shr above
 		jmp		SerialCommand_OutputWithParameters_Error
-		
-.clearBufferComplete:	
+
+.clearBufferComplete:
 		pop		ax				; sector count and command byte
 		dec		al				; decrememnt sector count
 		push	ax				; save
 		jz		SerialCommand_OutputWithParameters_ReturnCodeInALCF    ; CF clear from .clearBuffer test above
-				
+
 		cli						; interrupts back off for ACK byte to host
 								; (host could start sending data immediately)
 		out		dx,al			; ACK with next sector number
-		
+
 		jmp		.nextSector		; all is well, time for next sector
 
@@ -363,19 +363,19 @@
 ; Cleanup, error reporting, and exit
 ;
-		
-; 
+
+;
 ; Used in situations where a call is underway, such as with SerialCommand_WaitAndPoll
-; 
+;
 SerialCommand_OutputWithParameters_ErrorAndPop2Words:
 		pop		ax
 		pop		ax
 
-SerialCommand_OutputWithParameters_Error:		
+SerialCommand_OutputWithParameters_Error:
+		stc
 		mov		al,1
-		stc
-
-SerialCommand_OutputWithParameters_ReturnCodeInALCF:	
+
+SerialCommand_OutputWithParameters_ReturnCodeInALCF:
+		sti
 		mov		ah,al
-		sti
 
 		pop		bp				;  recover ax from stack, throw away
@@ -398,5 +398,5 @@
 ;       Returns when desired UART_LineStatus bit is cleared
 ;       Jumps directly to error exit if timeout elapses (and cleans up stack)
-;	Corrupts registers: 
+;	Corrupts registers:
 ;       CX, flags
 ;--------------------------------------------------------------------
@@ -404,10 +404,10 @@
 SerialCommand_WaitAndPoll_SoftDelayTicks   EQU   20
 
-ALIGN JUMP_ALIGN				
+ALIGN JUMP_ALIGN
 SerialCommand_WaitAndPoll_Init:
 		mov		cl,SerialCommand_WaitAndPoll_SoftDelayTicks
 		call	Timer_InitializeTimeoutWithTicksInCL
 ; fall-through
-		
+
 SerialCommand_WaitAndPoll:
 		call	Timer_SetCFifTimeout
@@ -422,6 +422,6 @@
 		jz		SerialCommand_WaitAndPoll
 ; fall-through
-		
-SerialCommand_WaitAndPoll_Done:	
+
+SerialCommand_WaitAndPoll_Done:
 		ret
 
@@ -442,13 +442,13 @@
 SerialCommand_WriteProtocol:
 		mov		bh,20h
-		
+
 .writeLoop:
 		test	bh,1
 		jnz		SerialCommand_WaitAndPoll_Done
-		
+
 		mov		ax,[es:di]		; fetch next word
 		inc		di
 		inc		di
-		
+
 		add		bp,ax			; update checksum
 		adc		bp,0
@@ -458,9 +458,9 @@
 .writeLoopChecksum:
 		call	SerialCommand_WaitAndPoll_Init
-		
+
 		out		dx,al			; output first byte
 
 		call	SerialCommand_WaitAndPoll
-		
+
 		mov		al,ah			; output second byte
 		out		dx,al
@@ -468,10 +468,10 @@
 		dec		bl
 		jnz		.writeLoop
-		
+
 		inc		bh
-		
+
 		mov		ax,bp			; merge checksum for possible write (last loop)
-		xor		ax,si		
-		
+		xor		ax,si
+
 		jmp		.writeLoopChecksum
 
@@ -501,9 +501,9 @@
 		mov		dx,[cs:bp+IDEVARS.wPortCtrl]
 		inc		dx
-		dec		dx		
+		dec		dx
 		jz		SerialCommand_AutoSerial
 
 ; fall-through
-SerialCommand_IdentifyDeviceInDL_DriveInBH:		
+SerialCommand_IdentifyDeviceInDL_DriveInBH:
 
 		push	bp				; setup fake IDEREGS_AND_INTPACK
@@ -516,5 +516,5 @@
 		mov		bl,0a0h			; protocol command to ah and onto stack with bh
 		mov		ah,bl
-		
+
 		push	bx
 
@@ -524,12 +524,12 @@
 
 		pop		bx
-		
-		pop		cx				
+
+		pop		cx
 		pop		dx
 
 		pop		bp
 
-; place packed port/baud in vendor area of packet, read by FinalizeDPT 
-		mov		byte [es:si+SerialCommand_IdentifyDevice_PackedPortAndBaud], dl	
+; place packed port/baud in vendor area of packet, read by FinalizeDPT
+		mov		byte [es:si+SerialCommand_IdentifyDevice_PackedPortAndBaud], dl
 
 		ret
@@ -540,27 +540,26 @@
 ;
 ; When the SerialAuto IDEVARS entry is used, scans the COM ports on the machine for a possible serial connection.
-; 
-		
+;
+
 SerialCommand_ScanPortAddresses:  db  0b8h, 0f8h, 0bch, 0bah, 0fah, 0beh, 0feh, 0
 ; Corresponds to I/O port:             3f8,  2f8,  3e8,  2e8,  2f0,  3e0,  2e0,  260,  368,  268,  360,  270
 ; COM Assignments:                       1,    2,    3,    4,    5,    6,    7,    8,    9,   10,   11,   12
 
-ALIGN JUMP_ALIGN						
-SerialCommand_AutoSerial:		
+ALIGN JUMP_ALIGN
+SerialCommand_AutoSerial:
 		mov		di,SerialCommand_ScanPortAddresses-1
-		
+
 .nextPort:
 		inc		di				; load next port address
 		mov		dl,[cs:di]
-		
+
 		mov		dh,0			; shift from one byte to two
-		shl		dx,1
-		shl		dx,1		
+		eSHL_IM	dx, 2
 		jz		.exitNotFound
 
 ;
 ; Test for COM port presence, write to and read from registers
-; 
-		push	dx		
+;
+		push	dx
 		add		dl,SerialCommand_UART_lineControl
 		mov		al, 09ah
@@ -569,5 +568,5 @@
 		pop		dx
 		cmp		al, 09ah
-		jnz		.nextPort		
+		jnz		.nextPort
 
 		mov		al, 0ch
@@ -579,27 +578,27 @@
 ;
 ; Pack into dl, baud rate starts at 0
-; 
+;
 		add		dx,-(SerialCommand_PackedPortAndBaud_StartingPort)
 		shr		dx,1
-		
+
 		jmp		.testFirstBaud
 
 ;
 ; Walk through 4 possible baud rates
-; 
-.nextBaud:		
+;
+.nextBaud:
 		inc		dx
 		test	dl,3
 		jz		.nextPort
-		
-.testFirstBaud:		
+
+.testFirstBaud:
 		call	SerialCommand_IdentifyDeviceInDL_DriveInBH
 		jc		.nextBaud
 
 		ret
-				
+
 .exitNotFound:
+		stc
 		mov		ah,1
-		stc
 
 		ret
Index: trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm	(revision 180)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm	(revision 181)
@@ -18,6 +18,5 @@
 		or		byte [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
 		mov		al, byte [es:si+SerialCommand_IdentifyDevice_PackedPortAndBaud]
-		mov		byte [ds:di+DPT.bSerialPortAndBaud], al
+		mov		byte [di+DPT.bSerialPortAndBaud], al
 		ret
 
-
Index: trunk/XTIDE_Universal_BIOS/Src/Device/Timer.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/Timer.asm	(revision 180)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/Timer.asm	(revision 181)
@@ -59,5 +59,5 @@
 %ifndef USE_AT
 	mov		ax, 2
-	; Fall to Delay_TimerTicksFromAX
+	; Fall to Timer_DelayTimerTicksFromAX
 %else
 	push	dx
@@ -68,5 +68,5 @@
 	mov		ah, EVENT_WAIT
 	int		BIOS_SYSTEM_INTERRUPT_15h
-	sti									; XT BIOSes return with interrupt disabled
+	sti									; XT BIOSes return with interrupts disabled. TODO: Maybe we can remove this since it's in an AT-only block?
 
 	pop		cx
