Mercurial > repos > blastem
comparison blastem.c @ 344:b46771135442
Handle busack across frame boundary
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 19 May 2013 11:38:15 -0700 |
parents | 467bfa17004a |
children | 29d2ca563499 |
comparison
equal
deleted
inserted
replaced
343:467bfa17004a | 344:b46771135442 |
---|---|
206 frame++; | 206 frame++; |
207 mclks -= mclks_per_frame; | 207 mclks -= mclks_per_frame; |
208 vdp_adjust_cycles(v_context, mclks_per_frame); | 208 vdp_adjust_cycles(v_context, mclks_per_frame); |
209 io_adjust_cycles(&gamepad_1, context->current_cycle, mclks_per_frame/MCLKS_PER_68K); | 209 io_adjust_cycles(&gamepad_1, context->current_cycle, mclks_per_frame/MCLKS_PER_68K); |
210 io_adjust_cycles(&gamepad_2, context->current_cycle, mclks_per_frame/MCLKS_PER_68K); | 210 io_adjust_cycles(&gamepad_2, context->current_cycle, mclks_per_frame/MCLKS_PER_68K); |
211 if (busack_cycle != CYCLE_NEVER) { | |
212 if (busack_cycle > mclks_per_frame/MCLKS_PER_68K) { | |
213 busack_cycle -= mclks_per_frame/MCLKS_PER_68K; | |
214 } else { | |
215 busack_cycle = CYCLE_NEVER; | |
216 busack = new_busack; | |
217 } | |
218 } | |
211 context->current_cycle -= mclks_per_frame/MCLKS_PER_68K; | 219 context->current_cycle -= mclks_per_frame/MCLKS_PER_68K; |
212 if (z_context->current_cycle >= mclks_per_frame/MCLKS_PER_Z80) { | 220 if (z_context->current_cycle >= mclks_per_frame/MCLKS_PER_Z80) { |
213 z_context->current_cycle -= mclks_per_frame/MCLKS_PER_Z80; | 221 z_context->current_cycle -= mclks_per_frame/MCLKS_PER_Z80; |
214 } else { | 222 } else { |
215 z_context->current_cycle = 0; | 223 z_context->current_cycle = 0; |
255 wait_render_frame(v_context, frame_limit); | 263 wait_render_frame(v_context, frame_limit); |
256 } | 264 } |
257 vdp_adjust_cycles(v_context, mclks_per_frame); | 265 vdp_adjust_cycles(v_context, mclks_per_frame); |
258 io_adjust_cycles(&gamepad_1, v_context->cycles/MCLKS_PER_68K, mclks_per_frame/MCLKS_PER_68K); | 266 io_adjust_cycles(&gamepad_1, v_context->cycles/MCLKS_PER_68K, mclks_per_frame/MCLKS_PER_68K); |
259 io_adjust_cycles(&gamepad_2, v_context->cycles/MCLKS_PER_68K, mclks_per_frame/MCLKS_PER_68K); | 267 io_adjust_cycles(&gamepad_2, v_context->cycles/MCLKS_PER_68K, mclks_per_frame/MCLKS_PER_68K); |
268 if (busack_cycle != CYCLE_NEVER) { | |
269 if (busack_cycle > mclks_per_frame/MCLKS_PER_68K) { | |
270 busack_cycle -= mclks_per_frame/MCLKS_PER_68K; | |
271 } else { | |
272 busack_cycle = CYCLE_NEVER; | |
273 busack = new_busack; | |
274 } | |
275 } | |
260 } | 276 } |
261 } | 277 } |
262 context->current_cycle = v_context->cycles / MCLKS_PER_68K; | 278 context->current_cycle = v_context->cycles / MCLKS_PER_68K; |
263 } | 279 } |
264 } else if(vdp_port < 8) { | 280 } else if(vdp_port < 8) { |
272 wait_render_frame(v_context, frame_limit); | 288 wait_render_frame(v_context, frame_limit); |
273 } | 289 } |
274 vdp_adjust_cycles(v_context, mclks_per_frame); | 290 vdp_adjust_cycles(v_context, mclks_per_frame); |
275 io_adjust_cycles(&gamepad_1, v_context->cycles/MCLKS_PER_68K, mclks_per_frame/MCLKS_PER_68K); | 291 io_adjust_cycles(&gamepad_1, v_context->cycles/MCLKS_PER_68K, mclks_per_frame/MCLKS_PER_68K); |
276 io_adjust_cycles(&gamepad_2, v_context->cycles/MCLKS_PER_68K, mclks_per_frame/MCLKS_PER_68K); | 292 io_adjust_cycles(&gamepad_2, v_context->cycles/MCLKS_PER_68K, mclks_per_frame/MCLKS_PER_68K); |
293 if (busack_cycle != CYCLE_NEVER) { | |
294 if (busack_cycle > mclks_per_frame/MCLKS_PER_68K) { | |
295 busack_cycle -= mclks_per_frame/MCLKS_PER_68K; | |
296 } else { | |
297 busack_cycle = CYCLE_NEVER; | |
298 busack = new_busack; | |
299 } | |
300 } | |
277 } | 301 } |
278 } | 302 } |
279 if (blocked < 0) { | 303 if (blocked < 0) { |
280 blocked = vdp_control_port_write(v_context, value); | 304 blocked = vdp_control_port_write(v_context, value); |
281 } else { | 305 } else { |