Index: /trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc	(revision 158)
@@ -8,5 +8,7 @@
 struc DPT	; 8 bytes
 	; General Disk Parameter Table related
-	.wFlags						resb	2
+	.wFlags:
+	.bFlagsLow					resb	1
+	.bFlagsHigh					resb	1
 	.bIdevarsOffset				resb	1	; Offset to IDEVARS for this drive
 
@@ -35,18 +37,20 @@
 
 
-; Bit definitions for DPT.wFlags
-MASK_DPT_CHS_SHIFT_COUNT		EQU	(7<<0)	; Bits 0...3, P-CHS to L-CHS bit shift count (0...4)
-FLG_DPT_SLAVE					EQU	FLG_DRVNHEAD_DRV	; (1<<4), Drive is slave drive
-MASK_DPT_ADDRESSING_MODE		EQU	(3<<5)	; Bits 5..6, Addressing Mode (bit 6 == FLG_DRVNHEAD_LBA)
-FLG_DPT_ENABLE_IRQ				EQU	(1<<7)
-FLG_DPT_REVERSED_A0_AND_A3		EQU	(1<<8)	; XTIDE mod, Address lines 0 and 3 reversed
-FLG_DPT_SERIAL_DEVICE			EQU	(1<<9)	; Serial Port Device
-FLG_DPT_BLOCK_MODE_SUPPORTED	EQU	(1<<10)	; Use block transfer commands
-FLG_DPT_INTERRUPT_IN_SERVICE	EQU	(1<<11)	; Set when waiting for IRQ
-FLG_DPT_RESET_nDRDY				EQU	(1<<12)	; Drive ready to accept commands
-FLG_DPT_RESET_nINITPRMS			EQU	(1<<13)	; Initialize Device Parameters successfull
-FLG_DPT_RESET_nRECALIBRATE		EQU	(1<<14)	; Recalibrate successfull
-FLG_DPT_RESET_nSETBLOCK			EQU	(1<<15)	; Initialize Block Mode successfull
-MASK_DPT_RESET					EQU	0F000h
+; Bit definitions for DPT.bFlagsLow
+MASKL_DPT_CHS_SHIFT_COUNT		EQU	(7<<0)	; Bits 0...3, P-CHS to L-CHS bit shift count (0...4)
+FLGL_DPT_SLAVE					EQU	FLG_DRVNHEAD_DRV	; (1<<4), Drive is slave drive
+MASKL_DPT_ADDRESSING_MODE		EQU	(3<<5)	; Bits 5..6, Addressing Mode (bit 6 == FLG_DRVNHEAD_LBA)
+FLGL_DPT_ENABLE_IRQ				EQU	(1<<7)
+
+; Bit definitions for DPT.bFlagsHigh
+FLGH_DPT_REVERSED_A0_AND_A3		EQU	(1<<0)	; XTIDE mod, Address lines 0 and 3 reversed
+FLGH_DPT_SERIAL_DEVICE			EQU	(1<<1)	; Serial Port Device
+FLGH_DPT_BLOCK_MODE_SUPPORTED	EQU	(1<<2)	; Use block transfer commands
+FLGH_DPT_INTERRUPT_IN_SERVICE	EQU	(1<<3)	; Set when waiting for IRQ
+FLGH_DPT_RESET_nDRDY			EQU	(1<<4)	; Drive ready to accept commands
+FLGH_DPT_RESET_nINITPRMS		EQU	(1<<5)	; Initialize Device Parameters successfull
+FLGH_DPT_RESET_nRECALIBRATE		EQU	(1<<6)	; Recalibrate successfull
+FLGH_DPT_RESET_nSETBLOCK		EQU	(1<<7)	; Initialize Block Mode successfull
+MASKH_DPT_RESET					EQU	0F0h
 
 ; Addressing modes for DPT.wFlags
