git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit 803abd9925508c308b3cfc44ac9df8a78227d059
parent 49ec02b3b371e031da32a261cf01112871bf9f1b
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Tue,  4 Jul 2023 23:25:53 +0300

Halt and Stop trigger the OAM bug

Diffstat:
MCore/sm83_cpu.c3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Core/sm83_cpu.c b/Core/sm83_cpu.c @@ -424,6 +424,7 @@ static void leave_stop_mode(GB_gameboy_t *gb) static void stop(GB_gameboy_t *gb, uint8_t opcode) { flush_pending_cycles(gb); + GB_read_memory(gb, gb->pc); // Timing is completely unverified, and only affects STOP triggering the OAM bug if ((gb->io_registers[GB_IO_JOYP] & 0x30) != 0x30) { gb->joyp_accessed = true; } @@ -1071,9 +1072,9 @@ static void cp_a_r(GB_gameboy_t *gb, uint8_t opcode) static void halt(GB_gameboy_t *gb, uint8_t opcode) { + cycle_read(gb, gb->pc); assert(gb->pending_cycles == 4); gb->pending_cycles = 0; - GB_advance_cycles(gb, 4); /* Despite what some online documentations say, the HALT bug also happens on a CGB, in both CGB and DMG modes. */ if (((gb->interrupt_enable & gb->io_registers[GB_IO_IF] & 0x1F) != 0)) {

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.