]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Plane count fix update. Blanking updates.
authorToni Wilen <twilen@winuae.net>
Sat, 8 Jan 2022 19:45:44 +0000 (21:45 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 8 Jan 2022 19:45:44 +0000 (21:45 +0200)
custom.cpp
drawing.cpp

index 36e354244f4ef3adaab5e5c0e5e8f30288e5c51d..3ed952010f6a760dd6ca2fbc316c13defe78c127 100644 (file)
@@ -428,7 +428,7 @@ static int last_hdiw;
 static diw_states diwstate, hdiwstate;
 static int diwstate_vpos;
 static int bpl_hstart;
-static bool exthblank, exthblank_state;
+static bool exthblank, exthblank_state, hcenterblank_state;
 static int last_diw_hpos, last_diw_hpos2;
 static int last_recorded_diw_hpos;
 static int last_hblank_start;
@@ -940,34 +940,34 @@ static void record_color_change2(int hpos, int regno, uae_u32 value)
        // HCENTER blanking (ECS Denise only)
        if (hcenter_v2 && vs_state_on && vpos < maxvpos_display_vsync && lof_display) {
                int chpos = pos;
-               if (hcenter_v2_end == 0xffff && hcenter_v2 < chpos && hcenter_v2 >= last_recorded_diw_hpos) {
-                       cc = &curr_color_changes[next_color_change];
-                       cc->linepos = hcenter_v2;
-                       cc->regno = RECORDED_REGISTER_CHANGE_OFFSET + 0x200;
-                       cc->value = 1;
-                       next_color_change++;
-                       cc[1].regno = -1;
-                       last_recorded_diw_hpos = cc->linepos;
-                       hcenter_v2_end = hcenter_v2;
-                       hcenter_v2_end += ((beamcon0 & BEAMCON0_PAL) ? 8 : 9) << CCK_SHRES_SHIFT;
-                       if (hcenter_v2_end >= maxhpos << CCK_SHRES_SHIFT) {
-                               hcenter_v2_end -= maxhpos << CCK_SHRES_SHIFT;
+               if (!hcenterblank_state && hcenter_v2 < chpos && hcenter_v2 >= last_recorded_diw_hpos) {
+                       hcenterblank_state = true;
+                       if ((bplcon0 & 1) && (bplcon3 & 1)) {
+                               cc = &curr_color_changes[next_color_change];
+                               cc->linepos = hcenter_v2;
+                               cc->regno = RECORDED_REGISTER_CHANGE_OFFSET + 0x200;
+                               cc->value = 1;
+                               next_color_change++;
+                               cc[1].regno = -1;
+                               last_recorded_diw_hpos = cc->linepos;
+                               if (debug_dma) {
+                                       record_dma_event(DMA_EVENT_HBS, diw_to_hpos(cc->linepos), vpos);
+                               }
                        }
-                       if (debug_dma) {
-                               record_dma_event(DMA_EVENT_HBS, diw_to_hpos(cc->linepos), vpos);
-                       }
-               }
-               if (!exthblank_state && hcenter_v2_end < chpos && hcenter_v2_end >= last_recorded_diw_hpos) {
-                       cc = &curr_color_changes[next_color_change];
-                       cc->linepos = hcenter_v2_end;
-                       cc->regno = RECORDED_REGISTER_CHANGE_OFFSET + 0x200;
-                       cc->value = 0;
-                       next_color_change++;
-                       cc[1].regno = -1;
-                       last_recorded_diw_hpos = cc->linepos;
-                       hcenter_v2_end = 0xffff;
-                       if (debug_dma) {
-                               record_dma_event(DMA_EVENT_HBE, diw_to_hpos(cc->linepos), vpos);
+               }
+               if (hcenterblank_state && hcenter_v2_end < chpos && hcenter_v2_end >= last_recorded_diw_hpos) {
+                       hcenterblank_state = false;
+                       if ((bplcon0 & 1) && (bplcon3 & 1)) {
+                               cc = &curr_color_changes[next_color_change];
+                               cc->linepos = hcenter_v2_end;
+                               cc->regno = RECORDED_REGISTER_CHANGE_OFFSET + 0x200;
+                               cc->value = 0;
+                               next_color_change++;
+                               cc[1].regno = -1;
+                               last_recorded_diw_hpos = cc->linepos;
+                               if (debug_dma) {
+                                       record_dma_event(DMA_EVENT_HBE, diw_to_hpos(cc->linepos), vpos);
+                               }
                        }
                }
        }
@@ -3573,14 +3573,6 @@ STATIC_INLINE void one_fetch_cycle_0(int hpos, int fm)
                }
        }
 
-       if (bplcon0_planes_changed) {
-               if (!bprun && hpos == last_bpl1dat_hpos) {
-                       flush_display(fm);
-                       toscr_nr_planes_shifter = toscr_nr_planes_shifter_new;
-                       bplcon0_planes_changed = false;
-               }
-       }
-
        fetch_cycle++;
        toscr_nbits += toscr_res2p;
 
@@ -4931,6 +4923,7 @@ static void reset_decisions_hsync_start(void)
        last_bpl1dat_hpos = -1;
        last_bpl1dat_hpos_early = false;
        last_hblank_start = -1;
+       hcenterblank_state = false;
 }
 
 int vsynctimebase_orig;
@@ -5052,24 +5045,29 @@ static void checklacecount(bool lace)
 
 static void set_hcenter(void)
 {
-       if (!aga_mode && ecs_denise && (bplcon0 & 1) && (bplcon3 & 1)) {
+       if (!aga_mode && ecs_denise) {
                if (beamcon0 & (BEAMCON0_VARVSYEN | BEAMCON0_VARCSYEN)) {
                        hcenter_v2 = (hcenter & 0xff) << CCK_SHRES_SHIFT;
                } else {
                        hcenter_v2 = 132 << CCK_SHRES_SHIFT;
                }
+               uae_u16 hc = hcenter_v2;
+               hcenter_v2 -= 3;
+               if (hc >= (1 << CCK_SHRES_SHIFT) && hcenter_v2 < (1 << CCK_SHRES_SHIFT)) {
+                       hcenter_v2 += maxhpos << CCK_SHRES_SHIFT;
+               }
+               hcenter_v2 = adjust_hr(hcenter_v2);
+               if (hcenter_v2 < (1 << CCK_SHRES_SHIFT)) {
+                       hcenter_v2 = 0;
+               }
+               hcenter_v2_end = hcenter_v2;
+               hcenter_v2_end += ((beamcon0 & BEAMCON0_PAL) ? 8 : 9) << CCK_SHRES_SHIFT;
+               if (hcenter_v2_end >= maxhpos << CCK_SHRES_SHIFT) {
+                       hcenter_v2_end -= maxhpos << CCK_SHRES_SHIFT;
+               }
        } else {
                hcenter_v2 = 0;
        }
-       uae_u16 hc = hcenter_v2;
-       hcenter_v2 -= 3;
-       if (hc >= (1 << CCK_SHRES_SHIFT) && hcenter_v2 < (1 << CCK_SHRES_SHIFT)) {
-               hcenter_v2 += maxhpos << CCK_SHRES_SHIFT;
-       }
-       hcenter_v2 = adjust_hr(hcenter_v2);
-       if (hcenter_v2 < (1 << CCK_SHRES_SHIFT)) {
-               hcenter_v2 = 0;
-       }
 }
 
 static void updateextblk(void)
@@ -5625,11 +5623,13 @@ static void init_hz(bool checkvposw)
                } else if (currprefs.gfx_overscanmode == OVERSCANMODE_EXTREME) {
                        maxhpos_display += EXTRAWIDTH_EXTREME;
                        maxvpos_display_vsync += 2;
+                       hsstop_detect -= 4;
                        minfirstline--;
                } else if (currprefs.gfx_overscanmode == OVERSCANMODE_BROADCAST) {
                        maxhpos_display += EXTRAWIDTH_BROADCAST;
                        maxvpos_display_vsync++;
                        minfirstline--;
+                       hsstop_detect -= 1;
                }
        }
 
