changeset 2510:0a22c1901492

Fix display of window plane in VDP composition viewer
author Michael Pavone <pavone@retrodev.com>
date Tue, 27 Aug 2024 21:27:21 -0700
parents 1102372feaee
children e51b1fc0e37f
files vdp.c
diffstat 1 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/vdp.c	Tue Aug 27 20:52:37 2024 -0700
+++ b/vdp.c	Tue Aug 27 21:27:21 2024 -0700
@@ -2084,6 +2084,35 @@
 			&& line < (context->inactive_start + context->border_bot + context->border_top)
 		) {
 			uint32_t *fb = context->debug_fbs[DEBUG_COMPOSITE] + context->debug_fb_pitch[DEBUG_COMPOSITE] * line / sizeof(uint32_t);
+			if (is_mode_5) {
+				uint32_t left, right;
+				uint16_t top_line, bottom_line;
+				if (context->regs[REG_WINDOW_V] & WINDOW_DOWN) {
+					top_line = ((context->regs[REG_WINDOW_V] & 0x1F) << 3) + context->border_top;
+					bottom_line = context->inactive_start + context->border_top;
+				} else {
+					top_line = context->border_top;
+					bottom_line = ((context->regs[REG_WINDOW_V] & 0x1F) << 3) + context->border_top;
+				}
+				if (line >= top_line && line < bottom_line) {
+					left = 0;
+					right = 320 + BORDER_LEFT + BORDER_RIGHT;
+				} else if (context->regs[REG_WINDOW_H] & WINDOW_RIGHT) {
+					left = (context->regs[REG_WINDOW_H] & 0x1F) * 16 + BORDER_LEFT;
+					right = 320 + BORDER_LEFT + BORDER_RIGHT;
+				} else {
+					left = 0;
+					right = (context->regs[REG_WINDOW_H] & 0x1F) * 16 + BORDER_LEFT;
+				}
+				for (uint32_t i = left; i < right; i++)
+				{
+					uint8_t src = context->layer_debug_buf[i] & DBG_SRC_MASK;
+					if (src == DBG_SRC_A) {
+						context->layer_debug_buf[i] &= ~DBG_SRC_MASK;
+						context->layer_debug_buf[i] |= DBG_SRC_W;
+					}
+				}
+			}
 			for (int i = 0; i < LINEBUF_SIZE; i++)
 			{
 				*(fb++) = context->debugcolors[context->layer_debug_buf[i]];