# HG changeset patch # User Michael Pavone # Date 1461460441 25200 # Node ID 34b811ea1e7cb2479a2c6df63dbb36c3b01fbbc1 # Parent 4cbc349a82a9dda1761dab5de173c8f9791c7359 Disable refresh emulation with some ifdefs for now as it currently is not accurate enough to actually improve overall accuracy/compatibility and in fact makes things that work right on real hardware break diff -r 4cbc349a82a9 -r 34b811ea1e7c blastem.c --- a/blastem.c Sat Apr 23 17:34:01 2016 -0700 +++ b/blastem.c Sat Apr 23 18:14:01 2016 -0700 @@ -239,22 +239,29 @@ //printf("Target: %d, YM bufferpos: %d, PSG bufferpos: %d\n", target, gen->ym->buffer_pos, gen->psg->buffer_pos * 2); } +uint32_t last_frame_num; + +//My refresh emulation isn't currently good enough and causes more problems than it solves +#ifdef REFRESH_EMULATION #define REFRESH_INTERVAL 128 #define REFRESH_DELAY 2 -uint32_t last_frame_num; uint32_t last_sync_cycle; uint32_t refresh_counter; +#endif + m68k_context * sync_components(m68k_context * context, uint32_t address) { genesis_context * gen = context->system; vdp_context * v_context = gen->vdp; z80_context * z_context = gen->z80; +#ifdef REFRESH_EMULATION //lame estimation of refresh cycle delay if (!gen->bus_busy) { refresh_counter += context->current_cycle - last_sync_cycle; context->current_cycle += REFRESH_DELAY * MCLKS_PER_68K * (refresh_counter / (MCLKS_PER_68K * REFRESH_INTERVAL)); refresh_counter = refresh_counter % (MCLKS_PER_68K * REFRESH_INTERVAL); } +#endif uint32_t mclks = context->current_cycle; sync_z80(z_context, mclks); @@ -328,7 +335,9 @@ context->sync_cycle = context->current_cycle + 1; } } +#ifdef REFRESH_EMULATION last_sync_cycle = context->current_cycle; +#endif return context; } @@ -388,7 +397,10 @@ } if (v_context->cycles != before_cycle) { //printf("68K paused for %d (%d) cycles at cycle %d (%d) for write\n", v_context->cycles - context->current_cycle, v_context->cycles - before_cycle, context->current_cycle, before_cycle); - last_sync_cycle = context->current_cycle = v_context->cycles; + context->current_cycle = v_context->cycles; +#ifdef REFRESH_EMULATION + last_sync_cycle = context->current_cycle; +#endif //Lock the Z80 out of the bus until the VDP access is complete gen->bus_busy = 1; sync_z80(gen->z80, v_context->cycles); @@ -461,7 +473,10 @@ } if (v_context->cycles != before_cycle) { //printf("68K paused for %d (%d) cycles at cycle %d (%d) for read\n", v_context->cycles - context->current_cycle, v_context->cycles - before_cycle, context->current_cycle, before_cycle); - last_sync_cycle = context->current_cycle = v_context->cycles; + context->current_cycle = v_context->cycles; +#ifdef REFRES_EMULATION + last_sync_cycle = context->current_cycle; +#endif //Lock the Z80 out of the bus until the VDP access is complete genesis_context *gen = context->system; gen->bus_busy = 1;