From: Toni Wilen Date: Sat, 16 Jul 2022 14:16:21 +0000 (+0300) Subject: Programmed mode positiong update, use hblank for centering. X-Git-Tag: 41000~193 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=d71242aa08d3649e76b21f55cfb109a8174c77ad;p=francis%2Fwinuae.git Programmed mode positiong update, use hblank for centering. --- diff --git a/custom.cpp b/custom.cpp index 0fda92a8..66514849 100644 --- a/custom.cpp +++ b/custom.cpp @@ -1313,7 +1313,7 @@ static void decide_hdiw(int hpos) return; } int start_diw_hpos = ((last_diw_hpos * 2 - DDF_OFFSET + 1) << 2) + 3; - int end_diw_hpos = ((hpos2 * 2 + 1) << 2) + 3; + int end_diw_hpos = ((hpos * 2 + 1) << 2) + 3; // should handle wrap around.. if (start_diw_hpos < ((1 << 2) + 3)) { start_diw_hpos = (1 << 2) + 3; @@ -5816,7 +5816,7 @@ void compute_vsynctime(void) void getsyncregisters(uae_u16 *phsstrt, uae_u16 *phsstop, uae_u16 *pvsstrt, uae_u16 *pvsstop) { *phsstrt = hsstrt; - *phsstop = hsstop_detect; + *phsstop = hsstop_detect * 2; *pvsstrt = vsstrt; *pvsstop = vsstop; } @@ -5967,9 +5967,9 @@ static void updateextblk(void) } hsyncendpos = hsstop; - hsstop_detect2 = hsstrt + 21; - if (hsstop_detect2 >= maxhpos) { - hsstop_detect2 -= maxhpos; + hsstop_detect2 = (hsstrt + 21) * 2; + if (hsstop_detect2 >= maxhpos * 2) { + hsstop_detect2 -= maxhpos * 2; } hsyncendpos2 = hsstop_detect2; @@ -5997,7 +5997,7 @@ static void updateextblk(void) hsyncstartpos = hsyncstartpos_hw; hsyncendpos2 = hsyncendpos = hsyncendpos_hw; denisehtotal = 227 + 7; - hsstop_detect2 = 35 + 9; + hsstop_detect2 = (35 + 9) * 2; } @@ -6427,31 +6427,39 @@ static void init_hz(bool checkvposw) // assume VGA-like monitor if VARBEAMEN if (currprefs.gfx_overscanmode >= OVERSCANMODE_ULTRA) { maxhpos_display = maxhpos; - hsstop_detect = 8; + hsstop_detect = 8 * 2; maxvpos_display_vsync += 2; - } else if (currprefs.gfx_overscanmode >= OVERSCANMODE_EXTREME) { - maxhpos_display = maxhpos - 2; - hsstop_detect = 18; - maxvpos_display_vsync += 2; - } else if (currprefs.gfx_overscanmode == OVERSCANMODE_BROADCAST) { - maxhpos_display = maxhpos - 10; - hsstop_detect = 22; - maxvpos_display_vsync++; } else { + int hp2 = maxhpos * 2; if (exthblank) { + int hb = 0; - int hbstrtx = hbstrt & 0xff; - int hbstopx = hbstop & 0xff; - if (hbstrtx > maxhpos / 2 && hbstopx < maxhpos / 2) { - hb = (maxhpos - hbstrtx) + hbstopx; - } else if (hbstopx < maxhpos / 2 && hbstrtx < hbstopx) { + int hbstrtx = (hbstrt & 0xff) * 2; + int hbstopx = (hbstop & 0xff) * 2; + if (aga_mode) { + hbstrtx |= (hbstrt & 0x400) ? 1 : 0; + hbstopx |= (hbstop & 0x400) ? 1 : 0; + } + if (hbstrtx > hp2) { + hbstrtx = hp2; + } + if (hbstopx > hp2) { + hbstopx = hp2; + } + if (hbstrtx > hp2 / 2 && hbstopx < hp2 / 2) { + hb = (hp2 - hbstrtx) + hbstopx; + } else if (hbstopx < hp2 / 2 && hbstrtx < hbstopx) { hb = hbstopx - hbstrtx; } - if (hb < 4) { - hb = 4; + if (hbstopx > hp2 / 2) { + hbstopx = 0; + } + if (hb < 0) { + hb = 0; } - maxhpos_display = maxhpos - (hb - 2); - int hsadj = 10; + +#if 0 + // HSYNC adjustment int hsz = 0; if (hsstrt > maxhpos / 2 && hsstop > hsstrt) { hsz = hsstop - hsstrt; @@ -6460,19 +6468,35 @@ static void init_hz(bool checkvposw) } else if (hsstop < maxhpos / 2 && hsstrt < hsstop) { hsz = hsstop - hsstrt; } - if (hsz >= 12) { - hsadj = 15; - } - hsstop_detect = (hbstopx - (hsstrt - hsadj)); +#endif + maxhpos_display = maxhpos - (hb / 2); + hsstop_detect = hbstopx; + } else { - maxhpos_display = maxhpos - 15; - hsstop_detect = 15; + + // hardwired + int hbstrtx = 7 * 2; + int hbstopx = 46 * 2; + int hb = hbstopx - hbstrtx; + maxhpos_display = maxhpos - (hb / 2); + hsstop_detect = 46 * 2 - 2; + } + + if (currprefs.gfx_overscanmode >= OVERSCANMODE_EXTREME) { + int diff = (maxhpos - 2) - maxhpos_display; + if (diff > 0) { + hsstop_detect -= (diff / 2) * 2; + } + maxhpos_display = maxhpos - 2; + maxvpos_display_vsync += 2; + } else if (currprefs.gfx_overscanmode == OVERSCANMODE_BROADCAST) { + maxhpos_display += EXTRAWIDTH_BROADCAST; + hsstop_detect--; + maxvpos_display_vsync++; } + } maxhpos_display *= 2; - if (currprefs.gfx_overscanmode < OVERSCANMODE_ULTRA && hsstop_detect2 > hsstop_detect + 5) { - hsstop_detect = hsstop_detect2; - } } else { diff --git a/drawing.cpp b/drawing.cpp index c455f8cf..851c235b 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -3918,7 +3918,7 @@ static void center_image (void) } else if (ew == -1) { // wide mode - int hs = hsync_end_left_border * 2; + int hs = hsync_end_left_border; visible_left_border = hs << currprefs.gfx_resolution; if (visible_left_border + w > maxdiw) { visible_left_border += (maxdiw - (visible_left_border + w) - 1) / 2; @@ -4094,7 +4094,7 @@ static void init_drawing_frame (void) struct wh *dst = currprefs.gfx_apmode[0].gfx_fullscreen ? &changed_prefs.gfx_monitor[0].gfx_size_fs : &changed_prefs.gfx_monitor[0].gfx_size_win; while (m < 3 * 2) { struct wh *src = currprefs.gfx_apmode[0].gfx_fullscreen ? &currprefs.gfx_monitor[0].gfx_size_fs_xtra[m] : &currprefs.gfx_monitor[0].gfx_size_win_xtra[m]; - if ((src->width > 0 && src->height > 0) || (currprefs.gfx_api || currprefs.gf[0].gfx_filter > 0)) { + if (src->width > 0 && src->height > 0) { int nr = m >> 1; int nl = (m & 1) == 0 ? 0 : 1; int nr_o = nr; diff --git a/include/custom.h b/include/custom.h index 2ef6a75f..6f1f1e79 100644 --- a/include/custom.h +++ b/include/custom.h @@ -117,7 +117,7 @@ extern uae_u16 INTREQR(void); #define MAXVPOS 312 #else #define MAXHPOS 256 -#define MAXVPOS 592 +#define MAXVPOS 800 #endif /* PAL/NTSC values */ diff --git a/include/drawing.h b/include/drawing.h index d27bf79a..20ab9a5a 100644 --- a/include/drawing.h +++ b/include/drawing.h @@ -286,7 +286,7 @@ extern uae_u16 spixels[MAX_SPR_PIXELS * 2]; #endif /* Way too much... */ -#define MAX_REG_CHANGE ((MAXVPOS + MAXVPOS_WRAPLINES) * 2 * MAXHPOS) +#define MAX_REG_CHANGE ((MAXVPOS + MAXVPOS_WRAPLINES) * 2 * MAXHPOS / 2) extern struct color_entry *curr_color_tables, *prev_color_tables;