Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm	(revision 596)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm	(revision 601)
@@ -59,5 +59,6 @@
 
 %ifdef MODULE_8BIT_IDE_ADVANCED
-	je		SHORT .ReverseA0andA3fromRegisterIndexInDX
+	cmp		al, DEVICE_8BIT_XTIDE_REV2_OLIVETTI
+	jbe		SHORT .ReverseA0andA3fromRegisterIndexInDX
 
 	eSHL_IM	dx, 1	; ADP50L and XT-CF
@@ -99,5 +100,4 @@
 IdeIO_OutputALtoIdeControlBlockRegisterInDL:
 	xor		dh, dh	; IDE Register index now in DX
-
 	mov		bl, [di+DPT_ATA.bDevice]
 	cmp		bl, DEVICE_8BIT_XTIDE_REV2
@@ -105,5 +105,6 @@
 
 %ifdef MODULE_8BIT_IDE_ADVANCED
-	je		SHORT .ReverseA0andA3fromRegisterIndexInDX
+	cmp		bl, DEVICE_8BIT_XTIDE_REV2_OLIVETTI
+	jbe		SHORT .ReverseA0andA3fromRegisterIndexInDX
 
 	; At this point remaining controllers (JRIDE, XTCF and ADP50L) all have a control
@@ -154,5 +155,4 @@
 IdeIO_OutputALtoIdeRegisterInDL:
 	xor		dh, dh	; IDE Register index now in DX
-
 	mov		bl, [di+DPT_ATA.bDevice]
 	cmp		bl, DEVICE_8BIT_XTIDE_REV2
@@ -160,5 +160,6 @@
 
 %ifdef MODULE_8BIT_IDE_ADVANCED
-	je		SHORT .ReverseA0andA3fromRegisterIndexInDX
+	cmp		bl, DEVICE_8BIT_XTIDE_REV2_OLIVETTI
+	jbe		SHORT .ReverseA0andA3fromRegisterIndexInDX
 
 	cmp		bl, DEVICE_8BIT_JRIDE_ISA
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdePioBlock.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdePioBlock.asm	(revision 596)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdePioBlock.asm	(revision 601)
@@ -55,4 +55,27 @@
 
 ;--------------------------------------------------------------------
+; IdePioBlock_ReadFromXtideRev2_Olivetti
+;	Parameters:
+;		CX:		Block size in 512 byte sectors
+;		DX:		IDE Data port address
+;		ES:DI:	Normalized ptr to buffer to receive data
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, CX
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+IdePioBlock_ReadFromXtideRev2_Olivetti:
+	UNROLL_SECTORS_IN_CX_TO_OWORDS
+ALIGN JUMP_ALIGN
+.InswLoop:
+	%rep 8	; WORDs
+		XTIDE_MOD_OLIVETTI_INSW
+	%endrep
+	loop	.InswLoop
+	ret
+
+
+;--------------------------------------------------------------------
 ; 8-bit PIO from a single data port.
 ;
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm	(revision 596)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm	(revision 601)
@@ -328,19 +328,20 @@
 ALIGN WORD_ALIGN
 g_rgfnPioRead:
-		dw		IdePioBlock_ReadFrom16bitDataPort	; 0, DEVICE_16BIT_ATA
+		dw		IdePioBlock_ReadFrom16bitDataPort		; 0, DEVICE_16BIT_ATA
 %ifdef MODULE_ADVANCED_ATA
-		dw		IdePioBlock_ReadFrom32bitDataPort	; 1, DEVICE_32BIT_ATA
+		dw		IdePioBlock_ReadFrom32bitDataPort		; 1, DEVICE_32BIT_ATA
 %elifdef MODULE_8BIT_IDE
 		dw		NULL
 %endif ; MODULE_ADVANCED_ATA
 %ifdef MODULE_8BIT_IDE
