changeset 1639:93518786f882

Implemented left column blank register bit in mode 5
author Michael Pavone <pavone@retrodev.com>
date Thu, 15 Nov 2018 22:21:09 -0800
parents f27142c48567
children 3602f3b20072
files vdp.c
diffstat 1 files changed, 37 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/vdp.c	Wed Nov 14 22:16:35 2018 -0800
+++ b/vdp.c	Thu Nov 15 22:21:09 2018 -0800
@@ -1329,28 +1329,31 @@
 					uint8_t pixel = context->regs[REG_BG_COLOR];
 					uint32_t *colors = context->colors;
 					src = DBG_SRC_BG;
-					if (*plane_b & 0xF) {
-						pixel = *plane_b;
-						src = DBG_SRC_B;
-					}
-					uint8_t intensity = *plane_b & BUF_BIT_PRIORITY;
-					if (*plane_a & 0xF && (*plane_a & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) {
-						pixel = *plane_a;
-						src = a_src;
-					}
-					intensity |= *plane_a & BUF_BIT_PRIORITY;
-					if (*sprite_buf & 0xF && (*sprite_buf & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) {
-						if ((*sprite_buf & 0x3F) == 0x3E) {
-							intensity += BUF_BIT_PRIORITY;
-						} else if ((*sprite_buf & 0x3F) == 0x3F) {
-							intensity = 0;
-						} else {
-							pixel = *sprite_buf;
-							src = DBG_SRC_S;
-							if ((pixel & 0xF) == 0xE) {
-								intensity = BUF_BIT_PRIORITY;
+					uint8_t intensity = 0;
+					if (col || !(context->regs[REG_MODE_1] & BIT_COL0_MASK) || i >= 8) {
+						if (*plane_b & 0xF) {
+							pixel = *plane_b;
+							src = DBG_SRC_B;
+						}
+						intensity = *plane_b & BUF_BIT_PRIORITY;
+						if (*plane_a & 0xF && (*plane_a & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) {
+							pixel = *plane_a;
+							src = a_src;
+						}
+						intensity |= *plane_a & BUF_BIT_PRIORITY;
+						if (*sprite_buf & 0xF && (*sprite_buf & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) {
+							if ((*sprite_buf & 0x3F) == 0x3E) {
+								intensity += BUF_BIT_PRIORITY;
+							} else if ((*sprite_buf & 0x3F) == 0x3F) {
+								intensity = 0;
 							} else {
-								intensity |= pixel & BUF_BIT_PRIORITY;
+								pixel = *sprite_buf;
+								src = DBG_SRC_S;
+								if ((pixel & 0xF) == 0xE) {
+									intensity = BUF_BIT_PRIORITY;
+								} else {
+									intensity |= pixel & BUF_BIT_PRIORITY;
+								}
 							}
 						}
 					}
@@ -1405,17 +1408,19 @@
 					if (output_disabled) {
 						pixel = 0x3F;
 					} else {
-						if (*plane_b & 0xF) {
-							pixel = *plane_b;
-							src = DBG_SRC_B;
-						}
-						if (*plane_a & 0xF && (*plane_a & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) {
-							pixel = *plane_a;
-							src = a_src;
-						}
-						if (*sprite_buf & 0xF && (*sprite_buf & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) {
-							pixel = *sprite_buf;
-							src = DBG_SRC_S;
+						if (col || !(context->regs[REG_MODE_1] & BIT_COL0_MASK) || i >= 8) {
+							if (*plane_b & 0xF) {
+								pixel = *plane_b;
+								src = DBG_SRC_B;
+							}
+							if (*plane_a & 0xF && (*plane_a & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) {
+								pixel = *plane_a;
+								src = a_src;
+							}
+							if (*sprite_buf & 0xF && (*sprite_buf & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) {
+								pixel = *sprite_buf;
+								src = DBG_SRC_S;
+							}
 						}
 					}
 					//TODO: Simulate CRAM corruption from bus fight