' ллллА ллА л лллл лллА ' лллАААА ллА ллА ллААА лллл ' ллАА лА лллА ллАА ллАллА ' лА ллА лллАА ллАА лА ллА ' лллА ллА ллА ллАА ллА ллА ' лллллА ллА ллАА ллАА ллА ллА ' лллА ллА ллАА ллА лллллллА ллА ллА ' ллА ллА лллА лАА лллллллА лллллллллА ' л ллА ллАлллАА лАА ААААлА ллААААААлА ' лл лА ллАллАА лА лА ллАА ллА ' лллл ллА ллллА лА ллА ллАА лАА ' лллллллллАА ллААА ллллАА лллллА ллА ллА ' АААААААА АА АллллллАААлА лАА лА ' ' -library for QuickBasic ' version 1.1 Copyright 3/2000 Sebastian Mate, Germany ' ' Introduction ' ------------ ' Not many words - but here you have a program that allows you to write your ' programs using SVGA-videomodes! The full code is offered! ' This FREEWARE-program was made possible using a small tutorial from ' Aaron Severn. Thanks! ' Please copy this program to friends! ' ATTENTION! - The use is on your own risc! ' ----------------------------------------- ' This program may damage (old) VGA/EGA etc. monitores! ' Be sure all your hardware is VESA-compatible! ' All modern PCs (let's say after 1995) normally suppurt VESA. ' I assume no responsibility for any harm that comes from using the material ' contained in this file to you, your computer, or anything relating to ' your existence. No warranty is provided or implied on this file! ' This file is provided as is. ' All names and trademarks belong to their owners. ' By using this SOFTWARE or documentation, you agree to the above ' terms and conditions. ' Monitor-damage ' -------------- ' As already said, this program may damage (old) VGA/EGA etc. monitores. ' Normaly 640x400x256 (VESA-mode &H100) is supported. If your videocard ' is not SVGA-compatible, you can't swich into a VESA-mode and so you ' can't damage your monitores. ' Speed ' ----- ' Well, this engine is VERY slow. You should have at least a Pentium CPU. ' And if so, you can't use it for games. It's too slow... ' For more speed I recommend: ' 'SVGAQB' & 'SVGAPV' A Super VGA Graphics Librarys for use with ' MS QuickBASIC 4.X and MS PDS/VBDOS ' Copyright 1993-1996 by Stephen L. Balkum and Daniel A. Sill ' Yet tested videocards ' --------------------- ' ' Model Enter SVGA PSET-Support Comments ' ------------------------------------------------------------------------- ' Cirrus Logic 5440 YES YES Works very fine! ' ATI Rage Pro (AGP) YES NOT 100% Why? I don't know!!! ' List of all 8-Bit VESA and "CIRRUS-LOGIC 5440" -videomodes ' ---------------------------------------------------------- ' ' Resolution Cirrus Logic-mode Vesa-Mode ' -------------------------------------------------------- ' 230x200 (=SCREEN 13) &H13 &H13 ' 640x400 &H5E &H100 ' 640x480 &H5F &H101 ' 800x600 &H5C &H103 ' 1024x768 &H60 &H105 ' 1280x1024 &H6D &H107 ' ' Please prefer the VESA-modes since not all cards support CL-modes. ' Required Videomemory ' -------------------- ' Not all VESA-cards support all videomodes. You have to check out first ' the amount of videomemory before you use the videomodes! ' ' Memory (in kilobytes) Enabled Resolutions ' ----------------------------------------------- ' < 512 640x480 ' >= 512 800x600 ' >= 1024 1024x768 ' >= 2048 1280x1024 ' List of all commands ' -------------------- ' ' - SVGAmode Mode% ' This will set the currend Videomode. ' Example: SVGAmode &H101 ' Note: You can swich in other modes (f.e. 1600x1280x24Bit) ' but wich are not supported by this program! ' - SVGAline x1%, y1%, x2%, y2%, colour% ' This is the same like the QBasic-command LINE (X,X)-(X,X), X ' - SVGAlineBF x1%, y1%, x2%, y2%, colour% ' This is the same like the QBasic-command LINE (X,X)-(X,X), X, BF ' - SVGApset x%, y%, colour% ' This is the same like the QBasic-command PSET (X,X), X ' - SVGAcls ' This would clear the screen. ' - SVGAtest ' Not required, you can remove this sub. ' - SVGApoint x%, y% (new sice version 1.1) ' This will return with the actual pixel-color. ' The color is stored in the global variable Col% ' ' (!) Note! In SVGA-mode only the commands above are supported. ' LINE, PSET etc. would not work. ' To use PALETTE, first set up SCREEN 13, so BASIC thinks ' it's in screen &H13 and you can do the PALETTE. ' The PRINT-command is not full supported. An extra SUB is ' planed! ' BUGS, QUESTIONS, ETC. ' --------------------- ' Please contact me: ' e-Mail: JMate@t-online.de ' Please tell me the model of your videocard so I can include it in the ' list above. Thanks! ' If you want more stuff like that search for my new OS, I think I will ' call it G.I.M.I. (Graphic Interfaced Multitasking Interpreter). ' You can load extern programs which run in moveable windows. Multitasking ' up to 20 programs at 500-2000 commands/second! SoundBlaster- and ' SVGA-support (this engine). You can write programs on your own. ' Yet in writing: Games like "Jump - Don't Fall", "Ball", "MouseRace" ' "PhotoEdit 1.0", "Waveplayer" ...... ' It's not ready, but it will make you able to write easily Setup-routines ' for your programs, with pictures (TGA), AVI-files, animated buttons... ' Just wait and see... ' Just look at my homepage: WWW.SebastianMate.DE5.DE ' Now press [F5] :-) ... '---------------------- Start of the sourcecode ----------------------- DEFINT A-Z DECLARE SUB SVGAline (x1%, y1%, x2%, y2%, COL%) DECLARE SUB SVGApoint (X%, Y%) DECLARE SUB SVGAtest () DECLARE SUB SVGAmode (Mode%) DECLARE SUB SVGApset (X%, Y%, COL%) DECLARE SUB SVGAlineBF (x1%, y1%, x2%, y2%, COL%) DECLARE SUB SVGAcls () TYPE RegTypeX 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 DIM SHARED REGS AS RegTypeX DIM SHARED RESX AS INTEGER, RESY AS INTEGER, curbank AS LONG, bank AS LONG, VGAmode DIM SHARED a, b, c, Mode%, VSEG, BankX, xResolution&, COL% DEF SEG = &HA000: VSEG = &HA000 REGS.AX = &H4F05: REGS.bx = 0 '---------------------- Start of the demonstration ----------------------- ' Just remove the following lines to write your own program NEW: DO DEF SEG = &HA000 SCREEN 0: WIDTH 80, 25: CLS PRINT " ллллА ллА л лллл лллА " PRINT " лллАААА ллА ллА ллААА лллл " PRINT " ллАА лА лллА ллАА ллАллА " PRINT " лА ллА лллАА ллАА лА ллА " PRINT " лллА ллА ллА ллАА ллА ллА " PRINT " лллллА ллА ллАА ллАА ллА ллА " PRINT " лллА ллА ллАА ллА лллллллА ллА ллА " PRINT " ллА ллА лллА лАА лллллллА лллллллллА " PRINT " л ллА ллАлллАА лАА ААААлА ллААААААлА " PRINT " лл лА ллАллАА лА лА ллАА ллА " PRINT " лллл ллА ллллА лА ллА ллАА лАА " PRINT " лллллллллАА ллААА ллллАА лллллА ллА ллА " PRINT " АААААААА АА АллллллАААлА лАА лА" PRINT " " PRINT " -library for QuickBasic" PRINT " version 1.0 Copyright 3/2000 Sebastian Mate" PRINT PRINT " Supported VESA-videomodes: (1) &H100 ......... 640x400x256" PRINT " (2) &H101 ......... 640x480x256" PRINT " (3) &H103 ......... 800x600x256" PRINT " (4) &H105 ........ 1024x768x256" PRINT " (5) &H107 ....... 1280x1024x256" INPUT " Enter a videomode: ", Mode% SCREEN 13 ' We set SCREEN 13 (see below!) SELECT CASE Mode%' We set the VESA-mode you selected ... CASE IS = 1: SVGAmode &H100 CASE IS = 2: SVGAmode &H101 CASE IS = 3: SVGAmode &H103 CASE IS = 4: SVGAmode &H105 CASE IS = 5: SVGAmode &H107 CASE ELSE GOTO NEW END SELECT SVGAtest ' ... and draw some nice lines. DO: LOOP WHILE INKEY$ = "" RANDOMIZE TIMER SVGAcls FOR a% = 1 TO 500 ' Demonstration of SVGApset x1 = INT(RND * RESX) y1 = INT(RND * RESX) COL = INT(RND * 256) SVGApset x1, y1, COL NEXT LOCATE 1, 1: PRINT " SVGApset x1, y1, col " DO: LOOP WHILE INKEY$ = "" SVGAcls FOR a% = 1 TO 50 ' Demonstration of SVGAline x1 = INT(RND * RESX) x2 = INT(RND * RESX) y1 = INT(RND * RESY) y2 = INT(RND * RESY) COL = INT(RND * 256) SVGAline x1, y1, x2, y2, COL NEXT LOCATE 1, 1: PRINT " SVGAline x1, y1, x2, y2, col " DO: LOOP WHILE INKEY$ = "" SVGAcls FOR a% = 1 TO 50 ' Demonstration of SVGAlineBF x1 = INT(RND * RESX) x2 = INT(RND * RESX) y1 = INT(RND * RESY) y2 = INT(RND * RESY) COL = INT(RND * 256) SVGAlineBF x1, y1, x2, y2, COL NEXT LOCATE 1, 1: PRINT " SVGAlineBF x1, y1, x2, y2, col " DO: LOOP WHILE INKEY$ = "" LOOP FatalError: PRINT "ERROR:" PRINT "NO VGA-CARD FOUND! IF THERE IS NO VGA COMPATIBILITY, THERE CAN'T BE SVGA!" BEEP SYSTEM SUB SVGAcls SVGAlineBF 0, 0, RESX, RESY, 0 END SUB SUB SVGAline (x1%, y1%, x2%, y2%, COL%) DEF SEG = &HA000 ' A higher Value of Fine! means lower line-quality, but more speed. fine! = .01 IF x1% = x2% THEN IF y1% > y2% THEN SWAP y1%, y2% FOR ym% = y1% TO y2% SVGApset x1%, ym%, COL% NEXT EXIT SUB END IF IF y1% = y2% THEN IF x1% > x2% THEN SWAP x1%, x2% FOR xm% = x1% TO x2% SVGApset xm%, y1%, COL% NEXT EXIT SUB END IF IF x1% > x2% AND y1% > y2% THEN SWAP x1%, x2%: SWAP y1%, y2% IF x1% < x2% AND y1% > y2% THEN SWAP x1%, x2%: SWAP y1%, y2% a! = x2% - x1% b! = y2% - y1% c! = 0 FOR cn! = 1 TO b! STEP fine! c! = c! + fine! X! = a! / (b! / c!) SVGApset X! + x1%, c! + y1%, COL% NEXT END SUB SUB SVGAlineBF (x1%, y1%, x2%, y2%, COL%) REGS.AX = &H4F05: REGS.bx = 0 DEF SEG = VSEG FOR Y% = y1% TO y2% FOR X% = x1% TO x2% SVGApset X%, Y%, COL% NEXT NEXT END SUB SUB SVGAmode (Mode%) VGAmode = Mode% BankX = 16 'BankX is required for the PSET routine. IF Mode% = &H100 THEN VGAmode = &H100: RESX = 640: RESY = 400 ' 640x400x256 IF Mode% = &H101 THEN VGAmode = &H101: RESX = 640: RESY = 480 ' 640x480x256 IF Mode% = &H103 THEN VGAmode = &H103: RESX = 800: RESY = 600 ' 800x600x256 IF Mode% = &H105 THEN VGAmode = &H105: RESX = 1024: RESY = 768 ' 1024x768x256 IF Mode% = &H107 THEN VGAmode = &H107: RESX = 1280: RESY = 1024: BankX = 4 '1280x1024x256 xResolution& = RESX REGS.AX = &H4F02 ' Setting up the required registers REGS.bx = VGAmode ' <<<<<<< ERROR HERE? >>>>>>>>> ' <<<<< RUN QUICK-BASIC WITH THE COMMANDLINE: QB /L QB.QLB >>>>>>>>>>>> CALL INTERRUPT(&H10, REGS, REGS) ' Let's do the interrupt! END SUB SUB SVGApoint (X%, Y%) offset& = Y% * xResolution& + X% bank = offset& \ &H10000 offset& = offset& - &H10000 * bank IF bank <> curbank THEN REGS.AX = &H4F05: REGS.bx = 0 curbank = bank: REGS.dx = BankX * curbank CALL INTERRUPT(&H10, REGS, REGS) END IF COL% = PEEK(offset&) END SUB SUB SVGApset (X%, Y%, COL%) offset& = Y% * xResolution& + X% bank = offset& \ &H10000 offset& = offset& - &H10000 * bank IF bank <> curbank THEN REGS.AX = &H4F05: REGS.bx = 0 curbank = bank: REGS.dx = BankX * curbank CALL INTERRUPT(&H10, REGS, REGS) END IF POKE offset&, COL% END SUB SUB SVGAtest DEF SEG = &HA000 REGS.AX = &H4F05: REGS.bx = 0 NX% = RESX / 2 - 127 NY% = RESY / 2 - 50 FOR LIN% = 0 TO RESY - 1 STEP 50 FOR X% = 0 TO RESX - 1 SVGApset X%, LIN%, 15 NEXT X% NEXT FOR LIN% = 0 TO RESX - 1 STEP 50 FOR X% = 0 TO RESY - 1 SVGApset LIN%, X%, 15 NEXT X% NEXT FOR X% = 0 TO 255 FOR Y% = 0 TO 100 SVGApset X% + NX%, Y% + NY%, X% NEXT Y% NEXT X% LOCATE 1, 1 PRINT " VESAMODE &H"; HEX$(VGAmode) PRINT RESX; "x"; RESY; "PIXELS" IF VGAmode = Mode% THEN PRINT " SUCCESS!" END SUB