@@ -5728,8 +5728,8 @@ static void init_hz(bool checkvposw)
        }
 
        if (beamcon0 & (BEAMCON0_VARVSYEN | BEAMCON0_VARCSYEN)) {
-               if (maxvpos_display_vsync >= vsstrt) {
-                       maxvpos_display_vsync = vsstrt;
+               if (maxvpos_display_vsync >= vsstrt + 3) {
+                       maxvpos_display_vsync = vsstrt + 3;
                }
                if (maxvpos_display_vsync < 0) {
                        maxvpos_display_vsync = 0;
@@ -7143,6 +7143,11 @@ static void BPLxDAT_next(uae_u32 vv)
                if (ecs_denise || (!ecs_denise && hpos >= 0x2e)) {
                        beginning_of_plane_block(hpos);
                        bprun_pipeline_flush_delay = maxhpos;
+                       if (bplcon0_planes_changed) {
+                               flush_display(fetchmode);
+                               toscr_nr_planes_shifter = toscr_nr_planes_shifter_new;
+                               bplcon0_planes_changed = false;
+                       }
                }
        }
 }
index ac64f5d9e59af38d05aac0d458df8daf6d30c6ad..ed0952d9d81f248309275027496db1c2b7b7ae9f 100644 (file)
@@ -623,6 +623,11 @@ static void set_hblanking_limits(void)
                hbstrt = (239 << CCK_SHRES_SHIFT) - 3;
                doblank = true;
        }
