changeset 1437:da72344af3ff

Fix external v counter when normal resolution interlace mode is active
author Michael Pavone <pavone@retrodev.com>
date Mon, 21 Aug 2017 23:49:56 -0700
parents 40c3be9f1af7
children e2bd03ed3190
files vdp.c
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/vdp.c	Mon Aug 21 23:08:36 2017 -0700
+++ b/vdp.c	Mon Aug 21 23:49:56 2017 -0700
@@ -2957,9 +2957,13 @@
 
 static uint16_t get_ext_vcounter(vdp_context *context)
 {
-	uint16_t line= context->vcounter & 0xFF;
-	if (context->double_res) {
-		line <<= 1;
+	uint16_t line= context->vcounter;
+	if (context->regs[REG_MODE_4] & BIT_INTERLACE) {
+		if (context->double_res) {
+			line <<= 1;
+		} else {
+			line &= 0x1FE;
+		}
 		if (line & 0x100) {
 			line |= 1;
 		}