diff options
author | Michael Pavone <pavone@retrodev.com> | 2016-12-27 13:26:14 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2016-12-27 13:26:14 -0800 |
commit | c0fa07690efd3128f971367346466964c2c13191 (patch) | |
tree | 9db3ea31fb9a2333302cc4afda6e7c9aa9541486 /vdp.c | |
parent | 7d80b3446ad2544ce91110b8af83735843024152 (diff) |
Fix inactive start line for Mode 4 in vdp_next_hint. Fix an off by one error in the range of registers allowed to be written in Mode 4
Diffstat (limited to 'vdp.c')
-rw-r--r-- | vdp.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -2180,7 +2180,7 @@ int vdp_control_port_write(vdp_context * context, uint16_t value) if ((value & 0xC000) == 0x8000) { //Register write uint8_t reg = (value >> 8) & 0x1F; - if (reg < (mode_5 ? VDP_REGS : 0xA)) { + if (reg < (mode_5 ? VDP_REGS : 0xB)) { //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)) { context->hv_latch = vdp_hv_counter_read(context); @@ -2535,7 +2535,9 @@ uint32_t vdp_next_hint(vdp_context * context) if (context->flags2 & FLAG2_HINT_PENDING) { return context->pending_hint_start; } - uint32_t inactive_start = context->latched_mode & BIT_PAL ? PAL_INACTIVE_START : NTSC_INACTIVE_START; + uint32_t inactive_start = (context->regs[REG_MODE_2] & BIT_MODE_5) + ? (context->latched_mode & BIT_PAL ? PAL_INACTIVE_START : NTSC_INACTIVE_START) + : MODE4_INACTIVE_START; uint32_t hint_line; if (context->vcounter + context->hint_counter >= inactive_start) { if (context->regs[REG_HINT] > inactive_start) { |