comparison blastem.c @ 345:29d2ca563499

Don't sync the 68K clock to the VDP clock unless the 68K had to wait for the VDP. This unfortunately breaks the direct color DMA demos, but should be more correct overall.
author Mike Pavone <pavone@retrodev.com>
date Sun, 19 May 2013 13:47:47 -0700
parents b46771135442
children aff29d50afd5
comparison
equal deleted inserted replaced
344:b46771135442 345:29d2ca563499
251 //printf("vdp_port write: %X, value: %X, cycle: %d\n", vdp_port, value, context->current_cycle); 251 //printf("vdp_port write: %X, value: %X, cycle: %d\n", vdp_port, value, context->current_cycle);
252 sync_components(context, 0); 252 sync_components(context, 0);
253 vdp_context * v_context = context->video_context; 253 vdp_context * v_context = context->video_context;
254 if (vdp_port < 0x10) { 254 if (vdp_port < 0x10) {
255 int blocked; 255 int blocked;
256 uint32_t before_cycle = v_context->cycles;
256 if (vdp_port < 4) { 257 if (vdp_port < 4) {
257 uint32_t before_cycle = v_context->cycles;
258 while (vdp_data_port_write(v_context, value) < 0) { 258 while (vdp_data_port_write(v_context, value) < 0) {
259 while(v_context->flags & FLAG_DMA_RUN) { 259 while(v_context->flags & FLAG_DMA_RUN) {
260 vdp_run_dma_done(v_context, mclks_per_frame); 260 vdp_run_dma_done(v_context, mclks_per_frame);
261 if (v_context->cycles >= mclks_per_frame) { 261 if (v_context->cycles >= mclks_per_frame) {
262 if (!headless) { 262 if (!headless) {
312 } 312 }
313 } else { 313 } else {
314 printf("Illegal write to HV Counter port %X\n", vdp_port); 314 printf("Illegal write to HV Counter port %X\n", vdp_port);
315 exit(1); 315 exit(1);
316 } 316 }
317 context->current_cycle = v_context->cycles/MCLKS_PER_68K; 317 if (v_context->cycles != before_cycle) {
318 context->current_cycle = v_context->cycles / MCLKS_PER_68K;
319 }
318 } else if (vdp_port < 0x18) { 320 } else if (vdp_port < 0x18) {
319 //TODO: Implement PSG 321 //TODO: Implement PSG
320 } else { 322 } else {
321 //TODO: Implement undocumented test register(s) 323 //TODO: Implement undocumented test register(s)
322 } 324 }