PCem

changeset 25:1d785579b814

TGUI 16-bit patterns now work. TGUI 24 bpp mode now works correctly. TGUI line lengths > 2048 bytes now work.
author TomW
date Sat Oct 19 22:14:22 2013 +0100
parents 4661055656f1
children 6238be7915d1
files src/vid_tvga.c
diffstat 1 files changed, 28 insertions(+), 9 deletions(-) [+]
line diff
     1.1 --- a/src/vid_tvga.c	Sat Oct 19 20:43:51 2013 +0100
     1.2 +++ b/src/vid_tvga.c	Sat Oct 19 22:14:22 2013 +0100
     1.3 @@ -138,7 +138,7 @@
     1.4                  if (svga->crtcreg <= 7 && svga->crtc[0x11] & 0x80) return;
     1.5                  old = svga->crtc[svga->crtcreg];
     1.6                  svga->crtc[svga->crtcreg] = val;
     1.7 -                //if (crtcreg!=0xE && crtcreg!=0xF) pclog("CRTC R%02X = %02X\n",crtcreg,val);
     1.8 +//                if (svga->crtcreg != 0xE && svga->crtcreg != 0xF) pclog("CRTC R%02X = %02X\n", svga->crtcreg, val);
     1.9                  if (old != val)
    1.10                  {
    1.11                          if (svga->crtcreg < 0xE || svga->crtcreg > 0x10)
    1.12 @@ -263,7 +263,12 @@
    1.13          if (!svga->rowoffset) svga->rowoffset = 0x100; /*This is the only sensible way I can see this being handled,
    1.14                                                           given that TVGA8900D has no overflow bits.
    1.15                                                           Some sort of overflow is required for 320x200x24 and 1024x768x16*/
    1.16 +        if (svga->crtc[0x29] & 0x10)
    1.17 +                svga->rowoffset += 0x100;
    1.18  
    1.19 +        if (gfxcard == GFX_TGUI9440 && svga->bpp == 24)
    1.20 +                svga->hdisp = (svga->crtc[1] + 1) * 8;
    1.21 +        
    1.22          if ((svga->crtc[0x1e] & 0xA0) == 0xA0) svga->ma_latch |= 0x10000;
    1.23          if ((svga->crtc[0x27] & 0x01) == 0x01) svga->ma_latch |= 0x20000;
    1.24          if ((svga->crtc[0x27] & 0x02) == 0x02) svga->ma_latch |= 0x40000;
    1.25 @@ -621,13 +626,27 @@
    1.26  	}
    1.27  	else
    1.28  	{
    1.29 -//		pclog("OTHER\n");
    1.30 -		for (y = 0; y < 8; y++)
    1.31 -		{
    1.32 -			for (x = 0; x < 8; x++)
    1.33 -			{
    1.34 -				tvga->accel.tvga_pattern[y][x] = tvga->accel.pattern[x + y*8];
    1.35 -			}
    1.36 +                if (tvga->accel.bpp == 0)
    1.37 +                {
    1.38 +//        		pclog("OTHER 8-bit\n");
    1.39 +        		for (y = 0; y < 8; y++)
    1.40 +        		{
    1.41 +        			for (x = 0; x < 8; x++)
    1.42 +        			{
    1.43 +        				tvga->accel.tvga_pattern[y][x] = tvga->accel.pattern[x + y*8];
    1.44 +        			}
    1.45 +                        }
    1.46 +		}
    1.47 +		else
    1.48 +                {
    1.49 +//        		pclog("OTHER 16-bit\n");
    1.50 +        		for (y = 0; y < 8; y++)
    1.51 +        		{
    1.52 +        			for (x = 0; x < 8; x++)
    1.53 +        			{
    1.54 +        				tvga->accel.tvga_pattern[y][x] = tvga->accel.pattern[x*2 + y*16] | (tvga->accel.pattern[x*2 + y*16 + 1] << 8);
    1.55 +        			}
    1.56 +                        }
    1.57  		}
    1.58  	}
    1.59  /*	for (y = 0; y < 8; y++)
    1.60 @@ -845,7 +864,7 @@
    1.61  		case 0x27: /*ROP*/
    1.62  		tvga->accel.rop = val;
    1.63  		tvga->accel.use_src = (val & 0x33) ^ ((val >> 2) & 0x33);
    1.64 -		pclog("Write ROP %02X %i\n", val, tvga->accel.use_src);
    1.65 +//		pclog("Write ROP %02X %i\n", val, tvga->accel.use_src);
    1.66  		break;
    1.67  		
    1.68  		case 0x28: /*Flags*/