changeset 318:789f2f5f2277

Implement hblank flag in status register
author Mike Pavone <pavone@retrodev.com>
date Fri, 10 May 2013 23:16:06 -0700
parents e5e8b48ad157
children 0bcab0475a7f
files vdp.c
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/vdp.c	Fri May 10 22:57:56 2013 -0700
+++ b/vdp.c	Fri May 10 23:16:06 2013 -0700
@@ -1193,17 +1193,21 @@
 	if (context->flags2 & FLAG2_VINT_PENDING) {
 		value |- 0x80;
 	}
+	uint32_t line= context->cycles / MCLKS_LINE;
+	uint32_t linecyc = context->cycles % MCLKS_LINE;
+	if (line >= (context->latched_mode & BIT_PAL ? PAL_ACTIVE : NTSC_ACTIVE)) {
+		value |= 0x8;
+	}
+	if (linecyc < (context->latched_mode & BIT_H40 ? (148 + 61) * 4 : ( + 46) * 5)) {
+		value |= 0x4;
+	}
 	if (context->flags & FLAG_DMA_RUN) {
 		value |= 0x2;
 	}
-	uint32_t line= context->cycles / MCLKS_LINE;
-	if (line >= (context->latched_mode & BIT_PAL ? PAL_ACTIVE : NTSC_ACTIVE)) {
-		value |= 0x8;
-	}
 	if (context->latched_mode & BIT_PAL) {//Not sure about this, need to verify
 		value |= 0x1;
 	}
-	//TODO: Lots of other bits in status port
+	//TODO: Sprite overflow, sprite collision, odd frame flag
 	return value;
 }