retro graphics

Tom Novelli tcn@clarityconnect.com
Sun, 1 Aug 1999 11:46:11 -0400


On Sat, Jul 31, 1999 at 10:08:02PM -0400, Paul Dufresne wrote:
> On Sat, Jul 31, 1999 at 03:26:45PM -0400, Tom Novelli wrote:
> > I got VGA working on my 486 now.. I examined the registers, and I had made a
> > mistake with the PEL-pan register.  So now the screen isn't shifted
> > sideways, and for some reason that helped it get back to textmode better,
> > but still with some problems.  And the more I switch back and forth between
> > text and graphics, the worse it gets.  But at least I can work with it.
> > 
> hum, maybe things looks good on Bochs but they are far from being right
> on my video card. What mode are you trying to get? Is it 320*200*256
> mode 13h? I runned tweak (simtelnet/msdos/vga) on my mode 13h and I get

Ok, so you type 'grmode' and see garbage on the screen.  That's normal.  If
'clrscr' doesn't remove the garbage, that's a problem.  Also try these:
	colorbars 		\ if you haven't already
	4 0 0 319 199 box	\ a red border around the screen
	65 gputc		\ an 'A' in the upper left
I guess a 'grtest' routine is in order...

I checked the register read/write routines.. they seem to be working fine. 
I went to grmode, played around came back to textmode (which looked messed
up), did 'vga@ hex 360000 100 cmove' to save the current registers, rebooted
so I could read them :), and did 'hex 360000 md'.  That gave me the same
result as 'textregs @ md'.  So either 'vga@' isn't reading the registers
correctly, or it's something else.

Hey, try this: 'grmode textmode'... does it come back to textmode allright? 
How about 'grmode', then, in graphics mode, 'textmode'...? That works for me
too.  But when I write to the graphics screen when I'm in graphics mode, it
corrupts textmode!  Check this out:

hex
: save	  grmode a0000 360000 1000 cmove textmode ;	\ save VRAM
: restore grmode 360000 a0000 1000 cmove textmode ;	\ restore VRAM
save
grmode			\ Garbage on screen
clrscr			\ No garbage
textmode		\ Now it's screwed up
restore			\ Now it's back to normal!

Hmmm... so that's what the garbage is for.  Looks like the VGA card's
character generator is using graphics memory as a scratchpad.  I wonder how
to get around this without saving & restoring the "garbage screen"?  Time to
look through vgadoc, svgalib, GGI, XF86... might as well become familar with
them since I'm gonna be using them as documentation ;)

I looked at the bank-switch and linear-addressing stuff.. it doesn't look
complicated so I'll start playing with high-resolution modes soon.

> 3C2r00=63
ok

CRTC:
> 3D4r0=5f 1=4f 2=50 3=82 4=54 5=80 6=bf 7=1f 8=0 9=41 10=9c
>         11=8e 12=8f 13=28 14=40 15=96 16=b9 17=a3
			    ^^^^^	      ^^^^^
3D4r14: I have 0, you have 40. That's "double word mode addressing"..
3D4r17: I have c3, you have a3. That's "word mode", bit-15 address wrap.
I tried using 40 and a3, and it still works.. so I'll leave it that way and
commit it to CVS.. you try it now :)

Sequencer:
> 3C4 1=01 3=00 4=0e
           ^^^^
I 3C4r3 unchanged from text mode (where it was 0).  It shouldn't matter
because it only affects the character generator.

Graphics controller:
> 3CE 5=40 6=05
ok

Attribute controller:
> 3C0 10=41 11=00 12=0f 13=00 14=00
ok

> just in case it can help you figure out why it looks wrong here.

Yeah, thanks alot man.  We'll have this straightened out in no time.

-- 
Tom Novelli <tcn@tunes.org>
http://bespin.tunes.org/~tcn