libgambatte/cartridge: allow mapping rom bank0 in more cases/please blargg
blargg seems to be of the opinion that mbc1 allows mapping bank0 via overflow for carts with few rom banks if his tests are anything to go by. I have no way of verifying this, but am changing it because it confuses people when his tests loop forever after succeeding.
This commit is contained in:
parent
4bfa055456
commit
fec81fa302
@ -88,7 +88,7 @@ class Mbc1 : public DefaultMbc {
|
||||
rambank & (rambanks(memptrs) - 1));
|
||||
}
|
||||
|
||||
void setRombank() const { memptrs.setRombank(adjustedRombank(rombank & (rombanks(memptrs) - 1))); }
|
||||
void setRombank() const { memptrs.setRombank(adjustedRombank(rombank) & (rombanks(memptrs) - 1)); }
|
||||
|
||||
public:
|
||||
explicit Mbc1(MemPtrs &memptrs)
|
||||
@ -160,7 +160,7 @@ class Mbc1Multi64 : public Mbc {
|
||||
memptrs.setRombank(adjustedRombank(rb));
|
||||
} else {
|
||||
memptrs.setRombank0(0);
|
||||
memptrs.setRombank(adjustedRombank(rombank & (rombanks(memptrs) - 1)));
|
||||
memptrs.setRombank(adjustedRombank(rombank) & (rombanks(memptrs) - 1));
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,10 +181,9 @@ public:
|
||||
break;
|
||||
case 1:
|
||||
rombank = (rombank & 0x60) | (data & 0x1F);
|
||||
memptrs.setRombank(adjustedRombank(
|
||||
rombank0Mode
|
||||
? toMulti64Rombank(rombank)
|
||||
: rombank & (rombanks(memptrs) - 1)));
|
||||
memptrs.setRombank(rombank0Mode
|
||||
? adjustedRombank(toMulti64Rombank(rombank))
|
||||
: adjustedRombank(rombank) & (rombanks(memptrs) - 1));
|
||||
break;
|
||||
case 2:
|
||||
rombank = (data << 5 & 0x60) | (rombank & 0x1F);
|
||||
@ -395,8 +394,13 @@ class Mbc5 : public DefaultMbc {
|
||||
bool enableRam;
|
||||
|
||||
static unsigned adjustedRombank(const unsigned bank) { return bank ? bank : 1; }
|
||||
void setRambank() const { memptrs.setRambank(enableRam ? MemPtrs::READ_EN | MemPtrs::WRITE_EN : 0, rambank & (rambanks(memptrs) - 1)); }
|
||||
void setRombank() const { memptrs.setRombank(adjustedRombank(rombank & (rombanks(memptrs) - 1))); }
|
||||
|
||||
void setRambank() const {
|
||||
memptrs.setRambank(enableRam ? MemPtrs::READ_EN | MemPtrs::WRITE_EN : 0,
|
||||
rambank & (rambanks(memptrs) - 1));
|
||||
}
|
||||
|
||||
void setRombank() const { memptrs.setRombank(adjustedRombank(rombank) & (rombanks(memptrs) - 1)); }
|
||||
|
||||
public:
|
||||
explicit Mbc5(MemPtrs &memptrs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user