Mercurial > repos > blastem
comparison blastem.c @ 452:608815ab4ff2
Merge
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 01 Sep 2013 14:27:17 -0700 |
parents | b7c3b2d22858 3758bcdae5de |
children | b491df8bdbc0 |
comparison
equal
deleted
inserted
replaced
451:b7c3b2d22858 | 452:608815ab4ff2 |
---|---|
219 gen->ym->current_cycle -= mclks_per_frame; | 219 gen->ym->current_cycle -= mclks_per_frame; |
220 gen->psg->cycles -= mclks_per_frame; | 220 gen->psg->cycles -= mclks_per_frame; |
221 if (gen->ym->write_cycle != CYCLE_NEVER) { | 221 if (gen->ym->write_cycle != CYCLE_NEVER) { |
222 gen->ym->write_cycle = gen->ym->write_cycle >= mclks_per_frame/MCLKS_PER_68K ? gen->ym->write_cycle - mclks_per_frame/MCLKS_PER_68K : 0; | 222 gen->ym->write_cycle = gen->ym->write_cycle >= mclks_per_frame/MCLKS_PER_68K ? gen->ym->write_cycle - mclks_per_frame/MCLKS_PER_68K : 0; |
223 } | 223 } |
224 //printf("reached frame end | 68K Cycles: %d, MCLK Cycles: %d\n", context->current_cycle, mclks); | 224 printf("reached frame end | 68K Cycles: %d, MCLK Cycles: %d\n", context->current_cycle, mclks); |
225 vdp_run_context(v_context, mclks_per_frame); | 225 vdp_run_context(v_context, mclks_per_frame); |
226 | 226 |
227 if (!headless) { | 227 if (!headless) { |
228 break_on_sync |= wait_render_frame(v_context, frame_limit); | 228 break_on_sync |= wait_render_frame(v_context, frame_limit); |
229 } | 229 } |
294 while (vdp_data_port_write(v_context, value) < 0) { | 294 while (vdp_data_port_write(v_context, value) < 0) { |
295 while(v_context->flags & FLAG_DMA_RUN) { | 295 while(v_context->flags & FLAG_DMA_RUN) { |
296 vdp_run_dma_done(v_context, mclks_per_frame); | 296 vdp_run_dma_done(v_context, mclks_per_frame); |
297 if (v_context->cycles >= mclks_per_frame) { | 297 if (v_context->cycles >= mclks_per_frame) { |
298 if (!headless) { | 298 if (!headless) { |
299 printf("reached frame end | 68K Cycles: %d, MCLK Cycles: %d\n", context->current_cycle, v_context->cycles); | |
299 wait_render_frame(v_context, frame_limit); | 300 wait_render_frame(v_context, frame_limit); |
300 } | 301 } |
301 vdp_adjust_cycles(v_context, mclks_per_frame); | 302 vdp_adjust_cycles(v_context, mclks_per_frame); |
302 genesis_context * gen = context->system; | 303 genesis_context * gen = context->system; |
303 io_adjust_cycles(gen->ports, v_context->cycles/MCLKS_PER_68K, mclks_per_frame/MCLKS_PER_68K); | 304 io_adjust_cycles(gen->ports, v_context->cycles/MCLKS_PER_68K, mclks_per_frame/MCLKS_PER_68K); |
311 busack = new_busack; | 312 busack = new_busack; |
312 } | 313 } |
313 } | 314 } |
314 } | 315 } |
315 } | 316 } |
316 context->current_cycle = v_context->cycles / MCLKS_PER_68K; | 317 //context->current_cycle = v_context->cycles / MCLKS_PER_68K; |
317 } | 318 } |
318 } else if(vdp_port < 8) { | 319 } else if(vdp_port < 8) { |
319 blocked = vdp_control_port_write(v_context, value); | 320 blocked = vdp_control_port_write(v_context, value); |
320 if (blocked) { | 321 if (blocked) { |
321 while (blocked) { | 322 while (blocked) { |
353 } else { | 354 } else { |
354 printf("Illegal write to HV Counter port %X\n", vdp_port); | 355 printf("Illegal write to HV Counter port %X\n", vdp_port); |
355 exit(1); | 356 exit(1); |
356 } | 357 } |
357 if (v_context->cycles != before_cycle) { | 358 if (v_context->cycles != before_cycle) { |
359 printf("68K paused for %d cycles at cycle %d\n", v_context->cycles / MCLKS_PER_68K - context->current_cycle, context->current_cycle); | |
358 context->current_cycle = v_context->cycles / MCLKS_PER_68K; | 360 context->current_cycle = v_context->cycles / MCLKS_PER_68K; |
359 } | 361 } |
360 } else if (vdp_port < 0x18) { | 362 } else if (vdp_port < 0x18) { |
361 genesis_context * gen = context->system; | 363 genesis_context * gen = context->system; |
362 sync_sound(gen, context->current_cycle * MCLKS_PER_68K); | 364 sync_sound(gen, context->current_cycle * MCLKS_PER_68K); |