From 9844cbc2459cc33d18ae17253e431547e5504579 Mon Sep 17 00:00:00 2001 From: GreaseMonkey Date: Tue, 23 Jan 2024 16:02:32 +1300 Subject: [PATCH 1/3] Add 8-dot hscroll compensation to EGA graphics modes This is in lieu of whatever the correct emulation would be (as per the text modes). Somehow I forgot to add this when reworking the fine scroll implementations. --- src/video/vid_ega_render.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/video/vid_ega_render.c b/src/video/vid_ega_render.c index 98905e0c8..0cb1216ad 100644 --- a/src/video/vid_ega_render.c +++ b/src/video/vid_ega_render.c @@ -199,6 +199,7 @@ ega_render_graphics(ega_t *ega) const bool attrblink = ((ega->attrregs[0x10] & 8) != 0); const bool blinked = ega->blink & 0x10; const bool crtcreset = ((ega->crtc[0x17] & 0x80) == 0); + const bool seq9dot = ((ega->seqregs[1] & 1) == 0); const bool seqoddeven = ((ega->seqregs[1] & 4) != 0); const uint8_t blinkmask = (attrblink && blinked ? 0x8 : 0x0); uint32_t *p = &buffer32->line[ega->displine + ega->y_add][ega->x_add]; @@ -206,6 +207,15 @@ ega_render_graphics(ega_t *ega) const int dotwidth = 1 << dwshift; const int charwidth = dotwidth * 8; int secondcclk = 0; + + /* Compensate for 8dot scroll */ + if (!seq9dot) { + for (int x = 0; x < dotwidth; x++) { + p[x] = ega->overscan_color; + } + p += dotwidth; + } + for (int x = 0; x <= (ega->hdisp + ega->scrollcache); x += charwidth) { uint32_t addr = ega->remap_func(ega, ega->ma) & ega->vrammask; From e5000f7419d1020c4e657b4168f91658d3b1c746 Mon Sep 17 00:00:00 2001 From: GreaseMonkey Date: Tue, 23 Jan 2024 17:03:33 +1300 Subject: [PATCH 2/3] Fix fine scroll wobbling in EGA when calling `ega_recalctimings` Closes: GH-4072 --- src/video/vid_ega.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/vid_ega.c b/src/video/vid_ega.c index 670d88e61..282fde656 100644 --- a/src/video/vid_ega.c +++ b/src/video/vid_ega.c @@ -557,7 +557,7 @@ ega_recalctimings(ega_t *ega) overscan_x <<= 1; ega->y_add = (overscan_y >> 1); - ega->x_add = (overscan_x >> 1); + ega->x_add = (overscan_x >> 1) - ega->scrollcache; if (ega->vres) ega->y_add >>= 1; From 257cf0d1a2cb18bfd28cf5230a9a8bf27198a492 Mon Sep 17 00:00:00 2001 From: GreaseMonkey Date: Tue, 23 Jan 2024 17:06:39 +1300 Subject: [PATCH 3/3] Remove the "reset horizontal fine scroll on split screen" VGAism from EGA --- src/video/vid_ega.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/video/vid_ega.c b/src/video/vid_ega.c index 282fde656..7979cd958 100644 --- a/src/video/vid_ega.c +++ b/src/video/vid_ega.c @@ -804,10 +804,6 @@ ega_poll(void *priv) ega->cca = ega->ma; ega->maback <<= 2; ega->sc = 0; - if (ega->attrregs[0x10] & 0x20) { - ega->scrollcache = 0; - ega->x_add = (overscan_x >> 1); - } } if (ega->vc == ega->dispend) { ega->dispon = 0;