-		dw		IdePioBlock_ReadFrom8bitDataPort	; 2, DEVICE_8BIT_ATA
-		dw		IdePioBlock_ReadFromXtideRev1		; 3, DEVICE_8BIT_XTIDE_REV1
-		dw		IdePioBlock_ReadFrom16bitDataPort	; 4, DEVICE_8BIT_XTIDE_REV2
+		dw		IdePioBlock_ReadFrom8bitDataPort		; 2, DEVICE_8BIT_ATA
+		dw		IdePioBlock_ReadFromXtideRev1			; 3, DEVICE_8BIT_XTIDE_REV1
+		dw		IdePioBlock_ReadFrom16bitDataPort		; 4, DEVICE_8BIT_XTIDE_REV2
+		dw		IdePioBlock_ReadFromXtideRev2_Olivetti	; 5, DEVICE_8BIT_XTIDE_REV2_OLIVETTI
 %ifdef MODULE_8BIT_IDE_ADVANCED
-		dw		IdePioBlock_ReadFrom8bitDataPort	; 5, DEVICE_8BIT_XTCF_PIO8
-		dw		IdePioBlock_ReadFrom16bitDataPort	; 6, DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD
-		dw		IdePioBlock_ReadFrom16bitDataPort	; 7, DEVICE_8BIT_XTCF_PIO16_WITH_BIU_OFFLOAD
-		dw		IdeDmaBlock_ReadFromXTCF			; 8, DEVICE_8BIT_XTCF_DMA
+		dw		IdePioBlock_ReadFrom8bitDataPort		; 6, DEVICE_8BIT_XTCF_PIO8
+		dw		IdePioBlock_ReadFrom16bitDataPort		; 7, DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD
+		dw		IdePioBlock_ReadFrom16bitDataPort		; 8, DEVICE_8BIT_XTCF_PIO16_WITH_BIU_OFFLOAD
+		dw		IdeDmaBlock_ReadFromXTCF				; 9, DEVICE_8BIT_XTCF_DMA
 %endif ; MODULE_8BIT_IDE_ADVANCED
 %endif ; MODULE_8BIT_IDE
@@ -348,19 +349,20 @@
 
 g_rgfnPioWrite:
-		dw		IdePioBlock_WriteTo16bitDataPort	; 0, DEVICE_16BIT_ATA
+		dw		IdePioBlock_WriteTo16bitDataPort		; 0, DEVICE_16BIT_ATA
 %ifdef MODULE_ADVANCED_ATA
-		dw		IdePioBlock_WriteTo32bitDataPort	; 1, DEVICE_32BIT_ATA
+		dw		IdePioBlock_WriteTo32bitDataPort		; 1, DEVICE_32BIT_ATA
 %elifdef MODULE_8BIT_IDE
 		dw		NULL
 %endif ; MODULE_ADVANCED_ATA
 %ifdef MODULE_8BIT_IDE
-		dw		IdePioBlock_WriteTo8bitDataPort		; 2, DEVICE_8BIT_ATA
-		dw		IdePioBlock_WriteToXtideRev1		; 3, DEVICE_8BIT_XTIDE_REV1
-		dw		IdePioBlock_WriteToXtideRev2		; 4, DEVICE_8BIT_XTIDE_REV2
+		dw		IdePioBlock_WriteTo8bitDataPort			; 2, DEVICE_8BIT_ATA
+		dw		IdePioBlock_WriteToXtideRev1			; 3, DEVICE_8BIT_XTIDE_REV1
+		dw		IdePioBlock_WriteToXtideRev2			; 4, DEVICE_8BIT_XTIDE_REV2
+		dw		IdePioBlock_WriteToXtideRev2			; 5, DEVICE_8BIT_XTIDE_REV2_OLIVETTI
 %ifdef MODULE_8BIT_IDE_ADVANCED
