From 6bcdb25304f593893a535294c1daf88350bd9588 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 5 Jan 2025 13:08:32 +0200 Subject: [PATCH 01/15] Fix statefile buffer overflow --- blitter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blitter.cpp b/blitter.cpp index 58154ed3..3f104531 100644 --- a/blitter.cpp +++ b/blitter.cpp @@ -2417,7 +2417,7 @@ uae_u8 *save_blitter(size_t *len, uae_u8 *dstptr, bool newstate) if (dstptr) { dstbak = dst = dstptr; } else { - dstbak = dst = xmalloc(uae_u8, 16); + dstbak = dst = xmalloc(uae_u8, 1000); } if (blt_info.blit_main) { From 9505a14e9ba7ee33259393e80dbebaddcdf74422 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 5 Jan 2025 13:08:50 +0200 Subject: [PATCH 02/15] Fix AGA autoscale --- drawing.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drawing.cpp b/drawing.cpp index 558ae7e6..d90199cb 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -631,13 +631,8 @@ int get_custom_limits (int *pw, int *ph, int *pdx, int *pdy, int *prealh) } int diwfirst, diwlast; - if (aga_mode) { - diwfirst = diwfirstword_total; - diwlast = diwlastword_total; - } else { - diwfirst = diwfirstword_total << 2; - diwlast = diwlastword_total << 2; - } + diwfirst = diwfirstword_total << 2; + diwlast = diwlastword_total << 2; int ddffirst = ddffirstword_total << (RES_MAX + 1); int ddflast = ddflastword_total << (RES_MAX + 1); From e6a3addbb20d02f3a8b206f6331afa61bb31aa5d Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 5 Jan 2025 13:09:26 +0200 Subject: [PATCH 03/15] Fix string formatting. --- od-win32/win32gui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index e2a22f8a..37499dc6 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -9429,10 +9429,10 @@ static INT_PTR CALLBACK ChipsetDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR xSendDlgItemMessage(hDlg, IDC_KEYBOARDMODE, CB_RESETCONTENT, 0, 0); xSendDlgItemMessage(hDlg, IDC_KEYBOARDMODE, CB_ADDSTRING, 0, (LPARAM)_T("Keyboard disconnected")); xSendDlgItemMessage(hDlg, IDC_KEYBOARDMODE, CB_ADDSTRING, 0, (LPARAM)_T("UAE High level emulation")); - _tcscpy(tmp, _T("A500 / A500 + (6570 - 036 MCU)")); + _tcscpy(tmp, _T("A500 / A500+ (6570-036 MCU)")); appendkbmcurom(tmp, has657036); xSendDlgItemMessage(hDlg, IDC_KEYBOARDMODE, CB_ADDSTRING, 0, tmp); - _tcscpy(tmp, _T("A600(6570 - 036 MCU)")); + _tcscpy(tmp, _T("A600 (6570-036 MCU)")); appendkbmcurom(tmp, has657036); xSendDlgItemMessage(hDlg, IDC_KEYBOARDMODE, CB_ADDSTRING, 0, tmp); _tcscpy(tmp, _T("A1000 (6500-1 MCU. ROM not yet dumped)")); From 2242bcbd4f850b10ee75963ab654ba63a99e6d2f Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 5 Jan 2025 13:10:13 +0200 Subject: [PATCH 04/15] Fix AGA 32-bit wide sprite. --- custom.cpp | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/custom.cpp b/custom.cpp index 9d5efd45..4ceb3fcb 100644 --- a/custom.cpp +++ b/custom.cpp @@ -8619,7 +8619,7 @@ static uae_u16 fetch16(struct rgabuf *r) return v; } -static uae_u32 fetch32(struct rgabuf *r) +static uae_u32 fetch32_bpl(struct rgabuf *r) { uae_u32 v; uaecptr p = r->pv; @@ -8644,6 +8644,31 @@ static uae_u32 fetch32(struct rgabuf *r) return v; } +static uae_u32 fetch32_spr(struct rgabuf *r) +{ + uae_u32 v; + uaecptr p = r->pv; + uaecptr pm = p & ~3; + if (p & 2) { + v = chipmem_lget_indirect(pm) & 0x0000ffff; + v |= v << 16; + } else if (fetchmode_fmode_spr & 2) { // optimized (fetchmode_fmode & 3) == 2 + v = chipmem_lget_indirect(pm) & 0xffff0000; + v |= v >> 16; + } else { + v = chipmem_lget_indirect(pm); + } +#ifdef DEBUGGER + if (memwatch_enabled) { + debug_getpeekdma_value_long(v, p - pm); + } + if (debug_dma) { + record_dma_read_value_wide(v, false); + } +#endif + return v; +} + static uae_u64 fetch64(struct rgabuf *r) { uae_u64 v; @@ -10126,7 +10151,7 @@ static void do_scandouble(void) if (fetchmode_fmode_bpl == 3) { rd->v64 = fetch64(&rga); } else if (fetchmode_fmode_bpl > 0) { - rd->v = fetch32(&rga); + rd->v = fetch32_bpl(&rga); } else { rd->v = fetch16(&rga); } @@ -10263,9 +10288,9 @@ static void process_sprites_fast(void) pos = fs->data64[0] >> 48; ctl = fs->data64[1] >> 48; } else if (fetchmode_fmode_spr == 1) { - fs->data[0] = fetch32(&r); + fs->data[0] = fetch32_spr(&r); r.pv += 4; - fs->data[1] = fetch32(&r); + fs->data[1] = fetch32_spr(&r); r.pv += 4; pos = fs->data[0] >> 16; ctl = fs->data[1] >> 16; @@ -11112,7 +11137,7 @@ static void handle_rga_out(void) } sdat = dat; } else if (fetchmode_fmode_spr == 1) { - uae_u32 dat = fetch32(r); + uae_u32 dat = fetch32_spr(r); sdat = dat >> 16; if (!dmastate) { write_drga(r->reg, pt, sdat); @@ -11175,7 +11200,7 @@ static void handle_rga_out(void) write_drga(r->reg, pt, dat); regs.chipset_latch_rw = (uae_u16)dat; } else if (fetchmode_fmode_bpl == 1) { - uae_u32 dat = fetch32(r); + uae_u32 dat = fetch32_bpl(r); write_drga(r->reg, pt, dat); regs.chipset_latch_rw = (uae_u16)dat; } else { From 5c12065d09080aca3931cd1b366edbcccc2be999 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 5 Jan 2025 13:11:21 +0200 Subject: [PATCH 05/15] Hide NTSC artifacts in normal overscan mode --- custom.cpp | 2 +- drawing.cpp | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/custom.cpp b/custom.cpp index 4ceb3fcb..f29e9eca 100644 --- a/custom.cpp +++ b/custom.cpp @@ -1701,7 +1701,7 @@ static void init_beamcon0(void) display_hstart_cyclewait_end = 6; } else if (currprefs.gfx_overscanmode <= OVERSCANMODE_OVERSCAN) { display_hstart_cyclewait = 32; - display_hstart_cyclewait_end = 8; + display_hstart_cyclewait_end = 7; } else if (currprefs.gfx_overscanmode == OVERSCANMODE_EXTREME) { display_hstart_cyclewait = 22; display_hstart_cyclewait_end = 0; diff --git a/drawing.cpp b/drawing.cpp index d90199cb..467f2a19 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -306,7 +306,7 @@ static uae_u32 *buf1, *buf2, *buf_d; static uae_u16 *gbuf; static uae_u8 pixx0, pixx1, pixx2, pixx3; static uae_u32 debug_buf[256 * 2 * 4], debug_bufx[256 * 2 * 4]; - +static uae_u32 *hbstrt_ptr1, *hbstrt_ptr2; void set_inhibit_frame(int monid, int bit) { @@ -3992,6 +3992,8 @@ static uae_u32 denise_render_sprites_ecs_shres(void) static void do_hbstrt(int cnt) { denise_hblank = true; + hbstrt_ptr1 = buf1; + hbstrt_ptr2 = buf2; if (!exthblankon_ecs) { if (delayed_vblank_ecs > 0) { #ifdef DEBUGGER @@ -4814,6 +4816,7 @@ void draw_denise_line(int gfx_ypos, enum nln_how how, uae_u32 linecnt, int start } get_line(gfx_ypos, how); + hbstrt_ptr1 = NULL; if (dtotal < 0 && currprefs.gfx_overscanmode < OVERSCANMODE_ULTRA) { @@ -4873,6 +4876,17 @@ void draw_denise_line(int gfx_ypos, enum nln_how how, uae_u32 linecnt, int start lts_changed = false; } + // blank last pixel row if normal overscan mode, it might have NTSC artifacts + if (hbstrt_ptr1 && currprefs.gfx_overscanmode <= OVERSCANMODE_OVERSCAN) { + int add = 1 << hresolution; + hbstrt_ptr1 -= denise_lol_shift_prev; + hbstrt_ptr2 -= denise_lol_shift_prev; + for (int i = 0; i < add; i++) { + *hbstrt_ptr1++ = 0x000000; + *hbstrt_ptr2++ = 0x000000; + } + } + if (currprefs.display_calibration && xlinebuffer) { emulate_black_level_calibration(buf1t, buf2t, bufdt, total, calib_start, calib_len); } From fd5ac03fc1158260596041c00188eb5a2f9bb55a Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 5 Jan 2025 13:12:38 +0200 Subject: [PATCH 06/15] HAM last color reset was missing. --- drawing.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drawing.cpp b/drawing.cpp index 467f2a19..e50a000e 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -2835,6 +2835,15 @@ static void expand_bplcon0_early(uae_u16 v) } } +static void setlasthamcolor(void) +{ + if (aga_mode) { + ham_lastcolor = denise_colors.color_regs_aga[last_bpl_pix]; + } else { + ham_lastcolor = denise_colors.color_regs_ecs[last_bpl_pix]; + } +} + static void expand_bplcon0(uae_u16 v) { uae_u16 old = bplcon0_denise; @@ -2847,7 +2856,7 @@ static void expand_bplcon0(uae_u16 v) if ((v & 0x800) && !(bplcon0_denise & 0x800)) { - ham_lastcolor = denise_colors.color_regs_ecs[last_bpl_pix]; + setlasthamcolor(); } bplcon0_denise = v; @@ -3171,6 +3180,8 @@ static void hstart_new(void) } sprites_hidden = sprites_hidden2; bplshiftcnt[0] = bplshiftcnt[1] = 0; + last_bpl_pix = 0; + setlasthamcolor(); #ifdef DEBUGGER if (debug_dma) { record_dma_event_denise(debug_dma_ptr, denise_cycle_half, DENISE_EVENT_BPL1DAT_HDIW, false); From 694ed328ee68253864185993eec8f98551bd5fbc Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 5 Jan 2025 13:14:09 +0200 Subject: [PATCH 07/15] Doublescan superhires fix. --- drawing.cpp | 50 ++++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/drawing.cpp b/drawing.cpp index e50a000e..12979469 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -2137,7 +2137,7 @@ static void setup_brdblank(void) { denise_brdstrt_unalign = false; denise_brdstop_unalign = false; - if (aga_mode && currprefs.gfx_resolution == RES_SUPERHIRES && borderblank) { + if (aga_mode && hresolution == RES_SUPERHIRES && borderblank) { denise_brdstrt = denise_hstop - 1; denise_brdstop = denise_hstrt - 1; denise_brdstrt_lores = denise_brdstrt >> 2; @@ -2156,7 +2156,7 @@ static void setup_brdblank(void) static void calchdiw(void) { - int hbmask = (1 << (RES_SUPERHIRES - currprefs.gfx_resolution)) - 1; + int hbmask = (1 << (RES_SUPERHIRES - hresolution)) - 1; denise_hstrt = (denise_diwstrt & 0xFF) << 2; denise_hstop = (denise_diwstop & 0xFF) << 2; @@ -2224,7 +2224,7 @@ static void spr_nearest(void) } denise_spr_nearestcnt = min - 2; if (aga_mode && denise_spr_nearestcnt > 0 && denise_spr_nearestcnt < 0x7fffffff) { - denise_spr_nearestcnt <<= currprefs.gfx_resolution; + denise_spr_nearestcnt <<= hresolution; } } @@ -2548,7 +2548,7 @@ static void update_bplcon1(void) int delay1 = (bplcon1_denise & 0x0f) | ((bplcon1_denise & 0x0c00) >> 6); int delay2 = ((bplcon1_denise >> 4) & 0x0f) | (((bplcon1_denise >> 4) & 0x0c00) >> 6); bool wasoddeven = bplcon1_shift[0] != bplcon1_shift[1]; - int mask = 3 >> (currprefs.gfx_resolution); + int mask = 3 >> hresolution; bplcon1_shift_mask = fetchmode_mask_denise >> denise_res; @@ -2623,7 +2623,7 @@ static void update_bordercolor(void) static void update_hblank(void) { if (exthblankon_aga) { - int hbmask = (1 << (RES_SUPERHIRES - currprefs.gfx_resolution)) - 1; + int hbmask = (1 << (RES_SUPERHIRES - hresolution)) - 1; denise_phbstrt = hbstrt_denise_reg & 0xff; denise_phbstop = hbstop_denise_reg & 0xff; @@ -2657,7 +2657,7 @@ static void update_hblank(void) denise_strlong_lores = ecs_denise || denisea1000 ? 0x0f : 0x11; denise_strlong_hd = denise_strlong_lores << 2; denise_strlong_unalign = false; - if (aga_mode && currprefs.gfx_resolution == RES_SUPERHIRES) { + if (aga_mode && hresolution == RES_SUPERHIRES) { denise_strlong_hd += 1; denise_strlong_unalign = true; } @@ -2665,7 +2665,7 @@ static void update_hblank(void) static void update_sprres_set(void) { - denise_spr_add = 1 << (RES_MAX - currprefs.gfx_resolution); + denise_spr_add = 1 << (RES_MAX - hresolution); denise_spr_shiftsize = 1 << (RES_SUPERHIRES - denise_sprres); } @@ -2835,6 +2835,17 @@ static void expand_bplcon0_early(uae_u16 v) } } +static void sethresolution(void) +{ + hresolution = currprefs.gfx_resolution; + if (doublescan == 1) { + hresolution++; + if (hresolution > RES_SUPERHIRES) { + hresolution = RES_SUPERHIRES; + } + } +} + static void setlasthamcolor(void) { if (aga_mode) { @@ -2868,6 +2879,7 @@ static void expand_bplcon0(uae_u16 v) int ores = denise_res; denise_res = GET_RES_DENISE(bplcon0_denise); denise_res_size = 1 << denise_res; + sethresolution(); denise_planes = GET_PLANES(bplcon0_denise); bplcolorburst = (bplcon0_denise & 0x200) != 0; if (!bplcolorburst) { @@ -2903,7 +2915,7 @@ static void expand_fmode(uae_u16 v) denise_xposmask_mask_lores = (v & 0x8000) ? 0x100 : 0x000; denise_xposmask_lores = denise_xposmask; denise_xposmask <<= 2; - denise_xposmask |= currprefs.gfx_resolution == RES_SUPERHIRES ? 3 : (currprefs.gfx_resolution == RES_HIRES ? 2 : 0); + denise_xposmask |= hresolution == RES_SUPERHIRES ? 3 : (hresolution == RES_HIRES ? 2 : 0); denise_bplfmode = (v & 3) == 3 ? 2 : (v & 3) == 0 ? 0 : 1; v >>= 2; @@ -3110,6 +3122,7 @@ void denise_reset(bool hard) expand_bplcon3(bplcon3_denise); expand_fmode(fmode_denise); expand_colmask(); + sethresolution(); } @@ -3458,7 +3471,7 @@ static void expand_drga(struct denise_rga *rd) if ((rd->flags & DENISE_RGA_FLAG_LOL)) { agnus_lol = (rd->flags & DENISE_RGA_FLAG_LOL_ON) != 0; if (!agnus_lol && !denise_lol_shift_prev) { - int add = 1 << currprefs.gfx_resolution; + int add = 1 << hresolution; buf1 += add; buf2 += add; buf_d += add; @@ -4539,7 +4552,7 @@ void end_draw_denise(void) static uae_u8 blc_prev[3]; static void emulate_black_level_calibration(uae_u32 *b1, uae_u32 *b2, uae_u32 *db, int dtotal, int cstart, int clen) { - int shift = currprefs.gfx_resolution + 1; + int shift = hresolution + 1; int off; if (cstart < 0) { @@ -4791,8 +4804,8 @@ static void get_line(int gfx_ypos, enum nln_how how) if (!buf1) { denise_pixtotal = -1; } else { - if ((denise_pixtotal << (1 + currprefs.gfx_resolution)) > vb->inwidth) { - denise_pixtotal = vb->inwidth >> (1 + currprefs.gfx_resolution); + if ((denise_pixtotal << (1 + hresolution)) > vb->inwidth) { + denise_pixtotal = vb->inwidth >> (1 + hresolution); } } @@ -4952,13 +4965,6 @@ static void select_lts(void) if (!denise_odd_even) { bplshiftcnt[1] = bplshiftcnt[0]; } - hresolution = currprefs.gfx_resolution; - if (doublescan == 1) { - hresolution++; - if (hresolution > RES_SUPERHIRES) { - hresolution = RES_SUPERHIRES; - } - } hresolution_add = 1 << hresolution; if (aga_mode) { @@ -5074,10 +5080,10 @@ static void lts_unaligned_aga(int cnt, int cnt_next, int h) int dpixcnt = 0; - int xshift = RES_SUPERHIRES - currprefs.gfx_resolution; + int xshift = RES_SUPERHIRES - hresolution; int xadd = 1 << xshift; int denise_res_size2 = denise_res_size << xshift; - if (denise_res > currprefs.gfx_resolution) { + if (denise_res > hresolution) { xshift = RES_SUPERHIRES - denise_res; xadd = 1 << xshift; denise_res_size2 = denise_res_size; @@ -5085,7 +5091,7 @@ static void lts_unaligned_aga(int cnt, int cnt_next, int h) int ipix = 0; for (int i = 0; i < (1 << RES_SUPERHIRES); i += xadd, ipix += xadd) { - if (i == 2 || !currprefs.gfx_resolution) { + if (i == 2 || !hresolution) { if (!h) { if (aga_delayed_color_idx >= 0) { From 204ec182d96c49d4994a7b842ba5daaa82e00581 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 5 Jan 2025 13:15:18 +0200 Subject: [PATCH 08/15] If HAM with 4 or less planes: use normal mode. Genlinetoscr don't generate non-HAM HAM modes. --- drawing.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drawing.cpp b/drawing.cpp index 12979469..ed44e41f 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -4967,6 +4967,10 @@ static void select_lts(void) } hresolution_add = 1 << hresolution; + if (denise_max_planes <= 4 && bplmode_new == CMODE_HAM) { + bplmode_new = CMODE_NORMAL; + } + if (aga_mode) { int spr = 0; From b8acab3312835f29cdca1863669b1eca53f87191 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 5 Jan 2025 14:02:57 +0200 Subject: [PATCH 09/15] Reset also sprite shiftercopydone when disarmed. --- drawing.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/drawing.cpp b/drawing.cpp index ed44e41f..e57e11f5 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -2266,6 +2266,7 @@ static void spr_arm(struct denise_spr *s, int state) select_lts(); } s->armed = 0; + s->shiftercopydone = false; } } } From a940a3361ed09e70b8a7c07ab53ac9dd66d44648 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 5 Jan 2025 16:41:10 +0200 Subject: [PATCH 10/15] Removed old code. --- blitter.cpp | 60 +++++++++-------------------------------------------- 1 file changed, 10 insertions(+), 50 deletions(-) diff --git a/blitter.cpp b/blitter.cpp index 3f104531..05e55a1c 100644 --- a/blitter.cpp +++ b/blitter.cpp @@ -73,7 +73,6 @@ extern uae_u8 agnus_hpos; #define BLITTER_PIPELINE_LASTD 0x1000 #define BLITTER_PIPELINE_FIRST 0x2000 #define BLITTER_PIPELINE_LAST 0x4000 -#define BLITTER_PIPELINE_CPU_FREE 0x8000 #define BLIT_NASTY_CPU_STEAL_CYCLE_COUNT 3 @@ -110,7 +109,7 @@ struct bltinfo blt_info; static uae_u8 blit_filltable[256][4][2]; uae_u32 blit_masktable[BLITTER_MAX_WORDS]; -static int blit_cyclecounter, blit_waitcyclecounter; +static int blit_cyclecounter; static int blit_maxcyclecounter, blit_slowdown, blit_totalcyclecounter; static int blit_misscyclecounter; @@ -124,7 +123,6 @@ static evt_t blit_firstline_cycles; static evt_t blit_first_cycle; static int blit_last_cycle, blit_dmacount, blit_cyclecount; static int blt_delayed_irq; -//static uae_u16 ddat; static int blit_dof; static uae_u16 debug_bltcon0, debug_bltcon1; @@ -880,17 +878,20 @@ static void blitter_loadadat(uae_u16 dat) uae_u32 blitahold; uae_u16 ashift = blt_info.bltcon0 >> 12; uae_u16 bltadat = blt_info.bltadat; + if (dat & BLITTER_PIPELINE_FIRST) { bltadat &= blt_info.bltafwm; } if (dat & BLITTER_PIPELINE_LAST) { bltadat &= blt_info.bltalwm; } + if (blitdesc) { blitahold = (((uae_u32)bltadat << 16) | blt_info.bltaold) >> (16 - ashift); } else { blitahold = (((uae_u32)blt_info.bltaold << 16) | bltadat) >> ashift; } + blt_info.bltaold = bltadat; blt_info.bltahold2 = blitahold; } @@ -1438,7 +1439,6 @@ static void blitter_dodma_new(struct rgabuf *rga, int ch, bool addmod) } case 2: // B { - int bshift = blt_info.bltcon1 >> 12; uae_u16 reg = 0x72; record_dma_blit(rga->reg, 0, pt); blt_info.bltbdat = dat = chipmem_wget_indirect(pt); @@ -1482,37 +1482,9 @@ static void blitter_dodma_new(struct rgabuf *rga, int ch, bool addmod) #endif } -static bool blitter_idle_cycle_register_write(uaecptr addr, uae_u32 v) -{ - addrbank *ab = &get_mem_bank(addr); - if (ab != &custom_bank) - return false; - addr &= 0x1fe; - if (v == 0xffffffff) { - v = regs.chipset_latch_rw; - } - if (addr == 0x40) { - blt_info.bltcon0 = v; - blit_bltset(1); - return true; - } else if (addr == 0x42) { - blt_info.bltcon1 = v; - blit_bltset(2); - return true; - } - return false; -} - -static bool decide_blitter_idle(uaecptr addr, uae_u32 value) +static void decide_blitter_idle(uae_u32 value) { markidlecycle(); - if (addr != 0xffffffff) { - shifter_skip_b_old = shifter_skip_b; - shifter_skip_y_old = shifter_skip_y; - blitfill_old = blitfill; - return blitter_idle_cycle_register_write(addr, value); - } - return false; } static void calc_mods(void) @@ -1572,8 +1544,6 @@ void process_blitter(struct rgabuf *rga) bool line = (dat & BLITTER_PIPELINE_LINE) != 0; bool addmod = (dat & BLITTER_PIPELINE_ADDMOD) != 0; - bool written = false; - uaecptr addr = 0xffffffff; uae_u32 value = 0; int added = 0; @@ -1581,11 +1551,11 @@ void process_blitter(struct rgabuf *rga) if (c == 0) { - written = decide_blitter_idle(addr, value); + decide_blitter_idle(value); } else if (c == 1 && line) { // line 1/4 (A, free) - written = decide_blitter_idle(addr, value); + decide_blitter_idle(value); if (dat & BLITTER_PIPELINE_FIRST) { blitter_line_proc_status(); blitter_line_proc_apt(); @@ -1617,7 +1587,7 @@ void process_blitter(struct rgabuf *rga) } else if (c == 5 && line) { // line 3/4 (free) - written = decide_blitter_idle(addr, value); + decide_blitter_idle(value); // this needs to be done before D channel transfer // because onedot state needs to be known 1 CCK in advance @@ -1755,14 +1725,6 @@ void generate_blitter(void) blt_info.blit_queued = BLITTER_MAX_PIPELINED_CYCLES; } -#if 0 - // Skip BLTSIZE write cycle - if (blit_waitcyclecounter) { - blit_waitcyclecounter = 0; - goto end; - } -#endif - if (blt_info.blit_queued) { // CPU steals the cycle if CPU has waited long enough and current cyle is not free. @@ -2119,7 +2081,6 @@ void do_blitter(int copper, uaecptr pc) } blit_maxcyclecounter = 0x7fffffff; - blit_waitcyclecounter = 0; if (blitter_cycle_exact) { if (immediate_blits) { @@ -2135,7 +2096,6 @@ void do_blitter(int copper, uaecptr pc) blitter_hcounter = 0; blitter_vcounter = 0; blit_cyclecounter = -CYCLECOUNT_START; - blit_waitcyclecounter = 1; blit_maxcyclecounter = blt_info.hblitsize * blt_info.vblitsize + 2; blt_info.blit_pending = 0; blt_info.blit_main = 1; @@ -2468,7 +2428,7 @@ uae_u8 *restore_blitter_new(uae_u8 *src) blit_first_cycle = restore_u32(); blit_last_cycle = restore_u32(); - blit_waitcyclecounter = restore_u32(); + restore_u32(); restore_u32(); blit_maxcyclecounter = restore_u32(); blit_firstline_cycles = restore_u32(); @@ -2661,7 +2621,7 @@ uae_u8 *save_blitter_new(size_t *len, uae_u8 *dstptr) save_u32((uae_u32)blit_first_cycle); save_u32(blit_last_cycle); - save_u32(blit_waitcyclecounter); + save_u32(0); save_u32(0); //(blit_startcycles); save_u32(blit_maxcyclecounter); save_u32((uae_u32)blit_firstline_cycles); From 1126358d827ff53d979e1166f2f53ab4d497f630 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 5 Jan 2025 16:41:50 +0200 Subject: [PATCH 11/15] Update desc variable immediately when blitter is not active. BLTBMOD write requires it. --- blitter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/blitter.cpp b/blitter.cpp index 05e55a1c..5c760b44 100644 --- a/blitter.cpp +++ b/blitter.cpp @@ -1923,6 +1923,7 @@ static void blitter_force_finish(bool state) void reset_blit(int bltcon) { if (!blt_info.blit_queued) { + blitdesc = blt_info.bltcon1 & BLTDESC; return; } if (bltcon) { From 6c3dba6919af630755ceea06426149388679cfe3 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 5 Jan 2025 16:42:19 +0200 Subject: [PATCH 12/15] Fix HAM --- drawing.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drawing.cpp b/drawing.cpp index e57e11f5..8ea6e497 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -3194,8 +3194,6 @@ static void hstart_new(void) } sprites_hidden = sprites_hidden2; bplshiftcnt[0] = bplshiftcnt[1] = 0; - last_bpl_pix = 0; - setlasthamcolor(); #ifdef DEBUGGER if (debug_dma) { record_dma_event_denise(debug_dma_ptr, denise_cycle_half, DENISE_EVENT_BPL1DAT_HDIW, false); @@ -4144,6 +4142,8 @@ static void do_hstrt_aga(int cnt) denise_hdiw = true; sprites_hidden2 &= ~1; sprites_hidden = sprites_hidden2; + last_bpl_pix = 0; + setlasthamcolor(); if (cnt < diwfirstword_total) { diwfirstword_total = cnt; } @@ -4172,6 +4172,8 @@ static void do_hstrt_ecs(int cnt) denise_hdiw = true; sprites_hidden2 &= ~1; sprites_hidden = sprites_hidden2; + last_bpl_pix = 0; + setlasthamcolor(); if (cnt < diwfirstword_total) { diwfirstword_total = cnt; } From 4eeececd37a5a86123d97618d7e87bb1f2bc02ae Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 5 Jan 2025 18:23:54 +0200 Subject: [PATCH 13/15] Fix internal buffer height calculation. --- custom.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/custom.cpp b/custom.cpp index f29e9eca..c3bfc3c2 100644 --- a/custom.cpp +++ b/custom.cpp @@ -1565,8 +1565,9 @@ void compute_framesync(void) if (vidinfo->drawbuffer.extrawidth == -2 && ((new_beamcon0 & (BEAMCON0_VARVBEN | bemcon0_vsync_mask)) || currprefs.gfx_overscanmode >= OVERSCANMODE_EXTREME)) { vidinfo->drawbuffer.extrawidth = -1; } - int maxv = current_linear_vpos - (minfirstline > vsync_startline ? minfirstline - vsync_startline : 0); - vidinfo->drawbuffer.inheight = (maxv + 1) << vres2; + int mfl = minfirstline + 1; + int maxv = current_linear_vpos - (mfl > vsync_startline ? mfl - vsync_startline : 0); + vidinfo->drawbuffer.inheight = maxv << vres2; vidinfo->drawbuffer.inheight2 = vidinfo->drawbuffer.inheight; vidinfo->drawbuffer.inxoffset = 0; From 64f1306941df48f2160daa4bc55a0fc59e40a1c3 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 5 Jan 2025 18:24:59 +0200 Subject: [PATCH 14/15] Fixed strange window movement when clicking on title bar and keeping it pressed and "Automatically capture mouse when window is activated" was enabled. --- od-win32/win32.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 8c9be627..56fd406e 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -1992,10 +1992,12 @@ static int inresizing; static int nSizingEdge; static POINT ptResizePos; static RECT rcResizeStartWindowRect; +static BOOL inresizefirst; static void StartCustomResize(AmigaMonitor *mon, HWND hWindow, int nEdge, int x, int y) { inresizing = TRUE; + inresizefirst = TRUE; SetCapture(hWindow); nSizingEdge = nEdge; ptResizePos.x = x; @@ -2055,8 +2057,13 @@ static void CustomResizeMouseMove(AmigaMonitor *mon, HWND hWindow) h += dy; break; case -1: - x += dx; - y += dy; + if (inresizefirst) { + changed = false; + inresizefirst = FALSE; + } else { + x += dx; + y += dy; + } break; default: changed = false; From 43f850efff3cd8628a6acdbfcbf05422f5151278 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 5 Jan 2025 18:36:34 +0200 Subject: [PATCH 15/15] 6000b2 --- custom.cpp | 2 +- od-win32/win32.h | 4 ++-- od-win32/winuaechangelog.txt | 13 +++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/custom.cpp b/custom.cpp index c3bfc3c2..1043efba 100644 --- a/custom.cpp +++ b/custom.cpp @@ -8439,7 +8439,7 @@ uae_u8 *save_cycles(size_t *len, uae_u8 *dstptr) if (dstptr) dstbak = dst = dstptr; else - dstbak = dst = xmalloc(uae_u8, 1000); + dstbak = dst = xmalloc(uae_u8, 128); save_u32(1); save_u32(CYCLE_UNIT); save_u64(get_cycles()); diff --git a/od-win32/win32.h b/od-win32/win32.h index d77f9bb5..9e4eeb99 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -20,12 +20,12 @@ #define LANG_DLL_FULL_VERSION_MATCH 1 #if WINUAEPUBLICBETA -#define WINUAEBETA _T("1") +#define WINUAEBETA _T("2") #else #define WINUAEBETA _T("") #endif -#define WINUAEDATE MAKEBD(2025, 1, 4) +#define WINUAEDATE MAKEBD(2025, 1, 5) //#define WINUAEEXTRA _T("AmiKit Preview") //#define WINUAEEXTRA _T("Amiga Forever Edition") diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index adb59d59..b1574738 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,17 @@ + +Beta 2: + +- Fixed 32-bit wide AGA sprite horizontally doubled image. +- Fixed automatic scaling in AGA modes. +- Fixed "HAM" mode with 4 or less planes. HAM previous pixel color variable was not reset correctly. +- NTSC right edge artifact was incorrectly visible in left edge in normal overscan mode. Now it is only visible in Overscan+ and higher modes. +- Doublescan modes that VGA autoswitched to superhires had random looking horizontal offset. +- BLTCON1 write didn't update internal DESC bit, causing possible following BLTBDAT write to use previous blit's direction value when doing initial shift. +- Fixed blitter statefile buffer overflow when saving. +- Fixed strange window movement when clicking on title bar and keeping it pressed and "Automatically capture mouse when window is activated" was enabled. +- Internal display buffer height was few pixels too tall, if window height was exactly same as visible display, bottom of window had black line and topmost line was missing. + Beta 1: IMPORTANT NOTE