Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm	(revision 221)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm	(revision 223)
@@ -8,5 +8,5 @@
 	.wWordsLeft				resb	2	; 2, WORDs left to transfer
 	.wWordsDone				resb	2	; 4, Number of sectors xferred
-							resb	1	; 6, 
+							resb	1	; 6,
 							resb	1	; 7, IDEPACK.bDeviceControl
 	.wDataPort				resb	2	; 8, IDE Data Port
@@ -327,5 +327,5 @@
 %ifdef USE_186	; OUTS instruction available
 	shl		cx, 1		; WORD count to BYTE count
-	eSEG	es			; Source is ES segment
+	es					; Source is ES segment
 	rep outsb
 %else			; If 8088/8086
@@ -369,5 +369,5 @@
 ALIGN JUMP_ALIGN
 WordWrite:
-	eSEG	es			; Source is ES segment
+	es					; Source is ES segment
 	rep
 	db		6Fh			; OUTSW (we want this in XT build)
@@ -377,5 +377,5 @@
 DWordWrite:
 	shr		cx, 1		; WORD count to DWORD count
-	eSEG	es			; Source is ES segment
+	es					; Source is ES segment
 	rep
 	db		66h			; Override operand size to 32-bit
Index: trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm	(revision 221)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm	(revision 223)
@@ -151,5 +151,5 @@
 ;
 		mov		bl,dl			; setup BL with proper values for read/write loops (BH comes later)
-		
+
 		mov		al,83h
 		add		dl,SerialCommand_UART_lineControl
@@ -202,5 +202,5 @@
 		mov		cx,4			; writing 3 words (plus 1)
 
-		cli						; interrupts off... 
+		cli						; interrupts off...
 
 		call	SerialCommand_WriteProtocol.entry
@@ -215,8 +215,8 @@
 ;;; more than 128 sectors (and for 128 specifically, the pointer must be segment aligned).
 ;;; See comments below at the point this entry point was called for more details...
-.nextSectorNormalize:			
+.nextSectorNormalize:
 		call	Registers_NormalizeESDI
 %endif
-		
+
 		pop		ax				; load command byte (done before call to .nextSector on subsequent iterations)
 		push	ax
@@ -249,5 +249,5 @@
 .readTimeout:
 		push	ax				; not only does this push preserve AX (which we need), but it also
-								; means the stack has the same number of bytes on it as when we are 
+								; means the stack has the same number of bytes on it as when we are
 								; sending a packet, important for error cleanup and exit
 		mov		ah,1
@@ -256,5 +256,5 @@
 		test	dl,1
 		jz		.readByte1Ready
-		jmp		.readByte2Ready		
+		jmp		.readByte2Ready
 
 ;----------------------------------------------------------------------------
@@ -275,5 +275,5 @@
 		adc		si, 0
 
-.readEntry:		
+.readEntry:
 		mov		dl,bh
 		in		al,dx
@@ -325,5 +325,5 @@
 
 		pop		ax				; sector count and command byte
-		dec		al				; decrememnt sector count
+		dec		al				; decrement sector count
 		push	ax				; save
 		jz		SerialCommand_OutputWithParameters_ReturnCodeInALCF    ; CF=0 from "cmp ax,bp" returning Zero above
@@ -336,9 +336,9 @@
 ;;; This code is no longer needed as we do not support more than 128 sectors, and for 128 the pointer
 ;;; must be segment aligned.  If we ever do want to support more sectors, the code can help...
-		
+
 ;
 ; Normalize buffer pointer for next go round, if needed.
 ;
-; We need to re-nomrlize the pointer in ES:DI after processing every 7f sectors.  That number could 
+; We need to re-normalize the pointer in ES:DI after processing every 7f sectors.  That number could
 ; have been 80 if we knew the offset was on a segment boundary, but this may not be the case.
 ;
@@ -347,6 +347,6 @@
 ;    b) on transitions from FF to FE, very rare case for writing 255 or 256 sectors
 ;    c) on transitions from 80 to 7F, a large read/write
-;    d) on transitions from 00 to FF, very, very rare case of writing 256 secotrs
-;       We don't need to renormalize in this case, but it isn't worth the memory/effort to not do 
+;    d) on transitions from 00 to FF, very, very rare case of writing 256 sectors
+;       We don't need to renormalize in this case, but it isn't worth the memory/effort to not do
 ;       the extra work, and it does no harm.
 ;
@@ -354,5 +354,5 @@
 ; for more than 127 sectors.  Back in the day, it appears that some BIOS could not support more than 127
 ; sectors, so that may be the practical limit for OS and application developers.  The Extended BIOS
