Dump EEPROM to ensure low level memory access is working correctly

This commit is contained in:
2024-09-20 18:03:34 +02:00
parent 29b0ace897
commit 190ecea855
5 changed files with 57 additions and 9 deletions

View File

@@ -21,6 +21,15 @@ int MEM_Write(mem_data_t *in)
return 0;
}
void MEM_Dump(void)
{
// byte rom[1024];
// Info("Dumping EEPROM memory:");
// for (int i = 0; i < 1024; i++) {
// rom[i] = ReadRaw(i);
// }
}
static int WriteRaw(word addr, byte data)
{
// The EEMWE bit determines whether setting EEWE to
@@ -52,6 +61,15 @@ static int WriteRaw(word addr, byte data)
// No interrupts during EEPROM write
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
// The EEPROM Address Registers EEARH and
// EEARL specify the EEPROM address in the
// 1024bytes EEPROM space. The EEPROM data
// bytes are addressed linearly between 0
// and 1023. The initial value of EEAR is
// undefined. A proper value must be written
// before the EEPROM may be accessed.
EEAR = addr;
EEDR = data;