Index: /trunk/XTIDE_Universal_BIOS/Inc/IdeRegisters.inc
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Inc/IdeRegisters.inc	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Inc/IdeRegisters.inc	(revision 158)
@@ -19,5 +19,5 @@
 STATUS_REGISTER_in				EQU		7		; Read only
 COMMAND_REGISTER_out			EQU		7		; Write only
-XTIDE_DATA_HIGH_REGISTER		EQU		8		; Non-standard (actually first Control Block reg)
+;XTIDE_DATA_HIGH_REGISTER		EQU		8		; Non-standard (actually first Control Block reg)
 
 ; IDE Register offsets from Control Block base port
@@ -58,5 +58,5 @@
 ; Bit definitions for IDE Device Control Register
 ; Bit 0 must be zero, unlisted bits are reserved.
-FLG_DEVCONTROL_HOB		EQU		(1<<7)	; High Order Byte (ATA6+)
+;FLG_DEVCONTROL_HOB		EQU		(1<<7)	; High Order Byte (ATA6+)
 ;FLG_DEVCONTROL_O8H		EQU		(1<<3)	; Drive has more than 8 heads (pre-ATA only, 1 on ATA1, reserved on ATA2+)
 FLG_DEVCONTROL_SRST		EQU		(1<<2)	; Software Reset
Index: /trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm	(revision 158)
@@ -69,5 +69,5 @@
 PushBlockMode:
 	mov		ax, 1
-	test	WORD [di+DPT.wFlags], FLG_DPT_BLOCK_MODE_SUPPORTED
+	test	BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED
 	jz		SHORT .PushBlockSizeFromAX
 	mov		al, [di+DPT_ATA.bSetBlock]
@@ -137,6 +137,6 @@
 ;--------------------------------------------------------------------
 PushResetStatus:
-	mov		ax, [di+DPT.wFlags]
-	and		ax, MASK_DPT_RESET
+	mov		al, [di+DPT.bFlagsHigh]
+	and		ax, MASKH_DPT_RESET
 	push	ax
 
Index: /trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm	(revision 158)
@@ -16,5 +16,5 @@
 ;--------------------------------------------------------------------
 Device_FinalizeDPT:
-	test	WORD [di+DPT.wFlags], FLG_DPT_SERIAL_DEVICE
+	test	BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
 	jnz		SHORT ReturnSuccessForSerialPort
 	jmp		IdeDPT_Finalize
@@ -34,5 +34,5 @@
 ;--------------------------------------------------------------------
 Device_ResetMasterAndSlaveController:
-	test	WORD [di+DPT.wFlags], FLG_DPT_SERIAL_DEVICE
+	test	BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
 	jnz		SHORT ReturnSuccessForSerialPort
 	jmp		IdeCommand_ResetMasterAndSlaveController
@@ -76,5 +76,5 @@
 ALIGN JUMP_ALIGN
 Device_OutputCommandWithParameters:
-	test	WORD [di+DPT.wFlags], FLG_DPT_SERIAL_DEVICE
+	test	BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
 	jnz		SHORT .OutputCommandToSerialPort
 	jmp		IdeCommand_OutputWithParameters
@@ -97,5 +97,5 @@
 ALIGN JUMP_ALIGN
 Device_SelectDrive:
-	test	WORD [di+DPT.wFlags], FLG_DPT_SERIAL_DEVICE
+	test	BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
 	jnz		SHORT ReturnSuccessForSerialPort
 	jmp		IdeCommand_SelectDrive
@@ -168,5 +168,5 @@
 ;--------------------------------------------------------------------
 TranslateRegisterAddressInDLifNecessaryThenJumpToBX:
-	test	WORD [di+DPT.wFlags], FLG_DPT_REVERSED_A0_AND_A3
+	test	BYTE [di+DPT.bFlagsHigh], FLGH_DPT_REVERSED_A0_AND_A3
 	jz		SHORT .JumpToIoFunctionInSI
 