-; function also appear to be capped at 127 sectors.  So although this can support the full 256 sectors 
+; function also appear to be capped at 127 sectors.  So although this can support the full 256 sectors
 ; if needed, we are optimized for that 1-127 range.
 ;
@@ -373,5 +373,5 @@
 										; (0-7e kicked out before we get here)
 										; 7f moves to 81 and OF=1, so OF=SF
-										; fe moves to 0 and OF=0, SF=0, so OF=SF 
+										; fe moves to 0 and OF=0, SF=0, so OF=SF
 										; ff moves to 1 and OF=0, SF=0, so OF=SF
 										; 80-fd moves to 82-ff and OF=0, so OF<>SF
@@ -387,7 +387,7 @@
 
 %else
-		
-		jmp		short .nextSector		
-		
+
+		jmp		short .nextSector
+
 %endif
 
@@ -425,5 +425,5 @@
 		jc		.clearBuffer	; note CF from shr above
 
-.clearBufferComplete:			
+.clearBufferComplete:
 		stc
 		mov		al,1
@@ -448,7 +448,7 @@
 ; SerialCommand_WriteProtocol
 ;
-; NOTE: As with its read counterpart, this loop is very time sensitive.  
-; Although it will still function, adding additional instructions will 
-; impact the write througput, especially on slower machines.  
+; NOTE: As with its read counterpart, this loop is very time sensitive.
+; Although it will still function, adding additional instructions will
+; impact the write throughput, especially on slower machines.
 ;
 ;	Parameters:
@@ -514,8 +514,12 @@
 		mov		ah,dl
 		jmp		.writeByte2Ready
-		
+
 .writeTimeout1:
+%ifndef USE_186
 		mov		ax,.writeByte1Ready
 		push	ax				; return address for ret at end of SC_writeTimeout2
+%else
+		push	.writeByte1Ready
+%endif
 ;;; fall-through
 
@@ -527,5 +531,5 @@
 ;               One entry point fills in AH with 20h for write
 ;		DX:		Port address (OK if already incremented to UART_lineStatus)
-;       BX:    
+;       BX:
 ;       Stack:	2 words on the stack below the command/count word
 ;	Returns:
@@ -553,5 +557,5 @@
 		xor		cx,cx
 .readTimeoutLoop:
-		mov		dl,bh				
+		mov		dl,bh
 		in		al,dx
 		test	al,ah
@@ -588,5 +592,5 @@
 ;	Returns:
 ;		AH:		INT 13h Error Code
-;               NOTE: Not set (or checked) during drive detection 
+;               NOTE: Not set (or checked) during drive detection
 ;		CF:		Cleared if success, Set if error
 ;	Corrupts registers:
@@ -596,9 +600,9 @@
 SerialCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH:
 ;
-; To improve boot time, we do our best to avoid looking for slave serial drives when we already know the results 
-; from the looking for a master.  This is particuarly true when doing a COM port scan, as we will end up running
-; through all the COM ports and baud rates a second time.  
-;
-; But drive detection isn't the only case - we also need to get the right drive when called on int13h/25h.  
+; To improve boot time, we do our best to avoid looking for slave serial drives when we already know the results
+; from the looking for a master.  This is particularly true when doing a COM port scan, as we will end up running
+; through all the COM ports and baud rates a second time.
+;
+; But drive detection isn't the only case - we also need to get the right drive when called on int13h/25h.
 ;
 ; The decision tree:
@@ -606,48 +610,48 @@
 ;    Master:
 ;		   bSerialPackedPortAndBaud Non-Zero:   -> Continue with bSerialPackedAndBaud (1)
-;		   bSerialPackedPortAndBaud Zero: 
+;		   bSerialPackedPortAndBaud Zero:
 ;		   			      bLastSerial Zero:     -> Scan (2)
 ;					      bLastSerial Non-Zero: -> Continue with bLastSerial (3)
-;			  				        
+;
 ;    Slave:
-;		   bSerialPackedPortAndBaud Non-Zero: 
+;		   bSerialPackedPortAndBaud Non-Zero:
 ;		   			      bLastSerial Zero:     -> Error - Not Found (4)
 ;					      bLastSerial Non-Zero: -> Continue with bSerialPackedAndBaud (5)
-;          bSerialPackedPortAndBaud Zero:     
+;          bSerialPackedPortAndBaud Zero:
 ;		   			      bLastSerial Zero:     -> Error - Not Found (4)
 ;					      bLastSerial Non-Zero: -> Continue with bLastSerial (6)
 ;
-; (1) This was a port/baud that was explicilty set with the configurator.  In the drive detection case, as this 
-;     is the Master, we are checking out a new controller, and so don't care about the value of bLastSerial.  
+; (1) This was a port/baud that was explicitly set with the configurator.  In the drive detection case, as this
+;     is the Master, we are checking out a new controller, and so don't care about the value of bLastSerial.
 ;     And as with the int13h/25h case, we just go off and get the needed information using the user's setting.