-		dw		IdePioBlock_WriteTo8bitDataPort		; 5, DEVICE_8BIT_XTCF_PIO8
-		dw		IdePioBlock_WriteTo16bitDataPort	; 6, DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD
-		dw		IdePioBlock_WriteTo16bitDataPort	; 7, DEVICE_8BIT_XTCF_PIO16_WITH_BIU_OFFLOAD
-		dw		IdeDmaBlock_WriteToXTCF				; 8, DEVICE_8BIT_XTCF_DMA
+		dw		IdePioBlock_WriteTo8bitDataPort			; 6, DEVICE_8BIT_XTCF_PIO8
+		dw		IdePioBlock_WriteTo16bitDataPort		; 7, DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD
+		dw		IdePioBlock_WriteTo16bitDataPort		; 8, DEVICE_8BIT_XTCF_PIO16_WITH_BIU_OFFLOAD
+		dw		IdeDmaBlock_WriteToXTCF					; 9, DEVICE_8BIT_XTCF_DMA
 %endif ; MODULE_8BIT_IDE_ADVANCED
 %endif ; MODULE_8BIT_IDE
Index: trunk/XTIDE_Universal_BIOS/Src/Device/IDE/JrIdeTransfer.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/IDE/JrIdeTransfer.asm	(revision 596)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/IDE/JrIdeTransfer.asm	(revision 601)
@@ -100,6 +100,6 @@
 	jc		SHORT ReturnWithMemoryIOtransferErrorInAH
 
-	mov		cx, [bp+MEMPIOVARS.wSectorsInBlock]	; Clears CH
-	cmp		[bp+MEMPIOVARS.bSectorsLeft], cl
+	mov		dx, [bp+MEMPIOVARS.wSectorsInBlock]	; Clears DH
+	cmp		[bp+MEMPIOVARS.bSectorsLeft], dl
 	jbe		SHORT .ReadLastBlockFromDrive
 
@@ -119,14 +119,14 @@
 	; transferred, there will be a wait for next block but DRQ is never
 	; set since all is transferred! Then we get timeout error.
-	mov		cx, [bp+MEMPIOVARS.wSectorsInBlock]
-	sub		[bp+MEMPIOVARS.bSectorsLeft], cl
-	add		[bp+MEMPIOVARS.bSectorsDone], cl
-	cmp		[bp+MEMPIOVARS.bSectorsLeft], cl
+	mov		dx, [bp+MEMPIOVARS.wSectorsInBlock]
+	sub		[bp+MEMPIOVARS.bSectorsLeft], dl
+	add		[bp+MEMPIOVARS.bSectorsDone], dl
+	cmp		[bp+MEMPIOVARS.bSectorsLeft], dl
 	ja		SHORT .ReadNextBlockFromDrive
 
 ALIGN JUMP_ALIGN
 .ReadLastBlockFromDrive:
-	mov		cl, [bp+MEMPIOVARS.bSectorsLeft]
-	push	cx
+	mov		dl, [bp+MEMPIOVARS.bSectorsLeft]
+	push	dx
 	call	ReadSingleBlockFromSectorAccessWindowInDSSItoESDI
 
@@ -181,6 +181,6 @@
 	jc		SHORT ReturnWithMemoryIOtransferErrorInAH
 
-	mov		cx, [bp+MEMPIOVARS.wSectorsInBlock]
-	cmp		[bp+MEMPIOVARS.bSectorsLeft], cl
+	mov		dx, [bp+MEMPIOVARS.wSectorsInBlock]
+	cmp		[bp+MEMPIOVARS.bSectorsLeft], dl
 	jbe		SHORT .WriteLastBlockToDrive
 
@@ -192,14 +192,14 @@
 
 	; Increment number of successfully written WORDs
-	mov		cx, [bp+MEMPIOVARS.wSectorsInBlock]
-	sub		[bp+MEMPIOVARS.bSectorsLeft], cl
-	add		[bp+MEMPIOVARS.bSectorsDone], cl
-	cmp		[bp+MEMPIOVARS.bSectorsLeft], cl
+	mov		dx, [bp+MEMPIOVARS.wSectorsInBlock]
+	sub		[bp+MEMPIOVARS.bSectorsLeft], dl
+	add		[bp+MEMPIOVARS.bSectorsDone], dl
+	cmp		[bp+MEMPIOVARS.bSectorsLeft], dl
 	ja		SHORT .WriteNextBlockToDrive
 
 ALIGN JUMP_ALIGN
 .WriteLastBlockToDrive:
-	mov		cl, [bp+MEMPIOVARS.bSectorsLeft]
-	push	cx
+	mov		dl, [bp+MEMPIOVARS.bSectorsLeft]
+	push	dx
 	ePUSH_T	bx, CheckErrorsAfterTransferringLastMemoryMappedBlock
 	; Fall to WriteSingleBlockFromDSSIToSectorAccessWindowInESDI
@@ -208,5 +208,5 @@
 ; WriteSingleBlockFromDSSIToSectorAccessWindowInESDI
 ;	Parameters:
-;		CX:		Number of sectors in block
+;		DX:		Number of sectors in block
 ;		DS:SI:	Normalized ptr to source buffer
 ;		ES:DI:	Ptr to Sector Access Window
@@ -220,5 +220,4 @@
 WriteSingleBlockFromDSSIToSectorAccessWindowInESDI:
 	mov		bx, di
-	mov		dx, cx
 	xor		cx, cx
 ALIGN JUMP_ALIGN
@@ -235,7 +234,7 @@
 ; ReadSingleBlockFromSectorAccessWindowInDSSItoESDI
 ;	Parameters:
-;		CX		Number of sectors in full block or sectors in last partial block
-;		ES:DI:	Normalized ptr to buffer to receive data (destination)
-;		DS:SI:	Ptr to Sector Access Window (source)
+;		DX:		Number of sectors in block
+;		ES:DI:	Normalized ptr to destination buffer
+;		DS:SI:	Ptr to Sector Access Window
 ;	Returns:
 ;		CX, DX:	Zero
@@ -247,5 +246,4 @@
 ReadSingleBlockFromSectorAccessWindowInDSSItoESDI:
 	mov		bx, si
-	mov		dx, cx
 	xor		cx, cx
 ALIGN JUMP_ALIGN
Index: trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm	(revision 596)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm	(revision 601)
@@ -43,44 +43,39 @@
 ALIGN JUMP_ALIGN
 SerialCommand_OutputWithParameters:
+	mov		ah, SerialServer_Command_Read
+	mov		al, [bp+IDEPACK.bCommand]
 
-		mov		ah,SerialServer_Command_Read
-
-		mov		al,[bp+IDEPACK.bCommand]
-
-		cmp		al,20h			; Read Sectors IDE command
-		jz		.readOrWrite
-		inc		ah				; now SerialServer_Protocol_Write
-		cmp		al,30h			; Write Sectors IDE command
-		jz		.readOrWrite
+	cmp		al, 20h							; Read Sectors IDE command
+	je		SHORT .readOrWrite
+	inc		ah								; now SerialServer_Protocol_Write
+	cmp		al, 30h							; Write Sectors IDE command
+	je		SHORT .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
+	xor		ah, ah							;  also clears carry
+	ret
 
 .readOrWrite:
-		mov		[bp+IDEPACK.bFeatures],ah		; store protocol command
+	mov		[bp+IDEPACK.bFeatures], ah		; store protocol command
 %ifdef USE_AT
-		mov		dh, [bp+IDEPACK.bSectorCount]
+	mov		dh, [bp+IDEPACK.bSectorCount]
 %endif
-		call	IdeTransfer_NormalizePointerInESSI
+	call	IdeTransfer_NormalizePointerInESSI
 %ifdef USE_AT
-		jnc		SHORT .PointerNormalizationWasSuccessful
-		xor		cx, cx			; Nothing transferred
-		stc
-		ret
+	jnc		SHORT .PointerNormalizationWasSuccessful
+	xor		cx, cx							; Nothing transferred
+	stc
+	ret
 .PointerNormalizationWasSuccessful:
 %endif
 
-		mov		dx, [di+DPT_SERIAL.wSerialPortAndBaud]
-
+	mov		dx, [di+DPT_SERIAL.wSerialPortAndBaud]
 ; fall through to SerialCommand_FallThroughToSerialServer_SendReceive
 
 ALIGN JUMP_ALIGN
 SerialCommand_FallThroughToSerialServer_SendReceive:
-
 ; fall through to SerialServer_SendReceive
-
 %include "SerialServer.asm"
 
@@ -93,6 +88,6 @@
 ALIGN JUMP_ALIGN
 SerialCommand_ReturnError:
-		stc
-		ret
+	stc
+	ret
 
 ;--------------------------------------------------------------------
@@ -155,47 +150,43 @@
 ;     master scan.
 ;
-		mov		dx,[cs:bp+IDEVARS.wSerialPortAndBaud]
-		xor		ax,ax
+	mov		dx, [cs:bp+IDEVARS.wSerialPortAndBaud]
+	xor		ax, ax
 
-		push	si
-		call	FindDPT_ToDSDIforSerialDevice
-		pop		si
+	push	si
+	call	FindDPT_ToDSDIforSerialDevice
+	pop		si
 %ifdef MODULE_SERIAL_FLOPPY
-		jnc		.founddpt
+	jnc		SHORT .founddpt
 ;
 ; If not found above with FindDPT_ToDSDIforSerialDevice, DI will point to the DPT after the last hard disk DPT
 ; So, if there was a previously found floppy disk, DI will point to that DPT and we use that value for the slave.
 ;
-		cmp		byte [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst], 0
-		jz		.notfounddpt
+	cmp		BYTE [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst], 0
+	je		SHORT .notfounddpt
 .founddpt:
 %else
-		jc		.notfounddpt
+	jc		SHORT .notfounddpt
 %endif
-		mov		ax, [di+DPT_SERIAL.wSerialPortAndBaud]
+	mov		ax, [di+DPT_SERIAL.wSerialPortAndBaud]
 .notfounddpt:
+	test	bh, FLG_DRVNHEAD_DRV
+	jz		SHORT .master
 
-		test	bh, FLG_DRVNHEAD_DRV
-		jz		.master
-
-		test	ax,ax			; Take care of the case that is different between master and slave.
-		jz		SerialCommand_ReturnError
+	test	ax, ax							; Take care of the case that is different between master and slave.
+	jz		SHORT SerialCommand_ReturnError
 
 ; fall-through
 .master:
-		test	dx,dx
-		jnz		.identifyDeviceInDX
+	test	dx, dx
+	jnz		SHORT .identifyDeviceInDX
 
-		xchg	dx, ax			;  move ax to dx (move previously found serial drive to dx, could be zero)
+	xchg	dx, ax							;  move ax to dx (move previously found serial drive to dx, could be zero)
 
 .identifyDeviceInDX:
-
 ; fall through to SerialCommand_FallThroughToSerialServerScan_ScanForServer
 
 ALIGN JUMP_ALIGN
 SerialCommand_FallThroughToSerialServerScan_ScanForServer:
-
 ; fall through to SerialServerScan_ScanForServer
-
 %include "SerialServerScan.asm"
 
@@ -206,3 +197,2 @@
 %endif
 
-
Index: trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm	(revision 596)
+++ trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm	(revision 601)
@@ -33,6 +33,6 @@
 ;--------------------------------------------------------------------
 SerialDPT_Finalize:
-		mov		ax, [es:si+SerialServer_ATA_wPortAndBaud]
-		mov		[di+DPT_SERIAL.wSerialPortAndBaud], ax
+	mov		ax, [es:si+SerialServer_ATA_wPortAndBaud]
+	mov		[di+DPT_SERIAL.wSerialPortAndBaud], ax
 
 ;
@@ -41,9 +41,8 @@
 ; if the floppy support is disabled.
 ;
-		mov		al, [es:si+SerialServer_ATA_wDriveFlags]
-		eSHL_IM	al, 1
-		mov		byte [di+DPT.bFlagsHigh], al
-
-		ret
+	mov		al, [es:si+SerialServer_ATA_wDriveFlags]
+	eSHL_IM	al, 1
+	mov		BYTE [di+DPT.bFlagsHigh], al
+	ret
 
 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
