diff options
author | PsyK0p4T <[email protected]> | 2021-07-09 00:24:21 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2021-07-09 00:24:21 +0200 |
commit | 18128f106325ef35c754d444ffb48f33b9ae682c (patch) | |
tree | e149dc872cc5bbfc9d3734b9abc2d432efad4e78 /Cart_Reader/NGP.ino | |
parent | f61ec0ff6d31a8c2137e7ebe999fe98536fef8d8 (diff) | |
download | cartreader-18128f106325ef35c754d444ffb48f33b9ae682c.tar.gz cartreader-18128f106325ef35c754d444ffb48f33b9ae682c.zip |
Update NGP.ino
4M, 8M, 16M chips support added
RomVersion detection fixed
SystemType detection (NGP Monochrome or NGP Color) added
Diffstat (limited to 'Cart_Reader/NGP.ino')
-rw-r--r-- | Cart_Reader/NGP.ino | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/Cart_Reader/NGP.ino b/Cart_Reader/NGP.ino index 423909c..190935e 100644 --- a/Cart_Reader/NGP.ino +++ b/Cart_Reader/NGP.ino @@ -9,7 +9,8 @@ static const char ngpMenuItem1[] PROGMEM = "Read Rom"; static const char ngpMenuItemReset[] PROGMEM = "Reset"; static const char* const menuOptionsNGP[] PROGMEM = {ngpMenuItem1, ngpMenuItemReset}; -char ngpRomVersion[5]; +char ngpRomVersion[3]; +uint8_t ngpSystemType; void setup_NGP() { // A0 - A7 @@ -51,7 +52,6 @@ void setup_NGP() { } void ngpMenu() { - uint8_t mainMenu; convertPgm(menuOptionsNGP, 2); @@ -94,9 +94,35 @@ bool getCartInfo_NGP() { switch (romSize) { - case 0x2c98: - cartSize = 1048576; - break; + // 4 Mbits + // Toshiba + case 0xab98: + cartSize = 524288; + break; + // Toshiba ? + case 0x4c20: + cartSize = 524288; + break; + + // 8 Mbits + // Toshiba + case 0x2c98: + cartSize = 1048576; + break; + // Samsung + case 0x2cec: + cartSize = 1048576; + break; + + // 16 Mbits + // Toshiba + case 0x2f98: + cartSize = 2097152; + break; + // Samsung + case 0x2fec: + cartSize = 2097152; + break; } // reset to read mode @@ -115,7 +141,8 @@ bool getCartInfo_NGP() { return false; snprintf(cartID, 5, "%02X%02X", readByte_NGP(0x000021), readByte_NGP(0x000020)); - snprintf(ngpRomVersion, 5, "%02X%02X", readByte_NGP(0x000023), readByte_NGP(0x000022)); + snprintf(ngpRomVersion, 3, "%02X", readByte_NGP(0x000022)); + ngpSystemType = readByte_NGP(0x000023); for (uint32_t i = 0; i < 17; i++) romName[i] = readByte_NGP(0x24 + i); @@ -134,13 +161,21 @@ void showCartInfo_NGP() { print_Msg(F("GameID: ")); println_Msg(cartID); - print_Msg(F("Rom Size: ")); - print_Msg((cartSize >> 17)); - println_Msg(F(" Mb")); - print_Msg(F("Version: ")); println_Msg(ngpRomVersion); + print_Msg(F("System: ")); + if (ngpSystemType == 0) + println_Msg("NGPMonochrome"); + else if (ngpSystemType == 16) + println_Msg("NGPColor"); + else + println_Msg("Unknown"); + + print_Msg(F("Rom Size: ")); + print_Msg((cartSize >> 17)); + println_Msg(F(" MB")); + println_Msg(F("")); println_Msg(F("Press Button...")); display_Update(); @@ -195,7 +230,6 @@ void readROM_NGP(char *outPathBuf, size_t bufferSize) { myFile.close(); } - void writeByte_NGP(uint32_t addr, uint8_t data) { PORTF = addr & 0xff; PORTK = (addr >> 8) & 0xff; @@ -240,4 +274,4 @@ uint8_t readByte_NGP(uint32_t addr) { return data; } -#endif
\ No newline at end of file +#endif |