changeset 2201:2f8984ff5c85

Prevent Mode 5 selection when not emulating the Genesis VDP
author Michael Pavone <pavone@retrodev.com>
date Mon, 22 Aug 2022 20:43:19 -0700
parents f11f4399d64b
children ee6d30c56eeb
files vdp.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/vdp.c	Mon Aug 22 20:19:59 2022 -0700
+++ b/vdp.c	Mon Aug 22 20:43:19 2022 -0700
@@ -3822,9 +3822,12 @@
 				//printf("register %d set to %X\n", reg, value & 0xFF);
 				if (reg == REG_MODE_1 && (value & BIT_HVC_LATCH) && !(context->regs[reg] & BIT_HVC_LATCH)) {
 					vdp_latch_hv(context);
-				}
-				if (reg == REG_BG_COLOR) {
+				} else if (reg == REG_BG_COLOR) {
 					value &= 0x3F;
+				} else if (reg == REG_MODE_2 && context->type != VDP_GENESIS) {
+					// only the Genesis VDP does anything with this bit
+					// so just clear it to prevent Mode 5 selection if we're not emulating that chip
+					value &= ~BIT_MODE_5;
 				}
 				/*if (reg == REG_MODE_4 && ((value ^ context->regs[reg]) & BIT_H40)) {
 					printf("Mode changed from H%d to H%d @ %d, frame: %d\n", context->regs[reg] & BIT_H40 ? 40 : 32, value & BIT_H40 ? 40 : 32, context->cycles, context->frame);