-; (2) We are using the special .ideVarsSerialAuto strucutre.  During drive detection, we would only be here
+; (2) We are using the special .ideVarsSerialAuto structure.  During drive detection, we would only be here
 ;     if bLastSerial is zero (since we only scan if no explicit drives are set), so we go off to scan.
-; (3) We are using the special .ideVarsSerialAuto strucutre.  We won't get here during drive detection, but
+; (3) We are using the special .ideVarsSerialAuto structure.  We won't get here during drive detection, but
 ;     we might get here on an int13h/25h call.  If we have scanned COM drives, they are the ONLY serial drives
 ;     in use, and so bLastSerial will reflect the port/baud setting for the scanned COM drives.
-; (4) No master has been found yet, therefore no slave should be found.  Avoiding the slave reduces boot time, 
+; (4) No master has been found yet, therefore no slave should be found.  Avoiding the slave reduces boot time,
 ;     especially in the full COM port scan case.  Note that this is different from the hardware IDE, where we
 ;     will scan for a slave even if a master is not present.  Note that if ANY master had been previously found,
-;     we will do the slave scan, which isn't harmful, it just wates time.  But the most common case (by a wide
+;     we will do the slave scan, which isn't harmful, it just wastes time.  But the most common case (by a wide
 ;     margin) will be just one serial controller.
 ; (5) A COM port scan for a master had been previously completed, and a drive was found.  In a multiple serial
-;     controller scenario being called with int13h/25h, we need to use the value in bSerialPackedPortAndBaud 
+;     controller scenario being called with int13h/25h, we need to use the value in bSerialPackedPortAndBaud
 ;     to make sure we get the proper drive.
-; (6) A COM port scan for a master had been previously completed, and a drive was found.  We would only get here 
-;     if no serial drive was explicitly set by the user in the configurator or that drive had not been found.  
-;     Instead of performing the full COM port scan for the slave, use the port/baud value stored during the 
+; (6) A COM port scan for a master had been previously completed, and a drive was found.  We would only get here
+;     if no serial drive was explicitly set by the user in the configurator or that drive had not been found.
+;     Instead of performing the full COM port scan for the slave, use the port/baud value stored during the
 ;     master scan.
-;		
-		mov		dl,[cs:bp+IDEVARS.bSerialPackedPortAndBaud]		
+;
+		mov		dl,[cs:bp+IDEVARS.bSerialPackedPortAndBaud]
 		mov		al,	byte [RAMVARS.xlateVars+XLATEVARS.bLastSerial]
-				
+
 		test	bh, FLG_DRVNHEAD_DRV
 		jz		.master
 
-		test	al,al			; Take care of the case that is different between master and slave.  
+		test	al,al			; Take care of the case that is different between master and slave.
 		jz		.error			; Because we do this here, the jz after the "or" below will not be taken
 
 ; fall-through
-.master:		
+.master:
 		test	dl,dl
 		jnz		.identifyDeviceInDL
@@ -655,7 +659,7 @@
 		or		dl,al			; Move bLast into position in dl, as well as test for zero
 		jz		.scanSerial
-		
+
 ; fall-through
-.identifyDeviceInDL:	
+.identifyDeviceInDL:
 
 		push	bp				; setup fake IDEREGS_AND_INTPACK
@@ -680,15 +684,15 @@
 
 		pop		bp
-; 
+;
 ; place packed port/baud in RAMVARS, read by FinalizeDPT and DetectDrives
 ;
 ; Note that this will be set during an int13h/25h call as well.  Which is OK since it is only used (at the
-; top of this routine) for drives found during a COM scan, and we only COM scan if there were no other 
+; top of this routine) for drives found during a COM scan, and we only COM scan if there were no other
 ; COM drives found.  So we will only reaffirm the port/baud for the one COM port/baud that has a drive.
-; 
+;
 		jc		.notFound											; only store bLastSerial if success
 		mov		byte [RAMVARS.xlateVars+XLATEVARS.bLastSerial], dl
 
-.notFound:		
+.notFound:
 		ret
 
@@ -715,8 +719,7 @@
 .nextPort:
 		inc		di				; load next port address
+		xor		dh, dh
 		mov		dl,[cs:di]
-
-		mov		dh,0			; shift from one byte to two
-		eSHL_IM	dx, 2
+		eSHL_IM	dx, 2			; shift from one byte to two
 		jz		.error
 
@@ -762,5 +765,5 @@
 		ret
 
-.error:	
+.error:
 		stc
 %if 0
