# HG changeset patch # User Michael Pavone # Date 1661226199 25200 # Node ID 2f8984ff5c854056cfcd691b5a797bf88fdcf5fd # Parent f11f4399d64bb444a9f80ec9449dde79f565d1e6 Prevent Mode 5 selection when not emulating the Genesis VDP diff -r f11f4399d64b -r 2f8984ff5c85 vdp.c --- 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);