From b3a637af75c186c4243f9529aec2ab599c204c70 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Mon, 24 Feb 2020 20:06:29 -0800 Subject: Fix YM2612 busy flag timing --- genesis.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'genesis.c') diff --git a/genesis.c b/genesis.c index ad21944..73a920d 100644 --- a/genesis.c +++ b/genesis.c @@ -403,11 +403,8 @@ m68k_context * sync_components(m68k_context * context, uint32_t address) } context->current_cycle -= deduction; z80_adjust_cycles(z_context, deduction); - gen->ym->current_cycle -= deduction; + ym_adjust_cycles(gen->ym, deduction); gen->psg->cycles -= deduction; - if (gen->ym->write_cycle != CYCLE_NEVER) { - gen->ym->write_cycle = gen->ym->write_cycle >= deduction ? gen->ym->write_cycle - deduction : 0; - } if (gen->reset_cycle != CYCLE_NEVER) { gen->reset_cycle -= deduction; } @@ -878,7 +875,7 @@ static uint8_t io_read(uint32_t location, m68k_context * context) value = gen->zram[location & 0x1FFF]; } else if (location < 0x6000) { sync_sound(gen, context->current_cycle); - value = ym_read_status(gen->ym); + value = ym_read_status(gen->ym, context->current_cycle); } else { value = 0xFF; } @@ -991,7 +988,7 @@ static uint8_t z80_read_ym(uint32_t location, void * vcontext) z80_context * context = vcontext; genesis_context * gen = context->system; sync_sound(gen, context->Z80_CYCLE); - return ym_read_status(gen->ym); + return ym_read_status(gen->ym, context->Z80_CYCLE); } static uint8_t z80_read_bank(uint32_t location, void * vcontext) -- cgit v1.2.3