Skip to content

Commit 1b37868

Browse files
committed
Fix 16K EEPROM reads and writes
1 parent fef5986 commit 1b37868

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/virtualdisk.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void* buf,
543543
}
544544
} else if (cluster == EEPROMFLIP_CLUSTER_START) {
545545
uint32_t address = (((uint32_t)cluster - (EEPROMFLIP_CLUSTER_START)) * CLUSTER_SIZE) + (cluster_offset * SECTOR_SIZE);
546-
ReadEepromData(address / 64, buf);
546+
ReadEepromData(address / 8, buf);
547547
} else if (cluster >= FLASHRAMFLIP_CLUSTER_START) {
548548
// Read SRAM/FRAM -- check if the cart responds to Flashram info request first, if not treat as SRAM.
549549
// Also support Dezaemon's banked SRAM.
@@ -589,7 +589,7 @@ int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void* buf,
589589

590590
} else if (cluster == EEPROM_CLUSTER_START) {
591591
uint32_t address = (((uint32_t)cluster - (FLASHRAM_CLUSTER_START)) * CLUSTER_SIZE) + (cluster_offset * SECTOR_SIZE);
592-
ReadEepromData(address / 64, buf);
592+
ReadEepromData(address / 8, buf);
593593
}
594594
}
595595
}
@@ -649,7 +649,7 @@ int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t*
649649
return 512; // Not writable.
650650
} else if (cluster == EEPROMFLIP_CLUSTER_START) {
651651
uint32_t address = (((uint32_t)cluster - (EEPROMFLIP_CLUSTER_START)) * CLUSTER_SIZE) + (cluster_offset * SECTOR_SIZE);
652-
WriteEepromData(address / 64, buffer);
652+
WriteEepromData(address / 8, buffer);
653653
} else if ((cluster >= FLASHRAMFLIP_CLUSTER_START) && (cluster < FLASHRAMFLIP_CLUSTER_START + 4)) {
654654
// Read SRAM/FRAM -- check if the cart responds to Flashram info request first, if not treat as SRAM.
655655
// Also support Dezaemon's banked SRAM.
@@ -679,7 +679,7 @@ int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t*
679679

680680
} else if (cluster == EEPROM_CLUSTER_START) {
681681
uint32_t address = (((uint32_t)cluster - (FLASHRAM_CLUSTER_START)) * CLUSTER_SIZE) + (cluster_offset * SECTOR_SIZE);
682-
WriteEepromData(address / 64, buffer);
682+
WriteEepromData(address / 8, buffer);
683683
}
684684
}
685685
}

0 commit comments

Comments
 (0)