Skip to content

Commit

Permalink
Implement VGA byte panning and cursor skew. Patch from Greatpsycho.
Browse files Browse the repository at this point in the history
  • Loading branch information
sarah-walker-pcem committed Nov 14, 2020
1 parent 9bdbcc1 commit ed30e17
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/vid_et4000.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ void et4000k_recalctimings(svga_t *svga)

if (svga->render == svga_render_text_80 && ((svga->crtc[0x37] & 0x0A) == 0x0A))
{
if(et4000->port_32cb_val & 0x80)
{
svga->ma_latch -= 2;
svga->ca_adj = -2;
}
if((et4000->port_32cb_val & 0xB4) == ((svga->crtc[0x37] & 3) == 2 ? 0xB4 : 0xB0))
{
svga->render = svga_render_text_80_ksc5601;
Expand Down
11 changes: 6 additions & 5 deletions src/vid_svga.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ void svga_recalctimings(svga_t *svga)
if (svga->crtc[9] & 0x20) svga->vblankstart |= 0x200;
svga->vblankstart++;

svga->hdisp = svga->crtc[1];
svga->hdisp = svga->crtc[1] - ((svga->crtc[5] & 0x60) >> 5);
svga->hdisp++;

svga->htotal = svga->crtc[0];
Expand All @@ -336,7 +336,8 @@ void svga_recalctimings(svga_t *svga)

svga->interlace = 0;

svga->ma_latch = (svga->crtc[0xc] << 8) | svga->crtc[0xd];
svga->ma_latch = ((svga->crtc[0xc] << 8) | svga->crtc[0xd]) + ((svga->crtc[8] & 0x60) >> 5);
svga->ca_adj = 0;

svga->hdisp_time = svga->hdisp;
svga->render = svga_render_blank;
Expand Down Expand Up @@ -658,9 +659,9 @@ void svga_poll(void *p)
changeframecount = svga->interlace ? 3 : 2;
svga->vslines = 0;

if (svga->interlace && svga->oddeven) svga->ma = svga->maback = svga->ma_latch + (svga->rowoffset << 1);
else svga->ma = svga->maback = svga->ma_latch;
svga->ca = (svga->crtc[0xe] << 8) | svga->crtc[0xf];
if (svga->interlace && svga->oddeven) svga->ma = svga->maback = svga->ma_latch + (svga->rowoffset << 1) + ((svga->crtc[5] & 0x60) >> 5);
else svga->ma = svga->maback = svga->ma_latch + ((svga->crtc[5] & 0x60) >> 5);
svga->ca = ((svga->crtc[0xe] << 8) | svga->crtc[0xf]) + ((svga->crtc[0xb] & 0x60) >> 5) + svga->ca_adj;

svga->ma <<= 2;
svga->maback <<= 2;
Expand Down
2 changes: 1 addition & 1 deletion src/vid_svga.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ typedef struct svga_t
int lowres, interlace;
int linedbl, rowcount;
double clock;
uint32_t ma_latch;
uint32_t ma_latch, ca_adj;
int bpp;

uint64_t dispontime, dispofftime;
Expand Down

0 comments on commit ed30e17

Please sign in to comment.