Index: /trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm	(revision 158)
@@ -54,8 +54,7 @@
 	; Create fake DPT to be able to use Device.asm functions
 	call	FindDPT_ForNewDriveToDSDI
-	xor		ax, ax
+	eMOVZX	ax, bh
 	cmp		BYTE [cs:bp+IDEVARS.bDevice], DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0
-	eCMOVE	ax, FLG_DPT_REVERSED_A0_AND_A3
-	or		al, bh
+	eCMOVE	ah, FLGH_DPT_REVERSED_A0_AND_A3
 	mov		[di+DPT.wFlags], ax
 	mov		[di+DPT.bIdevarsOffset], bp
@@ -65,5 +64,5 @@
 	cmp		bp, BYTE ROMVARS.ideVars0
 	jne		SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster
-	test	bh, FLG_DRVNHEAD_DRV
+	test	al, FLG_DRVNHEAD_DRV
 	jnz		SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster
 	mov		bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_MOTOR_STARTUP, FLG_STATUS_BSY)
@@ -82,5 +81,5 @@
 
 	; Clean stack and return
-	lea		sp, [bp+SIZE_OF_FAKE_IDEPACK]	; This assumes BP hasn't changed between Idepack_FakeToSSBP and here
+	lea		sp, [bp+EXTRA_BYTES_FOR_INTPACK]	; This assumes BP hasn't changed between Idepack_FakeToSSBP and here
 	pop		bp
 	ret
@@ -103,5 +102,5 @@
 ALIGN JUMP_ALIGN
 IdeCommand_OutputWithParameters:
-	push	bx							; Store status register bits to poll
+	push	bx						; Store status register bits to poll
 
 	; Select Master or Slave drive and output head number or LBA28 top bits
@@ -110,14 +109,16 @@
 
 	; Output Device Control Byte to enable or disable interrupts
-	mov		dl, DEVICE_CONTROL_REGISTER_out
 	mov		al, [bp+IDEPACK.bDeviceControl]
-	test	al, FLG_DEVCONTROL_nIEN
+	test	al, FLG_DEVCONTROL_nIEN	; Interrupts disabled?
 	jnz		SHORT .DoNotSetInterruptInServiceFlag
-	or		WORD [di+DPT.wFlags], FLG_DPT_INTERRUPT_IN_SERVICE
+
+	; Clear Task Flag and set Interrupt In-Service Flag
+	or		BYTE [di+DPT.bFlagsHigh], FLGH_DPT_INTERRUPT_IN_SERVICE
 	push	ds
-	LOAD_BDA_SEGMENT_TO	ds, cx, !		; Also zero CX
-	mov		[BDA.bHDTaskFlg], al
+	LOAD_BDA_SEGMENT_TO	ds, dx, !	; Also zero DX
+	mov		[BDA.bHDTaskFlg], dl
 	pop		ds
 .DoNotSetInterruptInServiceFlag:
+	mov		dl, DEVICE_CONTROL_REGISTER_out
 	call	Device_OutputALtoIdeControlBlockRegisterInDL
 
@@ -143,7 +144,7 @@
 
 	; Wait until command completed
-	pop		bx							; Pop status and timeout for polling
-	cmp		bl, FLG_STATUS_DRQ			; Data transfer started?
-	je		SHORT .StartDataTransfer
+	pop		bx						; Pop status and timeout for polling
+	cmp		bl, FLG_STATUS_DRQ		; Data transfer started?
+	je		SHORT IdeTransfer_StartWithCommandInAL
 	test	BYTE [bp+IDEPACK.bDeviceControl], FLG_DEVCONTROL_nIEN
 	jz		SHORT .WaitForIrqOrRdy
@@ -153,7 +154,4 @@
 .WaitForIrqOrRdy:
 	jmp		IdeWait_IRQorStatusFlagInBLwithTimeoutInBH
