Results 1 to 4 of 4

Thread: Protected mode VGA

  1. #1
    ChimpFace9000
    Guest

    Post Protected mode VGA

    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.

  2. #2
    Junior Member
    Join Date
    Jun 2000
    Posts
    28
    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

  3. #3
    ChimpFace9000
    Guest
    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.

  4. #4
    Junior Member
    Join Date
    Jun 2000
    Posts
    28
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width