changeset 1884:b5549258b98b

Slightly gross fix for edge case introduced in border cropping change
author Michael Pavone <pavone@retrodev.com>
date Sat, 21 Sep 2019 10:53:51 -0700
parents 9ab5184811ea
children 4178ce857e87
files vdp.c
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/vdp.c	Sat Sep 21 10:48:10 2019 -0700
+++ b/vdp.c	Sat Sep 21 10:53:51 2019 -0700
@@ -303,23 +303,23 @@
 			x -= 128;
 			//printf("Draw Slot %d of %d, Rendering sprite cell from %X to x: %d\n", context->cur_slot, context->sprite_draws, d->address, x);
 			
-			for (; address != ((context->serial_address+4) & 0xFFFF); address++) {
-				if (x >= 0 && x < 320) {
-					if (!(context->linebuf[x] & 0xF)) {
+				for (; address != ((context->serial_address+4) & 0xFFFF); address++) {
+					if (x >= 0 && x < 320) {
+						if (!(context->linebuf[x] & 0xF)) {
 						context->linebuf[x] = (context->vdpmem[address] >> 4) | d->pal_priority;
 					} else if (context->vdpmem[address] >> 4) {
 						context->flags2 |= FLAG2_SPRITE_COLLIDE;
+						}
 					}
-				}
-				x += dir;
-				if (x >= 0 && x < 320) {
-					if (!(context->linebuf[x] & 0xF)) {
+					x += dir;
+					if (x >= 0 && x < 320) {
+						if (!(context->linebuf[x] & 0xF)) {
 						context->linebuf[x] = (context->vdpmem[address] & 0xF)  | d->pal_priority;
 					} else if (context->vdpmem[address] & 0xF) {
 						context->flags2 |= FLAG2_SPRITE_COLLIDE;
+						}
 					}
-				}
-				x += dir;
+					x += dir;
 			}
 		}
 	} else if (context->flags & FLAG_CAN_MASK) {
@@ -2053,6 +2053,8 @@
 		context->h40_lines = 0;
 		context->frame++;
 		context->output_lines = 0;
+	} else if (context->output_lines && context->vcounter < context->inactive_start && context->vcounter > context->output_lines) {	
+		context->output_lines = context->vcounter;
 	}
 	uint32_t output_line = context->vcounter;
 	if (!(context->regs[REG_MODE_2] & BIT_MODE_5)) {