diff options
author | Mike Pavone <pavone@retrodev.com> | 2013-05-19 11:38:15 -0700 |
---|---|---|
committer | Mike Pavone <pavone@retrodev.com> | 2013-05-19 11:38:15 -0700 |
commit | 653a7fbec86098bded803d4a5b255a7c6e39239a (patch) | |
tree | c85ad4a3c2bcbfa5d8235b12d143b48e8edc32be | |
parent | f9358846fe3544430748a623c00b5bb6e6a87e2c (diff) |
Handle busack across frame boundary
-rw-r--r-- | blastem.c | 24 | ||||
-rw-r--r-- | runtime.S | 5 |
2 files changed, 25 insertions, 4 deletions
@@ -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) { @@ -485,11 +485,8 @@ inccycles: jnb do_limit add $4, %eax ret -do_limit: - +do_limit: call handle_cycle_limit - pop %rdi - pop %rcx add $4, %eax ret |