Mercurial > repos > blastem
comparison genesis.c @ 1902:32a3aa7b4a45
Fix YM2612 busy flag timing
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 24 Feb 2020 20:06:29 -0800 |
parents | 5433252329fb |
children | 8312e574100a |
comparison
equal
deleted
inserted
replaced
1901:5433252329fb | 1902:32a3aa7b4a45 |
---|---|
401 if (gen->mapper_type == MAPPER_JCART) { | 401 if (gen->mapper_type == MAPPER_JCART) { |
402 jcart_adjust_cycles(gen, deduction); | 402 jcart_adjust_cycles(gen, deduction); |
403 } | 403 } |
404 context->current_cycle -= deduction; | 404 context->current_cycle -= deduction; |
405 z80_adjust_cycles(z_context, deduction); | 405 z80_adjust_cycles(z_context, deduction); |
406 gen->ym->current_cycle -= deduction; | 406 ym_adjust_cycles(gen->ym, deduction); |
407 gen->psg->cycles -= deduction; | 407 gen->psg->cycles -= deduction; |
408 if (gen->ym->write_cycle != CYCLE_NEVER) { | |
409 gen->ym->write_cycle = gen->ym->write_cycle >= deduction ? gen->ym->write_cycle - deduction : 0; | |
410 } | |
411 if (gen->reset_cycle != CYCLE_NEVER) { | 408 if (gen->reset_cycle != CYCLE_NEVER) { |
412 gen->reset_cycle -= deduction; | 409 gen->reset_cycle -= deduction; |
413 } | 410 } |
414 } | 411 } |
415 } | 412 } |
876 location &= 0x7FFF; | 873 location &= 0x7FFF; |
877 if (location < 0x4000) { | 874 if (location < 0x4000) { |
878 value = gen->zram[location & 0x1FFF]; | 875 value = gen->zram[location & 0x1FFF]; |
879 } else if (location < 0x6000) { | 876 } else if (location < 0x6000) { |
880 sync_sound(gen, context->current_cycle); | 877 sync_sound(gen, context->current_cycle); |
881 value = ym_read_status(gen->ym); | 878 value = ym_read_status(gen->ym, context->current_cycle); |
882 } else { | 879 } else { |
883 value = 0xFF; | 880 value = 0xFF; |
884 } | 881 } |
885 } else { | 882 } else { |
886 value = 0xFF; | 883 value = 0xFF; |
989 static uint8_t z80_read_ym(uint32_t location, void * vcontext) | 986 static uint8_t z80_read_ym(uint32_t location, void * vcontext) |
990 { | 987 { |
991 z80_context * context = vcontext; | 988 z80_context * context = vcontext; |
992 genesis_context * gen = context->system; | 989 genesis_context * gen = context->system; |
993 sync_sound(gen, context->Z80_CYCLE); | 990 sync_sound(gen, context->Z80_CYCLE); |
994 return ym_read_status(gen->ym); | 991 return ym_read_status(gen->ym, context->Z80_CYCLE); |
995 } | 992 } |
996 | 993 |
997 static uint8_t z80_read_bank(uint32_t location, void * vcontext) | 994 static uint8_t z80_read_bank(uint32_t location, void * vcontext) |
998 { | 995 { |
999 z80_context * context = vcontext; | 996 z80_context * context = vcontext; |