From 76222651ba8293f663c02272807dc8d178c9b436 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 20 Jul 2017 20:55:12 +0200 Subject: [PATCH] EGA now renders at the correct size. --- src/VIDEO/vid_ega.c | 17 +++++++++++++---- src/VIDEO/vid_svga.c | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/VIDEO/vid_ega.c b/src/VIDEO/vid_ega.c index 0920e3884..a3c779ebb 100644 --- a/src/VIDEO/vid_ega.c +++ b/src/VIDEO/vid_ega.c @@ -454,7 +454,7 @@ void ega_recalctimings(ega_t *ega) if (ega->crtc[7] & 1) ega->vtotal |= 0x100; if (ega->crtc[7] & 32) ega->vtotal |= 0x200; - ega->vtotal++; + ega->vtotal += 2; if (ega->crtc[7] & 2) ega->dispend |= 0x100; if (ega->crtc[7] & 64) ega->dispend |= 0x200; @@ -466,7 +466,7 @@ void ega_recalctimings(ega_t *ega) if (ega->crtc[7] & 0x10) ega->split |= 0x100; if (ega->crtc[9] & 0x40) ega->split |= 0x200; - ega->split+=2; + ega->split++; ega->hdisp = ega->crtc[1]; ega->hdisp++; @@ -572,6 +572,8 @@ void ega_poll(void *p) } ega->displine++; + if (ega->interlace) + ega->displine++; if ((ega->stat & 8) && ((ega->displine & 15) == (ega->crtc[0x11] & 15)) && ega->vslines) ega->stat &= ~8; ega->vslines++; @@ -595,6 +597,8 @@ void ega_poll(void *p) ega->con = 0; ega->maback += (ega->rowoffset << 3); + if (ega->interlace) + ega->maback += (ega->rowoffset << 3); ega->maback &= ega->vrammask; ega->ma = ega->maback; } @@ -631,10 +635,14 @@ void ega_poll(void *p) ega->stat |= 8; if (ega->seqregs[1] & 8) x = ega->hdisp * ((ega->seqregs[1] & 1) ? 8 : 9) * 2; else x = ega->hdisp * ((ega->seqregs[1] & 1) ? 8 : 9); + + if (ega->interlace && !ega->oddeven) ega->lastline++; + if (ega->interlace && ega->oddeven) ega->firstline--; + if ((x != xsize || (ega->lastline - ega->firstline) != ysize) || update_overscan) { xsize = x; - ysize = ega->lastline - ega->firstline; + ysize = ega->lastline - ega->firstline + 1; if (xsize < 64) xsize = 640; if (ysize < 32) ysize = 200; y_add = enable_overscan ? 14 : 0; @@ -714,7 +722,7 @@ void ega_poll(void *p) } } - video_blit_memtoscreen(32, 0, ega->firstline, ega->lastline + y_add_ex, xsize + x_add_ex, ega->lastline - ega->firstline + y_add_ex); + video_blit_memtoscreen(32, 0, ega->firstline, ega->lastline + 1 + y_add_ex, xsize + x_add_ex, ega->lastline - ega->firstline + 1 + y_add_ex); frames++; @@ -754,6 +762,7 @@ void ega_poll(void *p) ega->vc = 0; ega->sc = 0; ega->dispon = 1; + ega->displine = (ega->interlace && ega->oddeven) ? 1 : 0; ega->displine = 0; ega->scrollcache = ega->attrregs[0x13] & 7; } diff --git a/src/VIDEO/vid_svga.c b/src/VIDEO/vid_svga.c index 3690bc2ac..01542b93b 100644 --- a/src/VIDEO/vid_svga.c +++ b/src/VIDEO/vid_svga.c @@ -1610,7 +1610,7 @@ void svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga) return; } - if ((wx!=xsize || wy!=ysize) && !vid_resize) + if (((wx!=xsize) || ((wy + 1)!=ysize)) && !vid_resize) { xsize=wx; ysize=wy+1;