diff vdp.c @ 680:4996369f1463

Some small synchronization improvements that do not seem to fix anything
author Michael Pavone <pavone@retrodev.com>
date Sun, 04 Jan 2015 23:05:37 -0800
parents a7971650c04e
children 7f96bd1cb1be
line wrap: on
line diff
--- a/vdp.c	Sun Jan 04 12:25:33 2015 -0800
+++ b/vdp.c	Sun Jan 04 23:05:37 2015 -0800
@@ -1627,7 +1627,7 @@
 					if (!context->double_res) {
 						context->framebuf = context->oddbuf;
 					}
-				}
+					}
 				context->cd &= 0x3C;
 			}
 		} else {
@@ -1892,7 +1892,7 @@
 	return MCLKS_LINE * (lines - 1) + vdp_cycles_next_line(context);
 }
 
-uint32_t vdp_cycles_to_frame_end(vdp_context * context)
+uint32_t vdp_frame_end_line(vdp_context * context)
 {
 	uint32_t frame_end;
 	if (context->flags2 & FLAG2_REGION_PAL) {
@@ -1908,7 +1908,18 @@
 			frame_end = NTSC_INACTIVE_START + 8;
 		}
 	}
-	return context->cycles + vdp_cycles_to_line(context, frame_end);
+	return frame_end;
+}
+
+uint32_t vdp_cycles_to_frame_end(vdp_context * context)
+{
+	return context->cycles + vdp_cycles_to_line(context, vdp_frame_end_line(context));
+}
+
+uint8_t vdp_is_frame_over(vdp_context * context)
+{
+	uint32_t frame_end = vdp_frame_end_line(context);
+	return context->vcounter >= frame_end && context->vcounter < (frame_end + 8);
 }
 
 uint32_t vdp_next_hint(vdp_context * context)