diff options
author | StapleButter <thetotalworm@gmail.com> | 2017-03-23 23:47:55 +0100 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2017-03-23 23:47:55 +0100 |
commit | 4f5eb6caa0ea719f3590fa6a1bd326a7ddd3a175 (patch) | |
tree | cccc9b8dd3811fa13e4f7b5bb4bcc8e19395465d | |
parent | 49314244e1f3923304bc731a691d2c3222f92627 (diff) |
support for tiny EEPROM
-rw-r--r-- | src/ARM.cpp | 5 | ||||
-rw-r--r-- | src/NDSCart.cpp | 40 |
2 files changed, 42 insertions, 3 deletions
diff --git a/src/ARM.cpp b/src/ARM.cpp index f15ce74..a2e0066 100644 --- a/src/ARM.cpp +++ b/src/ARM.cpp @@ -171,8 +171,9 @@ void ARM::JumpTo(u32 addr, bool restorecpsr) else addr &= ~0x1; } - if (addr == 0x0201764C) printf("capture test %d: R1=%08X\n", R[6], R[1]); - if (addr == 0x020175D8) printf("capture test %d: res=%08X\n", R[6], R[0]); + // aging cart debug crap + //if (addr == 0x0201764C) printf("capture test %d: R1=%08X\n", R[6], R[1]); + //if (addr == 0x020175D8) printf("capture test %d: res=%08X\n", R[6], R[0]); if (addr & 0x1) { diff --git a/src/NDSCart.cpp b/src/NDSCart.cpp index 29da046..615390b 100644 --- a/src/NDSCart.cpp +++ b/src/NDSCart.cpp @@ -268,7 +268,45 @@ void Write_Null(u8 val, bool islast) {} void Write_EEPROMTiny(u8 val, bool islast) { - // TODO + switch (CurCmd) + { + case 0x02: + case 0x0A: + if (DataPos < 1) + { + Addr = val; + Data = 0; + } + else + { + SRAM[(Addr & 0xFF) | ((CurCmd==0x0A)?0x100:0)] = val; + Addr++; + } + break; + + case 0x03: + case 0x0B: + if (DataPos < 1) + { + Addr = val; + Data = 0; + } + else + { + Data = SRAM[(Addr & 0xFF) | ((CurCmd==0x0B)?0x100:0)]; + Addr++; + } + break; + + case 0x9F: + Data = 0xFF; + break; + + default: + if (DataPos==0) + printf("unknown tiny EEPROM save command %02X\n", CurCmd); + break; + } } void Write_EEPROM(u8 val, bool islast) |