changeset 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
files blastem.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/blastem.c	Sun May 19 11:38:15 2013 -0700
+++ b/blastem.c	Sun May 19 13:47:47 2013 -0700
@@ -253,8 +253,8 @@
 	vdp_context * v_context = context->video_context;
 	if (vdp_port < 0x10) {
 		int blocked;
+		uint32_t before_cycle = v_context->cycles;
 		if (vdp_port < 4) {
-			uint32_t before_cycle = v_context->cycles;
 			while (vdp_data_port_write(v_context, value) < 0) {
 				while(v_context->flags & FLAG_DMA_RUN) {
 					vdp_run_dma_done(v_context, mclks_per_frame);
@@ -314,7 +314,9 @@
 			printf("Illegal write to HV Counter port %X\n", vdp_port);
 			exit(1);
 		}
-		context->current_cycle = v_context->cycles/MCLKS_PER_68K;
+		if (v_context->cycles != before_cycle) {
+			context->current_cycle = v_context->cycles / MCLKS_PER_68K;
+		}
 	} else if (vdp_port < 0x18) {
 		//TODO: Implement PSG
 	} else {