By Aaron Severn
VgaInfoBlock, returned by VESA function &H00. TYPE VgaInfoBlock VESASignature AS STRING * 4 VESAVersion AS INTEGER OEMStringPtr AS LONG Capabilities AS STRING * 4 VideoModePtr AS LONG TotalMemory AS INTEGER Reserved AS STRING * 236 END TYPE
0 - DAC is switchable 0 - DAC is fixed width, with 6-bits per primary color. 1 - DAC width is switchable. 1-31 - Reserved
ModeInfoBlock, returned by VESA function &H01.
TYPE ModeInfoBlock ModeAttributes AS INTEGER WinAAttributes AS STRING * 1 WinBAttributes AS STRING * 1 WinGranularity AS INTEGER WinSize AS INTEGER WinASegment AS INTEGER WinBSegment AS INTEGER WinFuncPtr AS LONG BytesPerScanLine AS INTEGER XResolution AS INTEGER YResolution AS INTEGER XCharSize AS STRING * 1 YCharSize AS STRING * 1 NumberOfPlanes AS STRING * 1 BitsPerPixel AS STRING * 1 NumberOfBanks AS STRING * 1 MemoryModel AS STRING * 1 BankSize AS STRING * 1 NumberOfImagePages AS STRING * 1 Rsvd AS STRING * 1 RedMaskSize AS STRING * 1 RedFieldPosition AS STRING * 1 GreenMaskSize AS STRING * 1 GreenFieldPosition AS STRING * 1 BlueMaskSize AS STRING * 1 BlueFieldPosition AS STRING * 1 RsvdMaskSize AS STRING * 1 DirectColorModeInfo AS STRING * 1 Reserved AS STRING * 216 END TYPE
ModeAttributes - describes certain characteristics of the video mode. Bits are defined as follows.
0 - Mode supported in hardware 0 - Mode not supported 1 - Mode is supported 1 - 1 (Reserved) 2 - Output functions supported by BIOS 0 - Output functions not supported 1 - Output functions are supported 3 - Monochrome/colour mode 0 - Monochrome mode 1 - Colour mode 4 - Mode type 0 - Text mode 1 - Graphics mode 5-15 - Reserved
0 - Window supported 0 - Window is not supported 1 - Window is supported 1 - Window readable 0 - Window is not readable 1 - Window is readable 2 - Window writeable 0 - Window is not writeable 1 - Window is writeable 3-7 - Reserved
&H00 - Text mode &H01 - CGA graphics &H02 - Hercules graphics &H03 - 4-plane planar &H04 - Packed pixel &H05 - Non-chain 4, 256 colour &H06 - Direct colour &H07 - YUV &H08-&H0F - Reserved, to be defined by VESA &H10-&HFF - To be defined by OEM
0 - Colour ramp is fixed/programmable 0 - Colour ramp is fixed 1 - Colour ramp is programmable 1 - Bits in Rsvd field are usable/reserved 0 - Bits in Rsvd field are reserved 1 - Bits in Rsvd field are usable
Appendix B - VESA defined screen modes
--------------------------------------
GRAPHICS MODES TEXT MODES Mode number Resolution Colours Mode number Columns Rows ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ &H100 640x400 256 &H108 80 60 &H101 640x480 256 &H109 132 25 &H102 800x600 16 &H10A 132 43 &H103 800x600 256 &H10B 132 50 &H104 1024x768 16 &H10C 132 60 &H105 1024x768 256 &H106 1280x1024 16 &H107 1280x1024 256 &H10D 320x200 32k (1:5:5:5) &H10E 320x200 64k (5:6:5) &H10F 320x200 16.8M (8:8:8) &H110 640x480 32k (1:5:5:5) &H111 640x480 64k (5:6:5) &H112 640x480 16.8M (8:8:8) &H113 800x600 32k (1:5:5:5) &H114 800x600 64k (5:6:5) &H115 800x600 16.8M (8:8:8) &H116 1024x768 32k (1:5:5:5) &H117 1024x768 64k (5:6:5) &H118 1024x768 16.8M (8:8:8) &H119 1280x1024 32k (1:5:5:5) &H11A 1280x1024 64k (5:6:5) &H11B 1280x1024 16.8M (8:8:8)
Input - AH = &H4F AL = &H00 ES:DI = Pointer to buffer Output - AX = Status (&H4F if successful) (All other registers are preserved)
Input - AH = &H4F AL = &H01 CX = SVGA video mode ES:DI = Pointer to buffer Output - AX = Status (&H4F if successful) (All other registers are preserved)
Function &H02 - Set Super VGA Video Mode
Input - AH = &H4F AL = &H02 BX = Video mode Bits 0-14 - Video mode 15 - Clear memory flag 0 - Clear video memory 1 - Don't clear video memory Output - AX = Status (&H4F if successful) (All other registers are preserved)
Input - AH = &H4F AL = &H03 Output - AX = Status (&H4F if successful) BX = Current video mode (All other registers are preserved)
Input - AH = &H4F AL = &H04 DL = &H00 Return save/restore state buffer size CX = Requested states Bit 0 - Save/restore video hardware state 1 - Save/restore video BIOS state 2 - Save/restore video DAC state 3 - Save/restore SVGA state Output - AX = Status (&H4F if successful) BX = Number of 64 byte blocks to hold the state buffer (All other registers are preserved) Input - AH = &H4F AL = &H04 DL = &H01 Save SVGA video state CX = Requested states (see above) ES:BX = Pointer to buffer Output - AX = Status (&H4F if successful) (All other registers are preserved) Input - AH = &H4F AL = &H04 DL = &H02 Restore SVGA video state CX = Requested states (see above) ES:BX = Pointer to buffer Output - AX = Status (&H4F if successful) (All other registers are preserved)
Input - AH = &H4F AL = &H05 BH = &H00 Select SVGA video memory window BL = Window number 0 - Window A 1 - Window B DX = Window position in video memory (in window granularity units) Output - AX = Status (&H4F if successful) Input - AH = &H4F AL = &H05 BH = &H01 Return SVGA video memory window BL = Window number (see above) Output - AX = Status (&H4F if successful) DX = Window position in video memory (in window granularity units)
Input - AH = &H4F AL = &H06 BL = &H00 Select scan line length CX = Desired width in pixels Output - AX = Status (&H4F if successful) BX = Bytes per scan line CX = Actual pixels per scan line DX = Maximum number of scan lines Input - AH = &H4F AL = &H06 BL = &H01 Return scan line length Output - AX = Status (&H4F if successful) BX = Bytes per scan line CX = Actual pixels per scan line DX = Maximum number of scan lines
Input - AH = &H4F AL = &H07 BH = &H00 BL = &H00 Select display start CX = First displayed pixel in scan line DX = First displayed scan line Output - AX = Status (&H4F if successful) Input - AH = &H4F AL = &H07 BL = &H01 Return display start Output - AX = Status (&H4F if successful) BH = &H00 Reserved and will be 0 CX = First displayed pixel in scan line DX = First displayed scan line
Input - AH = &H4F AL = &H08 BL = &H00 Set DAC palette width BH = Desired number of bits of colour per primary Output - AX = Status (&H4F if successful) BH = Current number of bits of colour per primary Input - AH = &H4F AL = &H08 BL = &H01 Get DAC palette width Output - AX = Status (&H4F if successful) BH = Current number of bits of colour per primary
Appendix E - Suggested sources
------------------------------
The most useful source for programming VESA SVGA is probably the VESA
specification. There are many places where you can find it, I have uploaded
a copy on my website, use the address below.
http://www.geocities.com/SiliconValley/Peaks/9572/vesasp12.txt
Another good source on SVGA programming in the PC Game Programmers
Encyclopedia. It includes the VESA specification listed above. You can get
a copy from the following address.
www.qzx.com/pc-gpe
Appendix F - Contact info
-------------------------
If you have questions, I'd prefer that you post them on the www board at my website, rather than e-mail me.
Until September 1998, I can be reached by e-mail at rlsevern@idirect.com After September 1998 I will have a different e-mail, I don't know what it will be yet so I can't tell you.
I can always be reached by posting a message on the www board at my website, the address is www.geocities.com/SiliconValley/Peaks/9572/ Also go there for more demo code on using SVGA in QuickBasic as well as many other useful routines and fun games.
Appendix G - Works Cited
------------------------
Super VGA BIOS Extension, Standard #VS911022, October 22, 1991, Document Version 1.0, VBE Version 1.2.
The moment you've been waiting for!
------------------------
HERE IT IS! the svga library that does all the stuff Aaron has documented the last couple of months.