Fixes for EGA scrolling

This commit is contained in:
GreaseMonkey
2024-01-09 17:20:31 +13:00
parent 9df44e60b5
commit 22ead81b80
2 changed files with 25 additions and 34 deletions

View File

@@ -684,7 +684,7 @@ void
ega_poll(void *priv) ega_poll(void *priv)
{ {
ega_t *ega = (ega_t *) priv; ega_t *ega = (ega_t *) priv;
int x; int x, y;
int old_ma; int old_ma;
int wx = 640; int wx = 640;
int wy = 350; int wy = 350;
@@ -704,37 +704,26 @@ ega_poll(void *priv)
video_wait_for_buffer(); video_wait_for_buffer();
} }
if (ega->vres) { old_ma = ega->ma;
old_ma = ega->ma; ega->displine *= ega->vres + 1;
ega->y_add *= ega->vres + 1;
ega->displine <<= 1; for (y = 0; y <= ega->vres; y++) {
ega->y_add <<= 1; /* Render scanline */
ega->render(ega); ega->render(ega);
/* Render overscan */
ega->x_add = (overscan_x >> 1); ega->x_add = (overscan_x >> 1);
ega_render_overscan_left(ega); ega_render_overscan_left(ega);
ega_render_overscan_right(ega); ega_render_overscan_right(ega);
ega->x_add = (overscan_x >> 1) - ega->scrollcache; ega->x_add = (overscan_x >> 1) - ega->scrollcache;
ega->displine++; if (y != ega->vres) {
ega->ma = old_ma;
ega->ma = old_ma; ega->displine++;
}
ega->render(ega);
ega->x_add = (overscan_x >> 1);
ega_render_overscan_left(ega);
ega_render_overscan_right(ega);
ega->x_add = (overscan_x >> 1) - ega->scrollcache;
ega->y_add >>= 1;
ega->displine >>= 1;
} else {
ega_render_overscan_left(ega);
ega->render(ega);
ega_render_overscan_right(ega);
} }
ega->displine /= ega->vres + 1;
ega->y_add /= ega->vres + 1;
if (ega->lastline < ega->displine) if (ega->lastline < ega->displine)
ega->lastline = ega->displine; ega->lastline = ega->displine;
@@ -887,16 +876,10 @@ ega_poll(void *priv)
ega->displine = (ega->interlace && ega->oddeven) ? 1 : 0; ega->displine = (ega->interlace && ega->oddeven) ? 1 : 0;
ega->scrollcache = (ega->attrregs[0x13] & 0x0f); ega->scrollcache = (ega->attrregs[0x13] & 0x0f);
if (!(ega->gdcreg[6] & 1) && !(ega->attrregs[0x10] & 1)) { /*Text mode*/ if (ega->scrollcache >= 0x8)
if (ega->seqregs[1] & 1) ega->scrollcache = 0;
ega->scrollcache &= 0x07; else
else { ega->scrollcache++;
ega->scrollcache++;
if (ega->scrollcache > 8)
ega->scrollcache = 0;
}
} else
ega->scrollcache &= 0x07;
if (ega->seqregs[1] & 8) if (ega->seqregs[1] & 8)
ega->scrollcache <<= 1; ega->scrollcache <<= 1;

View File

@@ -126,6 +126,14 @@ ega_render_text(ega_t *ega)
const bool blinked = ega->blink & 0x10; const bool blinked = ega->blink & 0x10;
uint32_t *p = &buffer32->line[ega->displine + ega->y_add][ega->x_add]; uint32_t *p = &buffer32->line[ega->displine + ega->y_add][ega->x_add];
/* 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) { for (int x = 0; x < (ega->hdisp + ega->scrollcache); x += charwidth) {
uint32_t addr = ega->remap_func(ega, ega->ma) & ega->vrammask; uint32_t addr = ega->remap_func(ega, ega->ma) & ega->vrammask;