-ALIGN JUMP_ALIGN
-.StartDataTransfer:
-	jmp		IdeTransfer_StartWithCommandInAL
 
 .DriveNotReady:
@@ -179,5 +177,5 @@
 	mov		bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY)
 	cmp		BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE
-	eCMOVE	bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_IDENTIFY_DEVICE, FLG_STATUS_BSY)
+	eCMOVE	bh, TIMEOUT_IDENTIFY_DEVICE
 	call	IdeWait_PollStatusFlagInBLwithTimeoutInBH
 	jc		SHORT ReturnSinceTimeoutWhenPollingBusy
@@ -189,5 +187,5 @@
 	mov		bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY)
 	cmp		BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE
-	eCMOVE	bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_IDENTIFY_DEVICE, FLG_STATUS_DRDY)
+	eCMOVE	bh, TIMEOUT_IDENTIFY_DEVICE
 	jmp		IdeWait_PollStatusFlagInBLwithTimeoutInBH
 
Index: /trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm	(revision 158)
@@ -114,5 +114,5 @@
 
 	; Clear Interrupt In-Service Flag from DPT
-	and		WORD [di+DPT.wFlags], ~FLG_DPT_INTERRUPT_IN_SERVICE
+	and		BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_INTERRUPT_IN_SERVICE
 
 	; Set Task Flag
Index: /trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm	(revision 158)
@@ -166,5 +166,5 @@
 ; InitializePiovarsInSSBPwithSectorCountInAX
 ;	Parameters:
-;		AX:		Number of sectors to transfer (0=65536)
+;		AX:		Number of sectors to transfer (1...65535)
 ;		BX:		Offset to transfer function lookup table
 ;		DS:DI:	Ptr to DPT (in RAMVARS segment)
@@ -179,7 +179,5 @@
 	; Store number of blocks to transfer
 	eMOVZX	cx, BYTE [di+DPT_ATA.bSetBlock]		; Block size in sectors
-	xor		dx, dx
-	test	ax, ax
-	eCMOVZ	dl, 1		; DX:AX = Sectors to transfer (1...65536)
+	xor		dx, dx		; DX:AX = Sectors to transfer (1...65535)
 	div		cx			; AX = Full blocks to transfer
 	test	dx, dx
@@ -197,5 +195,5 @@
 
 	; Get transfer function based on bus type
-	xchg	ax, bx
+	xchg	ax, bx								; Lookup table offset to AX
 	eMOVZX	bx, BYTE [di+DPT.bIdevarsOffset]	; CS:BX now points to IDEVARS
 	mov		dx, [cs:bx+IDEVARS.wPort]			; Load IDE Data port address
Index: /trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm	(revision 158)
@@ -1,6 +1,4 @@
 ; Project name	:	XTIDE Universal BIOS
 ; Description	:	Functions for managing IDEPACK struct.
-
-SIZE_OF_FAKE_IDEPACK		EQU		(IDEPACK_size - INTPACK_size)
 
 ; Section containing code
@@ -18,5 +16,5 @@
 Idepack_FakeToSSBP:
 	pop		ax
-	sub		sp, BYTE SIZE_OF_FAKE_IDEPACK
+	sub		sp, BYTE EXTRA_BYTES_FOR_INTPACK
 	mov		bp, sp
 	jmp		ax
Index: /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm	(revision 158)
@@ -22,5 +22,5 @@
 ALIGN JUMP_ALIGN
 AH24h_HandlerForSetMultipleBlocks:
-	test	WORD [di+DPT.wFlags], FLG_DPT_BLOCK_MODE_SUPPORTED
+	test	BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED
 	jnz		SHORT .TryToSetBlockMode
 	stc
Index: /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm	(revision 158)
@@ -28,7 +28,9 @@
 ALIGN JUMP_ALIGN
 AH2h_HandlerForReadDiskSectors:
-	call	AH2h_ExitInt13hIfSectorCountInIntpackIsZero
+	cmp		BYTE [bp+IDEPACK.intpack+INTPACK.al], 0
+	je		SHORT AH2h_ExitInt13hSinceSectorCountInIntpackIsZero
+
 	mov		ah, COMMAND_READ_SECTORS	; Load sector mode command
-	test	WORD [di+DPT.wFlags], FLG_DPT_BLOCK_MODE_SUPPORTED
+	test	BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED
 	eCMOVNZ	ah, COMMAND_READ_MULTIPLE	; Load block mode command
 	mov		bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ)
@@ -44,20 +46,11 @@
 
 ;--------------------------------------------------------------------
-; AH2h_ExitInt13hIfSectorCountInIntpackIsZero
+; AH2h_ExitInt13hSinceSectorCountInIntpackIsZero
 ;	Parameters:
-;		SS:BP:	Ptr to IDEPACK
-;	Parameters on INTPACK:
-;		AL:		Number of sectors to transfer (1...255)
+;		Nothing
 ;	Returns:
-;		Nothing (does not return if error)
-;	Corrupts registers:
-;		Nothing
+;		Jumps to Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
 ;--------------------------------------------------------------------
-ALIGN JUMP_ALIGN
-AH2h_ExitInt13hIfSectorCountInIntpackIsZero:
-	cmp		BYTE [bp+IDEPACK.intpack+INTPACK.al], 0
-	je		SHORT .InvalidSectorCount
-	ret
-.InvalidSectorCount:
+AH2h_ExitInt13hSinceSectorCountInIntpackIsZero:
 	mov		ah, RET_HD_INVALID
 	jmp		Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
Index: /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH3h_HWrite.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH3h_HWrite.asm	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH3h_HWrite.asm	(revision 158)
@@ -27,7 +27,9 @@
 ALIGN JUMP_ALIGN
 AH3h_HandlerForWriteDiskSectors:
-	call	AH2h_ExitInt13hIfSectorCountInIntpackIsZero
+	cmp		BYTE [bp+IDEPACK.intpack+INTPACK.al], 0
+	je		SHORT AH2h_ExitInt13hSinceSectorCountInIntpackIsZero
+
 	mov		ah, COMMAND_WRITE_SECTORS	; Load sector mode command
-	test	WORD [di+DPT.wFlags], FLG_DPT_BLOCK_MODE_SUPPORTED
+	test	BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED
 	eCMOVNZ	ah, COMMAND_WRITE_MULTIPLE	; Load block mode command
 	mov		bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ)
Index: /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm	(revision 158)
@@ -26,5 +26,7 @@
 ALIGN JUMP_ALIGN
 AH4h_HandlerForVerifyDiskSectors:
-	call	AH2h_ExitInt13hIfSectorCountInIntpackIsZero
+	cmp		BYTE [bp+IDEPACK.intpack+INTPACK.al], 0
+	je		SHORT AH2h_ExitInt13hSinceSectorCountInIntpackIsZero
+
 	mov		ah, COMMAND_VERIFY_SECTORS
 	mov		bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRDY)
Index: /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm	(revision 158)
@@ -46,15 +46,15 @@
 
 	; Try to select drive and wait until ready
-	or		WORD [di+DPT.wFlags], MASK_DPT_RESET		; Everything uninitialized
+	or		BYTE [di+DPT.bFlagsHigh], MASKH_DPT_RESET		; Everything uninitialized
 	call	AccessDPT_GetDriveSelectByteToAL
 	mov		[bp+IDEPACK.bDrvAndHead], al
 	call	Device_SelectDrive
 	jc		SHORT .ReturnNotSuccessfull
-	and		WORD [di+DPT.wFlags], ~FLG_DPT_RESET_nDRDY	; Clear since success
+	and		BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_RESET_nDRDY	; Clear since success
 
 	; Initialize CHS parameters if LBA is not used
 	call	InitializeDeviceParameters
 	jc		SHORT .RecalibrateDrive
