git.y1.nz

SameBoy

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

commit ecace40fb06fa929cd27a22f5853fc2775e18f93
parent a9c337264e783f234252929da3aeae089a1df8e2
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Sat,  2 Jan 2021 18:27:21 +0200

Minor APU bug fix

Diffstat:
MCore/apu.c4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/Core/apu.c b/Core/apu.c @@ -846,6 +846,10 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value) } else { /* Timing quirk: if already active, sound starts 2 (2MHz) ticks earlier.*/ + if (gb->apu.square_channels[index].sample_countdown <= 1) { + gb->apu.square_channels[index].current_sample_index++; + gb->apu.square_channels[index].current_sample_index &= 0x7; + } gb->apu.square_channels[index].sample_countdown = (gb->apu.square_channels[index].sample_length ^ 0x7FF) * 2 + 4 - gb->apu.lf_div; } gb->apu.square_channels[index].current_volume = gb->io_registers[index == GB_SQUARE_1 ? GB_IO_NR12 : GB_IO_NR22] >> 4;

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