PDA

Click to See Complete Forum and Search --> : Protected mode VGA


ChimpFace9000
Dec 18th, 2001, 09:56 AM
Im writing external VGA routines in assembly to be used with gcc, I know how to plot a pixel in real mode vga, but how do i do it in protected mode in external assembly? Im using nasm by the way.

Jimbob42
Dec 29th, 2001, 08:21 PM
This is how I did it in nasm, but on its own (without gcc).
For 320*200 I set GS base=0x00A0000, limit=320*200-1 then go
mov gs:[x+320*y],colour
I'm assuming you're in PM already cause of gcc

ChimpFace9000
Dec 29th, 2001, 11:00 PM
Ok i messed around with it for a little while, and when i use gs, i get a general protection fault. Could you do a quick example please.

You talk about setting the base and limit of gs. Is this a PM thing cuz ive never heard of it while using real mode before.

Jimbob42
Jan 4th, 2002, 06:34 PM
Here's a bootloader that goes into protected mode with paging. You know about real mode stuff. Just ignore the paging, I don't think that gcc uses it, although Win32 does.

RM: ds:bx = ds*16+bx (segment)
PM: ds:ebx = ds.base+ebx (selector)

Therefore, if ds.base=0x000A0000 and ebx=(320*y+x), then
mov [ds:ebx],al
sets (x,y) to al
Also you have selector limits for your own protection. If you go over that limit then you get a GPF. e.g. if ds.limit=1000 and you go
mov [ds:1001],al
then you get GPF.

Grab some good files off that operating systems site www.nondot.org/sabre/os/articles