From 66e153d3195de332bc045466b079ebd33b1ec0ec Mon Sep 17 00:00:00 2001 From: Michael Singer Date: Fri, 23 Aug 2024 14:40:22 +0200 Subject: [PATCH] GBM: Fix some comments and unused function --- Cart_Reader/GBM.ino | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Cart_Reader/GBM.ino b/Cart_Reader/GBM.ino index f376706..0790539 100644 --- a/Cart_Reader/GBM.ino +++ b/Cart_Reader/GBM.ino @@ -403,13 +403,13 @@ void send_GBM(byte myCommand) { break; case 0x04: - //CMD_04h -> Map entire flashrom (MBC4 mode) + //CMD_04h -> Disable mapping; makes the entire flash and SRAM accessible writeByte_GBM(0x0120, 0x04); writeByte_GBM(0x013F, 0xA5); break; case 0x05: - //CMD_05h -> Map menu (MBC5 mode) + //CMD_05h -> Enable mapping; re-enables the mapping that was previously selected by 0xCn writeByte_GBM(0x0120, 0x05); writeByte_GBM(0x013F, 0xA5); break; @@ -479,8 +479,14 @@ void switchGame_GBM(byte myData) { // Enable ports 0x0120 (F2) send_GBM(0x09); + // Enable mapping. Mapping must be enabled before the C0 cmd, otherwise switching has no effect. + send_GBM(0x05); + //CMD_C0h -> map selected game without reset - writeByte_GBM(0x0120, 0xC0 & myData); + // C0 is the menu or a single 1MB sized game + // C1 is the first game entry + // C2 is the second game entry... + writeByte_GBM(0x0120, 0xC0 | myData); writeByte_GBM(0x013F, 0xA5); } @@ -918,4 +924,4 @@ void writeMapping_GBM() { //****************************************** // End of File -//****************************************** \ No newline at end of file +//******************************************