Index: trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm	(revision 251)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm	(revision 258)
@@ -37,7 +37,8 @@
 %ifdef MODULE_SERIAL
 Device_FinalizeDPT:
-	TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE .FinalizeDptForSerialPortDevice
+	; needs to check IDEVARS vs. checking the DPT as the serial bit in the DPT is set in the Finalize routine
+	CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_SERIAL_PORT, .FinalizeDptForSerialPortDevice
 	jmp		IdeDPT_Finalize
-.FinalizeDptForSerialPortDevice:
+.FinalizeDptForSerialPortDevice: 
 	jmp		SerialDPT_Finalize
 
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm	(revision 251)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm	(revision 258)
@@ -12,5 +12,5 @@
 ;		CS:BP:	Ptr to IDEVARS for the controller
 ;	Returns:
-;		Nothing
+;		CF:		Clear, IDE interface only supports hard disks
 ;	Corrupts registers:
 ;		AX
@@ -42,5 +42,5 @@
 ;		CS:BP:	Ptr to IDEVARS for the controller
 ;	Returns:
-;		Nothing
+;		CF:		Always clear, we don't support floppies on the IDE inteface
 ;	Corrupts registers:
 ;		Nothing
@@ -52,3 +52,4 @@
 
 .EndDPT:
+	clc
 	ret
Index: trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm	(revision 251)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm	(revision 258)
@@ -56,4 +56,5 @@
 ;	Returns:
 ;		AH:		INT 13h Error Code
+;		CX:		Number of successfully transferred sectors (for transfer commands)
 ;		CF:		Cleared if success, Set if error
 ;	Corrupts registers:
@@ -309,5 +310,5 @@
 		dec		al				; decrement sector count
 		push	ax				; save
-		jz		SerialCommand_OutputWithParameters_ReturnCodeInALCF    ; CF=0 from "cmp ax,bp" returning Zero above
+		jz		SerialCommand_OutputWithParameters_ReturnCodeInAL
 
 		cli						; interrupts back off for ACK byte to host
@@ -409,19 +410,24 @@
 
 .clearBufferComplete:
-		stc
-		mov		al,1
-
-ALIGN JUMP_ALIGN
-SerialCommand_OutputWithParameters_ReturnCodeInALCF:
+		mov		al, 3			;  error return code and CF (low order bit)
+
+ALIGN JUMP_ALIGN
+SerialCommand_OutputWithParameters_ReturnCodeInAL:
 %if 0
 		sti						;  all paths here will already have interrupts turned back on
 %endif
-		mov		ah,al
-
-		pop		bp				;  recover ax (command and count) from stack, throw away
+		mov		ah, al			;  for success, AL will already be zero
+
+		pop		bx				;  recover "ax" (command and count) from stack
 
 		pop		bp
 		pop		di
 		pop		si
+
+		mov		ch, 0
+		mov		cl,[bp+IDEPACK.bSectorCount]
+		sub		cl, bl			; subtract off the number of sectors that remained
+		
+		shr		ah, 1			; shift down return code and CF
 
 		ret
@@ -632,5 +638,15 @@
 		call	FindDPT_ToDSDIforSerialDevice
 		pop		si
+%ifdef MODULE_SERIAL_FLOPPY
+		jc		.founddpt
+;
+; If not found above with FindDPT_ToDSDIforSerialDevice, DI will point to the DPT after the last hard disk DPT
+;
+		cmp		byte [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst], 0
+		jz		.notfounddpt
+.founddpt:
+%else
 		jnc		.notfounddpt
+%endif
 		mov		ax, [di+DPT_SERIAL.wSerialPortAndBaud]
 .notfounddpt:
@@ -678,5 +694,5 @@
 ; which is read by FinalizeDPT and DetectDrives
 ;
-		mov		[es:si+ATA6.wVendor],dx
+		mov		[es:si+ATA6.wSerialPortAndBaud],dx
 
 .notFound:
Index: trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm	(revision 251)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm	(revision 258)
@@ -11,12 +11,27 @@
 ;		ES:SI:	Ptr to 512-byte ATA information read from the drive
 ;	Returns:
-;		Nothing
+;		CF:		Set, indicates that this is a floppy disk
+;               Clear, indicates that this is a hard disk
 ;	Corrupts registers:
 ;		AX
 ;--------------------------------------------------------------------
 SerialDPT_Finalize:
-		or		byte [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
-		mov		ax, [es:si+ATA6.wVendor]
+		mov		ax, [es:si+ATA6.wSerialPortAndBaud]
 		mov		[di+DPT_SERIAL.wSerialPortAndBaud], ax
+
+;
+; Note that this section is not under %ifdef MODULE_SERIAL_FLOPPY.  It is important to 
+; detect floppy disks presented by the server and not treat them like hard disks, even
+; if the floppy support is disabled.
+;
+		mov		al, [es:si+ATA6.wSerialFloppyFlagAndType]
+		or		al, FLGH_DPT_SERIAL_DEVICE
+		or		byte [di+DPT.bFlagsHigh], al
+
+		test	al, FLGH_DPT_SERIAL_FLOPPY           ; clears CF
+		jz		.notfloppy
+		stc		
+.notfloppy:		
+		
 		ret
 
