-
- /* Only increment the current address if we have read both bytes in the current word when in FLASH
- * read mode, or for each byte when in EEPROM read mode */
- if (((CurrentByte & 0x01) && (V2Command == CMD_READ_FLASH_ISP)) || (V2Command == CMD_READ_EEPROM_ISP))
- CurrentAddress++;
+
+ /* EEPROM just increments the address each byte, flash needs to increment on each word and
+ * also check to ensure that a LOAD EXTENDED ADDRESS command is issued each time the extended
+ * address boundary has been crossed */
+ if (V2Command == CMD_READ_EEPROM_ISP)
+ {
+ CurrentAddress++;
+ }
+ else if (CurrentByte & 0x01)
+ {
+ if (!(++CurrentAddress & 0xFFFF))
+ ISPTarget_LoadExtendedAddress();
+ }