-	and		WORD [di+DPT.wFlags], ~FLG_DPT_RESET_nINITPRMS
+	and		BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_RESET_nINITPRMS
 
 	; Recalibrate drive by seeking to cylinder 0
@@ -62,5 +62,5 @@
 	call	AH11h_RecalibrateDrive
 	jc		SHORT .InitializeBlockMode
-	and		WORD [di+DPT.wFlags], ~FLG_DPT_RESET_nRECALIBRATE
+	and		BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_RESET_nRECALIBRATE
 
 	; Initialize block mode transfers
@@ -68,5 +68,5 @@
 	call	InitializeBlockMode
 	jc		SHORT .ReturnNotSuccessfull
-	and		WORD [di+DPT.wFlags], ~FLG_DPT_RESET_nSETBLOCK	; Keeps CF clear
+	and		BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_RESET_nSETBLOCK	; Keeps CF clear
 
 .ReturnNotSuccessfull:
@@ -90,5 +90,5 @@
 InitializeDeviceParameters:
 	; No need to initialize CHS parameters if LBA mode enabled
-	test	BYTE [di+DPT.wFlags], FLG_DRVNHEAD_LBA	; Clear CF
+	test	BYTE [di+DPT.bFlagsLow], FLG_DRVNHEAD_LBA	; Clear CF
 	jnz		SHORT ReturnSuccessSinceInitializationNotNeeded
 
@@ -115,5 +115,5 @@
 ALIGN JUMP_ALIGN
 InitializeBlockMode:
-	test	WORD [di+DPT.wFlags], FLG_DPT_BLOCK_MODE_SUPPORTED	; Clear CF
+	test	BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED	; Clear CF
 	jz		SHORT ReturnSuccessSinceInitializationNotNeeded
 
Index: /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Address.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Address.asm	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Address.asm	(revision 158)
@@ -89,6 +89,6 @@
 	; (LCylinder << n) + (LHead / PHeadCount)
 	mov		dx, cx					; Copy L-CHS Cylinder number to DX
-	mov		cl, [di+DPT.wFlags]		; Load shift count
-	and		cl, MASK_DPT_CHS_SHIFT_COUNT
+	mov		cl, [di+DPT.bFlagsLow]	; Load shift count
+	and		cl, MASKL_DPT_CHS_SHIFT_COUNT
 	shl		dx, cl					; DX = LCylinder << n
 	add		ax, dx					; AX = P-CHS Cylinder number
Index: /trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm	(revision 158)
@@ -115,4 +115,4 @@
 	call	Idepack_FakeToSSBP
 	call	AH0h_ResetHardDisksHandledByOurBIOS
-	add		sp, BYTE SIZE_OF_FAKE_IDEPACK
+	add		sp, BYTE EXTRA_BYTES_FOR_INTPACK
 	ret
Index: /trunk/XTIDE_Universal_BIOS/Src/Main.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/Main.asm	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Src/Main.asm	(revision 158)
@@ -157,8 +157,8 @@
 ; IDE Device support
 %include "IdeCommand.asm"
+%include "IdeTransfer.asm"		; Must be included after IdeCommand.asm
 %include "IdeDPT.asm"
 %include "IdeIO.asm"
 %include "IdeIrq.asm"
-%include "IdeTransfer.asm"
 %include "IdeWait.asm"
 %include "IdeError.asm"			; Must be included after IdeWait.asm
Index: /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm	(revision 158)
@@ -34,5 +34,5 @@
 AccessDPT_GetDeviceControlByteToAL:
 	xor		al, al
-	test	BYTE [di+DPT.wFlags], FLG_DPT_ENABLE_IRQ
+	test	BYTE [di+DPT.bFlagsLow], FLGL_DPT_ENABLE_IRQ
 	jnz		SHORT .EnableDeviceIrq
 	or		al, FLG_DEVCONTROL_nIEN	; Disable IRQ