+
+       if (currprefs.cs_dipagnus && hbstop < (48 << CCK_SHRES_SHIFT) - 3) {
+               hbstop = (48 << CCK_SHRES_SHIFT) - 3;
+       }
+
        if (doblank && programmedmode != 1) {
                // reposition to sync
                // use hardwired hblank emulation as overscan blanking.
@@ -689,8 +694,10 @@ void check_custom_limits(void)
        int bottom = fd->gfx_filter_bottom_border < 0 ? 0 : fd->gfx_filter_bottom_border;
 
        // backwards compatibility, old 0x38 start is gone.
-       left += (0x38 * 4) >> (RES_MAX - currprefs.gfx_resolution);
-       right += (0x38 * 4) >> (RES_MAX - currprefs.gfx_resolution);
+       if (left > 0) {
+               left += (0x38 * 4) >> (RES_MAX - currprefs.gfx_resolution);
+               right += (0x38 * 4) >> (RES_MAX - currprefs.gfx_resolution);
+       }
 
        if (left > visible_left_start)
                visible_left_start = left;
@@ -3308,6 +3315,10 @@ static void do_color_changes(line_draw_func worker_border, line_draw_func worker
        bool vbarea = vp < vblank_top_start || vp >= vblank_bottom_stop;
 
        extborder = false; // reset here because it always have start and end in same scanline
+       if (!ecs_denise) {
+               // used for OCS Denise blanking bug when not ECS Denise or AGA.
+               exthblank = false;
+       }
        for (i = dip_for_drawing->first_color_change; i <= dip_for_drawing->last_color_change; i++) {
                int regno = curr_color_changes[i].regno;
                uae_u32 value = curr_color_changes[i].value;
@@ -3436,9 +3447,9 @@ static void do_color_changes(line_draw_func worker_border, line_draw_func worker
                                        }
                                } else if (value & COLOR_CHANGE_BLANK) {
                                        if (value & 1) {
-                                               hposblank = 1;
+                                               exthblank = true;
                                        } else {
-                                               hposblank = 0;
+                                               exthblank = false;
                                        }
                                } else if (value & COLOR_CHANGE_BRDBLANK) {
                                        colors_for_drawing.extra &= ~(1 << CE_BORDERBLANK);
@@ -3759,9 +3770,6 @@ static void center_image (void)
        } else if (ew == -1) {
                // wide mode
                int hs = hsync_end_left_border * 2;
-               if (currprefs.gfx_overscanmode >= OVERSCANMODE_BROADCAST) {
-                       hs++;
-               }
                visible_left_border = hs << currprefs.gfx_resolution;
                if (visible_left_border + w > maxdiw) {
                        visible_left_border += (maxdiw - (visible_left_border + w) - 1) / 2;