changeset 1365:6dd2c3edd0b5

Add a bit of a hack to HINT start cycle to give correct values in my test ROM and further improve prevelance of CRAM dot noise in Outrunners and OD2
author Michael Pavone <pavone@retrodev.com>
date Fri, 19 May 2017 22:07:50 -0700
parents 30123ca5856c
children c74a2f31ae5f
files vdp.c
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/vdp.c	Fri May 19 20:54:04 2017 -0700
+++ b/vdp.c	Fri May 19 22:07:50 2017 -0700
@@ -2086,7 +2086,7 @@
 	SPRITE_RENDER_H40(174)
 	SPRITE_RENDER_H40(175)
 	SPRITE_RENDER_H40(176)
-	SPRITE_RENDER_H40(177)
+	SPRITE_RENDER_H40(177)//End of border?
 	SPRITE_RENDER_H40(178)
 	SPRITE_RENDER_H40(179)
 	SPRITE_RENDER_H40(180)
@@ -3256,13 +3256,18 @@
 	return context->cycles + vdp_cycles_to_line(context, context->inactive_start);
 }
 
+//This gives correct values in my test ROM. Kind of a hack, might be partly
+//due to interrupts getting latched at the end of a "dbi" micro-instruction
+//but that would only account for 28 of the 36 cycles. More hardware testing
+//necessary to determine the cause of the discrepency
+#define HINT_FUDGE 36
 uint32_t vdp_next_hint(vdp_context * context)
 {
 	if (!(context->regs[REG_MODE_1] & BIT_HINT_EN)) {
 		return 0xFFFFFFFF;
 	}
 	if (context->flags2 & FLAG2_HINT_PENDING) {
-		return context->pending_hint_start;
+		return context->pending_hint_start - HINT_FUDGE;
 	}
 	uint32_t hint_line;
 	if (context->state != ACTIVE) {
@@ -3290,7 +3295,7 @@
 			}
 		}
 	}
-	return context->cycles + vdp_cycles_to_line(context, hint_line);
+	return context->cycles + vdp_cycles_to_line(context, hint_line) - HINT_FUDGE;
 }
 
 static uint32_t vdp_next_vint_real(vdp_context * context)