changeset 1342:4ea094d15cce

Fix border rendering so that the first and last line of display are consistently drawn
author Michael Pavone <pavone@retrodev.com>
date Thu, 04 May 2017 22:14:12 -0700
parents f1607874dbee
children 033dda2d4598
files vdp.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/vdp.c	Thu May 04 21:06:35 2017 -0700
+++ b/vdp.c	Thu May 04 22:14:12 2017 -0700
@@ -2635,11 +2635,18 @@
 	}
 	uint32_t *dst = (
 		context->vcounter < context->inactive_start + context->border_bot 
-		|| context->vcounter > 0x200 - context->border_top
+		|| context->vcounter >= 0x200 - context->border_top
 	) && context->hslot >= BG_START_SLOT && context->hslot < bg_end_slot
 		? context->output + 2 * (context->hslot - BG_START_SLOT)
 		: NULL;
 		
+	if (
+		!dst && context->vcounter == context->inactive_start + context->border_bot
+		&& context->hslot >= line_change  && context->hslot < bg_end_slot
+	) {
+		dst = context->output + 2 * (context->hslot - BG_START_SLOT);
+	}
+		
 	uint8_t test_layer = context->test_port >> 7 & 3;
 	if (test_layer == 1) {
 		//sprite layer doesn't do anything interesting in the passive area
@@ -2652,7 +2659,7 @@
 	{
 		if (context->hslot == BG_START_SLOT && !test_layer && (
 			context->vcounter < context->inactive_start + context->border_bot 
-			|| context->vcounter > 0x200 - context->border_top
+			|| context->vcounter >= 0x200 - context->border_top
 		)) {
 			dst = context->output + (context->hslot - BG_START_SLOT) * 2;
 		} else if (context->hslot == bg_end_slot) {