]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Denise strobe vblank update
authorToni Wilen <twilen@winuae.net>
Thu, 4 Apr 2024 16:58:21 +0000 (19:58 +0300)
committerToni Wilen <twilen@winuae.net>
Thu, 4 Apr 2024 16:58:21 +0000 (19:58 +0300)
custom.cpp

index 39d0cae38a27b25d1eeb791572709f4341f1fce0..a5c917e96a50bdff1ea480c7ccaf5d9ab0596154 100644 (file)
@@ -382,7 +382,7 @@ static uae_u32 refmask;
 static int refresh_handled_slot;
 static bool refptr_preupdated;
 static bool hstrobe_conflict;
-static uae_u16 last_hstrobe;
+static uae_u16 strobe_vblank;
 static bool vhposw_modified;
 static int line_disabled;
 static bool custom_disabled;
@@ -6306,11 +6306,14 @@ static void reset_decisions_hsync_start(void)
        } else if (ecs_agnus) {
                // Visible vblank end is delayed by 1 line
                thisline_decision.vb = vb_start_line >= 2 + vblank_extraline || vb_end_next_line ? 0 : VB_NOVB;
-               if (hstrobe_conflict && last_hstrobe == 0x3a && thisline_decision.vb) {
+               if (hstrobe_conflict && strobe_vblank && thisline_decision.vb) {
                        thisline_decision.vb = VB_XBLANK;
                }
        } else {
                thisline_decision.vb = vb_start_line >= 2 + vblank_extraline || vb_end_next_line ? 0 : VB_NOVB;
+               if (hstrobe_conflict && strobe_vblank && thisline_decision.vb) {
+                       thisline_decision.vb = VB_XBLANK;
+               }
        }
 
        // if programmed vblank
@@ -14160,7 +14163,13 @@ static void hsync_handler_post(bool onvsync)
                uae_u16 strobe = get_strobe_reg(i);
                if (i == 0) {
                        if (!hstrobe_conflict) {
-                               last_hstrobe = strobe;
+                               if (strobe == 0x38 || (strobe == 0x3a && ecs_denise)) {
+                                       // OCS: only STREQU enables vblank. STREQU and STRVBL if ECS Denise.
+                                       strobe_vblank = 1;
+                               } else if (strobe == 0x3c) {
+                                       // STRHOR disables vblank
+                                       strobe_vblank = 0;
+                               }
                        }
                }
                alloc_cycle(hp, strobe != 0x1fe ? CYCLE_STROBE : CYCLE_REFRESH);
@@ -14544,7 +14553,7 @@ void custom_reset(bool hardreset, bool keyboardreset)
        hdiwstate_blank = diw_states::DIW_waiting_start;
        maxvpos_display_vsync_next = false;
        hstrobe_conflict = false;
-       last_hstrobe = 0;
+       strobe_vblank = 0;
 
        irq_forced_delay = 0;
        irq_forced = 0;
@@ -15181,9 +15190,17 @@ static int REGPARAM2 custom_wput_1 (int hpos, uaecptr addr, uae_u32 value, int n
 #endif
        case 0x034: POTGO(value); break;
 
-       case 0x038: last_hstrobe = 0x38; break;
-       case 0x03a: last_hstrobe = 0x3a; break;
-       case 0x03c: last_hstrobe = 0x3c; break;
+       case 0x038:
+               strobe_vblank = 1;
+               break;
+       case 0x03a:
+               if (ecs_denise) {
+                       strobe_vblank = 1;
+               }
+               break;
+       case 0x03c:
+               strobe_vblank = 0;
+               break;
 
        case 0x040: BLTCON0(hpos, value); break;
        case 0x042: BLTCON1(hpos, value); break;