Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

svga

Status
Not open for further replies.

deranged

Programmer
Nov 25, 2003
4
US
I know how to set mode 0x13h but it will only do the resolutions 320x200 and 720x400 not the ones i need like 640x480 800x600 and so on.

Could anyone point me twords a Super VGA(Mode - X) tutorial, or show me how?

please no brackeen or telling me to google.
 
> please no brackeen or telling me to google.
Why not?
I suppose we're supposed to guess some search terms you haven't tried, and then supposed to guess what in YOUR mind would be considered a GOOD tutorial.

What I might consider to be a nice "easy" tutorial could well be a big "huh" as far as you're concerned.

No doubt whatever is suggested will be met with "but that doesn't work with my compiler" (something else you didn't say by the way).

--
 
here are the things ive googled

svga c
svga c examples
vga mode x examples
vga examples
vga examples in c
and so on

and brackeen only has vga not svga

 
You will need biiiiig tutorial to work with mode-X, it couldn't be described in several posts. So, google it ;)
Or maybe look at some old news groups archive, or tutorials from some old DOS demo-group... I had those years ago, gone with a windows, sorry :(

 
I'm having to dig deep into long unused parts of my brain (from my DOS days), so if some of it's wrong, sorry, but looks like you're not getting much help otherwise & I'm sure someone will correct where I'm wrong. Anyway, this is why device drivers were invented.

0x13 is the standard vga graphics mode which was defined as 320x200. When SVGA cards first came out, every manufacturer had it's own mode numbers for the resolutions/color depths making it a nightmare to program for SVGA. VESA ( set a SVGA standard that most manufacturers eventually fell in line with.

If your video card is a VESA standard card, then you can set the mode based on the VESA standard. For example: 0x100 is 640x480 256 colors. You'll notice that this is not a 7-bit mode number like 0x13. Vesa defined only one 7-bit mode number 0x6A (try it instead of 0x13) which was 800x600 but only 16 colors. The rest of the modes are 15-bit modes. Most manufacturers had 7-bit modes for their svga settings also.

You could try to find the 7-bit modes for your particular hardware. Or try the 15-bit VESA modes.

Here's how we would set 15-bit modes:

Code:
union REGS in,out;
in.x.ax = 0x4F02;    // VESA set video mode
in.x.bx = newmode;   // the 15-bit mode i.e. 0x100
int86(0x10,&in,&out);

You can view the vesa standard along with the video modes & source code at:
Hope this helps, if not, then sorry in advance.
 
Yes, itsgsd is spot on.
You need to find out about VESA. It provides a series of useful interrupt calls, for instance one that tells you what extended sVGA modes are actually available on your video card, and it allows you to set them. It also provides another thing you are going to need: banking. The mapped memory available to the screen, certainly in DOS-type situations (I'm no expert elsewhere, but it sounds like you might be in this situation) is not big enough for the 800*600 screen sizes etc. Only 64K is available, but with VGA paging systems you actually get 4 planes, making a total of 256K - but of course your video card has umpteen megabytes. To get the rest you need to shift the start point of the mapped bit in the actual physical memory of the card, and this is one of the many things that was never standard between different sVGA cards. So the VESA standard provided an interrupt that will give you a far address you can call of a standardised procedure for setting the start position (memory banking). It also provides ways to find out the granularity of the banking (how far forward the start point shifts in each incrment. Also variable between cards).

Basically you'll be getting the picture by now that this is not totally trivial, and if you can get away with sticking to standard resolutions in VGA do so, or if you must go for more, see if you can use an environment where the work's been done for you (windows!). At the very least, have a look and see if someone's already made a vesa-friendly library for your compiler.

And I haven't even started on the fun and games of actually drawing a point hardware-style in VGA.

Good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top