mirror of https://github.com/mgba-emu/mgba.git
GB MBC: Fix MBC2 bit selection
This commit is contained in:
parent
c487b0cf43
commit
1402593855
1
CHANGES
1
CHANGES
|
@ -7,6 +7,7 @@ Emulation fixes:
|
|||
- ARM: Fix STR storing PC after address calculation
|
||||
- GB MBC: Fix MBC1 mode changing behavior
|
||||
- GB MBC: Fix MBC1 RAM enable bit selection
|
||||
- GB MBC: Fix MBC2 bit selection
|
||||
- GB Video: Fix state after skipping BIOS (fixes mgba.io/i/1715 and mgba.io/i/1716)
|
||||
- GBA: Fix timing advancing too quickly in rare cases
|
||||
- GBA BIOS: Implement dummy sound driver calls
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 528 B |
|
@ -1,2 +1,2 @@
|
|||
[testinfo]
|
||||
fail=1
|
||||
skip=360
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 528 B |
|
@ -1,2 +1,2 @@
|
|||
[testinfo]
|
||||
fail=1
|
||||
skip=360
|
||||
|
|
14
src/gb/mbc.c
14
src/gb/mbc.c
|
@ -480,9 +480,9 @@ void _GBMBC2(struct GB* gb, uint16_t address, uint8_t value) {
|
|||
struct GBMemory* memory = &gb->memory;
|
||||
int shift = (address & 1) * 4;
|
||||
int bank = value & 0xF;
|
||||
switch (address >> 13) {
|
||||
switch ((address & 0xC100) >> 8) {
|
||||
case 0x0:
|
||||
switch (value) {
|
||||
switch (value & 0x0F) {
|
||||
case 0:
|
||||
memory->sramAccess = false;
|
||||
break;
|
||||
|
@ -491,7 +491,7 @@ void _GBMBC2(struct GB* gb, uint16_t address, uint8_t value) {
|
|||
break;
|
||||
default:
|
||||
// TODO
|
||||
mLOG(GB_MBC, STUB, "MBC1 unknown value %02X", value);
|
||||
mLOG(GB_MBC, STUB, "MBC2 unknown value %02X", value);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -501,7 +501,10 @@ void _GBMBC2(struct GB* gb, uint16_t address, uint8_t value) {
|
|||
}
|
||||
GBMBCSwitchBank(gb, bank);
|
||||
break;
|
||||
case 0x5:
|
||||
case 0x80:
|
||||
case 0x81:
|
||||
case 0x82:
|
||||
case 0x83:
|
||||
if (!memory->sramAccess) {
|
||||
return;
|
||||
}
|
||||
|
@ -517,6 +520,9 @@ void _GBMBC2(struct GB* gb, uint16_t address, uint8_t value) {
|
|||
}
|
||||
|
||||
static uint8_t _GBMBC2Read(struct GBMemory* memory, uint16_t address) {
|
||||
if (!memory->sramAccess) {
|
||||
return 0xFF;
|
||||
}
|
||||
address &= 0x1FF;
|
||||
int shift = (address & 1) * 4;
|
||||
return (memory->sramBank[(address >> 1)] >> shift) | 0xF0;
|
||||
|
|
Loading…
Reference in New Issue