From 653a7fbec86098bded803d4a5b255a7c6e39239a Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Sun, 19 May 2013 11:38:15 -0700 Subject: Handle busack across frame boundary --- blastem.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'blastem.c') diff --git a/blastem.c b/blastem.c index 8ea6b01..49b180c 100644 --- a/blastem.c +++ b/blastem.c @@ -208,6 +208,14 @@ m68k_context * sync_components(m68k_context * context, uint32_t address) vdp_adjust_cycles(v_context, mclks_per_frame); io_adjust_cycles(&gamepad_1, context->current_cycle, mclks_per_frame/MCLKS_PER_68K); io_adjust_cycles(&gamepad_2, context->current_cycle, mclks_per_frame/MCLKS_PER_68K); + if (busack_cycle != CYCLE_NEVER) { + if (busack_cycle > mclks_per_frame/MCLKS_PER_68K) { + busack_cycle -= mclks_per_frame/MCLKS_PER_68K; + } else { + busack_cycle = CYCLE_NEVER; + busack = new_busack; + } + } context->current_cycle -= mclks_per_frame/MCLKS_PER_68K; if (z_context->current_cycle >= mclks_per_frame/MCLKS_PER_Z80) { z_context->current_cycle -= mclks_per_frame/MCLKS_PER_Z80; @@ -257,6 +265,14 @@ m68k_context * vdp_port_write(uint32_t vdp_port, m68k_context * context, uint16_ vdp_adjust_cycles(v_context, mclks_per_frame); io_adjust_cycles(&gamepad_1, v_context->cycles/MCLKS_PER_68K, mclks_per_frame/MCLKS_PER_68K); io_adjust_cycles(&gamepad_2, v_context->cycles/MCLKS_PER_68K, mclks_per_frame/MCLKS_PER_68K); + if (busack_cycle != CYCLE_NEVER) { + if (busack_cycle > mclks_per_frame/MCLKS_PER_68K) { + busack_cycle -= mclks_per_frame/MCLKS_PER_68K; + } else { + busack_cycle = CYCLE_NEVER; + busack = new_busack; + } + } } } context->current_cycle = v_context->cycles / MCLKS_PER_68K; @@ -274,6 +290,14 @@ m68k_context * vdp_port_write(uint32_t vdp_port, m68k_context * context, uint16_ vdp_adjust_cycles(v_context, mclks_per_frame); io_adjust_cycles(&gamepad_1, v_context->cycles/MCLKS_PER_68K, mclks_per_frame/MCLKS_PER_68K); io_adjust_cycles(&gamepad_2, v_context->cycles/MCLKS_PER_68K, mclks_per_frame/MCLKS_PER_68K); + if (busack_cycle != CYCLE_NEVER) { + if (busack_cycle > mclks_per_frame/MCLKS_PER_68K) { + busack_cycle -= mclks_per_frame/MCLKS_PER_68K; + } else { + busack_cycle = CYCLE_NEVER; + busack = new_busack; + } + } } } if (blocked < 0) { -- cgit v1.2.3