Skip to content

Commit

Permalink
Revert "Only redirect ROM read of dynamic area to MBC (#20)"
Browse files Browse the repository at this point in the history
This reverts commit 94f99a3.
  • Loading branch information
kremi151 committed Dec 29, 2020
1 parent 94f99a3 commit 39756ba
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions core/source/memory/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,11 @@ case 0x ## x ## 0: case 0x ## x ## 1: case 0x ## x ## 2: case 0x ## x ## 3: case
case 0x ## x ## 6: case 0x ## x ## 7: case 0x ## x ## 8: case 0x ## x ## 9: case 0x ## x ## A: case 0x ## x ## B: \
case 0x ## x ## C: case 0x ## x ## D: case 0x ## x ## E: case 0x ## x ## F

#define FB_MEMORY_CARTRIDGE_FIXED \
#define FB_MEMORY_CARTRIDGE \
FB_MEMORY_NIBBLE_RANGE(0): \
FB_MEMORY_NIBBLE_RANGE(1): \
FB_MEMORY_NIBBLE_RANGE(2): \
FB_MEMORY_NIBBLE_RANGE(3)

#define FB_MEMORY_CARTRIDGE_DYNAMIC \
FB_MEMORY_NIBBLE_RANGE(3): \
FB_MEMORY_NIBBLE_RANGE(4): \
FB_MEMORY_NIBBLE_RANGE(5): \
FB_MEMORY_NIBBLE_RANGE(6): \
Expand Down Expand Up @@ -274,9 +272,7 @@ case 0xFF

u8 Memory::read8BitsAt(memory_address offset) {
switch ((offset >> 8) & 0xff) {
FB_MEMORY_CARTRIDGE_FIXED:
return *(rom + offset);
FB_MEMORY_CARTRIDGE_DYNAMIC:
FB_MEMORY_CARTRIDGE:
return mbc->readFromROMAt(offset, rom);
FB_MEMORY_VRAM:
return ppuMemory.isVRAMAccessibleFromMMU()
Expand Down Expand Up @@ -329,8 +325,7 @@ i8 Memory::readSigned8BitsAt(memory_address offset) {

void Memory::write8BitsTo(memory_address offset, u8 val) {
switch ((offset >> 8) & 0xff) {
FB_MEMORY_CARTRIDGE_FIXED:
FB_MEMORY_CARTRIDGE_DYNAMIC:
FB_MEMORY_CARTRIDGE:
// Writing to read-only area, so we let it intercept by the MBC
mbc->interceptROMWrite(offset, val);
break;
Expand Down

0 comments on commit 39756ba

Please sign in to comment.