Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm	(revision 266)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm	(revision 267)
@@ -19,5 +19,5 @@
 	call	AccessDPT_GetDeviceControlByteToAL
 	or		al, FLG_DEVCONTROL_SRST | FLG_DEVCONTROL_nIEN	; Set Reset bit
-	OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER DEVICE_CONTROL_REGISTER_out
+	OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER		DEVICE_CONTROL_REGISTER_out
 	mov		ax, HSR0_RESET_WAIT_US
 	call	Timer_DelayMicrosecondsFromAX
@@ -27,5 +27,5 @@
 	or		al, FLG_DEVCONTROL_nIEN
 	and		al, ~FLG_DEVCONTROL_SRST						; Clear reset bit
-	OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER DEVICE_CONTROL_REGISTER_out
+	OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER		DEVICE_CONTROL_REGISTER_out
 	mov		ax, HSR1_RESET_WAIT_US
 	call	Timer_DelayMicrosecondsFromAX
@@ -122,9 +122,9 @@
 .DoNotSetInterruptInServiceFlag:
 %endif
-	OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER DEVICE_CONTROL_REGISTER_out
+	OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER		DEVICE_CONTROL_REGISTER_out
 
 	; Output Feature Number
 	mov		al, [bp+IDEPACK.bFeatures]
-	OUTPUT_AL_TO_IDE_REGISTER FEATURES_REGISTER_out
+	OUTPUT_AL_TO_IDE_REGISTER	FEATURES_REGISTER_out
 
 	; Output Sector Address High (only used by LBA48)
@@ -140,5 +140,5 @@
 	; Output command
 	mov		al, [bp+IDEPACK.bCommand]
-	OUTPUT_AL_TO_IDE_REGISTER COMMAND_REGISTER_out
+	OUTPUT_AL_TO_IDE_REGISTER	COMMAND_REGISTER_out
 
 	; Wait until command completed
@@ -182,5 +182,5 @@
 	; Select Master or Slave Drive
 	mov		al, [bp+IDEPACK.bDrvAndHead]
-	OUTPUT_AL_TO_IDE_REGISTER DRIVE_AND_HEAD_SELECT_REGISTER
+	OUTPUT_AL_TO_IDE_REGISTER	DRIVE_AND_HEAD_SELECT_REGISTER
 	mov		bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY)
 	cmp		BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE
@@ -204,12 +204,12 @@
 ALIGN JUMP_ALIGN
 IDEDEVICE%+OutputSectorCountAndAddress:
-	OUTPUT_AL_TO_IDE_REGISTER SECTOR_COUNT_REGISTER
+	OUTPUT_AL_TO_IDE_REGISTER	SECTOR_COUNT_REGISTER
 
 	mov		al, ah
-	OUTPUT_AL_TO_IDE_REGISTER LBA_LOW_REGISTER
+	OUTPUT_AL_TO_IDE_REGISTER	LBA_LOW_REGISTER
 
 	mov		al, cl
-	OUTPUT_AL_TO_IDE_REGISTER LBA_MIDDLE_REGISTER
+	OUTPUT_AL_TO_IDE_REGISTER	LBA_MIDDLE_REGISTER
 
 	mov		al, ch
-	JUMP_TO_OUTPUT_AL_TO_IDE_REGISTER LBA_HIGH_REGISTER
+	JUMP_TO_OUTPUT_AL_TO_IDE_REGISTER	LBA_HIGH_REGISTER
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeError.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeError.asm	(revision 266)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeError.asm	(revision 267)
@@ -20,5 +20,10 @@
 IDEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL:
 	mov		ah, al			; IDE Status Register to AH
-	INPUT_TO_AL_FROM_IDE_REGISTER ERROR_REGISTER_in
+	INPUT_TO_AL_FROM_IDE_REGISTER	ERROR_REGISTER_in
+
+%ifndef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS	; JR-IDE/ISA
+	jmp		ContinueFromMemIdeError
+%else
+ContinueFromMemIdeError:
 	xchg	al, ah			; Status Register now in AL, Error Register now in AH
 
@@ -30,7 +35,5 @@
 
 	; Fall to GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX
-%ifndef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS	; JR-IDE/ISA
-	jmp		GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX
-%endif
+
 
 ;--------------------------------------------------------------------
@@ -46,5 +49,4 @@
 ;		BX
 ;--------------------------------------------------------------------
-%ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS
 ALIGN JUMP_ALIGN
 GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX:
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeWait.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeWait.asm	(revision 266)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeWait.asm	(revision 267)
@@ -9,5 +9,5 @@
 ;	Parameters:
 ;		DS:DI:	Ptr to DPT (in RAMVARS segment)
-;		SS:BP:	Ptr to IDEPACK or PIOVARS
+;		SS:BP:	Ptr to IDEPACK, PIOVARS or MEMPIOVARS
 ;	Returns:
 ;		AH:		INT 13h Error Code
