Merge pull request #4075 from iamgreaser/gm/ega-hscroll-gfx-mode-fix

Fix a few bugs pertaining to EGA fine horizontal scrolling
This commit is contained in:
Miran Grča
2024-01-23 05:20:15 +01:00
committed by GitHub
2 changed files with 11 additions and 5 deletions

View File

@@ -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;
@@ -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;

View File

@@ -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;