From: Toni Wilen Date: Sat, 9 Jan 2021 14:56:48 +0000 (+0200) Subject: Blitter+copper wakeup fix. X-Git-Tag: 4900~218 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=516a81611affe7af05cace9f23ecf7e6f63af681;p=francis%2Fwinuae.git Blitter+copper wakeup fix. --- diff --git a/blitter.cpp b/blitter.cpp index cddcc334..716254c3 100644 --- a/blitter.cpp +++ b/blitter.cpp @@ -1237,8 +1237,13 @@ bool decide_blitter_maybe_write(int hpos, uaecptr addr, uae_u16 value) return false; } + if (hpos < 0) { + hpos = maxhpos; + } + if (!blt_info.blit_main && !blt_info.blit_finald) { - return false; + last_blitter_hpos = hpos; + goto end; } if (log_blitter && blitter_delayed_debug) { @@ -1250,10 +1255,6 @@ bool decide_blitter_maybe_write(int hpos, uaecptr addr, uae_u16 value) return false; } - if (hpos < 0) { - hpos = maxhpos; - } - while (last_blitter_hpos < hpos) { int c = get_current_channel(); @@ -1357,6 +1358,7 @@ bool decide_blitter_maybe_write(int hpos, uaecptr addr, uae_u16 value) last_blitter_hpos++; } +end: reset_channel_mods(); if (hsync) last_blitter_hpos = 0; diff --git a/custom.cpp b/custom.cpp index 00503f70..5890cee1 100644 --- a/custom.cpp +++ b/custom.cpp @@ -7594,39 +7594,22 @@ static void compute_spcflag_copper (int hpos) void blitter_done_notify (int hpos) { + bool nextline = false; + if (cop_state.state != COP_bltwait) return; - cop_state.state = COP_wait; - int hp = current_hpos(); - hp += 3; - hp &= ~1; int vp_wait = vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80); int vp = vpos; - if (hpos >= maxhpos) { - hpos -= maxhpos; - vp++; - } - last_copper_hpos = hp; - cop_state.hpos = hp; - cop_state.vpos = vp; - if (dmaen(DMA_COPPER) && vp_wait >= cop_state.vcmp) { - copper_enabled_thisline = 1; - set_special(SPCFLAG_COPPER); - } else { - unset_special(SPCFLAG_COPPER); - } - return; - vp_wait = vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80); - vp = vpos; - - hpos += 1; + hpos += 3; hpos &= ~1; if (hpos >= maxhpos) { hpos -= maxhpos; vp++; + nextline = true; } + cop_state.hpos = hpos; cop_state.vpos = vp; cop_state.state = COP_wait; @@ -7640,11 +7623,11 @@ void blitter_done_notify (int hpos) record_copper_blitwait(cop_state.ip - 4, hpos, vp); #endif - if (dmaen(DMA_COPPER) && vp_wait >= cop_state.vcmp) { + if (dmaen(DMA_COPPER) && vp_wait >= cop_state.vcmp && !nextline) { copper_enabled_thisline = 1; set_special(SPCFLAG_COPPER); } else { - unset_special (SPCFLAG_COPPER); + unset_special(SPCFLAG_COPPER); } }