SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 4ab256d896755cb101f3721d7231a5d98f3ee8f5 parent 10d996330ce462295d782047ede53ff37dc2ec3b Author: Lior Halphon <LIJI32@gmail.com> Date: Sat, 29 Jul 2023 16:08:26 +0300 Correct read emulation of the BANK register while still in the boot ROM Diffstat:
| M | Core/gb.h | 2 | +- |
| M | Core/memory.c | 5 | +++-- |
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/Core/gb.h b/Core/gb.h @@ -192,7 +192,7 @@ enum { /* Missing */ GB_IO_VBK = 0x4F, // CGB Mode Only - VRAM Bank - GB_IO_BANK = 0x50, // Write to disable the BIOS mapping + GB_IO_BANK = 0x50, // Write to disable the boot ROM mapping /* CGB DMA */ GB_IO_HDMA1 = 0x51, // CGB Mode Only - New DMA Source, High diff --git a/Core/memory.c b/Core/memory.c @@ -702,7 +702,8 @@ static uint8_t read_high_memory(GB_gameboy_t *gb, uint16_t addr) return 0xFF; } return (gb->io_registers[GB_IO_KEY1] & 0x7F) | (gb->cgb_double_speed? 0xFE : 0x7E); - + case GB_IO_BANK: + return 0xFE | gb->boot_rom_finished; case GB_IO_RP: { if (!gb->cgb_mode) return 0xFF; /* You will read your own IR LED if it's on. */ @@ -1572,7 +1573,7 @@ static void write_high_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value) return; case GB_IO_BANK: - gb->boot_rom_finished = true; + gb->boot_rom_finished |= value & 1; return; case GB_IO_KEY0:
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.