diff vdp.c @ 720:15d9359fd771

Add some tests for hint timing and fix it properly this time.
author Michael Pavone <pavone@retrodev.com>
date Wed, 20 May 2015 22:27:51 -0700
parents 019d27995e32
children 8f5339961903
line wrap: on
line diff
--- a/vdp.c	Wed May 20 19:05:11 2015 -0700
+++ b/vdp.c	Wed May 20 22:27:51 2015 -0700
@@ -1443,6 +1443,19 @@
 void vdp_advance_line(vdp_context *context)
 {
 	context->vcounter++;
+	context->vcounter &= 0x1FF;
+	if (context->flags2 & FLAG2_REGION_PAL) {
+		if (context->latched_mode & BIT_PAL) {
+			if (context->vcounter == 0x10B) {
+				context->vcounter = 0x1D2;
+			}
+		} else if (context->vcounter == 0x103){
+			context->vcounter = 0x1CA;
+		}
+	} else if (!(context->latched_mode & BIT_PAL) &&  context->vcounter == 0xEB) {
+		context->vcounter = 0x1E5;
+	}
+	
 	if (context->vcounter > (context->latched_mode & BIT_PAL ? PAL_INACTIVE_START : NTSC_INACTIVE_START)) {
 		context->hint_counter = context->regs[REG_HINT];
 	} else if (context->hint_counter) {
@@ -1565,19 +1578,6 @@
 		} else {
 			vdp_advance_line(context);
 		}
-		context->vcounter &= 0x1FF;
-		if (context->flags2 & FLAG2_REGION_PAL) {
-			if (context->latched_mode & BIT_PAL) {
-				if (context->vcounter == 0x10B) {
-					context->vcounter = 0x1D2;
-				}
-			} else if (context->vcounter == 0x103){
-				context->vcounter = 0x1CA;
-			}
-		} else if (!(context->latched_mode & BIT_PAL) &&  context->vcounter == 0xEB) {
-			context->vcounter = 0x1E5;
-		}
-		
 	}
 }