'=========================================================================== ' Subject: DISPLAY PARAMETERS OF SVGA MODE Date: 11-10-99 (22:23) ' Author: Antoni Gual Code: QB, PDS ' Origin: agual@eic.ictnet.es Packet: GRAPHICS.ABC '=========================================================================== 'This program will allow you to know the capabilities of your SVGA Vesa Card 'Simply run it, it will check for available modes, after it will check 'and display the parameters of each mode 'Based on Vesa standard 1.2, 'I Hope it helps somebody.. 'NOTE: If your card have some memory sockets free, some modes will appear 'in the modes list and will not be available.It's normal 'Tell me about... 'Antoni Gual agual@eic.ictnet.es DECLARE FUNCTION Binary$ (a$) DECLARE SUB Viewmodeinfo (i%) DECLARE FUNCTION GetVideoMode% () DECLARE SUB ViewVESAParameters () DEFINT A-Z CONST VESAOK = &H4F ' CPU registers used for BIOS calls. These are also defined in QB.BI. TYPE RegType AX AS INTEGER BX AS INTEGER cx AS INTEGER DX AS INTEGER BP AS INTEGER SI AS INTEGER DI AS INTEGER FLAGS AS INTEGER DS AS INTEGER ES AS INTEGER END TYPE ' Type used by VESA function 00h, filled with info on the VESA. TYPE VGAInfoBlock VESASignature AS STRING * 4 VESAVersion AS INTEGER OEMSTRINGPTR AS LONG Capabilities AS LONG VIDEOMODEPTR AS LONG TotalMemory AS INTEGER Reserved AS STRING * 236 END TYPE ' Type used by VESA function 02h, filled with info on a screen mode. 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 DIM SHARED Vgainfo AS VGAInfoBlock DIM SHARED regs AS RegType DIM SHARED modenums(30) AS INTEGER REDIM SHARED modeinfo(0) AS ModeinfoBlock '-=-=-=-=-=-=-=-=-=-=-=-=-=-DEMO CODE STARTS HERE-=-=-=-=-=-=-=-=-=-=-=-=-=- SCREEN 0: CLS regs.AX = &H4F00 regs.ES = VARSEG(Vgainfo) regs.DI = VARPTR(Vgainfo) CALL INTERRUPTX(&H10, regs, regs) IF regs.AX <> VESAOK THEN PRINT "VESA CARD NOT DETECTED": END a$ = MKL$(Vgainfo.VIDEOMODEPTR) DEF SEG = CVI(RIGHT$(a$, 2)) ptr = CVI(LEFT$(a$, 2)) i = 0 DO UNTIL md& = 65535 modenums(i) = md& i = i + 1 temp = PEEK(ptr) ptr = ptr + 1 md& = PEEK(ptr) * 256& + temp ptr = ptr + 1 LOOP modenums(0) = i - 1 ViewVESAParameters LOCATE 25, 1: PRINT "Press any Key to see each mode's values"; r$ = INPUT$(1) REDIM modeinfo(modenums(0)) AS ModeinfoBlock FOR i = 1 TO modenums(0) regs.AX = &H4F01 regs.cx = modenums(i) regs.ES = VARSEG(modeinfo(i)) regs.DI = VARPTR(modeinfo(i)) CALL INTERRUPTX(&H10, regs, regs) NEXT i = 1 DO Viewmodeinfo i LOCATE 25, 1: PRINT "Press left - right cursor keys to view new mode. ESC to exit"; DO: r$ = INKEY$: LOOP UNTIL LEN(r$) IF ASC(r$) THEN ky = ASC(r$) ELSE ky = -ASC(RIGHT$(r$, 1)) IF ky = -75 THEN IF i > 1 THEN i = i - 1 IF ky = -77 THEN IF i < modenums(0) THEN i = i + 1 LOOP UNTIL ky = 27 END 'Shut down SUB Viewmodeinfo (i) CLS PRINT "VESA Mode :"; HEX$(modenums(i)); IF modeinfo(i).ModeAttributes AND 1 THEN PRINT " Available" ELSE PRINT " Not Available" mode = ASC(modeinfo(i).MemoryModel) SELECT CASE mode CASE 0: PRINT "Text ", CASE 1: PRINT "CGA ", CASE 2: PRINT "Hercules ", CASE 3: PRINT "4 plane ", CASE 4: PRINT "Packed Pixel ", CASE 5: PRINT "Nonchain 4", CASE 6: PRINT "Direct Color ", CASE 7: PRINT "YUV ", CASE 8 TO 15: PRINT "VESA reserved ", CASE ELSE: PRINT "OEM Mode ", END SELECT PRINT modeinfo(i).Xresolution; " X "; modeinfo(i).Yresolution; " "; : IF mode = 0 THEN PRINT "Chars"; ELSE PRINT "pixels"; PRINT ASC(modeinfo(i).bitsperpixel); "bits/pixel"; modeinfo(i).bytesperscanline; " bytes/line" PRINT "Bios Function 10H "; : IF modeinfo(i).ModeAttributes AND 4 THEN PRINT "supported" ELSE PRINT " not supported" PRINT "Mode"; : IF modeinfo(i).ModeAttributes AND 8 THEN PRINT "Color "; ELSE PRINT " Monochrome"; IF modeinfo(i).ModeAttributes AND 16 THEN PRINT "Graphics" ELSE PRINT " Text" PRINT "Color Planes: "; ASC(modeinfo(i).NumberofPlanes) IF mode = 1 OR mode = 2 THEN PRINT "Banks: "; ASC(modeinfo(i).Numberofbanks); " of size "; ASC(modeinfo(i).Banksize) PRINT "Windows: Smallest size"; modeinfo(i).Wingranularity; "Kbytes Actual Size:"; modeinfo(i).Winsize PRINT "A: "; : LOCATE , 6: IF ASC(modeinfo(i).WinaAttributes) AND 1 THEN PRINT "Supported"; ELSE PRINT "Not supported"; LOCATE , 20: IF ASC(modeinfo(i).WinaAttributes) AND 2 THEN PRINT "Readable"; ELSE PRINT "Not readable"; LOCATE , 34: IF ASC(modeinfo(i).WinaAttributes) AND 4 THEN PRINT "Writeable"; ELSE PRINT "Not writeable"; LOCATE , 50: PRINT " at Segment "; HEX$(modeinfo(i).WinASegment) PRINT "B: "; LOCATE , 6: IF ASC(modeinfo(i).WinBAttributes) AND 1 THEN PRINT "Supported"; ELSE PRINT "Not supported"; LOCATE , 20: IF ASC(modeinfo(i).WinBAttributes) AND 2 THEN PRINT "Readable"; ELSE PRINT "Not readable"; LOCATE , 34: IF ASC(modeinfo(i).WinBAttributes) AND 4 THEN PRINT "Writeable"; ELSE PRINT "Not writeable"; LOCATE , 50: PRINT " at Segment "; HEX$(modeinfo(i).WinbSegment) PRINT "Pages "; ASC(modeinfo(i).numberofimagepages) + 1 PRINT "Char size "; ASC(modeinfo(i).Xcharsize); " X "; ASC(modeinfo(i).Ycharsize) IF mode = 6 OR mode = 7 THEN color$ = STRING$(8 * (-INT(-(ASC(modeinfo(i).bitsperpixel) / 8))), "r") red$ = STRING$(ASC(modeinfo(i).Redmasksize), "R") MID$(color$, 1 + LEN(color$) - LEN(red$) - ASC(modeinfo(i).redfieldposition)) = red$ green$ = STRING$(ASC(modeinfo(i).greenmasksize), "G") MID$(color$, 1 + LEN(color$) - LEN(green$) - ASC(modeinfo(i).greenfieldposition)) = green$ blue$ = STRING$(ASC(modeinfo(i).bluemasksize), "B") MID$(color$, 1 + LEN(color$) - LEN(blue$) - ASC(modeinfo(i).bluefieldposition)) = blue$ PRINT "Color: "; color$, "R=red G=green B=blue r=reserved" PRINT "Color Ramp "; : IF ASC(modeinfo(i).DirectColorModeInfo) AND 1 THEN PRINT "Programmable"; ELSE PRINT "Fixed"; LOCATE , 40: PRINT "Reserved field "; : IF ASC(modeinfo(i).DirectColorModeInfo) AND 1 THEN PRINT "Writeable" ELSE PRINT "Not Writeable" END IF END SUB ' Detect to see if a VESA compatible graphics card is present. SUB ViewVESAParameters PRINT Vgainfo.VESASignature; PRINT RTRIM$(STR$(Vgainfo.VESAVersion \ 256)); "."; LTRIM$(STR$(Vgainfo.VESAVersion AND 255)) a$ = MKL$(Vgainfo.OEMSTRINGPTR) DEF SEG = CVI(RIGHT$(a$, 2)) ptr = CVI(LEFT$(a$, 2)) B$ = "" DO UNTIL PEEK(ptr) = 0 B$ = B$ + CHR$(PEEK(ptr)) ptr = ptr + 1 LOOP PRINT "OEM Signature: "; B$ PRINT "Video modes supported by card (Memory installed may not be enough):" FOR j = 1 TO modenums(0): PRINT HEX$(modenums(j)), : NEXT: PRINT dacsw% = Vgainfo.Capabilities AND 1 IF dacsw% THEN PRINT "DAC is switchable" ELSE PRINT "DAC is fixed 6 bits/color" mem& = &H10000 * Vgainfo.TotalMemory PRINT "Total Memory"; mem&; " Bytes "; mem& / 1024 / 1024; "Megs" END SUB