SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit f5965fda2263ab6e15d9a7342d7343d3c91e0b98 parent 3d87c5c92a3bb48d35f909286d224d8268d778a1 Author: Lior Halphon <LIJI32@gmail.com> Date: Mon, 22 Dec 2025 22:46:05 +0200 Handle an edge case more accurately Diffstat:
| M | Core/apu.c | 8 | ++++---- |
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Core/apu.c b/Core/apu.c @@ -1365,10 +1365,6 @@ static void prepare_noise_start(GB_gameboy_t *gb) if ((gb->io_registers[GB_IO_NR43] & 0xf0) == 0x10 && (gb->apu.noise_channel.counter & 1)) { instant_step = true; } - if (gb->apu.noise_channel.did_step_counter) { - gb->apu.noise_channel.counter++; - gb->apu.noise_channel.counter &= 0x3FFF; - } /* TODO: needs further research, the conditions are very odd. What if NR43 changes before stepping? */ if ((gb->io_registers[GB_IO_NR43] & 0xf0) == 0x10 && !gb->apu.noise_channel.did_step_counter) { div_1_glitch = true; @@ -1418,6 +1414,10 @@ static void prepare_noise_start(GB_gameboy_t *gb) else if (divisor > 1 && (!gb->cgb_double_speed || gb->model > GB_MODEL_CGB_C)) { gb->apu.noise_channel.counter_countdown -= 4; } + /* TODO: This quirk seems way too specific */ + else if (divisor == 1 && gb->apu.is_active[GB_NOISE] && !(gb->io_registers[GB_IO_NR43] & 0xf0)) { + gb->apu.noise_channel.counter_countdown -= 4; + } } else if (gb->cgb_double_speed && gb->model <= GB_MODEL_CGB_C) { gb->apu.noise_channel.counter_countdown += 2;
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.