# HG changeset patch # User Michael Pavone # Date 1446324567 25200 # Node ID 74e161fe7d393a0a32d7e62e4b73feff002c3c97 # Parent 715475788e93e17335c09240574c71b1f90c33b3 Small tweaks to timing of 68K/Z80 interactions based on latest tests diff -r 715475788e93 -r 74e161fe7d39 blastem.c --- a/blastem.c Sat Oct 31 13:24:39 2015 -0700 +++ b/blastem.c Sat Oct 31 13:49:27 2015 -0700 @@ -473,6 +473,8 @@ { genesis_context * gen = context->system; if (location < 0x10000) { + //Access to Z80 memory incurs a one 68K cycle wait state + context->current_cycle += MCLKS_PER_68K; if (!z80_enabled || z80_get_busack(gen->z80, context->current_cycle)) { location &= 0x7FFF; if (location < 0x4000) { @@ -591,6 +593,8 @@ uint8_t value; genesis_context *gen = context->system; if (location < 0x10000) { + //Access to Z80 memory incurs a one 68K cycle wait state + context->current_cycle += MCLKS_PER_68K; if (!z80_enabled || z80_get_busack(gen->z80, context->current_cycle)) { location &= 0x7FFF; if (location < 0x4000) { diff -r 715475788e93 -r 74e161fe7d39 z80_to_x86.c --- a/z80_to_x86.c Sat Oct 31 13:24:39 2015 -0700 +++ b/z80_to_x86.c Sat Oct 31 13:49:27 2015 -0700 @@ -2630,6 +2630,9 @@ z80_run(context, cycle); context->busreq = 0; context->busack = 0; + //there appears to be at least a 1 Z80 cycle delay between busreq + //being released and resumption of execution + context->current_cycle += context->options->gen.clock_divider; } uint8_t z80_get_busack(z80_context * context, uint32_t cycle)