Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/EEPROM.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/EEPROM.asm	(revision 567)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/EEPROM.asm	(revision 568)
@@ -159,5 +159,5 @@
 	call	Buffers_IsXtideUniversalBiosSignatureInESDI
 	je		SHORT .RomFound
-	add		bh, 2					; Increment by 8kB
+	add		bx, 80h					; Increment by 2kB (minimum possible distance from the beginning of one option ROM to the next)
 	jnc		SHORT .SegmentLoop		; Loop until segment overflows
 	clc
Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Flash.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Flash.asm	(revision 567)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Flash.asm	(revision 568)
@@ -83,5 +83,5 @@
 
 	push	cx
-	call	.GetSdpCommandFunctionToDXwithFlashvarsInSSBP
+	call	.GetSdpCommandFunctionToAXwithFlashvarsInSSBP
 	mov		cx, [bp+FLASHVARS.wEepromPageSize]
 	mov		si, [bp+FLASHVARS.fpNextSourcePage]
@@ -94,18 +94,18 @@
 
 ;--------------------------------------------------------------------
-; .GetSdpCommandFunctionToDXwithFlashvarsInSSBP
-;	Parameters:
-;		SS:BP:	Ptr to FLASHVARS
-;	Returns:
-;		DX:		Ptr to SDP Command function
+; .GetSdpCommandFunctionToAXwithFlashvarsInSSBP
+;	Parameters:
+;		SS:BP:	Ptr to FLASHVARS
+;	Returns:
+;		AX:		Ptr to SDP Command function
 ;	Corrupts registers:
 ;		BX, SI
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
-.GetSdpCommandFunctionToDXwithFlashvarsInSSBP:
+.GetSdpCommandFunctionToAXwithFlashvarsInSSBP:
 	eMOVZX	bx, [bp+FLASHVARS.bEepromSdpCommand]
 	mov		si, [cs:bx+.rgpSdpCommandToEepromTypeLookupTable]
 	mov		bl, [bp+FLASHVARS.bEepromType]
-	mov		dx, [cs:bx+si]
+	mov		ax, [cs:bx+si]
 	ret
 
@@ -182,13 +182,15 @@
 ;		Nothing
 ;	Corrupts registers:
-;		Nothing
+;		AX
 ;--------------------------------------------------------------------
 %macro DISABLE_SDP 2
-	mov		BYTE [%1], 0AAh
-	mov		BYTE [%2], 55h
-	mov		BYTE [%1], 80h
-	mov		BYTE [%1], 0AAh
-	mov		BYTE [%2], 55h
-	mov		BYTE [%1], 20h
+	mov		ax, 80AAh
+%%Again:
+	mov		[%1], al		; 0AAh
+	shr		al, 1
+	mov		[%2], al		; 55h
+	mov		[%1], ah		; 80h/20h
+	xor		ax, 0A0FFh
+	jns		SHORT %%Again
 %endmacro
 
@@ -215,10 +217,10 @@
 WriteSdpEnableCommandFor2864mod:
 	ENABLE_SDP 155Ch, 0AA3h
-	jmp		ReturnFromSdpCommand
+	jmp		SHORT ReturnFromSdpCommand
 
 ALIGN JUMP_ALIGN
 WriteSdpEnableCommandFor28256or28512:
 	ENABLE_SDP 5555h, 2AAAh
-	jmp		ReturnFromSdpCommand
+	jmp		SHORT ReturnFromSdpCommand
 
 
@@ -241,14 +243,15 @@
 WriteSdpDisableCommandFor28256or28512:
 	DISABLE_SDP 5555h, 2AAAh
-DoNotWriteAnySdpCommand:
-	jmp		SHORT ReturnFromSdpCommand
-
-
-;--------------------------------------------------------------------
-; WriteNextChangedByteFromPageToEeprom
-;	Parameters:
+	jmp		SHORT ReturnFromSdpCommand
+
+DoNotWriteAnySdpCommand EQU ReturnFromSdpCommand
+
+
+;--------------------------------------------------------------------
+; WriteAllChangedBytesFromPageToEeprom
+;	Parameters:
+;		AX:		Offset to SDP command function
+;		BX:		Offset to next destination byte
 ;		CX:		Number of bytes left to write
-;		DX:		Offset to SDP command function
-;		BX:		Offset to next destination byte
 ;		SI:		Offset to next source byte
 ;		ES:DI:	Ptr to next comparison byte
@@ -258,15 +261,15 @@
 ;				Cleared if page written successfully
 ;	Corrupts registers:
-;		AX, BX, CX, SI, DI, DS, ES
+;		AX, BX, CX, DX, SI, DI, DS, ES
 ;--------------------------------------------------------------------
 ALIGN JUMP_ALIGN
 WriteAllChangedBytesFromPageToEeprom:
-	mov		ax, [bp+FLASHVARS.fpNextSourcePage+2]		; AX = Source segment
+	mov		dx, [bp+FLASHVARS.fpNextSourcePage+2]		; DX = Source segment
 	mov		ds, [bp+FLASHVARS.fpNextDestinationPage+2]	; DS = EEPROM segment
 	cli						; Disable interrupts
-	jmp		dx				; Write SDP command (once to the beginning of page)
+	jmp		ax				; Write SDP command (once to the beginning of page)
 ALIGN JUMP_ALIGN
 ReturnFromSdpCommand:
-	mov		ds, ax			; DS:SI now points to source byte
+	mov		ds, dx			; DS:SI now points to source byte
 
 ALIGN JUMP_ALIGN
@@ -278,5 +281,5 @@
 	mov		ds, [bp+FLASHVARS.fpNextDestinationPage+2]	; DS:BX now points to EEPROM
 	mov		[bx], al		; Write byte to EEPROM
-	mov		ds, [bp+FLASHVARS.fpNextSourcePage+2]		; Restore DS
+	mov		ds, dx			; Restore DS
 	mov		[bp+FLASHVARS.wLastOffsetWritten], bx
 	mov		[bp+FLASHVARS.bLastByteWritten], al
Index: trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/FlashMenu.asm
===================================================================
--- trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/FlashMenu.asm	(revision 567)
+++ trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/FlashMenu.asm	(revision 568)
@@ -185,6 +185,6 @@
 	pop		ds
 
-	cmp		word [cs:g_cfgVars+CFGVARS.wEepromSegment], 0
-	jnz		.alreadySet
+	cmp		WORD [cs:g_cfgVars+CFGVARS.wEepromSegment], 0
+	jne		.alreadySet
 
 	push	es
@@ -198,5 +198,5 @@
 	mov		ax, DEFAULT_EEPROM_SEGMENT
 .storeEepromSegment:
-	mov		word [cs:g_cfgVars+CFGVARS.wEepromSegment], ax
+	mov		WORD [cs:g_cfgVars+CFGVARS.wEepromSegment], ax
 
 .alreadySet:
