home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 14 / CDACTUAL.iso / cdactual / demobin / share / program / Basic / VGALIB10.ZIP / MANUAL.DOC < prev    next >
Encoding:
Text File  |  1991-08-21  |  31.7 KB  |  726 lines

  1.                         BASIC GAME DESIGNERS' VGA LIBRARY
  2.  
  3.  
  4.  
  5.  
  6. INTRODUCTION
  7.  
  8. This is a library of graphic functions, written in assembly language, that
  9. add a lot of speed and power to your QuickBASIC programs.  WARNING!  These
  10. functions will ONLY work in the VGA 256 color mode.  At present, the VGALIB
  11. supports the 320 x 200 mode, 320 x 240, and the 320 x 400 mode.  Soon,
  12. however, I plan to add support for SVGA modes...including 640x480 and
  13. 800x600.  
  14.  
  15. Almost all of the functions in my library have tested faster that their
  16. QuickBASIC equivalents and there are many functions in my library that aren't
  17. in BASIC.  After all, BASIC doesn't support anything better than 320x200.
  18.  
  19. VGALIB library of functions were written especially with game programming in
  20. mind.  I have included a demo program that has samples of a couple different
  21. games... a 3-D adventure game, a scrolling game, etc.  The documented source
  22. code to the demo is available upon registration, as well as a small tutorial
  23. and hints file on how to write PC games.
  24.  
  25.  
  26.  
  27. SHAREWARE?
  28.  
  29. The VGA QLB file is shareware.  You may freely distribute it as long as it is
  30. not modified and that it is distributed with the following original,
  31. unmodified, unaltered files:
  32.  
  33.      VGA     .QLB               The VGA QuickLibrary
  34.  
  35.      3D      .EXE               Demo of 3-D adventure game
  36.      SCROLL  .EXE               Demo of Scrolling game
  37.  
  38.      DECLARE .BAS               Declare statements for all the functions
  39.      DEMO    .BAS               Demo of graphic primitives
  40.  
  41.      MANUAL  .DOC               This manual
  42.      REGISTER.DOC               Registration form
  43.      
  44.  
  45. Feel free to use the QuickLibrary as much as you like.  It will allow you to
  46. use ALL of the functions in the run-time environment and allow you to "try
  47. before you buy."  That way, you can decide whether or not it will help you
  48. and whether you should buy it.
  49.  
  50. I encourage all of you who are seriously interested in PC game/graphics
  51. programming to register.  
  52.  
  53. Registered users will receive the latest version of the library (the .QLB
  54. file and the .LIB) and discounts on future revisions of the VGALIB, an
  55. updated manual, the source code and data files that make up the demo
  56. programs, other special programs not in the evaluation package, a small
  57. tutorial/hints file on programming PC games, a periodic game programmers
  58. newsletter, and my gratitude.  
  59.  
  60. I have a lot of things planned for this library.  Just some of things I plan
  61. to do (if there is enough interest..ie. registered users) are as follows:
  62.  
  63.  
  64.      1)    Add support for 256 color SVGA modes, 640 x 400, 640 x 480, and
  65.            800x600 modes.
  66.  
  67.      2)    Add support for using graphics primitives on the virtual screens. 
  68.            Being able to use LINE200, XLINE200, CIRCLE200, etc. on the virtual
  69.            screens.
  70.  
  71.      3)    Add support for loading, saving and manipulating images in various
  72.            formats, including GIF, PCX, MAC, and others.
  73.  
  74.      4)    Start a BBS dedicated to PC Game Programming with the current
  75.            version of my library available for registers users, as well as
  76.            forums about programming various types of games.  There will be a
  77.            technical support forum for my library where any questions you may
  78.            have can be answered by myself.
  79.  
  80. But none of this will happen unless you register it.  I put a lot of money,
  81. research, and programming time into creating and testing this library.  And
  82. my wife put up with me through all of this without asking for a divorce -- so
  83. please register it or she won't let me come out with version 2.
  84.  
  85.  
  86. GETTING STARTED
  87.  
  88. The first thing you should do is create a directory for the QuickLibrary and
  89. the demo program.  For example:
  90.  
  91. MD \VGALIB
  92.  
  93. Next, unzip the files into the directory and you're ready to go.  To start
  94. the demo, type DEMO at the prompt:
  95.  
  96. C:\VGALIB>DEMO
  97.  
  98. This will start the demo of the libraries features and some of the game
  99. programming genres (ie. 3-D Adventure games, Scrolling action games, etc.). 
  100. This also does a speed comparison between my graphic primitives and BASIC's
  101. functions.
  102.  
  103.  
  104. USING GRAPHICS FUNCTIONS IN THE QUICKBASIC ENVIRONMENT
  105.  
  106. The VGA Library is written for QuickBASIC 4.x.  Although I have only tested
  107. it with QuickBASIC 4.5, it should work with any version 4.  The registered
  108. version will run with BASIC PDS 7.x as well.
  109.  
  110. To use the VGA QuickLib (.QLB) in the QuickBASIC editor, you must start QB
  111. with the /L parameter followed by the path and name of the library.  For
  112. example:
  113.  
  114. C:\QB45>QB /LC:\VGALIB\VGALIB.QLB
  115.  
  116. This will cause QB to load the VGA graphics library into memory and allow you
  117. to access all of it's functions in the run-time environment.
  118.  
  119.  
  120.  
  121. DECLARING THE SUBROUTINES
  122.  
  123. All of the VGALIB commands are defined as subroutines.  You MUST declare any
  124. routines in be beginning of your program for them to work correctly.  If you
  125. do not declare the subroutines in your program, weird results may occur,
  126. including system lockup, garbled screen results, etc.
  127.  
  128. The basic program DECLARE.BAS, which is included, has the necessary
  129. declaration statements for you to access all of the functions.
  130.  
  131.  
  132.  
  133. THE LIBRARY
  134.  
  135. The following is a list of the commands, calling syntax, and a brief
  136. description of what each command does and any of my own comments.
  137.  
  138. In the 320x200 mode, you should only use the routines that end with the
  139. suffix 200 (ie. PSET200, LINE200, etc.) .  When in the 320x240 mode or the
  140. 320x400 mode, please use only routines that end with 240 (ie. PSET240,
  141. LINE240, PUT240, etc.)
  142.  
  143. Since I only added 320x240 and 320x400 support recently, some of the routines
  144. are slow but that will soon be remedied as I get more accustomed to the setup
  145. of the VGA memory in these extended modes.
  146.  
  147.  
  148. SET320x200
  149.  
  150.      Syntax:          Call SET320x200 or
  151.                       SET320x200
  152.        
  153.      Description:     This routine uses the DOS Interrupt to set the screen
  154.                       into graphics mode.  It sets up graphics mode 13H, which
  155.                       is the 320 x 200 mode in 256 colors.
  156.  
  157.                       WARNING!  If you use this command to switch to graphics
  158.                       mode, most of the QB graphics functions WILL NOT work
  159.                       because the QB SCREEN statement sets an internal QB
  160.                       variable that tells the QB environment which graphics
  161.                       mode it's in.  This subroutine DOES NOT set that variable
  162.                       so as far as QB is concerned...you're still in text mode. 
  163.                       CLS, LINE, PAINT, PSET, GET, PUT, and PRINT WILL NOT
  164.                       function when the SET320x200 is used.
  165.  
  166. SET320x240
  167.  
  168.      Syntax:          Call SET320x240 or
  169.                       SET320x240
  170.        
  171.      Description:     This routine uses the DOS Interrupt to set the screen
  172.                       into graphics mode.  It sets up graphics mode 13H, which
  173.                       is the 320 x 200 mode in 256 colors.  Then, it changes a
  174.                       few things around to give you 240 scan lines instead of
  175.                       200.  I won't go into specifics here.
  176.  
  177.                       WARNING!  When you are in this mode, use only the
  178.                       commands that end in 240....(ie. PSET240, POINT240,
  179.                       LINE240, etc.)  Using the other commands will cause
  180.                       bizarre results.  As of this writing there is no support
  181.                       to PRINT text in either the 320x240 or the 320x400
  182.                       modes... that will be added shortly.
  183.  
  184. SET320x400
  185.  
  186.      Syntax:          Call SET320x400 or
  187.                       SET320x400
  188.        
  189.      Description:     This routine uses the DOS Interrupt to set the screen
  190.                       into graphics mode.  It sets up graphics mode 13H, which
  191.                       is the 320 x 200 mode in 256 colors.  Then, it changes a
  192.                       few things around to give you 400 scan lines instead of
  193.                       200.  Again, I won't go into specifics here.  Register if
  194.                       you want more details.
  195.  
  196.                       WARNING!  When you are in this mode, use only the
  197.                       commands that end in 240....(ie. PSET240, POINT240,
  198.                       LINE240, etc.)  Using the other commands will cause
  199.                       bizarre results.  As of this writing there is no support
  200.                       to PRINT text in either the 320x240 or the 320x400
  201.                       modes... that will be added shortly.  The way the video
  202.                       memory is set up in the 320x240 and the 320x400 modes is
  203.                       identical so you can use the commands from the 240 mode
  204.                       in the 400 mode.
  205.  
  206. SET80x25
  207.  
  208.      Syntax:          Call SET80x25 or
  209.                       SET80x25
  210.        
  211.      Description:     This routine uses the DOS Interrupt to set the screen
  212.                       into text mode.
  213.  
  214.                       Normally, when QB terminates a program, it automatically
  215.                       exits to text mode.  If you used the SET320x200 sub to
  216.                       set the graphics mode, then YOU must set text mode before
  217.                       the program terminates or you will drop the user to DOS
  218.                       in graphics mode. 
  219.  
  220.  
  221. PSET200
  222.  
  223.      Syntax:          Call PSET200 (X%, Y%, Color%) or
  224.                       PSET200 X%, Y%, Color%
  225.  
  226.      Description:     This routine will set individual pixels on the screen. 
  227.                       It will set the pixel at column X% and row Y% to what
  228.                       ever color is specified by the Color% variable. (See
  229.                       DEMO.EXE or DEMO.BAS)
  230.  
  231.                       Other notes:  In the 320x240 mode & the 320x400 mode, you
  232.                       may use the PSET240 command, which has the identical
  233.                       syntax as the PSET200.
  234.  
  235. POINT200
  236.  
  237.      Syntax:          A%=PSET200 (X%, Y%) or
  238.                       
  239.      Description:     This routine will return the value of individual pixels
  240.                       on the screen.  POINT200 is almost identical to the BASIC
  241.                       Point function.
  242.  
  243.                       Other notes:  In the 320x240 mode & the 320x400 mode, you
  244.                       may use the POINT240 function, which has the identical
  245.                       syntax as the PSET200.
  246.  
  247. LINE200
  248.  
  249.      Syntax:          CALL LINE200(X1%, Y1%, X2%, Y2%, Color%) or
  250.                       LINE200 X1%, Y1%, X2%, Y2%, Color%
  251.  
  252.      Description:     Similar to QB's own LINE statement, the Line200 routine
  253.                       will draw a straight line between two points in the given
  254.                       color.  It is faster than the QB LINE statement. (See
  255.                       DEMO.EXE or DEMO.BAS)
  256.  
  257.                       Other notes:  In the 320x240 mode & the 320x400 mode, you
  258.                       may use the LINE240 command, which has the identical
  259.                       syntax as the LINE200.
  260.  
  261. XLINE200
  262.  
  263.      Syntax:          CALL XLINE200 (X1%, Y1%, X2%, Y2%, Color%) or
  264.                       XLINE200 X1%, Y1%, X2%, Y2%, Color%
  265.  
  266.      Description:     This routine is identical to the LINE200 routine above
  267.                       except it XORs the line on top of the existing
  268.                       background.  Consequently, if you XOR it back on, it will
  269.                       effectively erase itself, leaving the background
  270.                       unaffected.  This technique is often referred to as
  271.                       "rubberbanding."  (See DEMO.EXE or DEMO.BAS)
  272.  
  273.                       Other notes:  There is no XLINE  command for the 320x240
  274.                       mode & the 320x400 mode yet but it will be added shortly.
  275.  
  276.  
  277. BOX200     
  278.  
  279.      Syntax:          CALL BOX200 (X1%, Y1%, X2%, Y2%, Color%) or
  280.                       BOX200 X1%, Y1%, X2%, Y2%, Color%
  281.  
  282.      Description:     The BOX200 routine is very similar to the QB LINE command
  283.                       with the B option to create the outline of a box.  It
  284.                       create the outline of a box at the given coordinates.
  285.                       (See DEMO.EXE or DEMO.BAS)
  286.  
  287.                       Other notes:  In the 320x240 mode & the 320x400 mode, you
  288.                       may use the Box240 command, which has the identical
  289.                       syntax as the Box200.
  290.  
  291. BOXF200    
  292.  
  293.      Syntax:          CALL BOXF200 (X1%, Y1%, X2%, Y2%, Color%) or
  294.                       BOXF200 X1%, Y1%, X2%, Y2%, Color%
  295.  
  296.      Description:     The BOXF200 routine is very similar to the QB LINE
  297.                       command with the BF option to create the outline of a
  298.                       box.  It create the a box filled with the given color at
  299.                       the specified coordinates.  (See DEMO.EXE or DEMO.BAS)
  300.  
  301.                       Other notes:  In the 320x240 mode & the 320x400 mode, you
  302.                       may use the BoxF240 command, which has the identical
  303.                       syntax as the BoxF200.
  304.  
  305. CIRCLE200  
  306.  
  307.      Syntax:          CALL CIRCLE200 (X%, Y%, Radius%, Color%) or
  308.                       CIRLCE200 X%, Y%, Radius%, Color%
  309.  
  310.      Description:     This routine creates a circle who center is X%, Y% and
  311.                       whose radius is determined by the Radius% variable.  This
  312.                       creates only the circle outline, not a filled circle. 
  313.                       (See DEMO.EXE or DEMO.BAS)
  314.  
  315.                       Other notes:  In the 320x240 mode & the 320x400 mode, you
  316.                       may use the Circle240 command, which has the identical
  317.                       syntax as the Circle200.
  318.  
  319. GET200     
  320.  
  321.      Syntax:          CALL GET200 (X1%, Y1%, X2%, Y2%, Array(Offset%)) or
  322.                       GET200 X1%, Y1%, X2%, Y2%, Array(Offset%)
  323.  
  324.      Description:     Similar, but MUCH faster than BASIC's GET command, the
  325.                       GET200 routine will quickly copy an image from the screen
  326.                       to the an array.  The array must be previously
  327.                       dimensioned and can be either STATIC or DYNAMIC. 
  328.                       IMPORTANT!  DO NOT USE A CONVENTIONAL STRING ARRAY. 
  329.                       Doing so will cause unpredictable results.  You may
  330.                       however, use fixed length string arrays which you have
  331.                       created, or numeric arrays.
  332.  
  333.                       The size of the array is calculated as follows:
  334.  
  335.                            XDistance%  = ABS(X2% - X1%) + 1
  336.                            YDistance%  = ABS(Y2% - Y1%) + 1
  337.                            NumOfBytes% = XDistance% *YDistance% +10
  338.                            ArraySize% = NumOfBytes% \ ElementSize%
  339.  
  340.  
  341.                       ElementSize% depends on what type of array you are using.
  342.  
  343.                            Type of Array         ElementSize% 
  344.  
  345.                            Integer                    2
  346.                            Long Integer               4
  347.                            Single Precision           4
  348.                            Double Precision           8
  349.                            TYPE array                 Size TYPE
  350.         
  351.                       Other notes:  In the 320x240 mode & the 320x400 mode,
  352.                       there is not yet a GET command.  However, if you GET
  353.                       something using the GET200 command, you can use the
  354.                       PUT240 command to display it in the 320x240 & 32x400
  355.                       modes.
  356.  
  357. PUT200
  358.  
  359.      Syntax:          CALL PUT200 (X%, Y%, Array(Offset%), Operation%) or
  360.                       PUT256 X%, Y%, Array(Offset%), Operation%
  361.  
  362.      Description:     Again, the PUT200 is a faster version of BASIC's PUT
  363.                       command. It will quickly display an image that was
  364.                       captured using the GET200 command.  The Operation%
  365.                       variable is a logical operation.  The logical operations
  366.                       supported are:
  367.  
  368.  
  369.                            0               PSET            The image in the
  370.                                                            array will overwrite
  371.                                                            anything on the
  372.                                                            screen.
  373.  
  374.                            1               XOR             The image in the
  375.                                                            array will be XORed
  376.                                                            on to the screen.
  377.  
  378.                            2               AND             The image in the
  379.                                                            array will be ANDed
  380.                                                            onto the screen.
  381.  
  382.                            3               OR              The image in the
  383.                                                            array will be ORed
  384.                                                            onto the screen.
  385.                       
  386.                       Using the XOR logical operator, you can display an image
  387.                       on a complex background, and when you XOR it again it
  388.                       will disappear, restoring the original screen.  This is
  389.                       useful for some animation but causes flickering.
  390.  
  391.                       Other notes:  In the 320x240 mode & the 320x400 mode, you
  392.                       may use the PUT240 command, which has the identical
  393.                       syntax as the PUT200, except that it does not yet support
  394.                       the logical operators...only the PSET option.  The syntax
  395.                       is the same except that you do not include a logical
  396.                       operator.
  397.  
  398.  
  399. TPUT200
  400.  
  401.      Syntax:          CALL TPUT200 (X%, Y%, Array(Offset%)) or
  402.                       TPUT200 X%, Y%, Array(Offset%)
  403.  
  404.      Description:     This is a special routine that I made myself.  It the
  405.                       Transparent PUT200 routine.  Like PUT200, the TPUT200
  406.                       routine quickly copy an image captured with the GET200
  407.                       command to the screen.  However, the TPUT200 routine WILL
  408.                       NOT copy any pixel in the array that is color 255.  This
  409.                       is similar to the movie/TV technique called "blue
  410.                       screening."  
  411.  
  412.                       Other notes:  There is no TPUT command for the 320x240
  413.                       and 320x400 modes yet.  It should be done by time you
  414.                       register.
  415.  
  416. RPUT200
  417.  
  418.      Syntax:          CALL RPUT200 (X%, Y%, Array(Offset%)) or
  419.                       RPUT200 X%, Y%, Array(Offset%)
  420.  
  421.      Description:     This is a special routine that I made myself.  It the
  422.                       Reverse PUT200 routine.  Like PUT200, the RPUT200 routine
  423.                       quickly copy an image captured with the GET200 command to
  424.                       the screen.  However, the RPUT200 routine reverses the
  425.                       image from left to right. 
  426.  
  427.      
  428.                       Other notes:  There is no RPUT command for the 320x240
  429.                       and 320x400 modes yet.  It should be finished by time you
  430.                       register.
  431.  
  432.  
  433. VIRTUAL SCREENS
  434.  
  435. That's it for the commands you might be used to.  The next series of the
  436. commands have to do with virtual screens.  And what is a virtual screen you
  437. might ask?  What you see on the monitor is called a active screen.  The
  438. active screen is lives in the memory on your display adapter.
  439.  
  440. A virtual screen is a copy of the active screen that lives in RAM.  And
  441. because it is in RAM, we can do all sorts of neat things with it because
  442. we're not limited by the display adapter.  For instance, we can create a
  443. virtual screen that is LARGER than the active screen and then display only a
  444. part of it on the active screen.  This is a technique they often use in
  445. scrolling arcade games.
  446.  
  447. Anyway, QB doesn't really allow you to work with virtual screens.  You can do
  448. it.  Or at least I did it.  But it was SO slow it was not practical. 
  449. Consequently, I came up with some assembler routines to do the dirty work for
  450. me with considerably speeded things up.
  451.  
  452. Okay, that's it for the explanation.  There is more in the manual you get
  453. with the registered version.  Plus, the source code to SCROLL.EXE deals shows
  454. how to use virtual screens.
  455.  
  456.  
  457.  
  458. CreateVirtualScreen   
  459.  
  460.      Syntax:          CALL CreateVirtualScreen (Array(Offset%)) or
  461.                       CreateVirtualScreen X1%, Y1%, X2%, Y2%, Array(Offset%)
  462.  
  463.      Description:     This command creates a virtual screen with the array that
  464.                       you specify.  
  465.  
  466.                       Example:  CreateVirtualScreen 0, 0, 639, 479, Array(0) 
  467.                    
  468.                       That example creates a virtual screen that is 640 pixels
  469.                       wide by 480 pixels long.
  470.  
  471. VGET
  472.  
  473.      Syntax:          CALL VGET(Source(Off%)), X1%,Y1%,X2%, Y2%,Target(Off%)
  474.                       or VGET Source(Off%), X1%, Y1%, X2%, Y2%, Target(Off%)
  475.  
  476.      Description:     This command is similar to the GET200 command, except
  477.                       that it captures a rectangular image off of a virtual
  478.                       screen.  
  479.  
  480.                       Example:  VGET Source(0), 0, 0, 20, 20, Target(0)
  481.  
  482.                       In the example, VGET would copy the image off the virtual
  483.                       screen that you created in Source() at coordinates 0,0 to
  484.                       20,20 into an array called Target().  You could then
  485.                       PUT200 the image in Target() on the active screen, or use
  486.                       on of the other commands.
  487.  
  488.                       WARNING! This subroutine assumes a lot.  It assumes:
  489.                                 
  490.                                 1)    That there is a valid VIRTUAL SCREEN
  491.                                       created in the Source().
  492.  
  493.                                 2)    That the coordinates that you pass to it
  494.                                       are valid.
  495.  
  496.                                 3)    That Target() is dimensioned properly.
  497.                                       (See GET200)
  498.  
  499.                       If any of these assumptions are not met, unpredictable
  500.                       results may occur.
  501.  
  502. VPUT
  503.  
  504.      Syntax:          CALL VPUT (Target(Offset%), X%, Y%, Image(Offset%)) or
  505.                       VPUT Target(Offset%), X%, Y%, Image(Offset%)
  506.  
  507.      Description:     This is very similar to the PUT200 command, except that
  508.                       it PUTs images onto a virtual screen.  At present, it
  509.                       only supports the PSET option...no XOR, OR, AND options
  510.                       yet.
  511.  
  512.                       Again this routine assumes that the Target() array
  513.                       contains EITHER a Virtual Screen or another image that
  514.                       you've captured with the GET200 command.
  515.  
  516. VTPUT
  517.  
  518.      Syntax:          CALL VTPUT (Target(Offset%), X%, Y%,Image(Offset%)) or
  519.                       VTPUT Target(Offset%), X%, Y%, Image(Offset%)
  520.  
  521.      Description:     This is very similar to the VPUT command, except that it
  522.                       PUTs images onto a virtual screen using the "blue
  523.                       screening" technique.  (See TPUT200 for more)
  524.  
  525.                       Again this routine assumes that the Target() array
  526.                       contains EITHER a Virtual Screen or another image that
  527.                       you've captured with the GET200 command.
  528.  
  529.  
  530.  
  531.  
  532. OTHER NEAT STUFF
  533.  
  534. There are also some additional features that I've found useful for game
  535. programmers and graphics programmers alike.  They are small routines that
  536. allow you to use different fonts, routines to save/restore the VGA palette,
  537. and instructions on how to SAVE/RESTORE 256 Color Screens.  There will be
  538. more of these routines in future versions.  I plan to add support for loading
  539. & saving PCX, GIF, and other formats.  So look for future versions!
  540.  
  541.  
  542. SAVEPAL
  543.  
  544.      Syntax:          CALL SAVEPAL (Target(Offset%))
  545.                       SAVEPAL Target(Offset%)
  546.  
  547.      Description:     This subroutine saves the entire VGA color palette (all
  548.                       256 colors) into an array called Target().  The Target()
  549.                       array MUST have been previously dimensioned for at least
  550.                       768 bytes.  This is because the color palette contains
  551.                       three bytes (1 for green, blue, and red) for each color
  552.                       it saves.  So you need 256 * 3 (or 768) number of bytes
  553.                       to store the whole palette.
  554.  
  555.                       Once you have use the SAVEPAL command to save the palette
  556.                       values into an array, you may use the following technique
  557.                       to save it to disk:
  558.  
  559.                       DEFINT A-Z
  560.  
  561.                       ' Integer arrays are 2 bytes per element so we need
  562.                       ' 768 / 2 elements...or 384.
  563.  
  564.                       DIM Target(0 to 384)
  565.  
  566.                       ' Save the palette values into the array
  567.                       SAVEPAL Target(0)
  568.  
  569.                       ' Save the array to disk
  570.                       DEF SEG=VARSEG(Target(0))
  571.                       BSAVE "Test.PLT", VARPTR(Target(0)), 768
  572.                      DEF SEG
  573.                 
  574.  
  575. RESTOREPAL
  576.  
  577.      Syntax:          CALL RESTOREPAL (Source(Offset%))
  578.                       RESTOREPAL Source(Offset%)
  579.  
  580.      Description:     This subroutine restores  the entire VGA color palette
  581.                       (all 256 colors) from an array called Target().  The
  582.                       Source() array MUST have been previously dimensioned for
  583.                       at least 768 bytes and loaded with palette values.  
  584.  
  585.                       Below is a small program to restore a palette that was
  586.                       saved using the SAVEPAL routine, and then BSAVEd to disk.
  587.  
  588.                       DEFINT A-Z
  589.  
  590.                       ' Integer arrays are 2 bytes per element so we need
  591.                       ' 768 / 2 elements...or 384.
  592.  
  593.                       DIM Source(0 to 384)
  594.  
  595.                       ' Load the array from disk
  596.                       DEF SEG=VARSEG(Source(0))
  597.                       BSAVE "Test.PLT", VARPTR(Source(0))
  598.                      DEF SEG
  599.  
  600.                       ' Quickly restore the vga values
  601.                       RESTOREPAL Source(0)
  602.  
  603.  
  604.                       Other notes:  When used with the 320x240 or 320x400
  605.                       modes, you should use the RestorePal command AFTER you
  606.                       use the SET320x400/SET320x240 commands because the
  607.                       SET320x400/SET320x240 commands destroy the palette.
  608.  
  609. SETFONT200
  610.  
  611.      Syntax:          CALL SETFONT200 (FontArray(Offset%))
  612.                       SETFONT200 FontArray(Offset%)
  613.  
  614.      Description:     The SETFONT200 routine will enable a special graphics
  615.                       font which has been loaded into FontArray().  This uses
  616.                       a DOS interrupt to quickly change the VGA font table. 
  617.                       The evaluation copy comes with two fonts -- a futuristic
  618.                       font and a old looking font.  (To load a font, see
  619.                       DEMO4.EXE or DEMO4.EXE)
  620.  
  621.                       If you register you will receive a special character
  622.                       editor that will allow you to create your own fonts.
  623.  
  624. PRINT200
  625.  
  626.      Syntax:          CALL PRINT200 (X%,  Y%, Text$, Colr%)
  627.                       PRINT200 1, 1, "Hello", 14
  628.  
  629.      Description:     The PRINT200 print a string to the screen when in the
  630.                       320x200 mode at the coordinates specified by X%, Y%.  The
  631.                       Colr% variable specifies the foreground and background
  632.                       colors (something you can't do with QB PRINT).
  633.  
  634.                       Colr% = Background * 256 + Foreground
  635.  
  636.  
  637. OTHER UTILITY PROGRAMS
  638.  
  639. There are a few utility programs that are included with the registered
  640. version that help you to use the some of the VGALIB functions better.  They
  641. are:
  642.  
  643.      CHAREDIT.EXE     -    A small character editor for use with the
  644.                            SETFONT200 command.  It allows you to create as
  645.                            many 8 x 8 character fonts as your heart desires. 
  646.                            It saves fonts in BLOADable format to be used with
  647.                            the SETFONT200 command.
  648.  
  649.      SPREDIT.EXE      -    When you register your copy of VGALIB, you will
  650.                            receive my own sprite editor which will allow you
  651.                            sprites/icons which you can later animate with the
  652.                            functions in VGALIB.
  653.  
  654.  
  655.  
  656.  
  657. OTHER BENEFITS
  658.  
  659. I admit it.  Not ALL of my subroutines are faster than their BASIC
  660. counterparts.  But those that aren't are very close.  What I've tried to do
  661. is build a replacement library of graphics functions for BASIC that would
  662. allow you to totally avoid BASIC graphics library and cut down code size. 
  663. How much code size?  
  664.  
  665. Well, if you don't use any of BASIC's graphics commands...including CLS,
  666. SCREEN, LINE, GET/PUT, PAINT, PRINT, etc...you can cut down the size of your
  667. compiled code by about 20K or so.  I compiled two programs (identical except
  668. that one used BASIC's graphics commands and the other used VGALIB
  669. equivalents).  The VGALIB program compiled to just over 10K (10,976), the
  670. BASIC program compiled to just over 30K (36,222).  Not a bad savings.  It
  671. leaves you more room for your own program code.
  672.  
  673. Plus, VGALIB would make an EXCELLENT complement to Crescent's PDQ, since all
  674. of the functions and subs are made to work with integers.  With PDQ & VGALIB,
  675. you could conceivably compile graphics programs that were smaller and faster
  676. than "C" or Pascal programs.  Am I kidding?  No way.
  677.  
  678. So start programming those games you've always wanted to make.  Register your
  679. copy of VGALIB today!
  680.  
  681.  
  682.  
  683. AFTERWARD
  684.  
  685. Ok, that's it for all the hype.  This is the real me talking.  
  686.  
  687. I made VGALIB because I love to program games but I also love BASIC. And as
  688. you all know...BASIC has almost NO good graphics functions or the useful
  689. functions (GET/PUT) are slow and far from comprehensive.  
  690.  
  691. I looked for a good graphics library for BASIC but it seems all the good ones
  692. only supported "C" or Pascal...not BASIC.  I saw a really nice sounding
  693. graphics library from Company A for $250.  I called and asked them before I
  694. bought it and they said "Yeah...yeah...it'll do all those things you
  695. want...and more!"  So, I ordered it.  And it came.
  696.  
  697. The disks were in an envelope that had a sticker on it that basically said
  698. "OPEN THIS AND YOU CAN'T RETURN IT."  So here I am in a dilemma.  I can't
  699. find out if it does what they say unless I open it...and if I open it, and it
  700. doesn't do what I want...I can't return it.
  701.  
  702. Finally I decided to go ahead and open it.  Needless to say...it didn't do
  703. half the things they said it would, the manual was cryptic and the phone
  704. support person (I called 6 times and always spoke to the same person) was
  705. rude at best.  So there I was, in the same spot as before, except out $250.
  706.  
  707. That is why I am releasing my library (the QLB file at least) into Shareware. 
  708. So that you can try the graphics functions on your own system and see whether
  709. or not they are what you want.  If not, fine...you've lost nothing.  If so,
  710. all you have to do is register it and you're off and running.
  711.  
  712. I do hope you register.  But if not, at least send in your comments.  Tell me
  713. if you see something you like...and PLEASE tell me if there's something you
  714. WOULD like.
  715.  
  716. Send all comments, contributions, greeting cards, blank checks, etc. to:
  717.  
  718.  
  719.                              SCN Software Solutions
  720.                             1043 Main Street, Floor 2
  721.                              Emerald, PA  18080-1006
  722.  
  723.  
  724. Remember to make all checks or money orders payable to John or Tammy
  725. Cressman.  Thank you.
  726.