Skip to content

Commit

Permalink
Merge pull request #1020 from msinger/fix-gbm-comments
Browse files Browse the repository at this point in the history
GBM: Fix some comments and unused function
  • Loading branch information
sanni authored Aug 23, 2024
2 parents 0d60272 + 66e153d commit 612d020
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Cart_Reader/GBM.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -918,4 +924,4 @@ void writeMapping_GBM() {

//******************************************
// End of File
//******************************************
//******************************************

0 comments on commit 612d020

Please sign in to comment.