More correct emulation of manual clocking of channels 1 and 2
This commit is contained in:
parent
71c88323b7
commit
8809d8ac2f
@ -1000,11 +1000,12 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value)
|
|||||||
else {
|
else {
|
||||||
unsigned extra_delay = 0;
|
unsigned extra_delay = 0;
|
||||||
if (gb->model == GB_MODEL_CGB_E /* || gb->model == GB_MODEL_CGB_D */) {
|
if (gb->model == GB_MODEL_CGB_E /* || gb->model == GB_MODEL_CGB_D */) {
|
||||||
if ((!(value & 4) && ((gb->io_registers[reg] & 4) || old_sample_length == 0x3FF)) ||
|
if (!(value & 4) && !(((gb->apu.square_channels[index].sample_countdown - 1) / 2) & 0x400)) {
|
||||||
(old_sample_length == 0x7FF && gb->apu.square_channels[index].sample_length != 0x7FF)) {
|
|
||||||
gb->apu.square_channels[index].current_sample_index++;
|
gb->apu.square_channels[index].current_sample_index++;
|
||||||
gb->apu.square_channels[index].current_sample_index &= 0x7;
|
gb->apu.square_channels[index].current_sample_index &= 0x7;
|
||||||
|
gb->apu.is_active[index] = true;
|
||||||
}
|
}
|
||||||
|
/* Todo: verify with the schematics what's going on in here */
|
||||||
else if (gb->apu.square_channels[index].sample_length == 0x7FF &&
|
else if (gb->apu.square_channels[index].sample_length == 0x7FF &&
|
||||||
old_sample_length != 0x7FF &&
|
old_sample_length != 0x7FF &&
|
||||||
(gb->apu.square_channels[index].current_sample_index & 0x80)) {
|
(gb->apu.square_channels[index].current_sample_index & 0x80)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user