@@ -52,6 +52,6 @@
 ALIGN JUMP_ALIGN
 AccessDPT_GetAddressingModeForWordLookToBX:
-	mov		bl, [di+DPT.wFlags]
-	and		bx, BYTE MASK_DPT_ADDRESSING_MODE
+	mov		bl, [di+DPT.bFlagsLow]
+	and		bx, BYTE MASKL_DPT_ADDRESSING_MODE
 	eSHR_IM	bx, ADDRESSING_MODE_FIELD_POSITION-1
 	ret
@@ -72,6 +72,6 @@
 AccessDPT_GetLCHSfromPCHS:
 	xchg	ax, cx
-	mov		cl, [di+DPT.wFlags]
-	and		cl, MASK_DPT_CHS_SHIFT_COUNT	; Load shift count
+	mov		cl, [di+DPT.bFlagsLow]
+	and		cl, MASKL_DPT_CHS_SHIFT_COUNT	; Load shift count
 	mov		bx, [di+DPT.wPchsCylinders]		; Load P-CHS cylinders
 	shr		bx, cl							; Shift to L-CHS cylinders
@@ -115,5 +115,5 @@
 	eMOVZX	bx, [di+DPT.bIdevarsOffset]			; CS:BX points to IDEVARS
 	add		bx, BYTE IDEVARS.drvParamsMaster	; CS:BX points to Master Drive DRVPARAMS
-	test	BYTE [di+DPT.wFlags], FLG_DPT_SLAVE
+	test	BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE
 	jz		SHORT .ReturnPointerToDRVPARAMS
 	add		bx, BYTE DRVPARAMS_size				; CS:BX points to Slave Drive DRVPARAMS
Index: /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm	(revision 158)
@@ -60,5 +60,5 @@
 	cmp		[cs:bp+IDEVARS.bIRQ], ah		; Interrupts enabled?
 	jz		SHORT .StoreFlags				;  If not, do not set interrupt flag
-	or		al, FLG_DPT_ENABLE_IRQ
+	or		al, FLGL_DPT_ENABLE_IRQ
 .StoreFlags:
 	mov		[di+DPT.wFlags], ax
@@ -172,5 +172,5 @@
 	cmp		BYTE [es:si+ATA1.bBlckSize], 1	; Max block size in sectors
 	jbe		SHORT .BlockModeTransfersNotSupported
-	or		WORD [di+DPT.wFlags], FLG_DPT_BLOCK_MODE_SUPPORTED
+	or		BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED
 .BlockModeTransfersNotSupported:
 	; Fall to .StoreDeviceSpecificParameters
Index: /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm
===================================================================
--- /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm	(revision 157)
+++ /trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm	(revision 158)
@@ -98,5 +98,5 @@
 ALIGN JUMP_ALIGN
 IterateToSlaveAtPortCallback:
-	test	BYTE [di+DPT.wFlags], FLG_DPT_SLAVE	; Clears CF
+	test	BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE	; Clears CF
 	jnz		SHORT CompareBasePortAddress
 	ret		; Wrong DPT
@@ -104,5 +104,5 @@
 ALIGN JUMP_ALIGN
 IterateToMasterAtPortCallback:
-	test	BYTE [di+DPT.wFlags], FLG_DPT_SLAVE
+	test	BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE
 	jnz		SHORT ReturnWrongDPT				; Return if slave drive
 
@@ -146,5 +146,5 @@
 ALIGN JUMP_ALIGN
 IterateToDptWithInterruptInServiceFlagSet:
-	test	WORD [di+DPT.wFlags], FLG_DPT_INTERRUPT_IN_SERVICE
+	test	BYTE [di+DPT.bFlagsHigh], FLGH_DPT_INTERRUPT_IN_SERVICE
 	jz		SHORT ReturnWrongDPT
 	stc										; Set CF since wanted DPT
