mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-27 15:04:15 +01:00
Add support for the Game Boy MBC6 mapper (ROM read)
This commit is contained in:
parent
282f5bc108
commit
38c2262f1c
@ -421,7 +421,7 @@ void showCartInfo_GB() {
|
||||
else if ((romType == 25) || (romType == 26) || (romType == 27) || (romType == 28) || (romType == 29) || (romType == 309))
|
||||
print_Msg(F("MBC5"));
|
||||
else if (romType == 32)
|
||||
print_Msg(F("MBC6 (no support)"));
|
||||
print_Msg(F("MBC6"));
|
||||
else if (romType == 34)
|
||||
print_Msg(F("MBC7"));
|
||||
else if (romType == 252)
|
||||
@ -924,18 +924,28 @@ void readROM_GB() {
|
||||
if (romType == 0x104) {
|
||||
startBank = 0;
|
||||
romBanks >>= 1;
|
||||
endAddress = 0x7FFF;
|
||||
}
|
||||
// MBC6 banks are half size
|
||||
else if (romType == 32) {
|
||||
romBanks <<= 1;
|
||||
endAddress = 0x3FFF;
|
||||
}
|
||||
|
||||
for (word currBank = startBank; currBank < romBanks; currBank++) {
|
||||
// Second bank starts at 0x4000
|
||||
if (currBank > 1) {
|
||||
romAddress = 0x4000;
|
||||
|
||||
// MBC6 banks are half size
|
||||
if (romType == 32) {
|
||||
endAddress = 0x5FFF;
|
||||
}
|
||||
}
|
||||
|
||||
// M161 banks are double size and need mapper reset
|
||||
// Set ROM bank for M161
|
||||
if (romType == 0x104) {
|
||||
romAddress = 0;
|
||||
endAddress = 0x7FFF;
|
||||
PORTH &= ~(1 << 0);
|
||||
delay(50);
|
||||
PORTH |= (1 << 0);
|
||||
@ -953,6 +963,14 @@ void readROM_GB() {
|
||||
}
|
||||
}
|
||||
|
||||
// Set ROM bank for MBC6
|
||||
else if (romType == 32) {
|
||||
writeByte_GB(0x2800, 0);
|
||||
writeByte_GB(0x3800, 0);
|
||||
writeByte_GB(0x2000, currBank);
|
||||
writeByte_GB(0x3000, currBank);
|
||||
}
|
||||
|
||||
// Set ROM bank for TAMA5
|
||||
else if (romType == 0xFD) {
|
||||
writeByteSRAM_GB(0xA001, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user