From 2cf8ea7b570ce1ad35caf297b5927c1c06b3cc42 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 6 Nov 2022 19:00:34 +0200 Subject: [PATCH] Reading non-existing register fix --- custom.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/custom.cpp b/custom.cpp index 8b72c8c1..e0ad5d65 100644 --- a/custom.cpp +++ b/custom.cpp @@ -13727,8 +13727,9 @@ writeonly: // - if last cycle was DMA cycle: DMA cycle data // - if last cycle was not DMA cycle: FFFF or some ANDed old data. // - c = cycle_line_slot[hpos] & CYCLE_MASK; - bmdma = bitplane_dma_access(hpos, 0); + int hp = (hpos - 1) % maxhpos; + c = cycle_line_slot[hp] & CYCLE_MASK; + bmdma = bitplane_dma_access(hp, 0); if (aga_mode) { if (bmdma || (c > CYCLE_REFRESH && c < CYCLE_CPU)) { v = regs.chipset_latch_rw; -- 2.47.3