]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Blitter + copper wait workaround (until copper rewrite)
authorToni Wilen <twilen@winuae.net>
Sat, 23 Jan 2021 12:29:07 +0000 (14:29 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 23 Jan 2021 12:29:07 +0000 (14:29 +0200)
blitter.cpp
custom.cpp

index c7dc8bb2e2022e6bd476fa1f980d69e08fc38145..01c63bca1091de5d62d566089ab5813945e70e74 100644 (file)
@@ -427,7 +427,7 @@ static void blitter_interrupt(int hpos, int done)
        send_interrupt (6, (4 + 1) * CYCLE_UNIT);
        if (debug_dma)
                record_dma_event (DMA_EVENT_BLITIRQ, hpos, vpos);
-       blitter_done_notify(hpos);
+       blitter_done_notify(blitline);
 }
 
 static void blitter_done (int hpos)
@@ -439,7 +439,7 @@ static void blitter_done (int hpos)
        }
        blt_info.blit_finald = 0;
        blitter_interrupt (hpos, 1);
-       blitter_done_notify (hpos);
+       blitter_done_notify(blitline);
        event2_remevent (ev2_blitter);
        unset_special (SPCFLAG_BLTNASTY);
        if (log_blitter & 1)
index 60e352a4a8d5579ed4fbbc56c1d0ca827980d395..cbc28786482967044084dc536384d587e959e3ff 100644 (file)
@@ -7592,23 +7592,16 @@ static void compute_spcflag_copper (int hpos)
        set_special (SPCFLAG_COPPER);
 }
 
-void blitter_done_notify (int hpos)
+static void blitter_done_notify_wakeup(uae_u32 temp)
 {
-       bool nextline = false;
-
        if (cop_state.state != COP_bltwait)
                return;
 
        int vp_wait = vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80);
        int vp = vpos;
 
-       hpos += 3;
+       int hpos = current_hpos() + 1;
        hpos &= ~1;
-       if (hpos >= maxhpos) {
-               hpos -= maxhpos;
-               vp++;
-               nextline = true;
-       }
 
        cop_state.hpos = hpos;
        cop_state.vpos = vp;
@@ -7623,7 +7616,7 @@ 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 && !nextline) {
+       if (dmaen(DMA_COPPER) && vp_wait >= cop_state.vcmp) {
                copper_enabled_thisline = 1;
                set_special(SPCFLAG_COPPER);
        } else {
@@ -7631,6 +7624,17 @@ void blitter_done_notify (int hpos)
        }
 }
 
+
+void blitter_done_notify(int blitline)
+{
+       if (cop_state.state != COP_bltwait)
+               return;
+
+       // Blitline check is a hack!
+       // Copper emulation is not correct and new blitter emulation needs this workaround.
+       event2_newevent_xx(-1, (blitline ? 4 : 2) * CYCLE_UNIT, 0, blitter_done_notify_wakeup);
+}
+
 void do_copper (void)
 {
        int hpos = current_hpos ();