This topic is now archived and is closed to further replies.


800x600x32 VESA graphics mode

Recommended Posts

Hi, I wanted to get into the 800x600x32-bit colour VESA mode, so I made this little function:-
int sv_setmode(int mode)
   union REGS regs;

   regs.h.ah = 0x4F; = 0x02;
   regs.x.bx = mode;
   return int86(0x10, ®s, ®s);
(The registered symbols are supposed to read "the address of regs" (& regs), this source parser is brilliant, don't you think? ) And passed 115 as the parameter. This successfully placed me in what I could only assume to be my requested graphics mode. To test it, I wrote a simple pixel-plotting loop, using the good old 0xA000 VGA pointer as the place to write to:-
int x;

   screen[x*800+x] = x;
But rather than giving me a straight diagonal line of pixels across the screen, I ended up with a rather strange pattern of pixels, what appeared to be several diagonal lines occupying the top area of the screen. I know there are several things I am not taking into account (32-bit pixel values, banked video memory, etc.), so could anybody explain to me how I would produce said pattern in this mode? Please? I am using Borland Turbo C++ 3.0. Edited by - SMurf7 on March 23, 2002 6:16:43 PM

Share this post

Link to post
Share on other sites
Why aren''t you implementing banking? Or linear framebuffers? Otherwise, you get problems with VESA, since 0xA000 is only a segment wide (16-bits, since the days of DOS). I''d suggest you read some docs on VESA-programming.

Share this post

Link to post
Share on other sites
Ah yes, the video banking problem.
You need to create an algorithm to select the different sections.. since each ''window'' can only hold 65536 data values... but when you are using higher video modes.. the number of ''windows'' decrease. I think the vesa doc refers the banks as windows. Notice this is a very slow way to use a vesa mode because you have to call interrupts alot!

I am assuming that you are programming in real-mode.. if you can, learn how to use protected-mode and switch your video card to use a linear mode.. I did not find out how to do that.

You can find plenty of code on the simtel ms-dos ftp server (if that still exists).. or you can download djgpp and you can create apps in protected without coding all of the memory handlers and the icky protected mode stuff yourself.

Share this post

Link to post
Share on other sites