Index: trunk/XTIDE_Universal_BIOS/Src/Device/MemoryMappedIDE/MemIdeTransfer.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/MemoryMappedIDE/MemIdeTransfer.asm	(revision 266)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/MemoryMappedIDE/MemIdeTransfer.asm	(revision 267)
@@ -70,16 +70,16 @@
 ;--------------------------------------------------------------------
 ReadFromSectorAccessWindow:
-	pop		ds	; CS -> DS
-	mov		di, si
-	mov		si, JRIDE_SECTOR_ACCESS_WINDOW_OFFSET
-
-	call	WaitUntilReadyToTransferNextBlock
-	jc		SHORT ReturnWithMemoryIOtransferErrorInAH
-
-	mov		cx, [bp+PIOVARS.wWordsInBlock]
+	pop		ds		; CS -> DS
+	mov		di, si	; ES:DI = destination
+	mov		si, JRIDE_SECTOR_ACCESS_WINDOW_OFFSET	; DS:SI = source
+
+	call	WaitUntilReadyToTransferNextBlock
+	jc		SHORT ReturnWithMemoryIOtransferErrorInAH
+
+	mov		cx, [bp+MEMPIOVARS.wWordsInBlock]
 
 ALIGN JUMP_ALIGN
 .ReadNextBlockFromDrive:
-	cmp		[bp+PIOVARS.wWordsLeft], cx
+	cmp		[bp+MEMPIOVARS.wWordsLeft], cx
 	jbe		SHORT .ReadLastBlockFromDrive
 	call	ReadSingleBlockFromSectorAccessWindowInDSSItoESDI
@@ -88,12 +88,12 @@
 
 	; Increment number of successfully read WORDs
-	mov		cx, [bp+PIOVARS.wWordsInBlock]
-	sub		[bp+PIOVARS.wWordsLeft], cx
-	add		[bp+PIOVARS.wWordsDone], cx
+	mov		cx, [bp+MEMPIOVARS.wWordsInBlock]
+	sub		[bp+MEMPIOVARS.wWordsLeft], cx
+	add		[bp+MEMPIOVARS.wWordsDone], cx
 	jmp		SHORT .ReadNextBlockFromDrive
 
 ALIGN JUMP_ALIGN
 .ReadLastBlockFromDrive:
-	mov		ch, [bp+PIOVARS.wWordsLeft+1]		; Sectors left
+	mov		ch, [bp+MEMPIOVARS.wWordsLeft+1]	; Sectors left
 	call	ReadSingleBlockFromSectorAccessWindowInDSSItoESDI
 
@@ -107,7 +107,7 @@
 ReturnWithMemoryIOtransferErrorInAH:
 	lds		di, [bp+MEMPIOVARS.fpDPT]			; DPT now in DS:DI
-	mov		cx, [bp+PIOVARS.wWordsDone]
+	mov		cx, [bp+MEMPIOVARS.wWordsDone]
 	jc		SHORT .ConvertTransferredWordsInCXtoSectors
-	add		cx, [bp+PIOVARS.wWordsLeft]			; Never sets CF
+	add		cx, [bp+MEMPIOVARS.wWordsLeft]		; Never sets CF
 .ConvertTransferredWordsInCXtoSectors:
 	xchg	cl, ch
@@ -141,9 +141,9 @@
 	jc		SHORT ReturnWithMemoryIOtransferErrorInAH
 
-	mov		cx, [bp+PIOVARS.wWordsInBlock]
+	mov		cx, [bp+MEMPIOVARS.wWordsInBlock]
 
 ALIGN JUMP_ALIGN
 .WriteNextBlockToDrive:
-	cmp		[bp+PIOVARS.wWordsLeft], cx
+	cmp		[bp+MEMPIOVARS.wWordsLeft], cx
 	jbe		SHORT .WriteLastBlockToDrive
 	call	WriteSingleBlockFromDSSIToSectorAccessWindowInESDI
@@ -152,12 +152,12 @@
 
 	; Increment number of successfully written WORDs
-	mov		cx, [bp+PIOVARS.wWordsInBlock]
-	sub		[bp+PIOVARS.wWordsLeft], cx
-	add		[bp+PIOVARS.wWordsDone], cx
+	mov		cx, [bp+MEMPIOVARS.wWordsInBlock]
+	sub		[bp+MEMPIOVARS.wWordsLeft], cx
+	add		[bp+MEMPIOVARS.wWordsDone], cx
 	jmp		SHORT .WriteNextBlockToDrive
 
 ALIGN JUMP_ALIGN
 .WriteLastBlockToDrive:
-	mov		ch, [bp+PIOVARS.wWordsLeft+1]		; Sectors left
+	mov		ch, [bp+MEMPIOVARS.wWordsLeft+1]		; Sectors left
 	ePUSH_T	bx, CheckErrorsAfterTransferringLastMemoryMappedBlock
 	; Fall to WriteSingleBlockFromDSSIToSectorAccessWindowInESDI
