home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / vrac / svgapb21.zip / SVGAPB21.TXT < prev    next >
Text File  |  1994-05-09  |  266KB  |  10,936 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.                                   REFERENCE MANUAL
  9.  
  10.  
  11.                                    FOR SVGAPB.LIB
  12.  
  13.  
  14.                                     THE SUPER VGA
  15.  
  16.  
  17.                                   GRAPHICS LIBRARY
  18.  
  19.  
  20.                                    TO BE USED WITH
  21.  
  22.  
  23.                                  SPECTRA POWER BASIC
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.           1993-1994 by Zephyr Software - Stephen L. Balkum and Daniel A.
  45.           Sill
  46.  
  47.           All rights reserved.  No part of this book shall be reproduced or
  48.           transmitted by any means, electronic, mechanical, photocopying,
  49.           recording or otherwise, without written permission from Zephyr
  50.           Software - Stephen L. Balkum and Daniel A. Sill.
  51.  
  52.           Although every effort has been made to insure the accuracy of the
  53.           material in this book, Zephyr Software, Stephen L. Balkum and
  54.           Daniel A. Sill assume no responsibility for errors or omissions.
  55.           In addition no liability is assumed for damages resulting from
  56.           the use of the information contained herein.
  57.  
  58.           Printed in the United States of America
  59.  
  60.           Trademarks
  61.  
  62.           The Graphics Interchange Format (c) is the Copyright property of
  63.           CompuServe Incorporated.
  64.           GIF (sm) is a Service Mark property of CompuServe Incorporated.
  65.           Sound Blaster and Sound Blaster Pro are trademarks of Creative
  66.           Labs, Inc.
  67.           All others are trademarks of their respective owners.
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.                                                                          ii
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.                              SOFTWARE LICENSE AGREEMENT
  94.  
  95.                By using this software, you agree to the terms of this
  96.                                      agreement.
  97.  
  98.                No warranties are expressed or implied.  In no event
  99.                shall Zephyr Software, Stephen L. Balkum or Daniel A.
  100.                Sill be held liable for damages resulting from the use
  101.                or misuse of this product, including but not limited to
  102.                implied warranties of fitness for a particular purpose.
  103.  
  104.                The shareware version may be freely distributed as long
  105.                as all files stay together and are not modified in any
  106.                way.  No cost may be charged for the shareware version
  107.                beyond normal and reasonable copying and distribution
  108.                expenses.
  109.  
  110.                No products developed with this software shall be sold
  111.                unless this software has been registered with Zephyr
  112.                Software, Stephen L. Balkum or Daniel A. Sill.
  113.  
  114.                At no time for any reason shall this software be
  115.                reverse engineered, decompiled or disassembled.
  116.  
  117.                This software may not be rented or leased.
  118.  
  119.                This software may be used only on one terminal or one
  120.                computer at any one given moment in time.  This
  121.                software may not be installed on a network of any type.
  122.                Contact Zephyr Software, Stephen L. Balkum or Daniel A.
  123.                Sill for networking options.
  124.  
  125.                United States Government Restricted Rights:
  126.                Use, duplication or disclosure of this software and
  127.                documentation by the U.S. Government is subject to the
  128.                restrictions as set forth in subparagraph (c)(1)(ii) of
  129.                the Rights in Technical Data and Computer Software
  130.                clause at DFARS 252.227-7013.  Contractor/manufacturer
  131.                is Stephen L. Balkum and Daniel A. Sill, P.O. Box 7704,
  132.                Austin, Texas 78713-7704.
  133.  
  134.                The ownership of this software may be transferred as
  135.                long as Zephyr Software, Stephen L. Balkum or Daniel A.
  136.                Sill is notified in writing of the transfer date and
  137.                new owner.  The new owner must agree to this contract.
  138.                The transfer must include all registered updates and
  139.                previously registered versions.  The original owner may
  140.                not retain any copies in any form of the registered
  141.                software or its documents.
  142.  
  143.  
  144.  
  145.  
  146.  
  147.                                                                         iii
  148.  
  149.  
  150.  
  151.  
  152.  
  153.           INTRODUCTION
  154.  
  155.           We spent weeks searching the depths of the internet ftp sites for
  156.           a library that would allow the programmer full access to the
  157.           abilities of Super VGA.  We wanted the colors VGA could provide
  158.           and better resolution than EGA could provide.  Professionally
  159.           developed libraries with this ability were definitely out of our
  160.           price range.  After our searches continuously returned nothing,
  161.           we decided to fill the apparent void in the shareware market.
  162.  
  163.           Our searches did give two useful packages:  John Bridges' VGAKIT
  164.           and Finn Thoegersen's VGADOC.  We began with these two works and
  165.           developed a graphics library intended to allow the programmer
  166.           access to the huge world of high resolution programming.
  167.  
  168.           On the surface the task appeared quite simple.  However, it
  169.           quickly became obvious that the routines in this library would be
  170.           required to affect extremely large amounts of data.  Operations
  171.           must be quick to be successful.  Therefore, every effort was made
  172.           to create the fastest code possible - even at the expense of
  173.           size.  For this reason we opted to write code with the 32 bit
  174.           instructions of the 80386 and 80486 chips.  It is our opinion
  175.           that anyone with a hi-res card in a lesser machine may have some
  176.           priorities out of order. All routines are written in assembly and
  177.           use absolutely no floating point values.  Anytime a real number
  178.           was required, fixed point notation was used.  In addition we
  179.           attempted to write the routines such that any reasonable argument
  180.           passed can be interpreted intelligently by the library.
  181.  
  182.           With the numerous Super VGA cards available and no well
  183.           established standard we chose John Bridges' identification and
  184.           bank switching routines as a beginning.  These two routines have
  185.           undergone some modification, but not enough to justify
  186.           copyrighting this portion of the library's code by Zephyr
  187.           Software.  We have no intentions of releasing our changes to
  188.           these routines into the public domain.  From that point onward
  189.           all code is original.  In some instances common algorithms were
  190.           researched and original code written according to that algorithm.
  191.  
  192.           This Super VGA library gives the programmer transparent access to
  193.           twenty different Super VGA cards.  These cards include Acumos,
  194.           Ahead, ATI Technologies, Avance, Chips and Technologies, Cirrus
  195.           Logic, Everex, Genoa, MXIC, NCR, Oak Technologies,
  196.           Paradise/Western Digital, Primus, Realtek, Trident, Tseng Labs,
  197.           Video 7 and the VESA standard.  Please see the WHICHVGA function
  198.           for the specific chipsets.  The programmer only needs to verify
  199.           that the end user's card has been identified, but not which card
  200.           was recognized.  After proper identification, all functions react
  201.           in exactly the same fashion.  The library contains functions to
  202.           draw all of the major primitives.  In addition there are
  203.           functions that modify the screen palette, write text on the
  204.           screen with a choice of fonts and modify the reaction of the
  205.           primitives.  Identification routines include not only the video
  206.           card, but also the amount of video memory, type of processor and
  207.  
  208.  
  209.                                                                           2
  210.  
  211.  
  212.  
  213.  
  214.  
  215.           installed pointing devices.  Advanced functions provide full
  216.           mouse support (when used with a Microsoft compatible driver) and
  217.           joystick support.  Finally, support for two dimensional and three
  218.           dimensional coordinate systems is provided including rotation,
  219.           translation, scaling and projection.
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.                                                                           3
  272.  
  273.  
  274.  
  275.  
  276.  
  277.           SUGGESTED METHODS FOR USING THIS LIBRARY
  278.  
  279.           USE WITHIN THE BASIC ENVIRONMENT
  280.  
  281.           We assume that the programmer is familiar with all of the
  282.           capabilities of the Spectra Publishing's Pawer Basic (PB)
  283.           compiler and environment.  Understanding of PBLIB is encouraged.
  284.           If you wish to combine SVGAPB.PBL and additional libraries,
  285.           please see your Power Basic Users Manual.
  286.  
  287.           VERIFICATION OF A COMPUTER'S HARDWARE
  288.  
  289.           It is strongly recommended that any program written with this
  290.           library first verifies that the computer is a 80386 or better by
  291.           calling the WHICHCPU function.  Many of the library's functions
  292.           use 386 exclusive code which may cause a computer with a lesser
  293.           processor to crash.  In addition WHICHMOUSE must be called before
  294.           calling any of the mouse functions.  Lastly, it is recommended
  295.           that WHICHJOYSTICK be called before a program uses the joystick
  296.           routines.
  297.  
  298.           It is required that a program call WHICHVGA prior to any function
  299.           that communicates with the video card.  If WHICHVGA returns a
  300.           zero for unknown card type, the program should not call any
  301.           graphics function.  Without proper identification of the video
  302.           card any graphics function will likely cause a system failure.
  303.           It is recommended, although not necessary, that a program call
  304.           WHICHMEM prior to calling any RES function.  Although the video
  305.           card was properly identified, it may not have sufficient onboard
  306.           memory to support the desired resolution.  As a second check the
  307.           RES functions will do nothing if the video card has not been
  308.           identified or if the video card does not support the specified
  309.           resolution for memory or hardware reasons.
  310.  
  311.           THE 256 COLOR PALETTE
  312.  
  313.           The 256 color palette of the Super VGA cards is a six bit
  314.           palette.  Each of the 256 colors of the palette are described by
  315.           three values representing the intensity of the colors red, blue
  316.           and green.  These values can range from 0 to 63.  Anytime a value
  317.           outside of this range is used, the video card simply ignores the
  318.           upper two bits.  Therefore, 64 is the same as 0.  This should be
  319.           taken into consideration when manipulating the palette or when
  320.           importing a palette from an external source such as a GIF image.
  321.  
  322.           USE OF 2-D AND 3-D FUNCTIONS
  323.  
  324.           In the interest of speed, the 2-D and 3-D functions were written
  325.           to best work on multiple points at once.  We refer to these
  326.           functions as object-oriented.  This means that the points
  327.           defining an object (a box, a house, etc.) should be contained
  328.           within one array or part of an array and calls to the functions
  329.           should act on all of the points in the array.  Calls to functions
  330.           have a high speed overhead, therefore, placing more than one
  331.  
  332.  
  333.                                                                           4
  334.  
  335.  
  336.  
  337.  
  338.  
  339.           object in the same array and passing the entire array to the
  340.           functions can be beneficial.  However, these functions will work
  341.           on a single point as well.
  342.  
  343.           Another consequence of our object-oriented 2-D and 3-D functions
  344.           is the use of the scaling functions.  When scaling objects, we
  345.           recommend the object be defined about the origin.  D2SCALE and
  346.           D3SCALE both work with respect to the origin.  This eliminates a
  347.           significant number of translations that would otherwise be
  348.           required by having a definable scale origin.  For example, to
  349.           draw two boxes, one scaled by one-half of the other, each rotated
  350.           by 45 degrees at the center of the screen, the recommended
  351.           procedure is as follows:
  352.  
  353.             define an array BOX containing the 2-D points: (100, 100), (-
  354.                100, 100), (-100, -100), (100, -100), (note: the box is
  355.                centered about the origin.)
  356.             rotate BOX by 45 degrees about (0, 0) and place the output in
  357.                RBOX,
  358.             scale RBOX by 50% (scaling factor would be 128, or 80 hex) and
  359.                place output in SRBOX,
  360.             translate RBOX to the center of the screen - a translation of
  361.                320, 240 in 640x480 resolution - and place output in TRBOX,
  362.             translate SRBOX to the center of the screen - same translation
  363.                as for RBOX - and place output in TSRBOX,
  364.             draw TRBOX and TSRBOX on the screen.
  365.  
  366.           Notice that by defining the box centered about the origin the
  367.           translation values were extremely intuitive.  Also notice that if
  368.           we had scaled the second box after the translation, it would have
  369.           been draw in the upper left quadrant of the screen instead of the
  370.           center.
  371.  
  372.           In mathematics and many sciences it is customary that in a 2-D
  373.           coordinate system the Y axis increases upward and the X axis
  374.           increases to the right.  The computer industry has decided the Y
  375.           axis should increase downward.  The 2-D functions are not
  376.           affected by the choice in coordinate systems.  However, it is
  377.           important to remember that a positive rotation in D2ROTATE
  378.           rotates from the positive X axis to the positive Y axis.
  379.           Therefore, when using mathematical conventions, a positive
  380.           rotation moves counter-clockwise.  On the computer screen a
  381.           positive rotation moves clockwise.
  382.  
  383.           The 3-D coordinate system follows mathematical conventions by
  384.           using a right-handed coordinate system.  The easiest way to
  385.           visualize this coordinate system is by using your right hand.
  386.           Place your index finger and thumb at a right angle to one another
  387.           as if to form an imaginary pistol.  Now place your second finger
  388.           at a right angle to your index finger.  It should be at a right
  389.           angle to your thumb as well.  This represents the three axes.
  390.           The index finger is the X axis, the second finger is the Y axis
  391.           and the thumb is the Z axis.  The easiest way to remember
  392.           rotation directions in this system is cyclically.  A positive
  393.  
  394.  
  395.                                                                           5
  396.  
  397.  
  398.  
  399.  
  400.  
  401.           rotation about the X axis rotates the Y axis into the Z axis.  A
  402.           positive rotation about the Y axis rotates the Z axis into the X
  403.           axis.  A positive rotation about the Z axis rotates the X axis
  404.           into the Y axis.
  405.  
  406.           After doing all necessary 3-D transformations, projection onto
  407.           the 2-D computer screen is required.  Although the computer
  408.           screen's coordinate system does not follow mathematical
  409.           conventions, the D3PROJECT function automatically takes care of
  410.           all conversions.  The programmer only needs to draw the resulting
  411.           object on the screen with FILLCONVEXPOLY or a series of DRWLINEs.
  412.  
  413.           THE CONCEPT OF SPRITE GRAPHICS
  414.  
  415.           The key to sprite graphics is the assumption that only a small
  416.           percentage of the pixels in a graphics block are used by the
  417.           animation and the remaining pixels should be treated as
  418.           transparent, revealing the background behind the sprite.  The
  419.           sprite routines in this library only act on non-transparent
  420.           colors, thus, saving time by ignoring a large number of pixels.
  421.           When retrieving the background for a sprite, prior knowledge of
  422.           the sprite itself permits obtaining background only where it is
  423.           necessary.
  424.  
  425.           The following steps outline an example of the recommended
  426.           procedure for using the sprite functions:
  427.  
  428.             1. draw the sprite on the screen - a white stick figure on a
  429.                black background, for example
  430.             2. use BLKGET to place the sprite in an array STICK
  431.             3. use SPRITEGAP to simultaneously retrieve the background into
  432.                BACKSTICK and place STICK on the screen, declaring black as
  433.                the transparent color
  434.             4. use SPRITEPUT to replace the background BACKSTICK in the
  435.                same location as step 3
  436.             5. repeat steps 3 and 4 as many times and in as many locations
  437.                as desired
  438.  
  439.           EXTENDED MEMORY SUPPORT
  440.  
  441.           With the higher screen resolutions, more memory may be needed for
  442.           data storage.  For this reason extended memory support is
  443.           provided.  Accessing extended memory requires the computer to
  444.           switch into protected mode.  The process of switching into
  445.           protected mode and returning is handled by the extended memory
  446.           manager, usually HIMEM.SYS.  The switch is relatively slow.
  447.           Therefore, it should be used as fast storage access since it is
  448.           much faster than disk access.
  449.  
  450.           Extended memory access is also limited by the number of available
  451.           handles.  The limit is controlled by a switch on the extended
  452.           memory manager's command line and normally defaults to 32.  Also,
  453.           it is imperative that all allocated extended memory blocks be
  454.  
  455.  
  456.  
  457.                                                                           6
  458.  
  459.  
  460.  
  461.  
  462.  
  463.           freed before the program terminates.  Unfreed memory blocks will
  464.           be unavailable until the computer is rebooted.
  465.  
  466.           CONVENTIONS USED IN THIS MANUAL
  467.  
  468.           All parameters, other than strings, passed to and from functions
  469.           and procedures in this QuickBasic library are short (two byte)
  470.           integers.  No floating point values are used.
  471.  
  472.           Whenever a pixel is written on the screen, a mode is required.
  473.           Unless otherwise noted, there are four possible modes:  SET, XOR,
  474.           OR and AND.  These modes are represented by the numbers one
  475.           through four respectively.  Technically, SET is the fastest mode.
  476.           However, XOR maybe the most useful.  XOR'ing a point twice with
  477.           the same color returns the original color.  This can be used to
  478.           cover and uncover graphics.  In addition when a reference to a
  479.           color index is made, only values between and including 0 and 255
  480.           are valid.  Any integer will work, but only the lowest eight bits
  481.           are recognized.
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.                                                                           7
  520.  
  521.  
  522.  
  523.  
  524.  
  525.           BLKGET
  526.  
  527.             PROTOTYPE
  528.  
  529.             SUB BLKGET (X1%, Y1%, X2%, Y2%, GfxBlk%)
  530.  
  531.             INPUT
  532.  
  533.             X1, Y1 - top left corner of block
  534.             X2, Y2 - bottom right corner of block
  535.  
  536.             OUTPUT
  537.  
  538.             If declared as a function, BLKGET returns 1 if successful, 0
  539.             if failed.
  540.             GfxBlk - integer destination array holding retrieved bitmap
  541.  
  542.             USAGE
  543.  
  544.             BLKGET stores the pixel data contained within the block
  545.             defined by (X1, Y1)-(X2, Y2) in the variable referenced by
  546.             GfxBlk.  GfxBlk must be dimensioned as a short integer array
  547.             with a size in integers equal to
  548.                              [(X2-X1+1)*(Y2-Y1+1)] / 2+3.
  549.  
  550.             Note, however, that GfxBlk can be quite large.  If the size of
  551.             GfxBlk is insufficient, BLKGET will overwrite any data in
  552.             memory contained beyond GfxBlk and may possibly cause the
  553.             system to crash.  BLKGET enforces X2 X1 and Y2Y1.  Also, the
  554.             coordinates must be valid on the screen at the current
  555.             resolution.
  556.  
  557.             The bitmap is stored such that the first integer in the
  558.             destination array is the width and the second integer is the
  559.             height.  The remaining bytes are the bitmap raster data stored
  560.             by rows starting at the top of the block.
  561.  
  562.             Arrays should be passed by giving the element within the array
  563.             from where the action should take place.  This allows the
  564.             programmer to store more than one item within the same array
  565.             or act on only a portion of the array.
  566.  
  567.             SEE ALSO
  568.  
  569.             BLKPUT, BLKRESIZE, BLKROTATE, GETLASTSTRING, SPRITEGAP,
  570.             SPRITEGET, SPRITEPUT
  571.  
  572.             EXAMPLE
  573.  
  574.             REM PLACES 1/4 OF A CIRCLE AT THE CENTER OF THE SCREEN
  575.             $LINK "SVGAPB.PBL"
  576.             $INCLUDE "SVGAPB.BI"
  577.             DEFINT A-Z
  578.             DIM BLOCKDATA(483) AS INTEGER
  579.  
  580.  
  581.                                                                           8
  582.  
  583.  
  584.  
  585.  
  586.  
  587.             IF WHICHVGA = 0 THEN STOP
  588.             DUMMY=RES640
  589.             DRWCIRCLE 1, 10, 30, 30, 20
  590.             FILLAREA 30, 30, 10, 7
  591.             BLKGET 0, 0, 30, 30, BLOCKDATA(0)
  592.             BLKPUT 1, 320, 240, BLOCKDATA(0)
  593.             WHILE INKEY$ = "" : WEND
  594.             DUMMY=RESTEXT
  595.             END
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.                                                                           9
  644.  
  645.  
  646.  
  647.  
  648.  
  649.           BLKPUT
  650.  
  651.             PROTOTYPE
  652.  
  653.             SUB BLKPUT (Mode%, X%, Y%, GfxBlk%)
  654.  
  655.             INPUT
  656.  
  657.             Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  658.             X, Y - location for top left corner of block
  659.             GfxBlk - integer source array
  660.  
  661.             OUTPUT
  662.  
  663.             no value returned
  664.  
  665.             USAGE
  666.  
  667.             BLKPUT places the pixel data contained in the variable
  668.             referenced by GfxBlk on the screen.  The top, left corner of
  669.             the block is specified by (X, Y).  Any (X, Y) is acceptable
  670.             and any portion of the block that lies outside of the
  671.             currently defined viewport will not be drawn.
  672.  
  673.             Arrays should be passed by giving the element within the array
  674.             from where the action should take place.  This allows the
  675.             programmer to store more than one item within the same array
  676.             or act on only a portion of the array.
  677.  
  678.             SEE ALSO
  679.  
  680.             BLKGET, BLKRESIZE, BLKROTATE, GETLASTSTRING, SPRITEGAP,
  681.             SPRITEGET, SPRITEPUT, GIFPUT, SETVIEW
  682.  
  683.             EXAMPLE
  684.  
  685.             See BLKGET
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.                                                                          10
  706.  
  707.  
  708.  
  709.  
  710.  
  711.           BLKRESIZE
  712.  
  713.             PROTOTYPE
  714.  
  715.             SUB BLKRESIZE (X%, Y%, SourceGfxBlk%, DestGfxBlk%)
  716.  
  717.             INPUT
  718.  
  719.             NewXSize, NewYSize - size of resulting bitmap in DestGfxBlk
  720.             SourceGfxBlk - integer source array
  721.  
  722.             OUTPUT
  723.  
  724.             no value returned
  725.             DestGfxBlk - integer destination array holding resized bitmap
  726.  
  727.             USAGE
  728.  
  729.             BLKRESIZE takes the bitmap in SourceGfxBlk and scales it up or
  730.             down according the to values passed in NewXSize and NewYSize.
  731.             The resulting bitmap is returned in DestGfxBlk which should
  732.             already be declared with a size calculated according to the
  733.             equation in BLKGET.  NewXSize and NewYSize should not be zero.
  734.  
  735.             SEE ALSO
  736.  
  737.             BLKGET, BLKPUT, BLKROTATE
  738.  
  739.             EXAMPLE
  740.  
  741.             REM  RESIZE A BITMAP
  742.             $LINK "SVGAPB.PBL"
  743.             $INCLUDE "SVGAPB.BI"
  744.             DEFINT A-Z
  745.             DIM SRC%(0 TO 32000)
  746.             DIM DST%(0 TO 32000)
  747.  
  748.             IF WHICHCPU < 386 THEN END
  749.             IF WHICHVGA = 0 THEN END
  750.             VMODE=VIDEOMODEGET
  751.             IF RES640 <> 1 THEN
  752.                 DUMMY = RESTEXT
  753.                 END
  754.             END IF
  755.             X1 = 0
  756.             Y1 = 0
  757.             X2 = 50
  758.             Y2 = 50
  759.             FOR I = 0 TO 25
  760.                 XA = (RND * X2 - X1) + X1
  761.                 YA = (RND * Y2 - Y1) + Y1
  762.                 XB = (RND * X2 - X1) + X1
  763.                 YB = (RND * Y2 - Y1) + Y1
  764.                 C = RND * 16
  765.  
  766.  
  767.                                                                          11
  768.  
  769.  
  770.  
  771.  
  772.  
  773.                 DRWLINE 1, C, XA, YA, XB, YB
  774.             NEXT I
  775.             DRWBOX 1, 15, X1, Y1, X2, Y2
  776.             BLKGET X1, Y1, X2, Y2, SRC(0)
  777.             X1 = GETMAXX \ 2
  778.             Y1 = GETMAXY \ 2
  779.             X = SRC(0) + 1
  780.             Y = SRC(1) + 1
  781.             BLKRESIZE X, Y, SRC(0), DST(0)
  782.             BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  783.             FOR I = X TO X + 50
  784.                 BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  785.                 BLKRESIZE I, I, SRC(0), DST(0)
  786.                 BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  787.                 SDELAY 3
  788.             NEXT I
  789.             FOR I = X + 50 TO X - 50 STEP -1
  790.                 BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  791.                 BLKRESIZE I, I, SRC(0), DST(0)
  792.                 BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  793.                 SDELAY 3
  794.             NEXT I
  795.             FOR I = X - 50 TO X
  796.                 BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  797.                 BLKRESIZE I, I, SRC(0), DST(0)
  798.                 BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  799.                 SDELAY 3
  800.             NEXT I
  801.             VIDEOMODESET VMODE
  802.             END
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.                                                                          12
  830.  
  831.  
  832.  
  833.  
  834.  
  835.           BLKROTATE
  836.  
  837.             PROTOTYPE
  838.  
  839.             FUNCTION BLKROTATE% (Ang%, BackFill%, SourceGfxBlk%,
  840.             DestGfxBlk%)
  841.  
  842.             INPUT
  843.  
  844.             Ang - integer degree to rotate source bitmap
  845.             BackFillColor - index to color in current palette to fill
  846.             blank space in DestGfxBlk
  847.             SourceGfxBlk - integer source array
  848.  
  849.             OUTPUT
  850.  
  851.             BLKROTATE returns 1 if successful, 0 if unsuccessful.
  852.             DestGfxBlk - integer destination array holding rotated bitmap
  853.  
  854.             USAGE
  855.  
  856.             BLKROTATE takes the bitmap in SourceGfxBlk and rotates by the
  857.             number of degrees specified in Ang.  The bitmap rotation
  858.             algorithm is a three-pass shear technique modified to make
  859.             efficient use of this library's internal buffers.  Blank space
  860.             around the newly rotated block is filled with the color given
  861.             by BackFillColor.  The resulting bitmap is stored in
  862.             DestGfxBlk.  The size of DestGfxBlk should be at least as big
  863.             as given by BLKROTATESIZE.
  864.  
  865.             The function will fail if it calculates that the internal
  866.             buffers would be overflowed or if the destination array would
  867.             be larger than 65536 bytes.  BLKROTATESIZE should be called
  868.             first to ensure that buffer integrity is maintained.
  869.  
  870.             SEE ALSO
  871.  
  872.             BLKGET, BLKPUT, BLKRESIZE, BLKROTATESIZE
  873.  
  874.             EXAMPLE
  875.  
  876.             REM ROTATE A BITMAP
  877.             $LINK "SVGAPB.PBL"
  878.             $INCLUDE "SVGAPB.BI"
  879.             DEFINT A-Z
  880.             DIM SRC%(0 TO 32000)
  881.             DIM DST%(0 TO 32000)
  882.             IF WHICHCPU < 386 THEN END
  883.             IF WHICHVGA = 0 THEN END
  884.             VMODE = VIDEOMODEGET
  885.             IF RES640 <> 1 THEN
  886.                 DUMMY = RESTEXT
  887.                 END
  888.             END IF
  889.  
  890.  
  891.                                                                          13
  892.  
  893.  
  894.  
  895.  
  896.  
  897.             X1 = 0
  898.             Y1 = 0
  899.             X2 = 110
  900.             Y2 = 110
  901.             FOR I = 0 TO 50
  902.                 XA = (RND * X2 - X1) + X1
  903.                 YA = (RND * Y2 - Y1) + Y1
  904.                 XB = (RND * X2 - X1) + X1
  905.                 YB = (RND * Y2 - Y1) + Y1
  906.                 C = RND * 16
  907.                 DRWLINE 1, C, XA, YA, XB, YB
  908.             NEXT I
  909.             DRWBOX 1, 15, X1, Y1, X2, Y2
  910.             BLKGET X1, Y1, X2, Y2, SRC(0)
  911.             X1 = GETMAXX \ 2
  912.             Y1 = GETMAXY \ 2
  913.             FOR I = 0 TO 359 STEP 6
  914.                 IF BLKROTATESIZE(I, SRC(0)) <> 0 THEN
  915.                  DUMMY = BLKROTATE(I, 0, SRC(0), DST(0))
  916.                  BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  917.                  SDELAY 3
  918.                  BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  919.                 END IF
  920.             NEXT I
  921.             VIDEOMODESET VMODE
  922.             END
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.                                                                          14
  954.  
  955.  
  956.  
  957.  
  958.  
  959.           BLKROTATESIZE
  960.  
  961.             PROTOTYPE
  962.  
  963.             FUNCTION BLKROTATESIZE& (Ang%, SourceGfxBlk%)
  964.  
  965.             INPUT
  966.  
  967.             Ang - integer degree to rotate source bitmap
  968.             SourceGfxBlk - integer source array
  969.  
  970.             OUTPUT
  971.  
  972.             BLKROTATESIZE returns the number of bytes needed for the
  973.             destination array if successful, 0 if unsuccessful.
  974.  
  975.             USAGE
  976.  
  977.             BLKROTATESIZE takes the bitmap in SourceGfxBlk calculates the
  978.             required size of the output buffer needed when BLKROTATE is
  979.             called.  It also insures that the internal library buffers are
  980.             not overflowed.  The function will fail if it calculates that
  981.             the internal buffers would be overflowed or if the destination
  982.             array would be larger than 65536 bytes.  BLKROTATESIZE should
  983.             be called prior to BLKROTATE to ensure that buffer integrity
  984.             is maintained.
  985.  
  986.             SEE ALSO
  987.  
  988.             BLKGET, BLKPUT, BLKRESIZE, BLKROTATE
  989.  
  990.             EXAMPLE
  991.  
  992.             See BLKROTATE
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.                                                                          15
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.           BYTECOPY
  1022.  
  1023.             PROTOTYPE
  1024.  
  1025.             SUB BYTECOPY (SourceArray%, DestArray%, NumOfBytes&)
  1026.  
  1027.             INPUT
  1028.  
  1029.             SrcArray - integer array to be copied
  1030.             NumBytes - number of bytes to copy from SrcArray to DestArray
  1031.  
  1032.             OUTPUT
  1033.  
  1034.             no value returned
  1035.             DestArray - integer destination array holding copied data
  1036.  
  1037.             USAGE
  1038.  
  1039.             BYTECOPY copies the specified number of bytes from SrcArray to
  1040.             DestArray.  It is much faster than using a FOR/NEXT loop.  The
  1041.             arrays must be integer arrays.  NumBytes is equal to twice the
  1042.             number of elements to be copied.  For example, if SrcArray
  1043.             contains 10 integers to be copied, NumBytes is 2 * 10, or 20
  1044.             bytes.  The declaration for BYTECOPY can be changed to allow
  1045.             real numbers in which case NumBytes is equal to 4 times the
  1046.             number of elements to be copied.  Note, however, that BYTECOPY
  1047.             will not work with strings.
  1048.  
  1049.             Arrays should be passed by giving the element within the array
  1050.             from where the action should take place.  This allows the
  1051.             programmer to store more than one item within the same array
  1052.             or act on only a portion of the array.
  1053.  
  1054.             SEE ALSO
  1055.  
  1056.             PALCOPY
  1057.  
  1058.             EXAMPLE
  1059.  
  1060.             REM COPIES AN ARRAY
  1061.             $LINK "SVGAPB.PBL"
  1062.             $INCLUDE "SVGAPB.BI"
  1063.             DEFINT A-Z
  1064.             DIM ARRAY1(1 TO 10) AS INTEGER
  1065.             DIM ARRAY2(1 TO 10) AS INTEGER
  1066.  
  1067.             CLS
  1068.             FOR I=1 TO 10
  1069.                 ARRAY1(I) = I
  1070.                 ARRAY2(I) = 11 - I
  1071.             NEXT I
  1072.             PRINT "Before copying:"
  1073.             FOR I=1 TO 10
  1074.                 PRINT ARRAY1(I);
  1075.  
  1076.  
  1077.                                                                          16
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083.             NEXT I
  1084.             PRINT
  1085.             FOR I=1 TO 10
  1086.                 PRINT ARRAY2(I);
  1087.             NEXT I
  1088.             PRINT
  1089.             BYTECOPY ARRAY1(1), ARRAY2(1), 20
  1090.             PRINT "After copying:"
  1091.             FOR I=1 TO 10
  1092.                 PRINT ARRAY1(I);
  1093.             NEXT I
  1094.             PRINT
  1095.             FOR I=1 TO 10
  1096.                 PRINT ARRAY2(I);
  1097.             NEXT I
  1098.             PRINT
  1099.             END
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.                                                                          17
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.           D2ROTATE
  1146.  
  1147.             PROTOTYPE
  1148.  
  1149.             SUB D2ROTATE (Points%, XOrigin%, YOrigin%, Ang%, InAry%,
  1150.             OutAry%)
  1151.  
  1152.             INPUT
  1153.  
  1154.             NumPoints - number of points to be rotated
  1155.             Xorigin, Yorigin - center of rotation
  1156.             Angle - angle of rotation about center
  1157.             InArray - P2DType array containing points to rotate
  1158.  
  1159.             OUTPUT
  1160.  
  1161.             no value returned
  1162.             OutArray - P2DType array holding rotated values
  1163.  
  1164.             USAGE
  1165.  
  1166.             D2ROTATE takes the two dimensional points given in InArray and
  1167.             rotates them by the specified angle about Xorigin, Yorigin.
  1168.             The results are returned in OutArray which can be the same as
  1169.             InArray.  A positive angle causes a clockwise rotation on the
  1170.             screen, from the positive X axis to the positive Y axis.
  1171.  
  1172.             Arrays should be passed by giving the element within the array
  1173.             from where the action should take place.  This allows the
  1174.             programmer to store more than one item within the same array
  1175.             or act on only a portion of the array.
  1176.  
  1177.             SEE ALSO
  1178.  
  1179.             D2SCALE, D2TRANSLATE
  1180.  
  1181.             EXAMPLE
  1182.  
  1183.             REM ROTATE A TRIANGLE ABOUT ONE CORNER
  1184.             $LINK "SVGAPB.PBL"
  1185.             $INCLUDE "SVGAPB.BI"
  1186.             DEFINT A-Z
  1187.             DIM TRIO(1 TO 3) AS P2DType
  1188.             DIM TRI(1 TO 3) AS P2DType
  1189.             DIM TRI2(1 TO 3) AS P2DType
  1190.  
  1191.             TRIO(1).X = 0
  1192.             TRIO(1).Y = 0
  1193.             TRIO(2).X = -80
  1194.             TRIO(2).Y = 60
  1195.             TRIO(3).X = 80
  1196.             TRIO(3).Y = 60
  1197.             VMODE = VIDEOMODEGET
  1198.             IF WHICHVGA = 0 THEN STOP
  1199.  
  1200.  
  1201.                                                                          18
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.             DUMMY=RES640
  1208.             GOSUB DRWTRI
  1209.             FOR I = 0 TO 360 STEP 2
  1210.             D2ROTATE 3, 0, 0, I, TRIO(1).X, TRI(1).X
  1211.             GOSUB DRWTRI
  1212.             SDELAY 2
  1213.             GOSUB ERTRI
  1214.             NEXT I
  1215.             GOSUB DRWTRI
  1216.             WHILE INKEY$ = ""
  1217.             WEND
  1218.             VIDEOMODESET VMODE
  1219.             END
  1220.  
  1221.             DRWTRI:
  1222.             D2TRANSLATE 3, 320, 240, TRI(1).X, TRI2(1).X
  1223.             DRWLINE 1, 10, TRI2(1).X, TRI2(1).Y, TRI2(2).X, TRI2(2).Y
  1224.             DRWLINE 1, 10, TRI2(2).X, TRI2(2).Y, TRI2(3).X, TRI2(3).Y
  1225.             DRWLINE 1, 10, TRI2(3).X, TRI2(3).Y, TRI2(1).X, TRI2(1).Y
  1226.             RETURN
  1227.  
  1228.             ERTRI:
  1229.             D2TRANSLATE 3, 320, 240, TRI(1).X, TRI2(1).X
  1230.             DRWLINE 1, 0, TRI2(1).X, TRI2(1).Y, TRI2(2).X, TRI2(2).Y
  1231.             DRWLINE 1, 0, TRI2(2).X, TRI2(2).Y, TRI2(3).X, TRI2(3).Y
  1232.             DRWLINE 1, 0, TRI2(3).X, TRI2(3).Y, TRI2(1).X, TRI2(1).Y
  1233.             RETURN
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.                                                                          19
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.           D2SCALE
  1270.  
  1271.             PROTOTYPE
  1272.  
  1273.             SUB D2SCALE (Points%, ScaleX%, ScaleY%, InArray%, OutArray%)
  1274.  
  1275.             INPUT
  1276.  
  1277.             NumPoints - number of points to scale
  1278.             ScaleX - scale factor along X axis
  1279.             ScaleY - scale factor along Y axis
  1280.             InArray - P2DType array containing points to scale
  1281.  
  1282.             OUTPUT
  1283.  
  1284.             no value returned
  1285.             OutArray - P2DType array holding scaled values
  1286.  
  1287.             USAGE
  1288.  
  1289.             D2SCALE multiplies each coordinate in the two dimensional
  1290.             array InArray by the corresponding scale factor ScaleX or
  1291.             ScaleY.  The results are stored in OutArray which can be the
  1292.             same as InArray.  A scale factor of 256 (100 hex) is
  1293.             considered 100 percent and results in no change.  Therefore,
  1294.             128 (80 hex) reduces values by one half and 512 (200 hex)
  1295.             doubles values.
  1296.  
  1297.             Arrays should be passed by giving the element within the array
  1298.             from where the action should take place.  This allows the
  1299.             programmer to store more than one item within the same array
  1300.             or act on only a portion of the array.
  1301.  
  1302.             SEE ALSO
  1303.  
  1304.             D2ROTATE, D2TRANSLATE
  1305.  
  1306.             EXAMPLE
  1307.  
  1308.             REM SCALE A TRIANGLE
  1309.             $LINK "SVGAPB.PBL"
  1310.             $INCLUDE "SVGAPB.BI"
  1311.             DEFINT A-Z
  1312.             DIM TRIO(1 TO 3) AS P2DType
  1313.             DIM TRI(1 TO 3) AS P2DType
  1314.             DIM TRI2(1 TO 3) AS P2DType
  1315.  
  1316.             TRIO(1).X = 0
  1317.             TRIO(1).Y = 0
  1318.             TRIO(2).X = -80
  1319.             TRIO(2).Y = 60
  1320.             TRIO(3).X = 80
  1321.             TRIO(3).Y = 60
  1322.             VMODE = VIDEOMODEGET
  1323.  
  1324.  
  1325.                                                                          20
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.             IF WHICHVGA = 0 THEN STOP
  1332.             DUMMY=RES640
  1333.             GOSUB DRWTRI
  1334.             FOR I = 256 TO 512 STEP 4
  1335.             D2SCALE 3, I, I, TRIO(1).X, TRI(1).X
  1336.             GOSUB DRWTRI
  1337.             SDELAY 2
  1338.             GOSUB ERTRI
  1339.             NEXT I
  1340.             FOR I = 512 TO 128 STEP -4
  1341.             D2SCALE 3, I, I, TRIO(1).X, TRI(1).X
  1342.             GOSUB DRWTRI
  1343.             SDELAY 2
  1344.             GOSUB ERTRI
  1345.             NEXT I
  1346.  
  1347.             FOR I = 128 TO 256 STEP 4
  1348.             D2SCALE 3, I, I, TRIO(1).X, TRI(1).X
  1349.             GOSUB DRWTRI
  1350.             SDELAY 2
  1351.             GOSUB ERTRI
  1352.             NEXT I
  1353.             GOSUB DRWTRI
  1354.             WHILE INKEY$ = ""
  1355.             WEND
  1356.             VIDEOMODESET VMODE
  1357.             END
  1358.  
  1359.             DRWTRI:
  1360.             D2TRANSLATE 3, 320, 240, TRI(1).X, TRI2(1).X
  1361.             DRWLINE 1, 10, TRI2(1).X, TRI2(1).Y, TRI2(2).X, TRI2(2).Y
  1362.             DRWLINE 1, 10, TRI2(2).X, TRI2(2).Y, TRI2(3).X, TRI2(3).Y
  1363.             DRWLINE 1, 10, TRI2(3).X, TRI2(3).Y, TRI2(1).X, TRI2(1).Y
  1364.             RETURN
  1365.  
  1366.             ERTRI:
  1367.             D2TRANSLATE 3, 320, 240, TRI(1).X, TRI2(1).X
  1368.             DRWLINE 1, 0, TRI2(1).X, TRI2(1).Y, TRI2(2).X, TRI2(2).Y
  1369.             DRWLINE 1, 0, TRI2(2).X, TRI2(2).Y, TRI2(3).X, TRI2(3).Y
  1370.             DRWLINE 1, 0, TRI2(3).X, TRI2(3).Y, TRI2(1).X, TRI2(1).Y
  1371.             RETURN
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.                                                                          21
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.           D2TRANSLATE
  1394.  
  1395.             PROTOTYPE
  1396.  
  1397.             SUB D2TRANSLATE (Points%, TransX%, TransY%, InArray%,
  1398.             OutArray%)
  1399.  
  1400.             INPUT
  1401.  
  1402.             NumPoints - number of points to be translated
  1403.             TransX - distance to translate along X axis
  1404.             TransY - distance to translate along Y axis
  1405.             InArray - P2DType array containing points to translate
  1406.  
  1407.             OUTPUT
  1408.  
  1409.             no value returned
  1410.             OutArray - P2DType array holding translated values
  1411.  
  1412.             USAGE
  1413.  
  1414.             D2TRANSLATE takes the two dimensional points given in InArray
  1415.             and translates them by the specified number of pixels along
  1416.             each axis.  The results are returned in OutArray which can be
  1417.             the same as InArray.
  1418.  
  1419.             Arrays should be passed by giving the element within the array
  1420.             from where the action should take place.  This allows the
  1421.             programmer to store more than one item within the same array
  1422.             or act on only a portion of the array.
  1423.  
  1424.             SEE ALSO
  1425.  
  1426.             D2ROTATE, D2SCALE
  1427.  
  1428.             EXAMPLE
  1429.  
  1430.             REM TRANSLATE A TRIANGLE
  1431.             $LINK "SVGAPB.PBL"
  1432.             $INCLUDE "SVGAPB.BI"
  1433.             DEFINT A-Z
  1434.             DIM TRIO(1 TO 3) AS P2DType
  1435.             DIM TRI(1 TO 3) AS P2DType
  1436.             DIM TRI2(1 TO 3) AS P2DType
  1437.  
  1438.             TRIO(1).X = 0
  1439.             TRIO(1).Y = 0
  1440.             TRIO(2).X = -80
  1441.             TRIO(2).Y = 60
  1442.             TRIO(3).X = 80
  1443.             TRIO(3).Y = 60
  1444.             VMODE = VIDEOMODEGET
  1445.             IF WHICHVGA = 0 THEN STOP
  1446.             DUMMY=RES640
  1447.  
  1448.  
  1449.                                                                          22
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.             GOSUB DRWTRI
  1456.             FOR I = 0 TO 100 STEP 4
  1457.             D2TRANSLATE 3, I, I, TRIO(1).X, TRI(1).X
  1458.             GOSUB DRWTRI
  1459.             SDELAY 2
  1460.             GOSUB ERTRI
  1461.             NEXT I
  1462.             FOR I = 100 TO 0 STEP -4
  1463.             D2TRANSLATE 3, I, I, TRIO(1).X, TRI(1).X
  1464.             GOSUB DRWTRI
  1465.             SDELAY 2
  1466.             GOSUB ERTRI
  1467.             NEXT I
  1468.             GOSUB DRWTRI
  1469.             WHILE INKEY$ = ""
  1470.             WEND
  1471.             VIDEOMODESET VMODE
  1472.             END
  1473.  
  1474.             DRWTRI:
  1475.             D2TRANSLATE 3, 320, 240, TRI(1).X, TRI2(1).X
  1476.             DRWLINE 1, 10, TRI2(1).X, TRI2(1).Y, TRI2(2).X, TRI2(2).Y
  1477.             DRWLINE 1, 10, TRI2(2).X, TRI2(2).Y, TRI2(3).X, TRI2(3).Y
  1478.             DRWLINE 1, 10, TRI2(3).X, TRI2(3).Y, TRI2(1).X, TRI2(1).Y
  1479.             RETURN
  1480.  
  1481.             ERTRI:
  1482.             D2TRANSLATE 3, 320, 240, TRI(1).X, TRI2(1).X
  1483.             DRWLINE 1, 0, TRI2(1).X, TRI2(1).Y, TRI2(2).X, TRI2(2).Y
  1484.             DRWLINE 1, 0, TRI2(2).X, TRI2(2).Y, TRI2(3).X, TRI2(3).Y
  1485.             DRWLINE 1, 0, TRI2(3).X, TRI2(3).Y, TRI2(1).X, TRI2(1).Y
  1486.             RETURN
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.                                                                          23
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.           D3PROJECT
  1518.  
  1519.             PROTOTYPE
  1520.  
  1521.             FUNCTION D3PROJECT% (Points%, ProjParms%, InArray%, OutArray%)
  1522.  
  1523.             INPUT
  1524.  
  1525.             NumPoints - number of points to be projected
  1526.             ProjParams - PROJType structure containing parameters used in
  1527.             projection
  1528.                EyeX, EyeY, EyeZ - 3D location of viewer
  1529.                ScrD - distance from viewer to projection screen
  1530.                Theta - angle from positive 3D X axis to viewing direction
  1531.                Phi - angle from positive 3D Z axis to viewing direction
  1532.             InArray - P3DType array containing points to project
  1533.  
  1534.             OUTPUT
  1535.  
  1536.             D3PROJECT returns 1 if successful, 0 if any one point failed.
  1537.             OutArray - P2DType array holding projected values
  1538.  
  1539.             USAGE
  1540.                                 +Z axis
  1541.                                    |                   /\
  1542.                                    |                  /  \
  1543.                                    |            !     \ * \
  1544.                                    |            !......X: /
  1545.                                    |            ! Phi / \/
  1546.                                    |            !    /  :
  1547.                                    |            !   /   :
  1548.                                    |            !  /    :
  1549.                                    |       EyeX ! /ScrD :
  1550.                                    |       EyeY !/      :
  1551.                                    |       EyeZ *- - - -:- - - - -
  1552.                                    |           / `      :
  1553.                                    |          /   `     :
  1554.                                    |         /      `   :
  1555.                                    |        /      ---` :
  1556.                                    |       /___----
  1557.                                    |      /     Theta
  1558.                                    |
  1559.                                    |_____________________________+Y axis
  1560.                                    /
  1561.                                   /
  1562.                                  /
  1563.                                 /
  1564.                                /
  1565.                               /
  1566.                              /
  1567.                          +X axis
  1568.  
  1569.             D3PROJECT projects a specified number, NumPoints, of three
  1570.             dimensional points starting at InArray into two dimensions
  1571.  
  1572.  
  1573.                                                                          24
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.             according to the parameters in ProjParams.  The two
  1580.             dimensional points are stored in OutArray.  The location of
  1581.             the viewer in this three dimensional space is given by EyeX,
  1582.             EyeY, EyeZ in the ProjParams structure.  The direction the
  1583.             viewer is facing is specified with ScrD, Theta, Phi in the
  1584.             ProjParams structure using spherical coordinates.  A virtual
  1585.             set of axes parallel to the true axes are placed at the
  1586.             viewer's location.  ScrD is the distance from the viewer to
  1587.             the center of the projection screen, i.e. the currently
  1588.             defined viewport on the monitor's screen.  Theta is the angle
  1589.             in the virtual X-Y plane from the virtual X axis to the
  1590.             projection screen.  Positive angles rotate counter-clockwise
  1591.             in the X-Y plane.  Lastly, the angle of elevation above or
  1592.             below the virtual X-Y plane is given by Phi.  Positive angles
  1593.             direct viewing above the plane; negative below.
  1594.  
  1595.             If a point is projected to a location behind the viewer, i.e.
  1596.             on the side of the viewer opposite the projection screen,
  1597.             D3PROJECT returns a zero indicating one or more failed points.
  1598.             The returned values of the X and Y for failed points will be -
  1599.             32768 to make them easily identified.
  1600.  
  1601.             Arrays should be passed by giving the element within the array
  1602.             from where the action should take place.  This allows the
  1603.             programmer to store more than one item within the same array
  1604.             or act on only a portion of the array.
  1605.  
  1606.             SEE ALSO
  1607.  
  1608.             D3ROTATE, D3TRANSLATE, D3SCALE, FILLCONVEXPOLY, SETVIEW
  1609.  
  1610.             EXAMPLE
  1611.  
  1612.             REM DRAW A CUBE AT THE CENTER OF THE SCREEN
  1613.             $LINK "SVGAPB.PBL"
  1614.             $INCLUDE "SVGAPB.BI"
  1615.             DEFINT A-Z
  1616.             DIM CUBE(1 TO 8) AS P3DType
  1617.             DIM PLOT(1 TO 8) AS P2DType
  1618.             DIM PROJPARAMS AS PROJType
  1619.  
  1620.             CUBE(1).X =  100 : CUBE(1).Y = -100 : CUBE(1).Z =  100
  1621.             CUBE(2).X =  100 : CUBE(2).Y = -100 : CUBE(2).Z = -100
  1622.             CUBE(3).X =  100 : CUBE(3).Y =  100 : CUBE(3).Z = -100
  1623.             CUBE(4).X =  100 : CUBE(4).Y =  100 : CUBE(4).Z =  100
  1624.             CUBE(5).X = -100 : CUBE(5).Y = -100 : CUBE(5).Z =  100
  1625.             CUBE(6).X = -100 : CUBE(6).Y = -100 : CUBE(6).Z = -100
  1626.             CUBE(7).X = -100 : CUBE(7).Y =  100 : CUBE(7).Z = -100
  1627.             CUBE(8).X = -100 : CUBE(8).Y =  100 : CUBE(8).Z =  100
  1628.             VMODE = VIDEOMODEGET
  1629.             IF WHICHVGA = 0 THEN STOP
  1630.             DUMMY=RES640
  1631.             PROJPARAMS.EYEX = -1040
  1632.             PROJPARAMS.EYEY = -600
  1633.  
  1634.  
  1635.                                                                          25
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.             PROJPARAMS.EYEZ = -1200
  1642.             PROJPARAMS.SCRD = 1700
  1643.             PROJPARAMS.THETA = 30
  1644.             PROJPARAMS.PHI = 45
  1645.             DUMMY = D3PROJECT(8,PROJPARAMS.EYEX,CUBE(1).X,PLOT(1).X)
  1646.             GOSUB DRWCUBE
  1647.             WHILE INKEY$ = ""
  1648.             WEND
  1649.             VIDEOMODESET VMODE
  1650.             END
  1651.  
  1652.             DRWCUBE:
  1653.             FOR J=1 TO 3
  1654.             DRWLINE 1, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  1655.             NEXT J
  1656.             DRWLINE 1, 10, PLOT(4).X, PLOT(4).Y, PLOT(1).X, PLOT(1).Y
  1657.             FOR J=5 TO 7
  1658.             DRWLINE 1, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  1659.             NEXT J
  1660.             DRWLINE 1, 10, PLOT(8).X, PLOT(8).Y, PLOT(5).X, PLOT(5).Y
  1661.             FOR J=1 TO 4
  1662.             DRWLINE 1, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+4).X, PLOT(J+4).Y
  1663.             NEXT J
  1664.             RETURN
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.                                                                          26
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.           D3ROTATE
  1704.  
  1705.             PROTOTYPE
  1706.  
  1707.             SUB D3ROTATE (Points%, X%, Y%, Z%, AngleZ%, AngleY%, AngleX%,
  1708.             InArray%, OutArray%)
  1709.  
  1710.             INPUT
  1711.  
  1712.             NumPoints - number of points to be rotated
  1713.             X, Y, Z - center of rotation
  1714.             AngleZ - angle of rotation about the Z axis
  1715.             AngleY - angle of rotation about the Y axis
  1716.             AngleX - angle of rotation about the X axis
  1717.             InArray - P3DType array containing points to rotate
  1718.  
  1719.             OUTPUT
  1720.  
  1721.             no value returned
  1722.             OutArray - P3DType array holding rotated values
  1723.  
  1724.             USAGE
  1725.  
  1726.             D3ROTATE takes the three dimensional points given in InArray
  1727.             and rotates them by the specified angles about Xorigin,
  1728.             Yorigin, Zorigin.  The results are returned in OutArray which
  1729.             can be the same as InArray.  A virtual set of axes are placed
  1730.             at the origin of rotation and rotation takes place about these
  1731.             axes.  A positive angle causes a counter-clockwise rotation
  1732.             from the positive X axis to the positive Y axis.
  1733.  
  1734.             Arrays should be passed by giving the element within the array
  1735.             from where the action should take place.  This allows the
  1736.             programmer to store more than one item within the same array
  1737.             or act on only a portion of the array.
  1738.  
  1739.             SEE ALSO
  1740.  
  1741.             D3PROJECT, D3SCALE, D3TRANSLATE
  1742.  
  1743.             EXAMPLE
  1744.  
  1745.             REM ROTATE A CUBE AT THE CENTER OF THE SCREEN
  1746.             $LINK "SVGAPB.PBL"
  1747.             $INCLUDE "SVGAPB.BI"
  1748.             DEFINT A-Z
  1749.             DIM CUBE(1 TO 8) AS P3DType
  1750.             DIM RCUBE(1 TO 8) AS P3DType
  1751.             DIM PLOT(1 TO 8) AS P2DType
  1752.             DIM PROJPARAMS AS PROJType
  1753.  
  1754.             CUBE(1).X =  100 : CUBE(1).Y = -100 : CUBE(1).Z =  100
  1755.             CUBE(2).X =  100 : CUBE(2).Y = -100 : CUBE(2).Z = -100
  1756.             CUBE(3).X =  100 : CUBE(3).Y =  100 : CUBE(3).Z = -100
  1757.  
  1758.  
  1759.                                                                          27
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.             CUBE(4).X =  100 : CUBE(4).Y =  100 : CUBE(4).Z =  100
  1766.             CUBE(5).X = -100 : CUBE(5).Y = -100 : CUBE(5).Z =  100
  1767.             CUBE(6).X = -100 : CUBE(6).Y = -100 : CUBE(6).Z = -100
  1768.             CUBE(7).X = -100 : CUBE(7).Y =  100 : CUBE(7).Z = -100
  1769.             CUBE(8).X = -100 : CUBE(8).Y =  100 : CUBE(8).Z =  100
  1770.             VMODE = VIDEOMODEGET
  1771.             IF WHICHVGA = 0 THEN STOP
  1772.             DUMMY=RES640
  1773.             PROJPARAMS.EYEX = -1040
  1774.             PROJPARAMS.EYEY = -600
  1775.             PROJPARAMS.EYEZ = -1200
  1776.             PROJPARAMS.SCRD = 1700
  1777.             PROJPARAMS.THETA = 30
  1778.             PROJPARAMS.PHI = 45
  1779.             FOR I = 0 TO 360 STEP 5
  1780.             D3ROTATE 8, 0, 0, 0, I, I, I, CUBE(1).X, RCUBE(1).X
  1781.             DUMMY = D3PROJECT(8,PROJPARAMS.EYEX,RCUBE(1).X,PLOT(1).X)
  1782.             GOSUB DRWCUBE
  1783.             SDELAY 2
  1784.             GOSUB DRWCUBE
  1785.             NEXT I
  1786.             WHILE INKEY$ = ""
  1787.             WEND
  1788.             VIDEOMODESET VMODE
  1789.             END
  1790.  
  1791.             DRWCUBE:
  1792.             FOR J=1 TO 3
  1793.             DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  1794.             NEXT J
  1795.             DRWLINE 2, 10, PLOT(4).X, PLOT(4).Y, PLOT(1).X, PLOT(1).Y
  1796.             FOR J=5 TO 7
  1797.             DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  1798.             NEXT J
  1799.             DRWLINE 2, 10, PLOT(8).X, PLOT(8).Y, PLOT(5).X, PLOT(5).Y
  1800.             FOR J=1 TO 4
  1801.             DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+4).X, PLOT(J+4).Y
  1802.             NEXT J
  1803.             RETURN
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.                                                                          28
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.           D3SCALE
  1828.  
  1829.             PROTOTYPE
  1830.  
  1831.             D3SCALE (Points%, ScaleX%, ScaleY%, ScaleZ%, InArray%,
  1832.             OutArray%)
  1833.  
  1834.             INPUT
  1835.  
  1836.             NumPoints - number of points to scale
  1837.             ScaleX - scale factor along X axis
  1838.             ScaleY - scale factor along Y axis
  1839.             ScaleZ - scale factor along Z axis
  1840.             InArray - P3DType array containing points to scale
  1841.  
  1842.             OUTPUT
  1843.  
  1844.             no value returned
  1845.             OutArray - P3DType array holding scaled values
  1846.  
  1847.             USAGE
  1848.  
  1849.             D3SCALE multiplies each coordinate in the three dimensional
  1850.             array InArray by the corresponding scale factor ScaleX, ScaleY
  1851.             or ScaleZ.  The results are stored in OutArray which can be
  1852.             the same as InArray.  A scale factor of 256 (100 hex) is
  1853.             considered 100 percent and results in no change.  Therefore,
  1854.             128 (80 hex) reduces values by one half and 512 (200 hex)
  1855.             doubles values.
  1856.  
  1857.             Arrays should be passed by giving the element within the array
  1858.             from where the action should take place.  This allows the
  1859.             programmer to store more than one item within the same array
  1860.             or act on only a portion of the array.
  1861.  
  1862.             SEE ALSO
  1863.  
  1864.             D3PROJECT, D3ROTATE, D3TRANSLATE
  1865.  
  1866.             EXAMPLE
  1867.  
  1868.             REM SCALE A CUBE AT THE CENTER OF THE SCREEN
  1869.             $LINK "SVGAPB.PBL"
  1870.             $INCLUDE "SVGAPB.BI"
  1871.             DEFINT A-Z
  1872.             DIM CUBE(1 TO 8) AS P3DType
  1873.             DIM SCUBE(1 TO 8) AS P3DType
  1874.             DIM PLOT(1 TO 8) AS P2DType
  1875.             DIM PROJPARAMS AS PROJType
  1876.  
  1877.             CUBE(1).X =  100 : CUBE(1).Y = -100 : CUBE(1).Z =  100
  1878.             CUBE(2).X =  100 : CUBE(2).Y = -100 : CUBE(2).Z = -100
  1879.             CUBE(3).X =  100 : CUBE(3).Y =  100 : CUBE(3).Z = -100
  1880.             CUBE(4).X =  100 : CUBE(4).Y =  100 : CUBE(4).Z =  100
  1881.  
  1882.  
  1883.                                                                          29
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.             CUBE(5).X = -100 : CUBE(5).Y = -100 : CUBE(5).Z =  100
  1890.             CUBE(6).X = -100 : CUBE(6).Y = -100 : CUBE(6).Z = -100
  1891.             CUBE(7).X = -100 : CUBE(7).Y =  100 : CUBE(7).Z = -100
  1892.             CUBE(8).X = -100 : CUBE(8).Y =  100 : CUBE(8).Z =  100
  1893.             VMODE = VIDEOMODEGET
  1894.             IF WHICHVGA = 0 THEN STOP
  1895.             DUMMY=RES640
  1896.             PROJPARAMS.EYEX = -1040
  1897.             PROJPARAMS.EYEY = -600
  1898.             PROJPARAMS.EYEZ = -1200
  1899.             PROJPARAMS.SCRD = 1700
  1900.             PROJPARAMS.THETA = 30
  1901.             PROJPARAMS.PHI = 45
  1902.             FOR I = 256 TO 128 STEP -4
  1903.             D3SCALE 8, I, I, I, CUBE(1).X, SCUBE(1).X
  1904.             DUMMY = D3PROJECT(8,PROJPARAMS.EYEX,SCUBE(1).X,PLOT(1).X)
  1905.             GOSUB DRWCUBE
  1906.             SDELAY 2
  1907.             GOSUB DRWCUBE
  1908.             NEXT I
  1909.             FOR I = 132 TO 256 STEP 4
  1910.             D3SCALE 8, I, I, I, CUBE(1).X, SCUBE(1).X
  1911.             DUMMY = D3PROJECT(8,PROJPARAMS.EYEX,SCUBE(1).X,PLOT(1).X)
  1912.             GOSUB DRWCUBE
  1913.             SDELAY 2
  1914.             GOSUB DRWCUBE
  1915.             NEXT I
  1916.             WHILE INKEY$ = ""
  1917.             WEND
  1918.             VIDEOMODESET VMODE
  1919.             END
  1920.  
  1921.             DRWCUBE:
  1922.             FOR J=1 TO 3
  1923.             DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  1924.             NEXT J
  1925.             DRWLINE 2, 10, PLOT(4).X, PLOT(4).Y, PLOT(1).X, PLOT(1).Y
  1926.             FOR J=5 TO 7
  1927.             DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  1928.             NEXT J
  1929.             DRWLINE 2, 10, PLOT(8).X, PLOT(8).Y, PLOT(5).X, PLOT(5).Y
  1930.             FOR J=1 TO 4
  1931.             DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+4).X, PLOT(J+4).Y
  1932.             NEXT J
  1933.             RETURN
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.                                                                          30
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.           D3TRANSLATE
  1952.  
  1953.             PROTOTYPE
  1954.  
  1955.             SUB D3TRANSLATE (Points%, TransX%, TransY%, TransZ%, InArray%,
  1956.             OutArray%)
  1957.  
  1958.             INPUT
  1959.  
  1960.             NumPoints - number of points to translate
  1961.             TransX - distance to translate along X axis
  1962.             TransY - distance to translate along Y axis
  1963.             TransZ - distance to translate along Z axis
  1964.             InArray - P3DType array containing points to translate
  1965.  
  1966.             OUTPUT
  1967.  
  1968.             no value returned
  1969.             OutArray - P3DType array holding translated points
  1970.  
  1971.             USAGE
  1972.  
  1973.             D3TRANSLATE takes the three dimensional points given in
  1974.             InArray and translates them by the specified number of pixels
  1975.             along each axis.  The results are returned in OutArray which
  1976.             can be the same as InArray.
  1977.  
  1978.             Arrays should be passed by giving the element within the array
  1979.             from where the action should take place.  This allows the
  1980.             programmer to store more than one item within the same array
  1981.             or act on only a portion of the array.
  1982.  
  1983.             SEE ALSO
  1984.  
  1985.             D3PROJECT, D3ROTATE, D3SCALE
  1986.  
  1987.             EXAMPLE
  1988.  
  1989.             REM TRANSLATE A CUBE NEAR THE CENTER OF THE SCREEN
  1990.             $LINK "SVGAPB.PBL"
  1991.             $INCLUDE "SVGAPB.BI"
  1992.             DEFINT A-Z
  1993.             DIM CUBE(1 TO 8) AS P3DType
  1994.             DIM TCUBE(1 TO 8) AS P3DType
  1995.             DIM PLOT(1 TO 8) AS P2DType
  1996.             DIM PROJPARAMS AS PROJType
  1997.  
  1998.             CUBE(1).X =  100 : CUBE(1).Y = -100 : CUBE(1).Z =  100
  1999.             CUBE(2).X =  100 : CUBE(2).Y = -100 : CUBE(2).Z = -100
  2000.             CUBE(3).X =  100 : CUBE(3).Y =  100 : CUBE(3).Z = -100
  2001.             CUBE(4).X =  100 : CUBE(4).Y =  100 : CUBE(4).Z =  100
  2002.             CUBE(5).X = -100 : CUBE(5).Y = -100 : CUBE(5).Z =  100
  2003.             CUBE(6).X = -100 : CUBE(6).Y = -100 : CUBE(6).Z = -100
  2004.             CUBE(7).X = -100 : CUBE(7).Y =  100 : CUBE(7).Z = -100
  2005.  
  2006.  
  2007.                                                                          31
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.             CUBE(8).X = -100 : CUBE(8).Y =  100 : CUBE(8).Z =  100
  2014.             VMODE = VIDEOMODEGET
  2015.             IF WHICHVGA = 0 THEN STOP
  2016.             DUMMY=RES640
  2017.             PROJPARAMS.EYEX = -1040
  2018.             PROJPARAMS.EYEY = -600
  2019.             PROJPARAMS.EYEZ = -1200
  2020.             PROJPARAMS.SCRD = 1700
  2021.             PROJPARAMS.THETA = 30
  2022.             PROJPARAMS.PHI = 45
  2023.             FOR I = 0 TO 100 STEP 2
  2024.             D3TRANSLATE 8, I, I, I, CUBE(1).X, TCUBE(1).X
  2025.             DUMMY = D3PROJECT(8,PROJPARAMS.EYEX,TCUBE(1).X,PLOT(1).X)
  2026.             GOSUB DRWCUBE
  2027.             SDELAY 2
  2028.             GOSUB DRWCUBE
  2029.             NEXT I
  2030.             FOR I = 98 TO 0 STEP -2
  2031.             D3TRANSLATE 8, I, I, I, CUBE(1).X, TCUBE(1).X
  2032.             DUMMY = D3PROJECT(8,PROJPARAMS.EYEX,TCUBE(1).X,PLOT(1).X)
  2033.             GOSUB DRWCUBE
  2034.             SDELAY 2
  2035.             GOSUB DRWCUBE
  2036.             NEXT I
  2037.             WHILE INKEY$ = ""
  2038.             WEND
  2039.             VIDEOMODESET VMODE
  2040.             END
  2041.  
  2042.             DRWCUBE:
  2043.             FOR J=1 TO 3
  2044.             DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  2045.             NEXT J
  2046.             DRWLINE 2, 10, PLOT(4).X, PLOT(4).Y, PLOT(1).X, PLOT(1).Y
  2047.             FOR J=5 TO 7
  2048.             DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  2049.             NEXT J
  2050.             DRWLINE 2, 10, PLOT(8).X, PLOT(8).Y, PLOT(5).X, PLOT(5).Y
  2051.             FOR J=1 TO 4
  2052.             DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+4).X, PLOT(J+4).Y
  2053.             NEXT J
  2054.             RETURN
  2055.  
  2056.  
  2057.  
  2058.  
  2059.  
  2060.  
  2061.  
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.                                                                          32
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.           DRWBOX
  2076.  
  2077.              ROTOTYPE            P
  2078.  
  2079.             SUB DRWBOX (Mode%, Color%, X1%, Y1%, X2%, Y2%)
  2080.  
  2081.              NPUT            I
  2082.                                                                    +X axis
  2083.             Mode - pixel write mode  SET                                    (   =1, XOR=2,           X1, Y1
  2084.                   AND              =3,             OR       =4)
  2085.             Color - index to color in current palette
  2086.             X1, Y1 - location of top left corner
  2087.             X2, Y2 - location of bottom right corner      +Y axis   X2, Y2
  2088.  
  2089.              UTPUT            O
  2090.  
  2091.             no value returned
  2092.  
  2093.              SAGE            U
  2094.  
  2095.                    draws a rectangle             RWBOX            D                        of the color specified using Mode                                     
  2096.             with opposite vertices defined by (X1, Y1) and (X2, Y2).  The
  2097.             vertices given do not need to be exactly the top left and
  2098.             bottom right.  They only have to reference opposite sides of
  2099.             the rectangle.  Any portion of the rectangle that lies outside
  2100.             of the currently defined viewport will not be drawn.
  2101.  
  2102.             S    LSO                A             EE 
  2103.  
  2104.             DRWFILLBOX, DRWLINE, SETVIEW
  2105.  
  2106.             EXAMPLE
  2107.  
  2108.             REM DRAWS A BOX AROUND THE WHOLE SCREEN
  2109.             $LINK "SVGAPB.PBL"
  2110.             $INCLUDE "SVGAPB.BI"
  2111.             DEFINT A-Z
  2112.  
  2113.             VMODE=VIDEOMODEGET
  2114.             IF WHICHVGA = 0 THEN STOP
  2115.             DUMMY=RES640
  2116.             DRWBOX 1, 10, 0, 0, 639, 479
  2117.             WHILE INKEY$ = ""
  2118.             WEND
  2119.             VIDEOMODESET VMODE
  2120.             END
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130.  
  2131.                                                                          33
  2132.  
  2133.  
  2134.  
  2135.  
  2136.  
  2137.           DRWCIRCLE
  2138.  
  2139.              ROTOTYPE            P
  2140.  
  2141.             SUB DRWCIRCLE (Mode%, Color%, Xcenter%, Ycenter%, Radius%)
  2142.  
  2143.              NPUT            I
  2144.                                                                    +X axis
  2145.             Mode - pixel write mode  SET                                    (       XOR                                        =1,    =2,
  2146.               =3, AND            OR       =4)                                            R
  2147.             Color - index to color in current palette
  2148.             Xcenter, Ycenter - location of center of          X, Y
  2149.             circle                                        +Y axis
  2150.             Radius - distance from center to edge of
  2151.             circle
  2152.  
  2153.              UTPUT            O
  2154.  
  2155.             no value returned
  2156.  
  2157.              SAGE            U
  2158.  
  2159.             DRWCIRCLE draws a circle of the specified color using Mode
  2160.             with the center located at (Xcenter, Ycenter) and a radius of
  2161.             Radius.  All values of Xcenter, Ycenter and Radius are valid.
  2162.             Any portion of the circle that lies outside of the currently
  2163.             defined viewport will not be drawn.
  2164.  
  2165.             S    LSO                A             EE 
  2166.  
  2167.             DRWELLIPSE, DRWFILLCIRCLE, SETVIEW
  2168.  
  2169.              XAMPLE            E
  2170.  
  2171.             REM DRAWS A CIRCLE AT THE CENTER OF THE SCREEN
  2172.             $LINK "SVGAPB.PBL"
  2173.             $INCLUDE "SVGAPB.BI"
  2174.             DEFINT A-Z
  2175.  
  2176.             VMODE=VIDEOMODEGET
  2177.             IF WHICHVGA = 0 THEN STOP
  2178.             DUMMY=RES640
  2179.             DRWCIRCLE 1, 10, 320, 240, 200
  2180.             WHILE INKEY$ = ""
  2181.             WEND
  2182.             VIDEOMODESET VMODE
  2183.             END
  2184.  
  2185.  
  2186.  
  2187.  
  2188.  
  2189.  
  2190.  
  2191.  
  2192.  
  2193.                                                                          34
  2194.  
  2195.  
  2196.  
  2197.  
  2198.  
  2199.           DRWELLIPSE
  2200.  
  2201.              ROTOTYPE            P
  2202.  
  2203.             SUB DRWELLIPSE (Mode%, Color%, Xcenter%, Ycenter%, RadiusX%,
  2204.             RadiusY%)
  2205.  
  2206.              NPUT            I
  2207.                                                                     +X axis
  2208.             Mode - pixel write mode  SET                                    (          =2,                                            XOR                                        =1, 
  2209.               =3, AND            OR       =4)                                           RY
  2210.             Color - index to color in current                 X, Y
  2211.             palette                                                  RX
  2212.             Xcenter, Ycenter - location of center of   +Y axis
  2213.             ellipse
  2214.             RadiusX - radius parallel to X axis
  2215.             RadiusY - radius parallel to Y axis
  2216.  
  2217.              UTPUT            O
  2218.  
  2219.             no value returned
  2220.  
  2221.              SAGE            U
  2222.  
  2223.              RWELLIPSE             D          draws an ellipse of the specified color using Mode
  2224.             with the center defined by (Xcenter, Ycenter).  The radius in
  2225.             the horizontal direction is RaduisX and the radius in the
  2226.             vertical direction is RadiusY.  All values of Xcenter,
  2227.             Ycenter, RadiusX and RadiusY are valid.  Any portion of the
  2228.             ellipse that lies outside of the currently defined viewport
  2229.             will not be drawn.
  2230.  
  2231.                  LSO                A             EE             S
  2232.  
  2233.             DRWCIRCLE, DRWFILLELLIPSE, SETVIEW
  2234.  
  2235.             EXAMPLE
  2236.  
  2237.             REM DRAWS AN ELLIPSE AT THE CENTER OF THE SCREEN
  2238.             $LINK "SVGAPB.PBL"
  2239.             $INCLUDE "SVGAPB.BI"
  2240.             DEFINT A-Z
  2241.  
  2242.             VMODE=VIDEOMODEGET
  2243.             IF WHICHVGA = 0 THEN STOP
  2244.             DUMMY=RES640
  2245.             DRWELLIPSE 1, 10, 320, 240, 318, 238
  2246.             WHILE INKEY$ = ""
  2247.             WEND
  2248.             VIDEOMODESET VMODE
  2249.             END
  2250.  
  2251.  
  2252.  
  2253.  
  2254.  
  2255.                                                                          35
  2256.  
  2257.  
  2258.  
  2259.  
  2260.  
  2261.           DRWFILLBOX
  2262.  
  2263.              ROTOTYPE            P
  2264.  
  2265.             SUB DRWFILLBOX (Mode%, Color%, X1%, Y1%, X2%, Y2%)
  2266.  
  2267.              NPUT            I
  2268.                                                                    +X axis
  2269.             Mode - pixel write mode  SET                                    (   =1, XOR=2,           X1, Y1
  2270.                   AND              =3,             OR       =4)
  2271.             Color - index to color in current palette
  2272.             X1, Y1 - location of top left corner
  2273.             X2, Y2 - location of bottom right corner      +Y axis   X2, Y2
  2274.  
  2275.              UTPUT            O
  2276.  
  2277.             no value returned
  2278.  
  2279.              SAGE            U
  2280.  
  2281.              RWFILLBOX            D          draws a filled rectangle of the color specified                                                
  2282.             using Mode with opposite vertices defined by (X1, Y1) and (X2,
  2283.             Y2).  The vertices given do not need to be exactly the top
  2284.             left and bottom right.  They only have to reference opposite
  2285.             sides of the rectangle.  Any portion of the rectangle that
  2286.             lies outside of the currently defined viewport will not be
  2287.             drawn.
  2288.  
  2289.                  LSO                A             EE             S
  2290.  
  2291.             DRWBOX, DRWLINE, FILLCONVEXPOLY, SETVIEW
  2292.  
  2293.              XAMPLE            E
  2294.  
  2295.             REM DRAWS A FILLED BOX
  2296.             $LINK "SVGAPB.PBL"
  2297.             $INCLUDE "SVGAPB.BI"
  2298.             DEFINT A-Z
  2299.  
  2300.             VMODE = VIDEOMODEGET
  2301.             IF WHICHVGA = 0 THEN STOP
  2302.             DUMMY = RES640
  2303.             DRWFILLBOX 1, 10, 100, 100, 200, 200
  2304.             WHILE INKEY$ = ""
  2305.             WEND
  2306.             VIDEOMODESET VMODE
  2307.             END
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.                                                                          36
  2318.  
  2319.  
  2320.  
  2321.  
  2322.  
  2323.           DRWFILLCIRCLE
  2324.  
  2325.              ROTOTYPE            P
  2326.  
  2327.             SUB DRWFILLCIRCLE (Mode%, Color%, Xcenter%, Ycenter%, Radius%)
  2328.  
  2329.              NPUT            I
  2330.                                                                    +X axis
  2331.             Mode - pixel write mode  SET                                    (       XOR                                        =1,    =2,
  2332.               =3, AND            OR       =4)                                            R
  2333.             Color - index to color in current palette
  2334.             Xcenter, Ycenter - location of center of          X, Y
  2335.             circle                                        +Y axis
  2336.             Radius - distance from center to edge of
  2337.             circle
  2338.  
  2339.              UTPUT            O
  2340.  
  2341.             no value returned
  2342.  
  2343.              SAGE            U
  2344.  
  2345.             DRWFILLCIRCLE draws a filled circle of the specified color
  2346.             using Mode with the center located at (Xcenter, Ycenter) and a
  2347.             radius of Radius.  All values of Xcenter, Ycenter and Radius
  2348.             are valid.  Any portion of the circle that lies outside of the
  2349.             currently defined viewport will not be drawn.
  2350.  
  2351.                  LSO                A             EE             S
  2352.  
  2353.             DRWCIRCLE, SETVIEW
  2354.  
  2355.              XAMPLE            E
  2356.  
  2357.             REM DRAWS A FILLED CIRCLE
  2358.             $LINK "SVGAPB.PBL"
  2359.             $INCLUDE "SVGAPB.BI"
  2360.             DEFINT A-Z
  2361.  
  2362.             VMODE = VIDEOMODEGET
  2363.             IF WHICHVGA = 0 THEN STOP
  2364.             DUMMY = RES640
  2365.             DRWFILLCIRCLE 1, 10, 320, 240, 50
  2366.             WHILE INKEY$ = ""
  2367.             WEND
  2368.             VIDEOMODESET VMODE
  2369.             END
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.                                                                          37
  2380.  
  2381.  
  2382.  
  2383.  
  2384.  
  2385.           DRWFILLELLIPSE
  2386.  
  2387.              ROTOTYPE            P
  2388.  
  2389.             SUB DRWFILLELLIPSE (Mode%, Color%, Xcenter%, Ycenter%,
  2390.             RadiusX%, RadiusY%)
  2391.  
  2392.              NPUT            I
  2393.                                                                     +X axis
  2394.             Mode - pixel write mode  SET                                    (          =2,                                            XOR                                        =1, 
  2395.               =3, AND            OR       =4)                                           RY
  2396.             Color - index to color in current                 X, Y
  2397.             palette                                                  RX
  2398.             Xcenter, Ycenter - location of center of   +Y axis
  2399.             ellipse
  2400.             RadiusX - radius parallel to X axis
  2401.             RadiusY - radius parallel to Y axis
  2402.  
  2403.              UTPUT            O
  2404.  
  2405.             no value returned
  2406.  
  2407.              SAGE            U
  2408.  
  2409.              RWFILLELLIPSE             D              draws a filled ellipse of the specified color
  2410.             using Mode with the center defined by (Xcenter, Ycenter).  The
  2411.             radius in the horizontal direction is RaduisX and the radius
  2412.             in the vertical direction is RadiusY.  All values of Xcenter,
  2413.             Ycenter, RadiusX and RadiusY are valid.  Any portion of the
  2414.             ellipse that lies outside of the currently defined viewport
  2415.             will not be drawn.
  2416.  
  2417.             S   ALSO             EE 
  2418.  
  2419.             DRWELLIPSE, SETVIEW
  2420.  
  2421.             EXAMPLE
  2422.  
  2423.             REM DRAWS A FILLED ELLIPSE]
  2424.             $LINK "SVGAPB.PBL"
  2425.             $INCLUDE "SVGAPB.BI"
  2426.             DEFINT A-Z
  2427.  
  2428.             VMODE = VIDEOMODEGET
  2429.             IF WHICHVGA = 0 THEN STOP
  2430.             DUMMY = RES640
  2431.             DRWFILLELLIPSE 1, 10, 320, 240, 118, 50
  2432.             WHILE INKEY$ = ""
  2433.             WEND
  2434.             VIDEOMODESET VMODE
  2435.             END
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.                                                                          38
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.           DRWLINE
  2448.  
  2449.              ROTOTYPE            P
  2450.  
  2451.             SUB DRWLINE (Mode%, Color%, X1%, Y1%, X2%, Y2%)
  2452.  
  2453.              NPUT            I
  2454.                                                                    +X axis
  2455.             Mode - pixel write mode  SET                                    (       XOR                                        =1,    =2,         X1, Y1
  2456.                   AND              =3,             OR       =4)
  2457.             Color - index to color in current palette
  2458.             X1, Y1 - location of one endpoint of line
  2459.             X2, Y2 - location of other endpoint of line   +Y axis    X2, Y2
  2460.  
  2461.              UTPUT            O
  2462.  
  2463.             no value returned
  2464.  
  2465.              SAGE            U
  2466.  
  2467.              RWLINE             D       draws a line of the specified color using Mode with
  2468.             endpoints located at (X1, Y1) and (X2, Y2).  All values of X1,
  2469.             Y1, X2 and Y2 are valid.  Any portion of the line that lies
  2470.             outside of the currently defined viewport will not be drawn.
  2471.  
  2472.                  LSO                A            SEE 
  2473.  
  2474.             DRWBOX, SETVIEW
  2475.  
  2476.             EXAMPLE
  2477.  
  2478.             REM DRAWS A LINE FROM 0,0 TO THE CENTER OF THE SCREEN
  2479.             $LINK "SVGAPB.PBL"
  2480.             $INCLUDE "SVGAPB.BI"
  2481.             DEFINT A-Z
  2482.  
  2483.             VMODE=VIDEOMODEGET
  2484.             IF WHICHVGA = 0 THEN STOP
  2485.             DUMMY=RES640
  2486.             DRWLINE 1, 10, 0, 0, 320, 240
  2487.             WHILE INKEY$ = ""
  2488.             WEND
  2489.             VIDEOMODESET VMODE
  2490.             END
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.                                                                          39
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.           DRWPOINT
  2510.  
  2511.              ROTOTYPE            P
  2512.  
  2513.             SUB DRWPOINT (Mode%, Color%, X%, Y%)
  2514.  
  2515.              NPUT            I
  2516.                                                                    +X axis
  2517.             Mode - pixel write mode  SET                                    (          =2,                                            XOR                                        =1, 
  2518.                   AND            OR=3,    =4)
  2519.             Color - index to color in current palette         X, Y
  2520.             X, Y - location of pixel to write
  2521.                                                           +Y axis
  2522.              UTPUT            O
  2523.  
  2524.             no value returned
  2525.  
  2526.              SAGE            U
  2527.  
  2528.              RWPOINT             D        draws a single point of the specified color using
  2529.             Mode at (X, Y).  All values of X and Y are valid.  If the
  2530.             point (X, Y) lies outside of the currently defined viewport,
  2531.             no drawing will take place.
  2532.  
  2533.             SEE  LSO                A
  2534.  
  2535.             GETPOINT, SETVIEW
  2536.  
  2537.              XAMPLE            E
  2538.  
  2539.             REM DRAWS A POINT AT THE CENTER OF THE SCREEN
  2540.             $LINK "SVGAPB.PBL"
  2541.             $INCLUDE "SVGAPB.BI"
  2542.             DEFINT A-Z
  2543.  
  2544.             VMODE=VIDEOMODEGET
  2545.             IF WHICHVGA = 0 THEN STOP
  2546.             DUMMY=RES640
  2547.             DRWPOINT 1, 10, 320, 240
  2548.             WHILE INKEY$ = ""
  2549.             WEND
  2550.             VIDEOMODESET VMODE
  2551.             END
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.                                                                          40
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.           DRWSTRING
  2572.  
  2573.              ROTOTYPE            P
  2574.  
  2575.             SUB DRWSTRING (Mode%, FColor%, BColor%, Strng$, X%, Y%)
  2576.  
  2577.              NPUT            I
  2578.                                                                      +   s                                                                         i                                                                        x                                                                       a                                                                                                                                              X
  2579.             Mode - pixel write mode (no action=0,              Y                                                                                                                             ,                                                             X
  2580.                =1, XOR            SET       =2, OR=3,    =4)                                AND
  2581.             FColor - foreground index to color in
  2582.             current palette
  2583.             BColor - background index to color in          Y                                                          +   s                                                             i                                                             x                                                            a                                                             
  2584.             current palette
  2585.             Strng$ - string of ASCII characters to be drawn
  2586.             X, Y - location of upper, left corner of block
  2587.  
  2588.              UTPUT            O
  2589.  
  2590.             no value returned
  2591.  
  2592.              SAGE            U
  2593.  
  2594.              RWSTRING             D         takes the ASCII characters contained in Strng$ and
  2595.             creates a graphics block similar to the blocks used by Blkget
  2596.             and Blkput and places this block on the screen at the
  2597.             specified coordinates.  The characters are drawn with color
  2598.             FColor using the current font and the background is color
  2599.             BColor.  When mode 0, no action, is used, the graphics block
  2600.             is created in memory retrievable by GETLASTSTRING, but no text
  2601.             is actually drawn on the screen.  (Note: the system font is
  2602.             automatically installed when                                                   WHICHVGA is called.)
  2603.  
  2604.              EE             S    LSO                A
  2605.  
  2606.             FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRINGDN, DRWSTRINGLT,
  2607.             DRWSTRINGRT, GETLASTSTRING
  2608.  
  2609.             EXAMPLE
  2610.  
  2611.             REM DRAWS SOME NORMAL TEXT AT THE CENTER OF THE SCREEN
  2612.             $LINK "SVGAPB.PBL"
  2613.             $INCLUDE "SVGAPB.BI"
  2614.             DEFINT A-Z
  2615.  
  2616.             VMODE=VIDEOMODEGET
  2617.             IF WHICHVGA = 0 THEN STOP
  2618.             DUMMY=RES640
  2619.             A$ = "HELLO WORLD"
  2620.             DRWSTRING 1, 10, 0, A$, 320, 240
  2621.             WHILE INKEY$ = ""
  2622.             WEND
  2623.             VIDEOMODESET VMODE
  2624.             END
  2625.  
  2626.  
  2627.                                                                          41
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.  
  2648.  
  2649.  
  2650.  
  2651.  
  2652.  
  2653.  
  2654.  
  2655.  
  2656.  
  2657.  
  2658.  
  2659.  
  2660.  
  2661.  
  2662.  
  2663.  
  2664.  
  2665.  
  2666.  
  2667.  
  2668.  
  2669.  
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.                                                                          42
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.           DRWSTRINGDN
  2696.  
  2697.              ROTOTYPE            P
  2698.  
  2699.             SUB DRWSTRINGDN (Mode%, FColor%, BColor%, Strng$, X%, Y%)
  2700.  
  2701.              NPUT            I
  2702.                                                                      +   s                                                                         i                                                                        x                                                                       a                                                                                                                                              X
  2703.             Mode - pixel write mode (no action=0,
  2704.                =1, XOR            SET       =2, OR=3,    =4)                                AND
  2705.             FColor - foreground index to color in
  2706.             current palette                                          X Y                                                                                                                                              ,
  2707.             BColor - background index to color in          Y                                                          +   s                                                             i                                                             x                                                            a                                                             
  2708.             current palette
  2709.             Strng$ - string of ASCII characters to be drawn
  2710.             X, Y - location of lower, right corner of block
  2711.  
  2712.              UTPUT            O
  2713.  
  2714.             no value returned
  2715.  
  2716.              SAGE            U
  2717.  
  2718.              RWSTRINGDN             D           takes the ASCII characters contained in Strng$ and
  2719.             creates a graphics block similar to the blocks used by Blkget
  2720.             and Blkput.  The characters are drawn with color FColor using
  2721.             the current font and the background is color BColor.  When
  2722.             mode 0, no action, is used, the graphics block is created in
  2723.             memory retrievable by GETLASTSTRING, but no text is actually
  2724.             drawn on the screen.  (Note: the system font is automatically
  2725.             installed when  HICHVGA                           W        is called.)  The text is drawn upside
  2726.             down with X, Y specifying the lower, right corner.  This
  2727.             corner corresponds to the upper, left corner when the text is
  2728.             oriented upright.
  2729.  
  2730.                 A             EE             S    LSO
  2731.  
  2732.             FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRING, DRWSTRINGLT,
  2733.             DRWSTRINGRT, GETLASTSTRING
  2734.  
  2735.             EXAMPLE
  2736.  
  2737.             REM DRAWS SOME UP-SIDE-DOWN TEXT AT THE CENTER OF THE SCREEN
  2738.             $LINK "SVGAPB.PBL"
  2739.             $INCLUDE "SVGAPB.BI"
  2740.             DEFINT A-Z
  2741.  
  2742.             VMODE=VIDEOMODEGET
  2743.             IF WHICHVGA = 0 THEN STOP
  2744.             DUMMY=RES640
  2745.             A$ = "HELLO WORLD"
  2746.             DRWSTRINGDN 1, 10, 0, A$, 320, 240
  2747.             WHILE INKEY$ = ""
  2748.             WEND
  2749.  
  2750.  
  2751.                                                                          43
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.             VIDEOMODESET VMODE
  2758.             END
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.  
  2777.  
  2778.  
  2779.  
  2780.  
  2781.  
  2782.  
  2783.  
  2784.  
  2785.  
  2786.  
  2787.  
  2788.  
  2789.  
  2790.  
  2791.  
  2792.  
  2793.  
  2794.  
  2795.  
  2796.  
  2797.  
  2798.  
  2799.  
  2800.  
  2801.  
  2802.  
  2803.  
  2804.  
  2805.  
  2806.  
  2807.  
  2808.  
  2809.  
  2810.  
  2811.  
  2812.  
  2813.                                                                          44
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.           DRWSTRINGLT
  2820.  
  2821.              ROTOTYPE            P
  2822.  
  2823.             SUB DRWSTRINGLT (Mode%, FColor%, BColor%, Strng$, X%, Y%)
  2824.  
  2825.              NPUT            I
  2826.                                                                      +   s                                                                         i                                                                        x                                                                       a                                                                                                                                              X
  2827.             Mode - pixel write mode (no action=0,
  2828.                =1, XOR            SET       =2, OR=3,    =4)                                AND
  2829.             FColor - foreground index to color in
  2830.             current palette
  2831.             BColor - background index to color in          Y                                                          +   s                                                             i                                                             x                                                            a                                                             
  2832.             current palette                                     Y                                                                                                                               ,                                                              X
  2833.             Strng$ - string of ASCII characters to be drawn
  2834.             X, Y - location of lower, left corner of block
  2835.  
  2836.              UTPUT            O
  2837.  
  2838.             no value returned
  2839.  
  2840.              SAGE            U
  2841.  
  2842.              RWSTRINGLT             D           takes the ASCII characters contained in Strng$ and
  2843.             creates a graphics block similar to the blocks used by Blkget
  2844.             and Blkput.  The characters are drawn with color FColor using
  2845.             the current font and the background is color BColor.  When
  2846.             mode 0, no action, is used, the graphics block is created in
  2847.             memory retrievable by GETLASTSTRING, but no text is actually
  2848.             drawn on the screen.  (Note: the system font is automatically
  2849.             installed when  HICHVGA                           W        is called.)  The text block is rotated
  2850.                to the left with X, Y specifying the lower, left corner.            90
  2851.             This corner corresponds to the upper, left corner when the
  2852.             text is oriented upright.
  2853.  
  2854.  
  2855.             S   A             EE  LSO
  2856.  
  2857.             FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRING, DRWSTRINGDN,
  2858.             DRWSTRINGRT, GETLASTSTRING
  2859.  
  2860.              XAMPLE            E
  2861.  
  2862.             REM DRAWS SOME TEXT ROTATED BY 90 DEGREES TO THE LEFT AT THE
  2863.             REM CENTER OF THE SCREEN
  2864.             $LINK "SVGAPB.PBL"
  2865.             $INCLUDE "SVGAPB.BI"
  2866.             DEFINT A-Z
  2867.  
  2868.             VMODE=VIDEOMODEGET
  2869.             IF WHICHVGA = 0 THEN STOP
  2870.             DUMMY=RES640
  2871.             A$ = "HELLO WORLD"
  2872.             DRWSTRINGLT 1, 10, 0, A$, 320, 240
  2873.  
  2874.  
  2875.                                                                          45
  2876.  
  2877.  
  2878.  
  2879.  
  2880.  
  2881.             WHILE INKEY$ = ""
  2882.             WEND
  2883.             VIDEOMODESET VMODE
  2884.             END
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  
  2913.  
  2914.  
  2915.  
  2916.  
  2917.  
  2918.  
  2919.  
  2920.  
  2921.  
  2922.  
  2923.  
  2924.  
  2925.  
  2926.  
  2927.  
  2928.  
  2929.  
  2930.  
  2931.  
  2932.  
  2933.  
  2934.  
  2935.  
  2936.  
  2937.                                                                          46
  2938.  
  2939.  
  2940.  
  2941.  
  2942.  
  2943.           DRWSTRINGRT
  2944.  
  2945.              ROTOTYPE            P
  2946.  
  2947.             SUB DRWSTRINGRT (Mode%, FColor%, BColor%, Strng$, X%, Y%)
  2948.  
  2949.              NPUT            I
  2950.                                                                      +                                                                  Y                                                                 ,                                                                 X        s                                                                         i                                                                        x                                                                       a                                                                                                                                              X
  2951.             Mode - pixel write mode (no action=0,
  2952.                =1, XOR            SET       =2, OR=3,    =4)                                AND
  2953.             FColor - foreground index to color in
  2954.             current palette                                Y                                                          +   s                                                             i                                                             x                                                            a                                                             
  2955.             BColor - background index to color in
  2956.             current palette
  2957.             Strng$ - string of ASCII characters to be drawn
  2958.             X, Y - location of upper, right corner of block
  2959.  
  2960.              UTPUT            O
  2961.  
  2962.             no value returned
  2963.  
  2964.              SAGE            U
  2965.  
  2966.              RWSTRINGRT             D           takes the ASCII characters contained in Strng$ and
  2967.             creates a graphics block similar to the blocks used by Blkget
  2968.             and Blkput.  The characters are drawn with color FColor using
  2969.             the current font and the background is color BColor.  When
  2970.             mode 0, no action, is used, the graphics block is created in
  2971.             memory retrievable by GETLASTSTRING, but no text is actually
  2972.             drawn on the screen.  (Note: the system font is automatically
  2973.             installed when  HICHVGA                           W        is called.)  The text block is rotated
  2974.             90 to the right with X, Y specifying the upper, right corner.
  2975.             This corner corresponds to the upper, left corner if the text
  2976.             is oriented upright.
  2977.  
  2978.  
  2979.                 A            SEE  LSO
  2980.  
  2981.             FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRING, DRWSTRINGDN,
  2982.             DRWSTRINGLT, GETLASTSTRING
  2983.  
  2984.              XAMPLE            E
  2985.  
  2986.             REM DRAWS SOME TEXT ROTATED BY 90 DEGREES TO THE RIGHT AT THE
  2987.             REM CENTER OF THE SCREEN
  2988.             $LINK "SVGAPB.PBL"
  2989.             $INCLUDE "SVGAPB.BI"
  2990.             DEFINT A-Z
  2991.  
  2992.             VMODE=VIDEOMODEGET
  2993.             IF WHICHVGA = 0 THEN STOP
  2994.             DUMMY=RES640
  2995.             A$ = "HELLO WORLD"
  2996.             DRWSTRINGRT 1, 10, 0, A$, 320, 240
  2997.  
  2998.  
  2999.                                                                          47
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.             WHILE INKEY$ = ""
  3006.             WEND
  3007.             VIDEOMODESET VMODE
  3008.             END
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.  
  3041.  
  3042.  
  3043.  
  3044.  
  3045.  
  3046.  
  3047.  
  3048.  
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.                                                                          48
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.           FILLAREA
  3068.  
  3069.             PROTOTYPE
  3070.  
  3071.             SUB FILLAREA (XSeed%, YSeed%, BorderColor%, FillColor%)
  3072.  
  3073.             INPUT
  3074.  
  3075.             XSeed, YSeed - seed location to start fill
  3076.             BorderColor - index to color in current palette at which
  3077.             filling stops
  3078.             FillColor - index to color in current palette to fill within
  3079.             the border
  3080.  
  3081.             OUTPUT
  3082.  
  3083.             no value returned
  3084.  
  3085.             USAGE
  3086.  
  3087.             FILLAREA fills a region with a new color specified by
  3088.             FillColor.  The region is defined by any line or curve of the
  3089.             color BorderColor or by the edge of the viewport.  All
  3090.             graphics within the region are lost and covered with the
  3091.             FillColor.  The border is not effected.
  3092.  
  3093.             SEE ALSO
  3094.  
  3095.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLCOLOR,
  3096.             FILLCONVEXPOLY, FILLPAGE, FILLSCREEN, FILLVIEW, SETVIEW
  3097.  
  3098.             EXAMPLE
  3099.  
  3100.             REM FILLS A BOX WITH A COLOR
  3101.             $LINK "SVGAPB.PBL"
  3102.             $INCLUDE "SVGAPB.BI"
  3103.             DEFINT A-Z
  3104.  
  3105.             VMODE=VIDEOMODEGET
  3106.             IF WHICHVGA = 0 THEN STOP
  3107.             DUMMY=RES640
  3108.             DRWBOX 1, 10, 0, 0, 100, 100
  3109.             FILLAREA 1, 1, 10, 7
  3110.             WHILE INKEY$ = ""
  3111.             WEND
  3112.             VIDEOMODESET VMODE
  3113.             END
  3114.  
  3115.  
  3116.  
  3117.  
  3118.  
  3119.  
  3120.  
  3121.  
  3122.  
  3123.                                                                          49
  3124.  
  3125.  
  3126.  
  3127.  
  3128.  
  3129.           FILLCOLOR
  3130.  
  3131.             PROTOTYPE
  3132.  
  3133.             SUB FILLCOLOR (XSeed%, YSeed%, OldColor%, NewColor%)
  3134.  
  3135.             INPUT
  3136.  
  3137.             XSeed, YSeed - seed location to start fill
  3138.             OldColor - index to color in current palette to change
  3139.             NewColor - index to color in current palette to replace
  3140.             OldColor
  3141.  
  3142.             OUTPUT
  3143.  
  3144.             no value returned
  3145.  
  3146.             USAGE
  3147.  
  3148.             FILLCOLOR replaces every existence of OldColor with NewColor
  3149.             within a region.  The region is defined as any pixel of
  3150.             OldColor which has a path of pixels of OldColor or NewColor
  3151.             with sides touching back to the seed point, (XSeed, YSeed).
  3152.             Therefore, only pixels of OldColor are modified and no other
  3153.             information is changed.
  3154.  
  3155.             SEE ALSO
  3156.  
  3157.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  3158.             FILLCONVEXPOLY, FILLPAGE, FILLSCREEN, FILLVIEW, SETVIEW
  3159.  
  3160.             EXAMPLE
  3161.  
  3162.             REM REPLACES THE BLACK COLOR WITH A NEW COLOR
  3163.             $LINK "SVGAPB.PBL"
  3164.             $INCLUDE "SVGAPB.BI"
  3165.             DEFINT A-Z
  3166.  
  3167.             VMODE=VIDEOMODEGET
  3168.             IF WHICHVGA = 0 THEN STOP
  3169.             DUMMY=RES640
  3170.             DRWBOX 1, 10, 0, 0, 100, 100
  3171.             DRWBOX 1, 12, 20, 20, 80, 80
  3172.             FILLCOLOR 1, 1, 0, 7
  3173.             WHILE INKEY$ = ""
  3174.             WEND
  3175.             VIDEOMODESET VMODE
  3176.             END
  3177.  
  3178.  
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.                                                                          50
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.           FILLCONVEXPOLY
  3192.  
  3193.             PROTOTYPE
  3194.  
  3195.             SUB FILLCONVEXPOLY (PolyColor%, NumPoints%, PointArray%)
  3196.  
  3197.             INPUT
  3198.  
  3199.             PolyColor - index to color in current palette
  3200.             NumPoints - number of points in PointArray
  3201.             PointArray - P2DType array holding points of polygon
  3202.  
  3203.             OUTPUT
  3204.  
  3205.             no value returned
  3206.  
  3207.             USAGE
  3208.  
  3209.             FILLCONVEXPOLY draws a solid polygon outlined by the points
  3210.             given in PointArray.  The points are expected to be
  3211.             consecutive and the resulting polygon should be convex (ie.
  3212.             the polygon should not curve in on itself like a kidney bean).
  3213.             The function also assumes that the last point in the array
  3214.             connects to the first.
  3215.  
  3216.             SEE ALSO
  3217.  
  3218.             D3PROJECT, DRWFILLBOX, FILLAREA, FILLCOLOR, FILLPAGE,
  3219.             FILLSCREEN, FILLVIEW
  3220.  
  3221.             EXAMPLE
  3222.  
  3223.             REM SHOW FILLCONVEXPOLY
  3224.             $INCLUDE "SVGAPB.BI"
  3225.             $LINK "SVGAPB.PBL"
  3226.             DEFINT A-Z
  3227.             DIM T(0 TO 20) AS P2DType
  3228.  
  3229.             VGA = WHICHVGA
  3230.             DUMMY = RES640
  3231.  
  3232.             FOR I = 0 TO 99
  3233.                T(0).X = RND * GETMAXX
  3234.                T(0).Y = RND * GETMAXY
  3235.                T(1).X = RND * GETMAXX
  3236.                T(1).Y = RND * GETMAXY
  3237.                T(2).X = RND * GETMAXX
  3238.                T(2).Y = RND * GETMAXY
  3239.                C = RND * 15
  3240.                FILLCONVEXPOLY C, 3, T(0).X
  3241.             NEXT I
  3242.  
  3243.             WHILE INKEY$ = ""
  3244.             WEND
  3245.  
  3246.  
  3247.                                                                          51
  3248.  
  3249.  
  3250.  
  3251.  
  3252.  
  3253.  
  3254.             DUMMY = RESTEXT
  3255.             END
  3256.  
  3257.  
  3258.  
  3259.  
  3260.  
  3261.  
  3262.  
  3263.  
  3264.  
  3265.  
  3266.  
  3267.  
  3268.  
  3269.  
  3270.  
  3271.  
  3272.  
  3273.  
  3274.  
  3275.  
  3276.  
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.  
  3308.  
  3309.                                                                          52
  3310.  
  3311.  
  3312.  
  3313.  
  3314.  
  3315.           FILLPAGE
  3316.  
  3317.             PROTOTYPE
  3318.  
  3319.             SUB FILLPAGE (Color%)
  3320.  
  3321.             INPUT
  3322.  
  3323.             Color - index to color in current palette
  3324.  
  3325.             OUTPUT
  3326.  
  3327.             no value returned
  3328.  
  3329.             USAGE
  3330.  
  3331.             FILLPAGE clears the currently active page with the specified
  3332.             color.  All information on the page is lost.  (Note, a faster
  3333.             method to clear the page is to call any of the 'RES###'
  3334.             functions.  These reset the graphics screen and automatically
  3335.             clear it to color index zero as well as reset the default
  3336.             palette.)
  3337.  
  3338.             SEE ALSO
  3339.  
  3340.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  3341.             FILLCOLOR, FILLCONVEXPOLY, FILLSCREEN, FILLVIEW
  3342.  
  3343.             EXAMPLE
  3344.  
  3345.             REM FILLS THE CURRENT VIDEO PAGE WITH A COLOR
  3346.             $LINK "SVGAPB.PBL"
  3347.             $INCLUDE "SVGAPB.BI"
  3348.             DEFINT A-Z
  3349.  
  3350.             VMODE=VIDEOMODEGET
  3351.             IF WHICHVGA = 0 THEN STOP
  3352.             DUMMY=RES640
  3353.             DUMMY=PAGEACTIVE(0)
  3354.             FILLPAGE 10
  3355.             WHILE INKEY$ = ""
  3356.             WEND
  3357.             VIDEOMODESET VMODE
  3358.             END
  3359.  
  3360.  
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.  
  3371.                                                                          53
  3372.  
  3373.  
  3374.  
  3375.  
  3376.  
  3377.           FILLSCREEN
  3378.  
  3379.             PROTOTYPE
  3380.  
  3381.             SUB FILLSCREEN (Color%)
  3382.  
  3383.             INPUT
  3384.  
  3385.             Color - index to color in current palette
  3386.  
  3387.             OUTPUT
  3388.  
  3389.             no value returned
  3390.  
  3391.             USAGE
  3392.  
  3393.             FILLSCREEN clears the entire screen with the specified color.
  3394.             All information on the screen is lost.  (Note, a faster method
  3395.             to clear the screen is to call any of the 'RES###' functions.
  3396.             These reset the graphics screen and automatically clear it to
  3397.             color index zero as well as reset the default palette.)
  3398.  
  3399.             SEE ALSO
  3400.  
  3401.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  3402.             FILLCOLOR, FILLCONVEXPOLY, FILLPAGE, FILLVIEW
  3403.  
  3404.             EXAMPLE
  3405.  
  3406.             REM FILLS THE SCREEN WITH A COLOR
  3407.             $LINK "SVGAPB.PBL"
  3408.             $INCLUDE "SVGAPB.BI"
  3409.             DEFINT A-Z
  3410.  
  3411.             VMODE=VIDEOMODEGET
  3412.             IF WHICHVGA = 0 THEN STOP
  3413.             DUMMY=RES640
  3414.             FILLSCREEN 10
  3415.             WHILE INKEY$ = ""
  3416.             WEND
  3417.             VIDEOMODESET VMODE
  3418.             END
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.  
  3431.  
  3432.  
  3433.                                                                          54
  3434.  
  3435.  
  3436.  
  3437.  
  3438.  
  3439.           FILLVIEW
  3440.  
  3441.             PROTOTYPE
  3442.  
  3443.             SUB FILLVIEW (Color%)
  3444.  
  3445.             INPUT
  3446.  
  3447.             Color - index to color in current palette
  3448.  
  3449.             OUTPUT
  3450.  
  3451.             no value returned
  3452.  
  3453.             USAGE
  3454.  
  3455.             FILLVIEW fills the currently defined viewport with the
  3456.             specified color.  All information in the viewport is lost.
  3457.  
  3458.             SEE ALSO
  3459.  
  3460.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  3461.             FILLCOLOR, FILLCONVEXPOLY, FILLPAGE, FILLSCREEN, SETVIEW
  3462.  
  3463.             EXAMPLE
  3464.  
  3465.             REM FILLS THE VIEWPORT WITH A COLOR
  3466.             $LINK "SVGAPB.PBL"
  3467.             $INCLUDE "SVGAPB.BI"
  3468.             DEFINT A-Z
  3469.  
  3470.             VMODE=VIDEOMODEGET
  3471.             IF WHICHVGA = 0 THEN STOP
  3472.             DUMMY=RES640
  3473.             SETVIEW 100, 100, 539, 379
  3474.             FILLVIEW 10
  3475.             WHILE INKEY$ = ""
  3476.             WEND
  3477.             VIDEOMODESET VMODE
  3478.             END
  3479.  
  3480.  
  3481.  
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.  
  3494.  
  3495.                                                                          55
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.           FONTGETINFO
  3502.  
  3503.             PROTOTYPE
  3504.  
  3505.             SUB FONTGETINFO (Width%, Height%)
  3506.  
  3507.             INPUT
  3508.  
  3509.             no input parameters
  3510.  
  3511.             OUTPUT
  3512.  
  3513.             no value returned
  3514.             Width - width in pixels of current font
  3515.             Height - height in pixels of current font
  3516.  
  3517.             USAGE
  3518.  
  3519.             FONTGETINFO returns in Width and Height the dimensions of the
  3520.             currently loaded font.
  3521.  
  3522.             SEE ALSO
  3523.  
  3524.             FONTSET, FONTSYSTEM
  3525.  
  3526.             EXAMPLE
  3527.  
  3528.             REM GET INFO ON THE SYSTEM FONT
  3529.             $LINK "SVGAPB.PBL"
  3530.             $INCLUDE "SVGAPB.BI"
  3531.             DEFINT A-Z
  3532.  
  3533.             VMODE=VIDEOMODEGET
  3534.             IF WHICHVGA = 0 THEN STOP
  3535.             DUMMY=RES640
  3536.             FONTGETINFO WDTH, HGTH
  3537.             A$ = "SYSTEM FONT WIDTH =" + STR$(WDTH)
  3538.             B$ = "SYSTEM FONT HEIGHT =" + STR$(HGTH)
  3539.             DRWSTRING 1, 7, 0, A$, 0, 0
  3540.             DRWSTRING 1, 7, 0, B$, 0, 20
  3541.             WHILE INKEY$ = ""
  3542.             WEND
  3543.             VIDEOMODESET VMODE
  3544.             END
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.                                                                          56
  3558.  
  3559.  
  3560.  
  3561.  
  3562.  
  3563.           FONTSET
  3564.  
  3565.             PROTOTYPE
  3566.  
  3567.             SUB FONTSET (Font?)
  3568.  
  3569.             INPUT
  3570.  
  3571.             Font - byte array with 4098 elements containing font data
  3572.  
  3573.             OUTPUT
  3574.  
  3575.             no value returned
  3576.  
  3577.             USAGE
  3578.  
  3579.             FONTSET loads the current font with the data in Font.  The
  3580.             byte array must have at least 4098 members.  The first byte of
  3581.             Font holds the font width (1 to 8) and the second byte holds
  3582.             the font height (1 to 16).  The remaining 4096 bytes are the
  3583.             character raster data, 16 bytes per character.
  3584.  
  3585.             SEE ALSO
  3586.  
  3587.             FONTGETINFO, FONTSYSTEM
  3588.  
  3589.             EXAMPLE
  3590.  
  3591.             See FONTSYSTEM
  3592.  
  3593.  
  3594.  
  3595.  
  3596.  
  3597.  
  3598.  
  3599.  
  3600.  
  3601.  
  3602.  
  3603.  
  3604.  
  3605.  
  3606.  
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.  
  3619.                                                                          57
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.           FONTSYSTEM
  3626.  
  3627.             PROTOTYPE
  3628.  
  3629.             SUB FONTSYSTEM ()
  3630.  
  3631.             INPUT
  3632.  
  3633.             no input parameters
  3634.  
  3635.             OUTPUT
  3636.  
  3637.             no value returned
  3638.  
  3639.             USAGE
  3640.  
  3641.             FONTSYSTEM sets the current font to the standard system font.
  3642.             This font is automatically set when WHICHVGA is called.
  3643.  
  3644.             SEE ALSO
  3645.  
  3646.             WHICHVGA, FONTGETINFO, FONTSET
  3647.  
  3648.             EXAMPLE
  3649.  
  3650.             REM LOAD A FONT FROM DISK AND ENABLE IT
  3651.             REM THEN GO BACK TO THE SYSTEM FONT
  3652.             $LINK "SVGAPB.PBL"
  3653.             $INCLUDE "SVGAPB.BI"
  3654.             DEFINT A-Z
  3655.  
  3656.             DIM NEWFONT(4097) AS BYTE
  3657.  
  3658.             VMODE = VIDEOMODEGET
  3659.             IF WHICHVGA = 0 THEN STOP
  3660.             DUMMY=RES640
  3661.             OPEN "DRAGON.FNT" FOR BINARY AS #1
  3662.             FOR I = 0 TO 4097
  3663.                GET #1, , NEWFONT(I)
  3664.             NEXT I
  3665.             CLOSE #1
  3666.             FONTSET NEWFONT(0)
  3667.             DRWSTRING 1, 7, 0, "The Dragon Font!", 0, 0
  3668.             FONTSYSTEM
  3669.             DRWSTRING 1, 7, 0, "The System Font!", 0, 20
  3670.             WHILE INKEY$ = ""
  3671.             WEND
  3672.             VIDEOMODESET VMODE
  3673.             END
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679.  
  3680.  
  3681.                                                                          58
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.           GETARCCOS
  3688.  
  3689.             PROTOTYPE
  3690.  
  3691.             FUNCTION GETARCCOS% (Value&)
  3692.  
  3693.             INPUT
  3694.  
  3695.             Value - number between -1 and +1 scaled up by 13 bits (8192)
  3696.  
  3697.             OUTPUT
  3698.  
  3699.             GETARCCOS returns the arc cosine of Value in degrees.
  3700.  
  3701.             USAGE
  3702.  
  3703.             GETARCCOS returns the arc cosine in degrees for the given
  3704.             value.  The return will be between 0 and 180 degrees.  Value
  3705.             should be between -8192 and +8192 representing the range -1 to
  3706.             +1.  Input values outside this range are invalid and GETARCCOS
  3707.             will return -32768. Floating point values are ignored.  This
  3708.             function uses an integer lookup table stored within the
  3709.             library in order to produce the fastest possible results.  No
  3710.             floating point arithmetic is used.  The scale factor of 13
  3711.             bits (8192) was chosen because this is the number of bits at
  3712.             which every change of one degree gives a change in the value
  3713.             of the sine (or cosine) function.
  3714.  
  3715.             SEE ALSO
  3716.  
  3717.             GETARCSIN, GETARCTAN, GETCOS, GETSIN, GETTAN
  3718.  
  3719.             EXAMPLE
  3720.  
  3721.             REM SHOW GETARCCOS
  3722.             $LINK "SVGAPB.PBL"
  3723.             $INCLUDE "SVGAPB.BI"
  3724.             DEFINT A-Z
  3725.  
  3726.             VMODE = VIDEOMODEGET
  3727.             IF WHICHVGA = 0 THEN STOP
  3728.             DUMMY=RES640
  3729.             DRWBOX 1, 10, 0, 0, 639, 479
  3730.             DRWLINE 1, 10, 0, 240, 639, 240
  3731.             DRWLINE 1, 10, 320, 0, 320, 479
  3732.             DEG2RAD! = 4 * ATN(1) / 180
  3733.             FOR I = -8192 TO 8192 STEP 16
  3734.                Y1& = GETARCCOS(I)
  3735.                DRWPOINT 1, 12, 320 + Y1& * 3, 240 - I / 34
  3736.             NEXT I
  3737.             WHILE INKEY$ = ""
  3738.             WEND
  3739.             VIDEOMODESET VMODE
  3740.             END
  3741.  
  3742.  
  3743.                                                                          59
  3744.  
  3745.  
  3746.  
  3747.  
  3748.  
  3749.           GETARCSIN
  3750.  
  3751.             PROTOTYPE
  3752.  
  3753.             FUNCTION GETARCSIN% (Value&)
  3754.  
  3755.             INPUT
  3756.  
  3757.             Value - number between -1 and +1 scaled up by 13 bits (8192)
  3758.  
  3759.             OUTPUT
  3760.  
  3761.             GETARCSIN returns the arc sine of Value in degrees.
  3762.  
  3763.             USAGE
  3764.  
  3765.             GETARCSIN returns the arc sine in degrees for the given value.
  3766.             The return will be between -90 and +90 degrees.  Value should
  3767.             be between -8192 and +8192 representing the range -1 to +1.
  3768.             Input values outside this range are invalid and GETARCSIN will
  3769.             return -32768. Floating point values are ignored.  This
  3770.             function uses an integer lookup table stored within the
  3771.             library in order to produce the fastest possible results.  No
  3772.             floating point arithmetic is used.  The scale factor of 13
  3773.             bits (8192) was chosen because this is the number of bits at
  3774.             which every change of one degree gives a change in the value
  3775.             of the sine (or cosine) function.
  3776.  
  3777.             SEE ALSO
  3778.  
  3779.             GETARCCOS, GETARCTAN, GETCOS, GETSIN, GETTAN
  3780.  
  3781.             EXAMPLE
  3782.  
  3783.             REM SHOW GETARCSIN
  3784.             $LINK "SVGAPB.PBL"
  3785.             $INCLUDE "SVGAPB.BI"
  3786.             DEFINT A-Z
  3787.  
  3788.             VMODE = VIDEOMODEGET
  3789.             IF WHICHVGA = 0 THEN STOP
  3790.             DUMMY=RES640
  3791.             DRWBOX 1, 10, 0, 0, 639, 479
  3792.             DRWLINE 1, 10, 0, 240, 639, 240
  3793.             DRWLINE 1, 10, 320, 0, 320, 479
  3794.             DEG2RAD! = 4 * ATN(1) / 180
  3795.             FOR I = -8192 TO 8192 STEP 16
  3796.                Y1& = GETARCSIN(I)
  3797.                DRWPOINT 1, 12, 320 + Y1& * 3, 240 - I / 34
  3798.             NEXT I
  3799.             WHILE INKEY$ = ""
  3800.             WEND
  3801.             VIDEOMODESET VMODE
  3802.             END
  3803.  
  3804.  
  3805.                                                                          60
  3806.  
  3807.  
  3808.  
  3809.  
  3810.  
  3811.           GETARCTAN
  3812.  
  3813.             PROTOTYPE
  3814.  
  3815.             FUNCTION GETARCTAN% (Value&)
  3816.  
  3817.             INPUT
  3818.  
  3819.             Value - long integer representing a decimal scaled up by 13
  3820.             bits (8192)
  3821.  
  3822.             OUTPUT
  3823.  
  3824.             GETARCTAN returns the arc tangent of Value in degrees.
  3825.  
  3826.             USAGE
  3827.  
  3828.             GETARCTAN returns the arc cosine in degrees for the given
  3829.             value.  The return will be between -89 and +89 degrees.  Value
  3830.             can be any long integer.  It is interpreted as a decimal
  3831.             scaled up by 8192 (13 bits). Floating point values are
  3832.             ignored.  This function uses an integer lookup table stored
  3833.             within the library in order to produce the fastest possible
  3834.             results.  No floating point arithmetic is used.  The scale
  3835.             factor of 13 bits (8192) was chosen because this is the number
  3836.             of bits at which every change of one degree gives a change in
  3837.             the value of the sine (or cosine) function.
  3838.  
  3839.             SEE ALSO
  3840.  
  3841.             GETARCCOS, GETARCSIN, GETCOS, GETSIN, GETTAN
  3842.  
  3843.             EXAMPLE
  3844.  
  3845.             REM SHOW GETARCTAN
  3846.             $LINK "SVGAPB.PBL"
  3847.             $INCLUDE "SVGAPB.BI"
  3848.             DEFINT A-Z
  3849.  
  3850.             VMODE = VIDEOMODEGET
  3851.             IF WHICHVGA = 0 THEN STOP
  3852.             DUMMY=RES640
  3853.             DRWBOX 1, 10, 0, 0, 639, 479
  3854.             DRWLINE 1, 10, 0, 240, 639, 240
  3855.             DRWLINE 1, 10, 320, 0, 320, 479
  3856.             DEG2RAD! = 4 * ATN(1) / 180
  3857.             FOR I = -8192 TO 8192 STEP 16
  3858.                Y1& = GETARCTAN(I)
  3859.                Y2& = ATN(I / 8192) / DEG2RAD!
  3860.                DRWPOINT 1, 12, 320 + Y1& * 6, 240 - I / 34
  3861.                DRWPOINT 1, 15, 320 + Y2& * 6, 240 - I / 34
  3862.             NEXT I
  3863.             WHILE INKEY$ = ""
  3864.             WEND
  3865.  
  3866.  
  3867.                                                                          61
  3868.  
  3869.  
  3870.  
  3871.  
  3872.  
  3873.             VIDEOMODESET VMODE
  3874.             END
  3875.  
  3876.  
  3877.  
  3878.  
  3879.  
  3880.  
  3881.  
  3882.  
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898.  
  3899.  
  3900.  
  3901.  
  3902.  
  3903.  
  3904.  
  3905.  
  3906.  
  3907.  
  3908.  
  3909.  
  3910.  
  3911.  
  3912.  
  3913.  
  3914.  
  3915.  
  3916.  
  3917.  
  3918.  
  3919.  
  3920.  
  3921.  
  3922.  
  3923.  
  3924.  
  3925.  
  3926.  
  3927.  
  3928.  
  3929.                                                                          62
  3930.  
  3931.  
  3932.  
  3933.  
  3934.  
  3935.           GETCOS
  3936.  
  3937.             PROTOTYPE
  3938.  
  3939.             FUNCTION GETCOS& (Angle&)
  3940.  
  3941.             INPUT
  3942.  
  3943.             Angle - angle in degrees
  3944.  
  3945.             OUTPUT
  3946.  
  3947.             GETCOS returns the cosine of Angle scaled up by 13 bits
  3948.             (8192).
  3949.  
  3950.             USAGE
  3951.  
  3952.             GETCOS returns the cosine of the specified angle.  Angle can
  3953.             be any long value; floating point values are ignored.  The
  3954.             return value has been multiplied by 8192.  This function uses
  3955.             an integer lookup table stored within the library in order to
  3956.             produce the fastest possible results.  No floating point
  3957.             arithmetic is used.  The scale factor of 13 bits (8192) was
  3958.             chosen because this is the number of bits at which every
  3959.             change of one degree gives a change in the value of the sine
  3960.             (or cosine) function.
  3961.  
  3962.             SEE ALSO
  3963.  
  3964.             GETARCCOS, GETARCSIN, GETARCTAN, GETSIN, GETTAN
  3965.  
  3966.             EXAMPLE
  3967.  
  3968.             REM SHOW GETCOS
  3969.             $LINK "SVGAPB.PBL"
  3970.             $INCLUDE "SVGAPB.BI"
  3971.             DEFINT A-Z
  3972.  
  3973.             VMODE = VIDEOMODEGET
  3974.             IF WHICHVGA = 0 THEN STOP
  3975.             DUMMY=RES640
  3976.             DRWBOX 1, 10, 0, 0, 639, 479
  3977.             DRWLINE 1, 10, 0, 240, 639, 240
  3978.             DRWLINE 1, 10, 320, 0, 320, 479
  3979.             DEG2RAD! = 4 * ATN(1) / 180
  3980.             FOR I = -360 TO 360
  3981.                Y1& = GETCOS(I)
  3982.                Y1& = Y1& * 240 / 8192
  3983.                Y2& = 240 * COS(I * DEG2RAD!)
  3984.                DRWPOINT 1, 15, 320 + I, 240 - Y1&
  3985.                DRWPOINT 1, 12, 320 + I, 240 - Y2&
  3986.             NEXT I
  3987.             WHILE INKEY$ = ""
  3988.             WEND
  3989.  
  3990.  
  3991.                                                                          63
  3992.  
  3993.  
  3994.  
  3995.  
  3996.  
  3997.             VIDEOMODESET VMODE
  3998.             END
  3999.  
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.  
  4031.  
  4032.  
  4033.  
  4034.  
  4035.  
  4036.  
  4037.  
  4038.  
  4039.  
  4040.  
  4041.  
  4042.  
  4043.  
  4044.  
  4045.  
  4046.  
  4047.  
  4048.  
  4049.  
  4050.  
  4051.  
  4052.  
  4053.                                                                          64
  4054.  
  4055.  
  4056.  
  4057.  
  4058.  
  4059.           GETLASTSTRING
  4060.  
  4061.             PROTOTYPE
  4062.  
  4063.             SUB GETLASTSTRING (StrngGfxBlk%)
  4064.  
  4065.             INPUT
  4066.  
  4067.             no input parameters
  4068.  
  4069.             OUTPUT
  4070.  
  4071.             no value returned
  4072.             GfxBlk - integer destination array holding bitmap of text
  4073.             block
  4074.  
  4075.             USAGE
  4076.  
  4077.             GETLASTSTRING returns the text drawn on the screen by the last
  4078.             called DRWSTRING function.  The text is returned in GfxBlk
  4079.             which may be used with BLKPUT or the sprite functions.  The
  4080.             text in GfxBlk is oriented in the same manner as the last
  4081.             called DRWSTRING function.  The intended use is to call the
  4082.             DRWSTRING function using mode 0 which does not actually draw
  4083.             text on the screen.  GETLASTSTRING should be called
  4084.             immediately after the DRWSTRING function to prevent possible
  4085.             loss of data caused by other functions.
  4086.  
  4087.             GfxBlk must be dimensioned as a short integer array with a
  4088.             size in integers equal to
  4089.  
  4090.                     [(fontwidth*stringlength)*(fontheight)] / 2+3.
  4091.  
  4092.             The font's dimensions can be obtained by calling FONTGETINFO
  4093.             and the string's length can be obtained using Basic's LEN
  4094.             function.  Note, however, that GfxBlk can be quite large.  If
  4095.             the size of GfxBlk is insufficient, GETLASTSTRING will
  4096.             overwrite any data in memory contained beyond GfxBlk and may
  4097.             possibly cause the system to crash.
  4098.  
  4099.             Arrays should be passed by giving the element within the array
  4100.             from where the action should take place.  This allows the
  4101.             programmer to store more than one item within the same array
  4102.             or act on only a portion of the array.
  4103.  
  4104.             SEE ALSO
  4105.  
  4106.             BLKPUT, DRWSTRING, DRWSTRINGDN, DRWSTRINGLT, DRWSTRINGRT,
  4107.             FONTGETINFO
  4108.  
  4109.             EXAMPLE
  4110.  
  4111.             REM USES GETLASTSTRING TO DRAW SOME TEXT AT THE CENTER OF THE
  4112.             SCREEN
  4113.  
  4114.  
  4115.                                                                          65
  4116.  
  4117.  
  4118.  
  4119.  
  4120.  
  4121.             $LINK "SVGAPB.PBL"
  4122.             $INCLUDE "SVGAPB.BI"
  4123.             DEFINT A-Z
  4124.  
  4125.             VMODE=VIDEOMODEGET
  4126.             IF WHICHVGA = 0 THEN STOP
  4127.             DUMMY=RES640
  4128.             A$ = "HELLO WORLD"
  4129.             DRWSTRING 0, 10, 0, A$, 0, 0
  4130.             FONTGETINFO W, H
  4131.             L = LEN(A$)
  4132.             BLKSIZE = ( (W*L)*H )\2 + 3
  4133.             DIM BLK(0 TO BLKSIZE)
  4134.             GETLASTSTRING BLK(0)
  4135.             BLKPUT 1, 320, 240, BLK(0)
  4136.             WHILE INKEY$ = ""
  4137.             WEND
  4138.             VIDEOMODESET VMODE
  4139.             END
  4140.  
  4141.  
  4142.  
  4143.  
  4144.  
  4145.  
  4146.  
  4147.  
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.  
  4155.  
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162.  
  4163.  
  4164.  
  4165.  
  4166.  
  4167.  
  4168.  
  4169.  
  4170.  
  4171.  
  4172.  
  4173.  
  4174.  
  4175.  
  4176.  
  4177.                                                                          66
  4178.  
  4179.  
  4180.  
  4181.  
  4182.  
  4183.           GETMAXX
  4184.  
  4185.             PROTOTYPE
  4186.  
  4187.             FUNCTION GETMAXX% ()
  4188.  
  4189.             INPUT
  4190.  
  4191.             no input parameters
  4192.  
  4193.             OUTPUT
  4194.  
  4195.             GETMAXX returns the current horizontal resolution of the
  4196.             screen.
  4197.  
  4198.             USAGE
  4199.  
  4200.             GETMAXX returns the horizontal resolution of the screen in the
  4201.             current mode.  This function should only be called if one of
  4202.             the RES### functions has been previously called.  Otherwise,
  4203.             the value returned is meaningless.
  4204.  
  4205.             SEE ALSO
  4206.  
  4207.             GETMAXY
  4208.  
  4209.             EXAMPLE
  4210.  
  4211.             REM SHOW GETMAXX
  4212.             $LINK "SVGAPB.PBL"
  4213.             $INCLUDE "SVGAPB.BI"
  4214.             DEFINT A-Z
  4215.  
  4216.             VMODE = VIDEOMODEGET
  4217.             IF WHICHVGA = 0 THEN STOP
  4218.             DUMMY=RES640
  4219.             X$ = "MAX X SCREEN VALUE IS:" + STR$(GETMAXX)
  4220.             DRWSTRING 1, 7, 0, X$, 0, 0
  4221.             SETVIEW 0, 0, 400, 479
  4222.             X$ = "MAX X SCREEN VALUE IS STILL:" + STR$(GETMAXX)
  4223.             DRWSTRING 1, 7, 0, X$, 0, 20
  4224.             WHILE INKEY$ = ""
  4225.             WEND
  4226.             VIDEOMODESET VMODE
  4227.             END
  4228.  
  4229.  
  4230.  
  4231.  
  4232.  
  4233.  
  4234.  
  4235.  
  4236.  
  4237.  
  4238.  
  4239.                                                                          67
  4240.  
  4241.  
  4242.  
  4243.  
  4244.  
  4245.           GETMAXY
  4246.  
  4247.             PROTOTYPE
  4248.  
  4249.             FUNCTION GETMAXY% ()
  4250.  
  4251.             INPUT
  4252.  
  4253.             no input parameters
  4254.  
  4255.             OUTPUT
  4256.  
  4257.             GETMAXY returns the current vertical resolution of the screen.
  4258.  
  4259.             USAGE
  4260.  
  4261.             GETMAXY returns the vertical resolution of the screen in the
  4262.             current mode.  This function should only be called if one of
  4263.             the RES### functions has been previously called.  Otherwise,
  4264.             the value returned is meaningless.
  4265.  
  4266.             SEE ALSO
  4267.  
  4268.             GETMAXX
  4269.  
  4270.             EXAMPLE
  4271.  
  4272.             REM SHOW GETMAXY
  4273.             $LINK "SVGAPB.PBL"
  4274.             $INCLUDE "SVGAPB.BI"
  4275.             DEFINT A-Z
  4276.  
  4277.             VMODE = VIDEOMODEGET
  4278.             IF WHICHVGA = 0 THEN STOP
  4279.             DUMMY=RES640
  4280.             Y$ = "MAX Y SCREEN VALUE IS:" + STR$(GETMAXY)
  4281.             DRWSTRING 1, 7, 0, Y$, 0, 0
  4282.             SETVIEW 0, 0, 639, 200
  4283.             Y$ = "MAX Y SCREEN VALUE IS STILL:" + STR$(GETMAXY)
  4284.             DRWSTRING 1, 7, 0, Y$, 0, 20
  4285.             WHILE INKEY$ = ""
  4286.             WEND
  4287.             VIDEOMODESET VMODE
  4288.             END
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294.  
  4295.  
  4296.  
  4297.  
  4298.  
  4299.  
  4300.  
  4301.                                                                          68
  4302.  
  4303.  
  4304.  
  4305.  
  4306.  
  4307.           GETPOINT
  4308.  
  4309.             PROTOTYPE
  4310.  
  4311.             FUNCTION GETPOINT% (X%, Y%)
  4312.  
  4313.             INPUT
  4314.  
  4315.             X, Y - location of pixel to read
  4316.  
  4317.             OUTPUT
  4318.  
  4319.             GETPOINT returns the color index of pixel at X, Y.
  4320.  
  4321.             USAGE
  4322.  
  4323.             GETPOINT returns the value of the pixel at location X, Y.
  4324.             This value is a color index into the current palette.
  4325.  
  4326.             SEE ALSO
  4327.  
  4328.             DRWPOINT
  4329.  
  4330.             EXAMPLE
  4331.  
  4332.             REM DRAW A POINT AND CHECK TO MAKE SURE IT IS THERE
  4333.             $LINK "SVGAPB.PBL"
  4334.             $INCLUDE "SVGAPB.BI"
  4335.  
  4336.             DEFINT A-Z
  4337.             IF WHICHVGA = 0 THEN STOP
  4338.             IF WHICHMEM < 512 THEN STOP
  4339.             VMODE = VIDEOMODEGET
  4340.             DUMMY=RES640
  4341.             DRWPOINT 1, 10, 320, 240
  4342.             POINTVALUE = GETPOINT(320, 240)
  4343.             A$ = "THE POINT VALUE IS:" + STR$(POINTVALUE)
  4344.             DRWSTRING 1, 7, 0, A$, 0, 0
  4345.             WHILE INKEY$ = ""
  4346.             WEND
  4347.             VIDEOMODESET VMODE
  4348.             END
  4349.  
  4350.  
  4351.  
  4352.  
  4353.  
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360.  
  4361.  
  4362.  
  4363.                                                                          69
  4364.  
  4365.  
  4366.  
  4367.  
  4368.  
  4369.           GETSIN
  4370.  
  4371.             PROTOTYPE
  4372.  
  4373.             FUNCTION GETSIN& (Ang&)
  4374.  
  4375.             INPUT
  4376.  
  4377.             Angle - angle in degrees
  4378.  
  4379.             OUTPUT
  4380.  
  4381.             GETSIN returns the sine of Angle scaled up by 13 bits (8192).
  4382.  
  4383.             USAGE
  4384.  
  4385.             GETSIN returns the sine of the specified angle.  Angle can be
  4386.             any long value; floating point values are ignored.  The return
  4387.             value has been multiplied by 8192.  This function uses an
  4388.             integer lookup table stored within the library in order to
  4389.             produce the fastest possible results.  No floating point
  4390.             arithmetic is used.  The scale factor of 13 bits (8192) was
  4391.             chosen because this is the number of bits at which every
  4392.             change of one degree gives a change in the value of the sine
  4393.             (or cosine) function.
  4394.  
  4395.             SEE ALSO
  4396.  
  4397.             GETARCCOS, GETARCSIN, GETARCTAN, GETCOS, GETTAN
  4398.  
  4399.             EXAMPLE
  4400.  
  4401.             REM SHOW GETSIN
  4402.             $LINK "SVGAPB.PBL"
  4403.             $INCLUDE "SVGAPB.BI"
  4404.             DEFINT A-Z
  4405.  
  4406.             VMODE = VIDEOMODEGET
  4407.             IF WHICHVGA = 0 THEN STOP
  4408.             DUMMY=RES640
  4409.             DRWBOX 1, 10, 0, 0, 639, 479
  4410.             DRWLINE 1, 10, 0, 240, 639, 240
  4411.             DRWLINE 1, 10, 320, 0, 320, 479
  4412.             DEG2RAD! = 4 * ATN(1) / 180
  4413.             FOR I = -360 TO 360
  4414.                Y1& = GETSIN(I)
  4415.                Y1& = Y1& * 240 / 8192
  4416.                Y2& = 240 * SIN(I * DEG2RAD!)
  4417.                DRWPOINT 1, 15, 320 + I, 240 - Y1&
  4418.                DRWPOINT 1, 12, 320 + I, 240 - Y2&
  4419.             NEXT I
  4420.             WHILE INKEY$ = ""
  4421.             WEND
  4422.             VIDEOMODESET VMODE
  4423.  
  4424.  
  4425.                                                                          70
  4426.  
  4427.  
  4428.  
  4429.  
  4430.  
  4431.             END
  4432.  
  4433.  
  4434.  
  4435.  
  4436.  
  4437.  
  4438.  
  4439.  
  4440.  
  4441.  
  4442.  
  4443.  
  4444.  
  4445.  
  4446.  
  4447.  
  4448.  
  4449.  
  4450.  
  4451.  
  4452.  
  4453.  
  4454.  
  4455.  
  4456.  
  4457.  
  4458.  
  4459.  
  4460.  
  4461.  
  4462.  
  4463.  
  4464.  
  4465.  
  4466.  
  4467.  
  4468.  
  4469.  
  4470.  
  4471.  
  4472.  
  4473.  
  4474.  
  4475.  
  4476.  
  4477.  
  4478.  
  4479.  
  4480.  
  4481.  
  4482.  
  4483.  
  4484.  
  4485.  
  4486.  
  4487.                                                                          71
  4488.  
  4489.  
  4490.  
  4491.  
  4492.  
  4493.           GETTAN
  4494.  
  4495.             PROTOTYPE
  4496.  
  4497.             FUNCTION GETTAN& (Ang&)
  4498.  
  4499.             INPUT
  4500.  
  4501.             Angle - angle in degrees
  4502.  
  4503.             OUTPUT
  4504.  
  4505.             GETTAN returns the tangent of Angle scaled up by 13 bits
  4506.             (8192).
  4507.  
  4508.             USAGE
  4509.  
  4510.             GETTAN returns the tangent of the specified angle.  Angle can
  4511.             be any long value except +(90+n*180), where n is an integer.
  4512.             Floating point values are ignored.  The return value has been
  4513.             multiplied by 8192.  If an invalid angle is given, the GETTAN
  4514.             will return &H80000000 (-2147483648).  This function uses an
  4515.             integer lookup table stored within the library in order to
  4516.             produce the fastest possible results.  No floating point
  4517.             arithmetic is used.  The scale factor of 13 bits (8192) was
  4518.             chosen because this is the number of bits at which every
  4519.             change of one degree gives a change in the value of the sine
  4520.             (or cosine) function.
  4521.  
  4522.             SEE ALSO
  4523.  
  4524.             GETARCCOS, GETARCSIN, GETARCTAN, GETCOS, GETSIN
  4525.  
  4526.             EXAMPLE
  4527.  
  4528.             REM SHOW GETTAN
  4529.             $LINK "SVGAPB.PBL"
  4530.             $INCLUDE "SVGAPB.BI"
  4531.             DEFINT A-Z
  4532.  
  4533.             VMODE = VIDEOMODEGET
  4534.             IF WHICHVGA = 0 THEN STOP
  4535.             DUMMY=RES640
  4536.             DRWBOX 1, 10, 0, 0, 639, 479
  4537.             DRWLINE 1, 10, 0, 240, 639, 240
  4538.             DRWLINE 1, 10, 320, 0, 320, 479
  4539.             DEG2RAD! = 4 * ATN(1) / 180
  4540.             FOR I = -360 TO 360
  4541.                IF ((I - 90) / 180) <> INT((I - 90) / 180) THEN
  4542.                  Y1& = GETTAN(I)
  4543.                  Y1& = Y1& * 240 / 8192
  4544.                  Y2& = 240 * TAN(I * DEG2RAD!)
  4545.                  DRWPOINT 1, 15, 320 + I, 240 - Y1&
  4546.                  DRWPOINT 1, 12, 320 + I, 240 - Y2&
  4547.  
  4548.  
  4549.                                                                          72
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555.                END IF
  4556.             NEXT I
  4557.             WHILE INKEY$ = ""
  4558.             WEND
  4559.             VIDEOMODESET VMODE
  4560.             END
  4561.  
  4562.  
  4563.  
  4564.  
  4565.  
  4566.  
  4567.  
  4568.  
  4569.  
  4570.  
  4571.  
  4572.  
  4573.  
  4574.  
  4575.  
  4576.  
  4577.  
  4578.  
  4579.  
  4580.  
  4581.  
  4582.  
  4583.  
  4584.  
  4585.  
  4586.  
  4587.  
  4588.  
  4589.  
  4590.  
  4591.  
  4592.  
  4593.  
  4594.  
  4595.  
  4596.  
  4597.  
  4598.  
  4599.  
  4600.  
  4601.  
  4602.  
  4603.  
  4604.  
  4605.  
  4606.  
  4607.  
  4608.  
  4609.  
  4610.  
  4611.                                                                          73
  4612.  
  4613.  
  4614.  
  4615.  
  4616.  
  4617.           GIFGETINFO
  4618.  
  4619.             PROTOTYPE
  4620.  
  4621.             FUNCTION GIFGETINFO% (FileName$, GifXSize%, GifYSize%,
  4622.             NumColors%, Pal AS RGBType)
  4623.  
  4624.             INPUT
  4625.  
  4626.             Filename$ - the filename of the GIF image to read
  4627.  
  4628.             OUTPUT
  4629.  
  4630.             GIFGETINFO returns the status of the function (1 = success).
  4631.             Width - the width in pixels of the image
  4632.             Height - the height in pixels of the image
  4633.             NumColors - the number of colors in the image palette
  4634.             Pal - RGBType array with 768 elements containing the image
  4635.             palette
  4636.  
  4637.             USAGE
  4638.  
  4639.             GIFGETINFO reads Filename$ and returns the characteristics of
  4640.             the image.  The dimensions of the image are returned in Width,
  4641.             Height.  The number of colors in the image's palette is
  4642.             returned in NumColors and the palette is returned in Pal.
  4643.             Although the image's palette may contain less than 256 colors,
  4644.             Pal must be 768 elements in length.  The image's palette will
  4645.             begin with the first element of Pal..
  4646.  
  4647.             For ease of programming the GIF decoder requires that the
  4648.             image be non-interlaced, use only a global color map and be
  4649.             compressed according to GIF87a specifications.
  4650.  
  4651.             If GIFGETINFO determines that Filename$ is a satisfactory
  4652.             file, the function will return a one.  Otherwise, the function
  4653.             will return one of several error codes concerning Filename$ as
  4654.             listed below:
  4655.  
  4656.             0 =  does not exist or there is some disk I/O problem
  4657.             -1 = does not have the GIF87a signature
  4658.             -2 = image is interlaced
  4659.             -3 = does not use a global color map
  4660.             -4 = has some general error
  4661.  
  4662.             SEE ALSO
  4663.  
  4664.             GIFMAKE, GIFPUT
  4665.  
  4666.             EXAMPLE
  4667.  
  4668.             REM GET THE INFORMATION OF THE GIF FILE 'UTTOWER.GIF'
  4669.             $LINK "SVGAPB.PBL"
  4670.             $INCLUDE "SVGAPB.BI"
  4671.  
  4672.  
  4673.                                                                          74
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.             DEFINT A-Z
  4680.             DIM GIFPAL(255) AS RGBType
  4681.  
  4682.             CLS
  4683.             GIFFILENAME$="UTTOWER.GIF"
  4684.             PRINT
  4685.             OK = GIFGETINFO(GIFFILENAME$, XSIZE, YSIZE, NUMCOL, GIFPAL(0))
  4686.             IF OK = 1 THEN
  4687.                A$ = "'" + GIFFILENAME$ + "' is identified as a 'Non-
  4688.             Interlaced' type GIF"
  4689.                A$ = A$ + "'GIF87a' GIF."
  4690.                PRINT A$
  4691.                A$ = "Dimensions are:" + STR$(XSIZE) + " pixels wide and" +
  4692.             STR$(YSIZE)
  4693.                A$ = A$ + " pixels high"
  4694.                PRINT A$
  4695.                A$ = "Number of colors:" + STR$(NUMCOL)
  4696.                PRINT A$
  4697.             END IF
  4698.             WHILE INKEY$ = ""
  4699.             WEND
  4700.             END
  4701.  
  4702.  
  4703.  
  4704.  
  4705.  
  4706.  
  4707.  
  4708.  
  4709.  
  4710.  
  4711.  
  4712.  
  4713.  
  4714.  
  4715.  
  4716.  
  4717.  
  4718.  
  4719.  
  4720.  
  4721.  
  4722.  
  4723.  
  4724.  
  4725.  
  4726.  
  4727.  
  4728.  
  4729.  
  4730.  
  4731.  
  4732.  
  4733.  
  4734.  
  4735.                                                                          75
  4736.  
  4737.  
  4738.  
  4739.  
  4740.  
  4741.           GIFMAKE
  4742.  
  4743.             PROTOTYPE
  4744.  
  4745.             FUNCTION GIFMAKE% (X1%, Y1%, X2%, Y2%, FileName$)
  4746.  
  4747.             INPUT
  4748.  
  4749.             X1, Y1 - the location of the top, left corner of the image
  4750.             X2, Y2 - the bottom, right corner of the image
  4751.             Filename$ - filename to store the GIF image
  4752.  
  4753.             OUTPUT
  4754.  
  4755.             GIFMAKE returns a 1 if successful, 0 if unsuccessful.
  4756.  
  4757.             USAGE
  4758.  
  4759.             GIFMAKE takes the bitmap enclosed in the box defined by (X1,
  4760.             Y1) - (X2, Y2) and writes a GIF with the filename specified by
  4761.             Filename$.  The resulting file uses the GIF87a compression
  4762.             specifications.  X1, Y1, X2 and Y2 must be valid coordinates
  4763.             on the currently active page.  Filename$ may specify a full
  4764.             path and drive letter, if necessary.
  4765.  
  4766.             SEE ALSO
  4767.  
  4768.             GIFGETINFO, GIFPUT
  4769.  
  4770.             EXAMPLE
  4771.  
  4772.             REM MAKE A 256 COLOR GIF FILE
  4773.             $LINK "SVGAPB.PBL"
  4774.             $INCLUDE "SVGAPB.BI"
  4775.             DEFINT A-Z
  4776.             DIM DT(0 TO 10000) AS INTEGER
  4777.             IF WHICHCPU < 386 THEN END
  4778.             IF WHICHVGA = 0 THEN END
  4779.             VMODE = VIDEOMODEGET
  4780.             DUMMY = RES640
  4781.             FILLSCREEN 10
  4782.             FOR A = 0 TO 200
  4783.                X1 = RND * GETMAXX
  4784.                Y1 = RND * GETMAXY
  4785.                X2 = RND * GETMAXX
  4786.                Y2 = RND * GETMAXY
  4787.                C = RND * 255
  4788.                DRWLINE 1, C, X1, Y1, X2, Y2
  4789.             NEXT A
  4790.             DRWBOX 1, 15, 0, 0, GETMAXX, GETMAXY
  4791.             A$ = "This GIF file was created using Zephyr Software's
  4792.             'GIFMAKE'!"
  4793.             DRWSTRING 1, 15, 0, A$, 2, 2
  4794.             ER = GIFMAKE(0, 0, GETMAXX, GETMAXY, "TEST.GIF")
  4795.  
  4796.  
  4797.                                                                          76
  4798.  
  4799.  
  4800.  
  4801.  
  4802.  
  4803.             VIDEOMODESET VMODE
  4804.             IF ER <> 1 THEN
  4805.                PRINT "GIF MAKE ERROR!"
  4806.             END IF
  4807.             END
  4808.  
  4809.  
  4810.  
  4811.  
  4812.  
  4813.  
  4814.  
  4815.  
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822.  
  4823.  
  4824.  
  4825.  
  4826.  
  4827.  
  4828.  
  4829.  
  4830.  
  4831.  
  4832.  
  4833.  
  4834.  
  4835.  
  4836.  
  4837.  
  4838.  
  4839.  
  4840.  
  4841.  
  4842.  
  4843.  
  4844.  
  4845.  
  4846.  
  4847.  
  4848.  
  4849.  
  4850.  
  4851.  
  4852.  
  4853.  
  4854.  
  4855.  
  4856.  
  4857.  
  4858.  
  4859.                                                                          77
  4860.  
  4861.  
  4862.  
  4863.  
  4864.  
  4865.           GIFPUT
  4866.  
  4867.             PROTOTYPE
  4868.  
  4869.             FUNCTION GIFPUT% (Mode%, Xloc%, Yloc%,  FileName$)
  4870.  
  4871.             INPUT
  4872.  
  4873.             Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  4874.             X, Y - the location of the top, left corner of the GIF image
  4875.             Filename$ - filename of the GIF image to read
  4876.  
  4877.             OUTPUT
  4878.  
  4879.             GIFPUT returns the status of the function (1 = success).
  4880.  
  4881.             USAGE
  4882.  
  4883.             GIFPUT reads the GIF image from Filename$ and places it on the
  4884.             screen with the top, left corner at X, Y.  The image is
  4885.             automatically clipped to the currently defined viewport.  The
  4886.             image's palette should be previously obtained by using
  4887.             GIFGETINFO.
  4888.  
  4889.             For ease of programming the GIF decoder requires that the
  4890.             image be non-interlaced, use only a global color map and be
  4891.             compressed according to GIF87a specifications.
  4892.  
  4893.             If GIFPUT encounters no problems, the function will return a
  4894.             one.  Otherwise, the function will return one of several error
  4895.             codes concerning Filename$ as listed below:
  4896.  
  4897.             0 =  does not exist or there is some disk I/O problem
  4898.             -1 = does not have the GIF87a signature
  4899.             -2 = image is interlaced
  4900.             -3 = does not use a global color map
  4901.             -4 = has some general error
  4902.  
  4903.             SEE ALSO
  4904.  
  4905.             GIFGETINFO, GIFMAKE, SETVIEW
  4906.  
  4907.             EXAMPLE
  4908.  
  4909.             REM DISPLAY THE GIF FILE 'UTTOWER.GIF'
  4910.             $LINK "SVGAPB.PBL"
  4911.             $INCLUDE "SVGAPB.BI"
  4912.             DEFINT A-Z
  4913.             DIM GIFPAL(255) AS RGBType
  4914.  
  4915.             IF WHICHVGA = 0 THEN STOP
  4916.             IF WHICHMEM < 512 THEN STOP
  4917.             GIFFILENAME$="UTTOWER.GIF"
  4918.             VMODE = VIDEOMODEGET
  4919.  
  4920.  
  4921.                                                                          78
  4922.  
  4923.  
  4924.  
  4925.  
  4926.  
  4927.             DUMMY=RES640
  4928.             OK = GIFGETINFO(GIFFILENAME$, XSIZE, YSIZE, NUMCOL, GIFPAL(0))
  4929.             IF OK = 1 THEN
  4930.                FIXIT = 0
  4931.                FOR I = 0 TO NUMCOL - 1
  4932.                  IF GIFPAL(I).R > 63 THEN
  4933.                     FIXIT = 1
  4934.                     EXIT FOR
  4935.                  END IF
  4936.                  IF GIFPAL(I).G > 63 THEN
  4937.                     FIXIT = 1
  4938.                     EXIT FOR
  4939.                  END IF
  4940.                  IF GIFPAL(I).B> 63 THEN
  4941.                     FIXIT = 1
  4942.                     EXIT FOR
  4943.                  END IF
  4944.                NEXT I
  4945.                IF FIXIT = 1 THEN
  4946.                  FOR I= 0 TO NUMCOL - 1
  4947.                     SHIFT RIGHT GIFPAL(I).R, 2
  4948.                     SHIFT RIGHT GIFPAL(I).G, 2
  4949.                     SHIFT RIGHT GIFPAL(I).B, 2
  4950.                  NEXT I
  4951.                END IF
  4952.                PALSET GIFPAL(0), 0, 255
  4953.                OK = GIFPUT(1, 0, 0, GIFFILENAME$)
  4954.                IF OK <> 1 THEN
  4955.                  SOUND 100, 5
  4956.                END IF
  4957.             END IF
  4958.             WHILE INKEY$ = ""
  4959.             WEND
  4960.             VIDEOMODESET VMODE
  4961.             END
  4962.  
  4963.  
  4964.  
  4965.  
  4966.  
  4967.  
  4968.  
  4969.  
  4970.  
  4971.  
  4972.  
  4973.  
  4974.  
  4975.  
  4976.  
  4977.  
  4978.  
  4979.  
  4980.  
  4981.  
  4982.  
  4983.                                                                          79
  4984.  
  4985.  
  4986.  
  4987.  
  4988.  
  4989.           JOYSTICKINFO
  4990.  
  4991.             PROTOTYPE
  4992.  
  4993.             SUB JOYSTICKINFO (JAX%, JAY%, JAButs%, JBX%, JBY%, JBButs%)
  4994.  
  4995.             INPUT
  4996.  
  4997.             no input parameters
  4998.  
  4999.             OUTPUT
  5000.  
  5001.             no value returned
  5002.             JAX, JAY - horizontal and vertical values of joystick A
  5003.             JAButs - button status of joystick A
  5004.             JBX, JBY - horizontal and vertical values of joystick B
  5005.             JBButs - button status of joystick B
  5006.  
  5007.             USAGE
  5008.  
  5009.             JOYSTICKINFO returns the current status of the two joysticks'
  5010.             position and buttons.  The position is returned in JAX, JAY
  5011.             for joystick A and JBX, JBY for joystick B.  The buttons'
  5012.             status is held in JAButs and JBButs.  For each joystick,
  5013.             button A - usually the fire button - is held in bit zero and
  5014.             button B is in bit one.  Button status is most easily checked
  5015.             with a bitwise AND of JAButs (or JBButs) and the desired bit.
  5016.  
  5017.             Not all joysticks are constructed the same.  In addition,
  5018.             joysticks are not linear devices.  The value of its center
  5019.             will not necessarily be the mean of its extreme values.
  5020.             Therefore, it is recommended that any program using the
  5021.             joystick for more than just directional control complete a
  5022.             calibration of the joystick prior to usage.  For an example of
  5023.             joystick calibration, see the SVGADEMO.EXE source code.
  5024.  
  5025.             SEE ALSO
  5026.  
  5027.             WHICHJOYSTICK
  5028.  
  5029.             EXAMPLE
  5030.  
  5031.             REM DISPLAY THE STATUS OF THE JOYSTICK PORT
  5032.             $LINK "SVGAPB.PBL"
  5033.             $INCLUDE "SVGAPB.BI"
  5034.             DEFINT A-Z
  5035.  
  5036.             CLS
  5037.             WHILE INKEY$ = ""
  5038.                JOYSTICKINFO JAX, JAY, JAButs, JBX, JBY, JBButs
  5039.                LOCATE 1, 1
  5040.                PRINT STRING$(40, 32)
  5041.                LOCATE 1, 1
  5042.                PRINT JAX; JAY; JAButs, JBX; JBY; JBButs;
  5043.  
  5044.  
  5045.                                                                          80
  5046.  
  5047.  
  5048.  
  5049.  
  5050.  
  5051.                SDELAY 4
  5052.             WEND
  5053.             END
  5054.  
  5055.  
  5056.  
  5057.  
  5058.  
  5059.  
  5060.  
  5061.  
  5062.  
  5063.  
  5064.  
  5065.  
  5066.  
  5067.  
  5068.  
  5069.  
  5070.  
  5071.  
  5072.  
  5073.  
  5074.  
  5075.  
  5076.  
  5077.  
  5078.  
  5079.  
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086.  
  5087.  
  5088.  
  5089.  
  5090.  
  5091.  
  5092.  
  5093.  
  5094.  
  5095.  
  5096.  
  5097.  
  5098.  
  5099.  
  5100.  
  5101.  
  5102.  
  5103.  
  5104.  
  5105.  
  5106.  
  5107.                                                                          81
  5108.  
  5109.  
  5110.  
  5111.  
  5112.  
  5113.           MOUSEBUTPRESS
  5114.  
  5115.             PROTOTYPE
  5116.  
  5117.             SUB MOUSEBUTPRESS (ReqBut%, Xloc%, Yloc%, Num%, MButs%)
  5118.  
  5119.             INPUT
  5120.  
  5121.             ReqButton - button for which information is requested
  5122.  
  5123.             OUTPUT
  5124.  
  5125.             no value returned
  5126.             X, Y - current location of mouse cursor
  5127.             Num - number of times button has been pressed since last
  5128.             request
  5129.             MouseButs - current status of the mouse buttons
  5130.  
  5131.             USAGE
  5132.  
  5133.             MOUSEBUTPRESS returns in Num the number of times a mouse
  5134.             button has been pressed since the last call to MOUSEBUTPRESS.
  5135.             In addition the current status of the mouse cursor and buttons
  5136.             is returned.  The position is returned in X, Y.  The buttons'
  5137.             status is held in MouseButs.  The left button is held in bit
  5138.             zero, right button in bit one and center button - for three
  5139.             button mice - in bit two.  Button status is most easily
  5140.             checked with a bitwise AND of MouseButs and the desired bit.
  5141.             The button for which a history is desired is identified by the
  5142.             bits in ReqButton.  However, only one bit may be set.
  5143.             Therefore, only the values of 1, 2 and 4 are permitted.  If
  5144.             more than one bit in ReqButton is set, the function will exit
  5145.             and no information will be returned.
  5146.  
  5147.             SEE ALSO
  5148.  
  5149.             MOUSEBUTRELEASE, MOUSESTATUS
  5150.  
  5151.             EXAMPLE
  5152.  
  5153.             REM ENABLE, SHOW, MOUSE / DISPLAY LEFT BUTTON PRESS HISTORY
  5154.             REM FOR THE LAST 2 SECONDS
  5155.             $LINK "SVGAPB.PBL"
  5156.             $INCLUDE "SVGAPB.BI"
  5157.             DEFINT A-Z
  5158.  
  5159.             VMODE = VIDEOMODEGET
  5160.             IF WHICHVGA = 0 THEN STOP
  5161.             IF WHICHMOUSE = 0 THEN STOP
  5162.             DUMMY=RES640
  5163.             MOUSEENTER
  5164.             MOUSESHOW
  5165.             WHILE INKEY$ = ""
  5166.                MOUSEBUTPRESS 1, X, Y, N, MBUTS
  5167.  
  5168.  
  5169.                                                                          82
  5170.  
  5171.  
  5172.  
  5173.  
  5174.  
  5175.                D$ = "MX=" + STR$(X)
  5176.                L = LEN(D$)
  5177.                IF L < 10 THEN
  5178.                  D$ = D$ + STRING$(8 - L, 32)
  5179.                END IF
  5180.                D$ = D$ + "MY=" + STR$(Y)
  5181.                L = LEN(D$)
  5182.                IF L < 20 THEN
  5183.                  D$ = D$ + STRING$(16 - L, 32)
  5184.                END IF
  5185.                D$ = D$ + "Number Of Times=" + STR$(N)
  5186.                DRWSTRING 1, 15, 8, D$, 0, 0
  5187.                SDELAY 80
  5188.             WEND
  5189.             MOUSEEXIT
  5190.             VIDEOMODESET VMODE
  5191.             END
  5192.  
  5193.  
  5194.  
  5195.  
  5196.  
  5197.  
  5198.  
  5199.  
  5200.  
  5201.  
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.  
  5209.  
  5210.  
  5211.  
  5212.  
  5213.  
  5214.  
  5215.  
  5216.  
  5217.  
  5218.  
  5219.  
  5220.  
  5221.  
  5222.  
  5223.  
  5224.  
  5225.  
  5226.  
  5227.  
  5228.  
  5229.  
  5230.  
  5231.                                                                          83
  5232.  
  5233.  
  5234.  
  5235.  
  5236.  
  5237.           MOUSEBUTRELEASE
  5238.  
  5239.             PROTOTYPE
  5240.  
  5241.             SUB MOUSEBUTRELEASE (ReqBut%, Xloc%, Yloc%, Num%, MButs%)
  5242.  
  5243.             INPUT
  5244.  
  5245.             ReqButton - button for which information is requested
  5246.  
  5247.             OUTPUT
  5248.  
  5249.             no value returned
  5250.             X, Y - current location of mouse cursor
  5251.             Num - number of times button has been released since last
  5252.             request
  5253.             MouseButs - current status of mouse buttons
  5254.  
  5255.             USAGE
  5256.  
  5257.             MOUSEBUTRELEASE returns in Num the number of times a mouse
  5258.             button has been released since the last call to
  5259.             MOUSEBUTRELEASE.  In addition the current status of the mouse
  5260.             cursor and buttons is returned.  The position is returned in
  5261.             X, Y.  The buttons' status is held in MouseButs.  The left
  5262.             button is held in bit zero, right button in bit one and center
  5263.             button - for three button mice - in bit two.  Button status is
  5264.             most easily checked with a bitwise AND of MouseButs and the
  5265.             desired bit.  The button for which a history is desired is
  5266.             identified by the bits in ReqButton.  However, only one bit
  5267.             may be set.  Therefore, only the values of 1, 2 and 4 are
  5268.             permitted.  If more than one bit in ReqButton is set, the
  5269.             function will exit and no information will be returned.
  5270.  
  5271.             SEE ALSO
  5272.  
  5273.             MOUSEBUTPRESS, MOUSESTATUS
  5274.  
  5275.             EXAMPLE
  5276.  
  5277.             REM ENABLE, SHOW, MOUSE / DISPLAY LEFT BUTTON RELEASE HISTORY
  5278.             REM FOR THE LAST 2 SECONDS
  5279.             $LINK "SVGAPB.PBL"
  5280.             $INCLUDE "SVGAPB.BI"
  5281.             DEFINT A-Z
  5282.  
  5283.             VMODE = VIDEOMODEGET
  5284.             IF WHICHVGA = 0 THEN STOP
  5285.             IF WHICHMOUSE = 0 THEN STOP
  5286.             DUMMY=RES640
  5287.             MOUSEENTER
  5288.             MOUSESHOW
  5289.             WHILE INKEY$ = ""
  5290.                MOUSEBUTRELEASE 1, X, Y, N, MBUTS
  5291.  
  5292.  
  5293.                                                                          84
  5294.  
  5295.  
  5296.  
  5297.  
  5298.  
  5299.                D$ = "MX=" + STR$(X)
  5300.                L = LEN(D$)
  5301.                IF L < 10 THEN
  5302.                D$ = D$ + STRING$(8 - L, 32)
  5303.                END IF
  5304.                D$ = D$ + "MY=" + STR$(Y)
  5305.                L = LEN(D$)
  5306.                IF L < 20 THEN
  5307.                  D$ = D$ + STRING$(16 - L, 32)
  5308.                END IF
  5309.                D$ = D$ + "Number Of Times=" + STR$(N)
  5310.                DRWSTRING 1, 15, 8, D$, 0, 0
  5311.                SDELAY 80
  5312.             WEND
  5313.             MOUSEEXIT
  5314.             VIDEOMODESET VMODE
  5315.             END
  5316.  
  5317.  
  5318.  
  5319.  
  5320.  
  5321.  
  5322.  
  5323.  
  5324.  
  5325.  
  5326.  
  5327.  
  5328.  
  5329.  
  5330.  
  5331.  
  5332.  
  5333.  
  5334.  
  5335.  
  5336.  
  5337.  
  5338.  
  5339.  
  5340.  
  5341.  
  5342.  
  5343.  
  5344.  
  5345.  
  5346.  
  5347.  
  5348.  
  5349.  
  5350.  
  5351.  
  5352.  
  5353.  
  5354.  
  5355.                                                                          85
  5356.  
  5357.  
  5358.  
  5359.  
  5360.  
  5361.           MOUSECURSORDEFAULT
  5362.  
  5363.             PROTOTYPE
  5364.  
  5365.             SUB MOUSECURSORDEFAULT ()
  5366.  
  5367.             INPUT
  5368.  
  5369.             no input parameters
  5370.  
  5371.             OUTPUT
  5372.  
  5373.             no value returned
  5374.  
  5375.             USAGE
  5376.  
  5377.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  5378.             arrow with the hot spot in the upper, left corner.  This is
  5379.             the cursor set when MOUSEENTER is called.
  5380.  
  5381.             SEE ALSO
  5382.  
  5383.             MOUSECURSORSET, MOUSEENTER
  5384.  
  5385.             EXAMPLE
  5386.  
  5387.             See MOUSECURSORSET
  5388.  
  5389.  
  5390.  
  5391.  
  5392.  
  5393.  
  5394.  
  5395.  
  5396.  
  5397.  
  5398.  
  5399.  
  5400.  
  5401.  
  5402.  
  5403.  
  5404.  
  5405.  
  5406.  
  5407.  
  5408.  
  5409.  
  5410.  
  5411.  
  5412.  
  5413.  
  5414.  
  5415.  
  5416.  
  5417.                                                                          86
  5418.  
  5419.  
  5420.  
  5421.  
  5422.  
  5423.           MOUSECURSORSET
  5424.  
  5425.             PROTOTYPE
  5426.  
  5427.             SUB MOUSECURSORSET (MouseCursor?)
  5428.  
  5429.             INPUT
  5430.  
  5431.             MouseCursor - byte array of 386 elements containing mouse
  5432.             cursor data
  5433.  
  5434.             OUTPUT
  5435.  
  5436.             no value returned
  5437.  
  5438.             USAGE
  5439.  
  5440.             MOUSECURSORSET defines the cursor according to the data in
  5441.             MouseCursor.  The hot spot X and Y location for the cursor is
  5442.             defined by the first two bytes of MouseCursor.  The values for
  5443.             the hot spot must be within the cursor.  Valid values are from
  5444.             0 to 15 for the X location and from 0 to 23 for the Y
  5445.             location.
  5446.  
  5447.             SEE ALSO
  5448.  
  5449.             MOUSECURSORDEFAULT, MOUSEENTER, MOUSESHOW
  5450.  
  5451.             EXAMPLE
  5452.  
  5453.             REM MAKE A BIG CURSOR, THEN RESTORE IT BACK TO THE DEFAULT
  5454.             $LINK "SVGAPB.PBL"
  5455.             $INCLUDE "SVGAPB.BI"
  5456.             DEFINT A-Z
  5457.  
  5458.             VMODE = VIDEOMODEGET
  5459.             IF WHICHVGA = 0 THEN STOP
  5460.             IF WHICHMEM < 512 THEN STOP
  5461.             IF WHICHMOUSE = 0 THEN STOP
  5462.             DUMMY=RES640
  5463.             MOUSEENTER
  5464.             DIM BIGMOUSECURSOR(385) AS BYTE
  5465.             FOR I = 0 TO 385
  5466.                READ BIGMOUSECURSOR(I)
  5467.             NEXT I
  5468.             MOUSECURSORSET BIGMOUSECURSOR(0)
  5469.             MOUSERANGESET 0, 0, 639, 400
  5470.             MOUSESHOW
  5471.             A$ = "Press A Key To Return To The Default Cursor"
  5472.             DRWSTRING 1, 7, 0, A$, 0, 420
  5473.             WHILE INKEY$ = ""
  5474.             WEND
  5475.             MOUSECURSORDEFAULT
  5476.             A$ = "Press A Key To End                         "
  5477.  
  5478.  
  5479.                                                                          87
  5480.  
  5481.  
  5482.  
  5483.  
  5484.  
  5485.             DRWSTRING 1, 7, 0, A$, 0, 420
  5486.             WHILE INKEY$ = ""
  5487.             WEND
  5488.             MOUSEEXIT
  5489.             VIDEOMODESET VMODE
  5490.             END
  5491.  
  5492.             REM *BIG ARROW MOUSE CURSOR DATA
  5493.             DATA 2,2
  5494.             DATA 0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255
  5495.             DATA 0,15,15,0,0,255,255,255,255,255,255,255,255,255,255,255
  5496.             DATA 0,15,15,15,15,0,0,0,255,255,255,255,255,255,255,255
  5497.             DATA 0,15,15,15,15,15,15,15,0,0,255,255,255,255,255,255
  5498.             DATA 0,15,15,15,15,15,15,15,15,15,0,0,0,255,255,255
  5499.             DATA 0,15,15,15,15,15,15,15,15,15,15,15,15,0,0,255
  5500.             DATA 0,15,15,15,15,15,15,15,15,15,15,15,15,15,0,255
  5501.             DATA 0,15,15,15,15,15,15,15,15,15,15,15,0,0,255,255
  5502.             DATA 0,15,15,15,15,15,15,15,15,15,15,0,255,255,255,255
  5503.             DATA 0,15,15,15,15,15,15,15,15,0,0,255,255,255,255,255
  5504.             DATA 0,15,15,15,15,15,15,15,15,0,255,255,255,255,255,255
  5505.             DATA 0,15,15,15,15,15,0,15,15,15,0,255,255,255,255,255
  5506.             DATA 0,15,15,15,15,0,0,15,15,15,0,255,255,255,255,255
  5507.             DATA 0,15,15,0,0,255,255,0,15,15,15,0,255,255,255,255
  5508.             DATA 0,15,0,255,255,255,255,0,15,15,15,0,255,255,255,255
  5509.             DATA 0,0,255,255,255,255,255,255,0,15,15,15,0,255,255,255
  5510.             DATA 255,255,255,255,255,255,255,255,255,0,15,15,15,0,255,255
  5511.             DATA 255,255,255,255,255,255,255,255,255,0,15,15,15,0,255,255
  5512.             DATA 255,255,255,255,255,255,255,255,255,255,0,15,15,15,0,255
  5513.             DATA 255,255,255,255,255,255,255,255,255,255,255,0,15,15,15,0
  5514.             DATA 255,255,255,255,255,255,255,255,255,255,255,0,15,15,15,0
  5515.             DATA 255,255,255,255,255,255,255,255,255,255,255,255,0,15,15,0
  5516.             DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0
  5517.             DATA
  5518.             255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,25
  5519.             5
  5520.  
  5521.  
  5522.  
  5523.  
  5524.  
  5525.  
  5526.  
  5527.  
  5528.  
  5529.  
  5530.  
  5531.  
  5532.  
  5533.  
  5534.  
  5535.  
  5536.  
  5537.  
  5538.  
  5539.  
  5540.  
  5541.                                                                          88
  5542.  
  5543.  
  5544.  
  5545.  
  5546.  
  5547.           MOUSEENTER
  5548.  
  5549.             PROTOTYPE
  5550.  
  5551.             SUB MOUSEENTER ()
  5552.  
  5553.             INPUT
  5554.  
  5555.             no input parameters
  5556.  
  5557.             OUTPUT
  5558.  
  5559.             no value returned
  5560.  
  5561.             USAGE
  5562.  
  5563.             MOUSEENTER must be called before any other mouse functions.
  5564.             It initializes all of the mouse abilities including installing
  5565.             the Zephyr mouse display driver.  MOUSEENTER initializes the
  5566.             default mouse cursor, the default sensitivity and sets the
  5567.             range to the current screen resolution.  The mouse cursor
  5568.             location is set to the middle of the screen.
  5569.  
  5570.             SEE ALSO
  5571.  
  5572.             MOUSEEXIT, MOUSEHIDE, MOUSESHOW
  5573.  
  5574.             EXAMPLE
  5575.  
  5576.             REM ENABLE AND SHOW THE MOUSE
  5577.             $LINK "SVGAPB.PBL"
  5578.             $INCLUDE "SVGAPB.BI"
  5579.             DEFINT A-Z
  5580.  
  5581.             VMODE = VIDEOMODEGET
  5582.             IF WHICHVGA = 0 THEN STOP
  5583.             IF WHICHMOUSE = 0 THEN STOP
  5584.             DUMMY=RES640
  5585.             MOUSEENTER
  5586.             MOUSESHOW
  5587.             WHILE INKEY$ = ""
  5588.             WEND
  5589.             MOUSEEXIT
  5590.             VIDEOMODESET VMODE
  5591.             END
  5592.  
  5593.  
  5594.  
  5595.  
  5596.  
  5597.  
  5598.  
  5599.  
  5600.  
  5601.  
  5602.  
  5603.                                                                          89
  5604.  
  5605.  
  5606.  
  5607.  
  5608.  
  5609.           MOUSEEXIT
  5610.  
  5611.             PROTOTYPE
  5612.  
  5613.             SUB MOUSEEXIT ()
  5614.  
  5615.             INPUT
  5616.  
  5617.             no input parameters
  5618.  
  5619.             OUTPUT
  5620.  
  5621.             no value returned
  5622.  
  5623.             USAGE
  5624.  
  5625.             MOUSEEXIT properly disables all of the mouse abilities.  This
  5626.             function also removes the Zephyr mouse display driver.  This
  5627.             function should be called prior to exiting any program that
  5628.             previously called MOUSEENTER.
  5629.  
  5630.             SEE ALSO
  5631.  
  5632.             MOUSEENTER, MOUSEHIDE, MOUSESHOW
  5633.  
  5634.             EXAMPLE
  5635.  
  5636.             See MOUSEENTER
  5637.  
  5638.  
  5639.  
  5640.  
  5641.  
  5642.  
  5643.  
  5644.  
  5645.  
  5646.  
  5647.  
  5648.  
  5649.  
  5650.  
  5651.  
  5652.  
  5653.  
  5654.  
  5655.  
  5656.  
  5657.  
  5658.  
  5659.  
  5660.  
  5661.  
  5662.  
  5663.  
  5664.  
  5665.                                                                          90
  5666.  
  5667.  
  5668.  
  5669.  
  5670.  
  5671.           MOUSEHIDE
  5672.  
  5673.             PROTOTYPE
  5674.  
  5675.             SUB MOUSEHIDE ()
  5676.  
  5677.             INPUT
  5678.  
  5679.             no input parameters
  5680.  
  5681.             OUTPUT
  5682.  
  5683.             no value returned
  5684.  
  5685.             USAGE
  5686.  
  5687.             MOUSEHIDE turns off the mouse display driver and removes the
  5688.             cursor from the display.  It is recommended to hide the mouse
  5689.             any time something will be drawn in its general vicinity.
  5690.             Note, however, that although the cursor is not visible, all
  5691.             other mouse abilities remain active.
  5692.  
  5693.             SEE ALSO
  5694.  
  5695.             MOUSEENTER, MOUSEEXIT, MOUSESHOW
  5696.  
  5697.             EXAMPLE
  5698.  
  5699.             REM ENABLE, SHOW, AND THE HIDE THE MOUSE
  5700.             $LINK "SVGAPB.PBL"
  5701.             $INCLUDE "SVGAPB.BI"
  5702.             DEFINT A-Z
  5703.  
  5704.             VMODE = VIDEOMODEGET
  5705.             IF WHICHVGA = 0 THEN STOP
  5706.             IF WHICHMOUSE = 0 THEN STOP
  5707.             DUMMY=RES640
  5708.  
  5709.             MOUSEENTER
  5710.             MOUSESHOW
  5711.             WHILE INKEY$ = ""
  5712.             WEND
  5713.             MOUSEHIDE
  5714.  
  5715.             WHILE INKEY$ = ""
  5716.             WEND
  5717.             MOUSEEXIT
  5718.             VIDEOMODESET VMODE
  5719.  
  5720.             END
  5721.  
  5722.  
  5723.  
  5724.  
  5725.  
  5726.  
  5727.                                                                          91
  5728.  
  5729.  
  5730.  
  5731.  
  5732.  
  5733.           MOUSEINFO
  5734.  
  5735.             PROTOTYPE
  5736.  
  5737.             SUB MOUSEINFO (DrvMajorVer%, DrvMinorVer%, MouseType%,
  5738.             IRQnumber%)
  5739.  
  5740.             INPUT
  5741.  
  5742.             no input parameters
  5743.  
  5744.             OUTPUT
  5745.  
  5746.             no value returned
  5747.             MajorVersion - Microsoft compatible mouse driver major version
  5748.             number
  5749.             MinorVersion - Microsoft compatible mouse driver minor version
  5750.             number
  5751.             MouseType - type of mouse installed
  5752.             IRQ - the interrupt used by the mouse
  5753.  
  5754.             USAGE
  5755.  
  5756.             MOUSEINFO returns information about the mouse and its
  5757.             installed driver.  The driver must be Microsoft compatible.
  5758.             This information can be used to determine whether the mouse
  5759.             functions in this library will operate correctly.  For proper
  5760.             operation the driver version number must be greater than 1.00.
  5761.             IRQ gives the interrupt number of the mouse - probably 3 or 4.
  5762.             MouseType returns information about the type of hardware
  5763.             installed according to the following table:
  5764.  
  5765.             0 =  unknown type
  5766.             1 =  bus mouse
  5767.             2 =  serial mouse
  5768.             3 =  Inport mouse
  5769.             4 =  PS/2 mouse
  5770.             5 =  HP mouse
  5771.  
  5772.             SEE ALSO
  5773.  
  5774.             WHICHMOUSE
  5775.  
  5776.             EXAMPLE
  5777.  
  5778.             REM RETURN INFORMATION ABOUT THE MOUSE
  5779.             $LINK "SVGAPB.PBL"
  5780.             $INCLUDE "SVGAPB.BI"
  5781.             DEFINT A-Z
  5782.  
  5783.             CLS
  5784.             MOUSE = WHICHMOUSE
  5785.             IF MOUSE > 0 THEN
  5786.                MOUSEINFO MJV, MNV, TP, I
  5787.  
  5788.  
  5789.                                                                          92
  5790.  
  5791.  
  5792.  
  5793.  
  5794.  
  5795.                VER$ = STR$(MNV)
  5796.                L = LEN(VER$)
  5797.                VER$ = STR$(MJV) + "." + RIGHT$(VER$, L - 1)
  5798.                VER$ = "Software driver version is" + VER$
  5799.                VER$ = VER$ + " (Microsoft equivalent version)."
  5800.                SELECT CASE TP
  5801.                  CASE = 1
  5802.                     MTYPE$ = "bus mouse"
  5803.                  CASE = 2
  5804.                     MTYPE$ = "serial mouse"
  5805.                  CASE = 3
  5806.                     MTYPE$ = "Inport mouse"
  5807.                  CASE = 4
  5808.                     MTYPE$ = "PS/2 mouse"
  5809.                  CASE = 5
  5810.                     MTYPE$ = "HP mouse"
  5811.                  CASE ELSE
  5812.                     MTYPE$ = "unknown type"
  5813.                END SELECT
  5814.                PRINT "Microsoft compatible " + MTYPE$ + " detected with";
  5815.                PRINT STR$(MOUSE) + " buttons on IRQ" + STR$(I) + "."
  5816.                PRINT VER$
  5817.             ELSE
  5818.                PRINT "No Microsoft compatible mouse detected."
  5819.             END IF
  5820.             PRINT
  5821.             WHILE INKEY$ = ""
  5822.             WEND
  5823.             END
  5824.  
  5825.  
  5826.  
  5827.  
  5828.  
  5829.  
  5830.  
  5831.  
  5832.  
  5833.  
  5834.  
  5835.  
  5836.  
  5837.  
  5838.  
  5839.  
  5840.  
  5841.  
  5842.  
  5843.  
  5844.  
  5845.  
  5846.  
  5847.  
  5848.  
  5849.  
  5850.  
  5851.                                                                          93
  5852.  
  5853.  
  5854.  
  5855.  
  5856.  
  5857.           MOUSELOCSET
  5858.  
  5859.             PROTOTYPE
  5860.  
  5861.             SUB MOUSELOCSET (Xloc%, Yloc%)
  5862.  
  5863.             INPUT
  5864.  
  5865.             X, Y - location on screen
  5866.  
  5867.             OUTPUT
  5868.  
  5869.             no value returned
  5870.  
  5871.             USAGE
  5872.  
  5873.             MOUSELOCSET moves the mouse cursor the location on the screen
  5874.             specified by X, Y.  If either X or Y is outside of the
  5875.             currently permitted mouse range, it is set to the closest
  5876.             border.  The currently permitted mouse range is the current
  5877.             screen resolution or the last called MOUSERANGESET.
  5878.  
  5879.             SEE ALSO
  5880.  
  5881.             MOUSEENTER, MOUSERANGESET
  5882.  
  5883.             EXAMPLE
  5884.  
  5885.             REM ENABLE AND SHOW THE MOUSE THEN MOVE IT TO THE ORIGIN
  5886.             $LINK "SVGAPB.PBL"
  5887.             $INCLUDE "SVGAPB.BI"
  5888.             DEFINT A-Z
  5889.  
  5890.             VMODE = VIDEOMODEGET
  5891.             IF WHICHVGA = 0 THEN STOP
  5892.             IF WHICHMOUSE = 0 THEN STOP
  5893.             DUMMY=RES640
  5894.             MOUSEENTER
  5895.             MOUSESHOW
  5896.             WHILE INKEY$ = ""
  5897.             WEND
  5898.             MOUSELOCSET 0, 0
  5899.             WHILE INKEY$ = ""
  5900.             WEND
  5901.             MOUSEEXIT
  5902.             VIDEOMODESET VMODE
  5903.             END
  5904.  
  5905.  
  5906.  
  5907.  
  5908.  
  5909.  
  5910.  
  5911.  
  5912.  
  5913.                                                                          94
  5914.  
  5915.  
  5916.  
  5917.  
  5918.  
  5919.           MOUSERANGESET
  5920.  
  5921.             PROTOTYPE
  5922.  
  5923.             MOUSERANGESET (X1%, Y1%, X2%, Y2%)
  5924.  
  5925.             INPUT
  5926.  
  5927.             X1, Y1 - location on screen of top, left corner of range
  5928.             X2, Y2 - location on screen of bottom, right corner of range
  5929.  
  5930.             OUTPUT
  5931.  
  5932.             no value returned
  5933.  
  5934.             USAGE
  5935.  
  5936.             MOUSERANGESET defines a permissible range on the screen for
  5937.             mouse movement.  The mouse is automatically positioned in the
  5938.             center of this range.
  5939.  
  5940.             SEE ALSO
  5941.  
  5942.             MOUSELOCSET, MOUSESTATUS
  5943.  
  5944.             EXAMPLE
  5945.  
  5946.             REM ENABLE, SHOW, AND SET A RANGE FOR THE MOUSE
  5947.             $LINK "SVGAPB.PBL"
  5948.             $INCLUDE "SVGAPB.BI"
  5949.             DEFINT A-Z
  5950.  
  5951.             VMODE = VIDEOMODEGET
  5952.             IF WHICHVGA = 0 THEN STOP
  5953.             IF WHICHMOUSE = 0 THEN STOP
  5954.             DUMMY=RES640
  5955.             MOUSEENTER
  5956.             DRWBOX 1, 10, 100, 100, 539, 379
  5957.             MOUSERANGESET 100, 100, 539, 379
  5958.             MOUSESHOW
  5959.             WHILE INKEY$ = ""
  5960.             WEND
  5961.             MOUSEEXIT
  5962.             VIDEOMODESET VMODE
  5963.             END
  5964.  
  5965.  
  5966.  
  5967.  
  5968.  
  5969.  
  5970.  
  5971.  
  5972.  
  5973.  
  5974.  
  5975.                                                                          95
  5976.  
  5977.  
  5978.  
  5979.  
  5980.  
  5981.           MOUSERESTORESTATE
  5982.  
  5983.             PROTOTYPE
  5984.  
  5985.             SUB MOUSERESTORESTATE (MouseBuf?)
  5986.  
  5987.             INPUT
  5988.  
  5989.             MouseBuf - byte array holding complete mouse status
  5990.             information
  5991.  
  5992.             OUTPUT
  5993.  
  5994.             no value returned
  5995.  
  5996.             USAGE
  5997.  
  5998.             MOUSERESTORESTATE completely restores a previously saved mouse
  5999.             status as contained in MouseBuf.  The mouse status must have
  6000.             been already stored in MouseBuf by MOUSESAVESTATE.
  6001.  
  6002.             SEE ALSO
  6003.  
  6004.             MOUSESAVESTATE, MOUSESTORAGESIZE
  6005.  
  6006.             EXAMPLE
  6007.  
  6008.             REM SAVE THE CURRENT MOUSE DRIVER STATUS,SHELL OUT, RESTORE IT
  6009.             $LINK "SVGAPB.PBL"
  6010.             $INCLUDE "SVGAPB.BI"
  6011.             DEFINT A-Z
  6012.  
  6013.             IF WHICHMOUSE = 0 THEN STOP
  6014.             BUFSIZE = MOUSESTORAGESIZE
  6015.             DIM MBUFFER(BUFSIZE) AS BYTE
  6016.             MOUSESAVESTATE MBUFFER(0)
  6017.             PRINT "TYPE 'EXIT' TO RETURN TO THE PROGRAM"
  6018.             SHELL
  6019.             CLS
  6020.             MOUSERESTORESTATE MBUFFER(0)
  6021.             PRINT "DRIVER RESTORED..."
  6022.             WHILE INKEY$ = ""
  6023.             WEND
  6024.             END
  6025.  
  6026.  
  6027.  
  6028.  
  6029.  
  6030.  
  6031.  
  6032.  
  6033.  
  6034.  
  6035.  
  6036.  
  6037.                                                                          96
  6038.  
  6039.  
  6040.  
  6041.  
  6042.  
  6043.           MOUSESAVESTATE
  6044.  
  6045.             PROTOTYPE
  6046.  
  6047.             SUB MOUSESAVESTATE (MouseBuf?)
  6048.  
  6049.             INPUT
  6050.  
  6051.             no input parameters
  6052.  
  6053.             OUTPUT
  6054.  
  6055.             no value returned
  6056.             MouseBuf - byte array holding complete mouse status
  6057.             information
  6058.  
  6059.             USAGE
  6060.  
  6061.             MOUSESAVESTATE saves the complete mouse status in MouseBuf.
  6062.             The size of MouseBuf in bytes is defined by MOUSESTORAGESIZE
  6063.             which should called first.
  6064.  
  6065.             SEE ALSO
  6066.  
  6067.             MOUSERESTORESTATE, MOUSESTORAGESIZE
  6068.  
  6069.             EXAMPLE
  6070.  
  6071.             See MOUSERESTORESTATE
  6072.  
  6073.  
  6074.  
  6075.  
  6076.  
  6077.  
  6078.  
  6079.  
  6080.  
  6081.  
  6082.  
  6083.  
  6084.  
  6085.  
  6086.  
  6087.  
  6088.  
  6089.  
  6090.  
  6091.  
  6092.  
  6093.  
  6094.  
  6095.  
  6096.  
  6097.  
  6098.  
  6099.                                                                          97
  6100.  
  6101.  
  6102.  
  6103.  
  6104.  
  6105.           MOUSESENSSET
  6106.  
  6107.             PROTOTYPE
  6108.  
  6109.             SUB MOUSESENSSET (Xsens%, Ysens%,DblSpedThrshold%)
  6110.  
  6111.             INPUT
  6112.  
  6113.             XSens - number of mickeys per 8 pixels horizontally (default =
  6114.             8 mickeys per 8 pixels)
  6115.             YSens - number of mickeys per 8 pixels vertically (default =
  6116.             16 mickeys per 8 pixels)
  6117.             DblSpdThresh = number of mickeys per second at which speed is
  6118.             doubled (default = 64)
  6119.  
  6120.             OUTPUT
  6121.  
  6122.             no value returned
  6123.  
  6124.             USAGE
  6125.  
  6126.             MOUSESENSSET defines the relationship between mouse movement
  6127.             and cursor movement on the screen.  A mickey is defined as
  6128.             1/200th of an inch.  The ratio between mickeys and pixels is
  6129.             specified by XSens and YSens in the horizontal and vertical
  6130.             directions respectively.  When the mouse movement is faster
  6131.             than DblSpdThresh in mickeys per second, the speed is doubled.
  6132.             The default values are assigned whenever MOUSEENTER or
  6133.             MOUSEEXIT are called.
  6134.  
  6135.             SEE ALSO
  6136.  
  6137.             MOUSEENTER, MOUSEEXIT, MOUSESTATUS
  6138.  
  6139.             EXAMPLE
  6140.  
  6141.             REM ENABLE, SHOW THE MOUSE AND MAKE IT VERY SENSITIVE
  6142.             $LINK "SVGAPB.PBL"
  6143.             $INCLUDE "SVGAPB.BI"
  6144.             DEFINT A-Z
  6145.  
  6146.             VMODE = VIDEOMODEGET
  6147.             IF WHICHVGA = 0 THEN STOP
  6148.             IF WHICHMOUSE = 0 THEN STOP
  6149.             DUMMY=RES640
  6150.             MOUSEENTER
  6151.             MOUSESHOW
  6152.             MOUSESENSSET 50, 50, 10
  6153.             WHILE INKEY$ = ""
  6154.             WEND
  6155.             MOUSEEXIT
  6156.             VIDEOMODESET VMODE
  6157.             END
  6158.  
  6159.  
  6160.  
  6161.                                                                          98
  6162.  
  6163.  
  6164.  
  6165.  
  6166.  
  6167.           MOUSESHOW
  6168.  
  6169.             PROTOTYPE
  6170.  
  6171.             SUB MOUSESHOW ()
  6172.  
  6173.             INPUT
  6174.  
  6175.             no input parameters
  6176.  
  6177.             OUTPUT
  6178.  
  6179.             no value returned
  6180.  
  6181.             USAGE
  6182.  
  6183.             MOUSESHOW enables the mouse display driver and places the
  6184.             cursor on the screen.  The cursor is only updated when the
  6185.             mouse is moved.  Therefore, it is recommended to hide the
  6186.             cursor when drawing on the screen to avoid unexpected results.
  6187.  
  6188.             SEE ALSO
  6189.  
  6190.             MOUSEENTER, MOUSEEXIT, MOUSEHIDE
  6191.  
  6192.             EXAMPLE
  6193.  
  6194.             See MOUSEHIDE
  6195.  
  6196.  
  6197.  
  6198.  
  6199.  
  6200.  
  6201.  
  6202.  
  6203.  
  6204.  
  6205.  
  6206.  
  6207.  
  6208.  
  6209.  
  6210.  
  6211.  
  6212.  
  6213.  
  6214.  
  6215.  
  6216.  
  6217.  
  6218.  
  6219.  
  6220.  
  6221.  
  6222.  
  6223.                                                                          99
  6224.  
  6225.  
  6226.  
  6227.  
  6228.  
  6229.           MOUSESTATUS
  6230.  
  6231.             PROTOTYPE
  6232.  
  6233.             SUB MOUSESTATUS (X%, Y%, MButs%)
  6234.  
  6235.             INPUT
  6236.  
  6237.             no input parameters
  6238.  
  6239.             OUTPUT
  6240.  
  6241.             no value returned
  6242.             X, Y - mouse position on screen
  6243.             MouseButs - status of mouse buttons
  6244.  
  6245.             USAGE
  6246.  
  6247.             MOUSESTATUS returns the current status of the mouse position
  6248.             and buttons.  The position is returned in X, Y.  The buttons'
  6249.             status is held in MouseButs.  The left button is held in bit
  6250.             zero, right button in bit one and center button - for three
  6251.             button mice - in bit two.  Button status is most easily
  6252.             checked with a bitwise AND of MouseButs and the desired bit.
  6253.  
  6254.             SEE ALSO
  6255.  
  6256.             MOUSERANGESET, MOUSESENSSET
  6257.  
  6258.             EXAMPLE
  6259.  
  6260.             REM ENABLE, SHOW, DISPLAY MOUSE STATUS
  6261.             $LINK "SVGAPB.PBL"
  6262.             $INCLUDE "SVGAPB.BI"
  6263.             DEFINT A-Z
  6264.             VMODE = VIDEOMODEGET
  6265.             IF WHICHVGA = 0 THEN STOP
  6266.             IF WHICHMOUSE = 0 THEN STOP
  6267.             DUMMY=RES640
  6268.             MOUSEENTER
  6269.             MOUSESHOW
  6270.             WHILE INKEY$ = ""
  6271.                MOUSESTATUS X, Y, MButs
  6272.                D$ = "MX=" + STR$(X)
  6273.                L = LEN(D$)
  6274.                IF L < 10 THEN D$ = D$ + STRING$(8 - L, 32)
  6275.                D$ = D$ + "MY=" + STR$(Y)
  6276.                L = LEN(D$)
  6277.                IF L < 20 THEN
  6278.                  D$ = D$ + STRING$(16 - L, 32)
  6279.                END IF
  6280.                D$ = D$ + "MBUTS=" + STR$(MButs)
  6281.                DRWSTRING 1, 15, 8, D$, 0, 0
  6282.             WEND
  6283.  
  6284.  
  6285.                                                                         100
  6286.  
  6287.  
  6288.  
  6289.  
  6290.  
  6291.             MOUSEEXIT
  6292.             VIDEOMODESET VMODE
  6293.             END
  6294.  
  6295.  
  6296.  
  6297.  
  6298.  
  6299.  
  6300.  
  6301.  
  6302.  
  6303.  
  6304.  
  6305.  
  6306.  
  6307.  
  6308.  
  6309.  
  6310.  
  6311.  
  6312.  
  6313.  
  6314.  
  6315.  
  6316.  
  6317.  
  6318.  
  6319.  
  6320.  
  6321.  
  6322.  
  6323.  
  6324.  
  6325.  
  6326.  
  6327.  
  6328.  
  6329.  
  6330.  
  6331.  
  6332.  
  6333.  
  6334.  
  6335.  
  6336.  
  6337.  
  6338.  
  6339.  
  6340.  
  6341.  
  6342.  
  6343.  
  6344.  
  6345.  
  6346.  
  6347.                                                                         101
  6348.  
  6349.  
  6350.  
  6351.  
  6352.  
  6353.           MOUSESTORAGESIZE
  6354.  
  6355.             PROTOTYPE
  6356.  
  6357.             FUNCTION MOUSESTORAGESIZE% ()
  6358.  
  6359.             INPUT
  6360.  
  6361.             no input parameters
  6362.  
  6363.             OUTPUT
  6364.  
  6365.             MOUSESTORAGESIZE returns the number of bytes needed to store
  6366.             the complete mouse status.
  6367.  
  6368.             USAGE
  6369.  
  6370.             MOUSESTORAGESIZE determines the proper size buffer to hold the
  6371.             complete mouse status information.  This buffer should be
  6372.             created before calling MOUSESAVESTATE.
  6373.  
  6374.             SEE ALSO
  6375.  
  6376.             MOUSERESTORESTATE, MOUSESAVESTATE
  6377.  
  6378.             EXAMPLE
  6379.  
  6380.             REM RETURN THE SIZE IN BYTES NEEDED TO SAVE THE MOUSE STATUS
  6381.             $LINK "SVGAPB.PBL"
  6382.             $INCLUDE "SVGAPB.BI"
  6383.             DEFINT A-Z
  6384.  
  6385.             CLS
  6386.             IF WHICHMOUSE = 0 THEN STOP
  6387.             A$ = "The Mouse Driver Requires A" + STR$(MOUSESTORAGESIZE) +
  6388.             " Byte Buffer "
  6389.             A$ = A$ + "To Save Current Status."
  6390.             PRINT A$
  6391.             PRINT
  6392.             WHILE INKEY$ = ""
  6393.             WEND
  6394.             END
  6395.  
  6396.  
  6397.  
  6398.  
  6399.  
  6400.  
  6401.  
  6402.  
  6403.  
  6404.  
  6405.  
  6406.  
  6407.  
  6408.  
  6409.                                                                         102
  6410.  
  6411.  
  6412.  
  6413.  
  6414.  
  6415.           OVERSCANSET
  6416.  
  6417.             PROTOTYPE
  6418.  
  6419.             SUB OVERSCANSET (Colr%)
  6420.  
  6421.             INPUT
  6422.  
  6423.             Color - index to color in current palette
  6424.  
  6425.             OUTPUT
  6426.  
  6427.             no value returned
  6428.  
  6429.             USAGE
  6430.  
  6431.             OVERSCANSET sets the overscan region to the specified color.
  6432.             The overscan region is the area between the usable pixel area
  6433.             and the region not scanned by the monitor.  Normally, the
  6434.             overscan is color zero which is defined as black the majority
  6435.             of the time.  The overscan color is reset to zero anytime a
  6436.             RES### function is called.
  6437.  
  6438.             Note: OVERSCANSET always works in the 320x200 resolution.  In
  6439.             the higher resolutions on many common SVGA cards this function
  6440.             is ignored.  Instead, the card always assigns the overscan
  6441.             region to color zero.  Therefore, it is recommended to not use
  6442.             OVERSCANSET, but assign color zero as needed.
  6443.  
  6444.             EXAMPLE
  6445.  
  6446.             REM SET THE OVERSCAN COLOR TO GREEN
  6447.             $LINK "SVGAPB.PBL"
  6448.             $INCLUDE "SVGAPB.BI"
  6449.             DEFINT A-Z
  6450.             VMODE = VIDEOMODEGET
  6451.             IF WHICHVGA = 0 THEN STOP
  6452.             RES320
  6453.             OVERSCANSET 10
  6454.             WHILE INKEY$ = ""
  6455.             WEND
  6456.             VIDEOMODESET VMODE
  6457.             END
  6458.  
  6459.  
  6460.  
  6461.  
  6462.  
  6463.  
  6464.  
  6465.  
  6466.  
  6467.  
  6468.  
  6469.  
  6470.  
  6471.                                                                         103
  6472.  
  6473.  
  6474.  
  6475.  
  6476.  
  6477.           PAGEACTIVE
  6478.  
  6479.             PROTOTYPE
  6480.  
  6481.             FUNCTION PAGEACTIVE% (Page%)
  6482.  
  6483.             INPUT
  6484.  
  6485.             Page - number of page to make active
  6486.  
  6487.             OUTPUT
  6488.  
  6489.             PAGEACTIVE returns a 1 if successful, 0 if unsuccessful.
  6490.  
  6491.             USAGE
  6492.  
  6493.             PAGEACTIVE sets the active page as specified by Page.  It
  6494.             works by creating an offset to be added when any bank
  6495.             switching is performed.  This function does not affect the
  6496.             actual display.  A page is defined as the number of 64K blocks
  6497.             necessary to contain the current screen resolution.  For
  6498.             example, 640x480 requires 307,200 bytes which is a little more
  6499.             than 4.5 64K blocks.  One page in this resolution will be 5
  6500.             banks.
  6501.  
  6502.             PAGEACTIVE does not work in 320x200 mode since this mode uses
  6503.             no bank switching.
  6504.  
  6505.             SEE ALSO
  6506.  
  6507.             PAGEDISPLAY
  6508.  
  6509.             EXAMPLE
  6510.  
  6511.             REM SHOW PAGEACTIVE FUNCTION
  6512.             REM THIS EXAMPLE REQUIRES 1 MEG OF VIDEO MEMORY
  6513.             $LINK "SVGAPB.PBL"
  6514.             $INCLUDE "SVGAPB.BI"
  6515.             DEFINT A-Z
  6516.  
  6517.             IF WHICHVGA = 0 THEN
  6518.                END
  6519.             END IF
  6520.             IF WHICHMEM < 1024 THEN
  6521.                END
  6522.             END IF
  6523.             IF RES640 = 0 THEN
  6524.                END
  6525.             END IF
  6526.  
  6527.             REM MAKE SURE VIDEO CARD SUPPORTS PAGE FLIPPING
  6528.             IF PAGEDISPLAY(0, 0, 0) = 0 THEN
  6529.                DUMMY = RESTEXT
  6530.             END
  6531.  
  6532.  
  6533.                                                                         104
  6534.  
  6535.  
  6536.  
  6537.  
  6538.  
  6539.             END IF
  6540.             DUMMY = PAGEACTIVE(0)
  6541.             FILLPAGE 0
  6542.             DRWSTRING 1, 10, 0, "PAGE 0", 0, 0
  6543.             DRWSTRING 1, 10, 0, "PRESS A KEY...", 0, 300
  6544.             DUMMY = PAGEACTIVE(1)
  6545.             FILLPAGE 0
  6546.             DRWSTRING 1, 12, 0, "PAGE 1", 0, 20
  6547.             DRWSTRING 1, 12, 0, "PRESS A KEY...", 0, 300
  6548.             DUMMY = PAGEACTIVE(2)
  6549.             FILLPAGE 0
  6550.             DRWSTRING 1, 13, 0, "PAGE 2", 0, 40
  6551.             DRWSTRING 1, 13, 0, "PRESS A KEY...", 0, 300
  6552.             DUMMY = PAGEDISPLAY(0, 0, 0)
  6553.             WHILE INKEY$ = ""
  6554.             WEND
  6555.             DUMMY = PAGEDISPLAY(0, 0, 1)
  6556.             WHILE INKEY$ = ""
  6557.             WEND
  6558.             DUMMY = PAGEDISPLAY(0, 0, 2)
  6559.             WHILE INKEY$ = ""
  6560.             WEND
  6561.             DUMMY = RESTEXT
  6562.             CLS
  6563.             END
  6564.  
  6565.  
  6566.  
  6567.  
  6568.  
  6569.  
  6570.  
  6571.  
  6572.  
  6573.  
  6574.  
  6575.  
  6576.  
  6577.  
  6578.  
  6579.  
  6580.  
  6581.  
  6582.  
  6583.  
  6584.  
  6585.  
  6586.  
  6587.  
  6588.  
  6589.  
  6590.  
  6591.  
  6592.  
  6593.  
  6594.  
  6595.                                                                         105
  6596.  
  6597.  
  6598.  
  6599.  
  6600.  
  6601.           PAGEDISPLAY
  6602.  
  6603.             PROTOTYPE
  6604.  
  6605.             FUNCTION PAGEDISPLAY% (X%, Y%, Page%)
  6606.  
  6607.             INPUT
  6608.  
  6609.             X, Y - coordinate to place at top, left of display
  6610.             Page - number of page to make active
  6611.  
  6612.             OUTPUT
  6613.  
  6614.             PAGEACTIVE returns a 1 if successful, 0 if unsuccessful.
  6615.  
  6616.             USAGE
  6617.  
  6618.             PAGEDISPLAY tells the video card where in video memory to
  6619.             begin the display.  This display offset is calculated from the
  6620.             specified Page, X and Y.  This is done by multiplying Y times
  6621.             the width of the current resolution, adding X and then adding
  6622.             the appropriate number of 64K blocks for Page.  X, Y and Page
  6623.             must all be positive numbers, but are otherwise not
  6624.             restricted.  The display will wrap if the values are
  6625.             abnormally large.  Wrapping will happen from side to side as
  6626.             well as from top of memory to bottom of memory.
  6627.  
  6628.             PAGEDISPLAY does not work in 320x200 mode since this mode uses
  6629.             no bank switching.  In addition, older models of some SVGA
  6630.             cards operating in native mode do not support paging.  In this
  6631.             library these cards are: Acumos, Ahead version A, Everex and
  6632.             Genoa.  To ensure compatibility, a program should make a call
  6633.             similar to:
  6634.  
  6635.             RET = PAGEDISPLAY(0,0,0)
  6636.             IF RET = 0 THEN PRINT "PAGING NOT SUPPORTED"
  6637.  
  6638.             Note: SVGA cards by ATI Technologies appear to ignore bit 4
  6639.             (counting from 0 to 19) in its linear addressing mode and
  6640.             assume it is zero.  Therefore, bit 4 of the x parameter will
  6641.             be ignored by ATI chipsets.
  6642.  
  6643.             SEE ALSO
  6644.  
  6645.             PAGEACTIVE
  6646.  
  6647.             EXAMPLE
  6648.  
  6649.             See PAGEACTIVE
  6650.  
  6651.  
  6652.  
  6653.  
  6654.  
  6655.  
  6656.  
  6657.                                                                         106
  6658.  
  6659.  
  6660.  
  6661.  
  6662.  
  6663.           PALCHGAUTO
  6664.  
  6665.             PROTOTYPE
  6666.  
  6667.             SUB PALCHGAUTO (Pal AS RGBType, NewPal AS RGBType, FirstColr%,
  6668.             LastColr%, Speed%)
  6669.  
  6670.             INPUT
  6671.  
  6672.             Pal - RGBType array with 768 elements containing initial
  6673.             palette
  6674.             NewPal - RGBType array with 768 elements containing new
  6675.             palette
  6676.             FirstColor - index into palette where change will begin
  6677.             LastColor - index into palette where change will end
  6678.             Speed - speed of change
  6679.  
  6680.             OUTPUT
  6681.  
  6682.             no value returned
  6683.  
  6684.             USAGE
  6685.  
  6686.             PALCHGAUTO smoothly fades the colors between FirstColor and
  6687.             LastColor from the palette Pal to NewPal.  The speed of the
  6688.             fade is set by Speed which is percentage change between each
  6689.             step of the fade.  Only values between 1 and 128 are valid
  6690.             where 1 represents a one percent change between steps and 128
  6691.             (80 hex) represents fifty percent change between steps.  A
  6692.             Speed of 128 would then have only two steps.  A Speed outside
  6693.             of the valid range causes the function to immediately return
  6694.             without making any changes.  The time required to accomplish
  6695.             the entire fade is approximately equal to 0.033 seconds times
  6696.             256 divided by Speed.  PALCHGAUTO does not modify either Pal
  6697.             or NewPal.
  6698.  
  6699.             SEE ALSO
  6700.  
  6701.             PALCHGSTEP, PALDIMSTEP, PALIOAUTO
  6702.  
  6703.             EXAMPLE
  6704.  
  6705.             REM AUTOFADE FROM ONE PALETTE TO ANOTHER AND BACK AGAIN
  6706.             $LINK "SVGAPB.PBL"
  6707.             $INCLUDE "SVGAPB.BI"
  6708.             DEFINT A-Z
  6709.             DIM PAL(255) AS RGBType
  6710.             DIM NEWPAL(255) AS RGBType
  6711.  
  6712.             VMODE = VIDEOMODEGET
  6713.             IF WHICHVGA = 0 THEN STOP
  6714.             IF WHICHMEM < 512 THEN STOP
  6715.             DUMMY=RES640
  6716.             PALGET PAL(0), 0, 255
  6717.  
  6718.  
  6719.                                                                         107
  6720.  
  6721.  
  6722.  
  6723.  
  6724.  
  6725.             FOR I = 0 TO 255
  6726.                NEWPAL(I).R = PAL(I).G
  6727.                NEWPAL(I).G = PAL(I).B
  6728.                NEWPAL(I).B = PAL(I).R
  6729.             NEXT I
  6730.             COLR = 0
  6731.             FOR I = 0 TO 639
  6732.                DRWLINE 1, COLR, I, 0, I, 479
  6733.                COLR = COLR + 1
  6734.                IF COLR > 255 THEN
  6735.                  COLR = 0
  6736.                END IF
  6737.             NEXT I
  6738.             PALCHGAUTO PAL(0), NEWPAL(0), 0, 255, 2
  6739.             PALCHGAUTO NEWPAL(0), PAL(0), 0, 255, 2
  6740.             WHILE INKEY$ = ""
  6741.             WEND
  6742.             VIDEOMODESET VMODE
  6743.             END
  6744.  
  6745.  
  6746.  
  6747.  
  6748.  
  6749.  
  6750.  
  6751.  
  6752.  
  6753.  
  6754.  
  6755.  
  6756.  
  6757.  
  6758.  
  6759.  
  6760.  
  6761.  
  6762.  
  6763.  
  6764.  
  6765.  
  6766.  
  6767.  
  6768.  
  6769.  
  6770.  
  6771.  
  6772.  
  6773.  
  6774.  
  6775.  
  6776.  
  6777.  
  6778.  
  6779.  
  6780.  
  6781.                                                                         108
  6782.  
  6783.  
  6784.  
  6785.  
  6786.  
  6787.           PALCHGSTEP
  6788.  
  6789.             PROTOTYPE
  6790.  
  6791.             PALCHGSTEP (Pal AS RGBType, NewPal AS RGBType, FirstColr%,
  6792.             LastColr%, Percent%)
  6793.  
  6794.             INPUT
  6795.  
  6796.             Pal - RGBType array with 768 elements containing initial
  6797.             palette
  6798.             NewPal - RGBType array with 768 elements containing new
  6799.             palette
  6800.             FirstColor - index into palette where change will begin
  6801.             LastColor - index into palette where change will end
  6802.             Percent - percent step from current palette to new palette
  6803.  
  6804.             OUTPUT
  6805.  
  6806.             no value returned
  6807.  
  6808.             USAGE
  6809.  
  6810.             PALCHGSTEP changes the palette colors between FirstColor and
  6811.             LastColor by Percent from Pal to NewPal.  This function works
  6812.             very much like PALCHGAUTO except it only takes a single step
  6813.             and returns.  The step taken is a percentage specified by
  6814.             Percent where 256 (100 hex) is a 100 percent change.  The
  6815.             valid range for Percent is 0 to 256.  Values beyond this range
  6816.             cause the function to immediately return without making any
  6817.             changes.  A loop from 4 to 256 by fours using PALCHGSTEP would
  6818.             have similar results as PALCHGAUTO with a speed of 4.  Neither
  6819.             Pal, nor NewPal are modified.
  6820.  
  6821.             SEE ALSO
  6822.  
  6823.             PALCHGAUTO, PALDIMSTEP, PALIOAUTO
  6824.  
  6825.             EXAMPLE
  6826.  
  6827.             REM STEP FADE FROM ONE PALETTE TO ANOTHER AND BACK AGAIN FAST
  6828.             $LINK "SVGAPB.PBL"
  6829.             $INCLUDE "SVGAPB.BI"
  6830.             DEFINT A-Z
  6831.             DIM PAL(255) AS RGBType
  6832.             DIM NEWPAL(255) AS RGBType
  6833.  
  6834.             VMODE = VIDEOMODEGET
  6835.             IF WHICHVGA = 0 THEN STOP
  6836.             IF WHICHMEM < 512 THEN STOP
  6837.             DUMMY=RES640
  6838.             PALGET PAL(0), 0, 255
  6839.             FOR I = 0 TO 255
  6840.                NEWPAL(I).R = PAL(I).G
  6841.  
  6842.  
  6843.                                                                         109
  6844.  
  6845.  
  6846.  
  6847.  
  6848.  
  6849.                NEWPAL(I).G = PAL(I).B
  6850.                NEWPAL(I).B = PAL(I).R
  6851.             NEXT I
  6852.             COLR = 0
  6853.             FOR I = 0 TO 639
  6854.                DRWLINE 1, COLR, I, 0, I, 479
  6855.                COLR = COLR + 1
  6856.                IF COLR > 255 THEN
  6857.                  COLR = 0
  6858.                END IF
  6859.             NEXT I
  6860.             FOR I = 1 TO 255 STEP 2
  6861.                PALCHGSTEP PAL(0), NEWPAL(0), 0, 255, I
  6862.             NEXT I
  6863.             FOR I = 1 TO 255 STEP 16
  6864.                PALCHGSTEP NEWPAL(0), PAL(0), 0, 255, I
  6865.             NEXT I
  6866.             WHILE INKEY$ = ""
  6867.             WEND
  6868.             VIDEOMODESET VMODE
  6869.             END
  6870.  
  6871.  
  6872.  
  6873.  
  6874.  
  6875.  
  6876.  
  6877.  
  6878.  
  6879.  
  6880.  
  6881.  
  6882.  
  6883.  
  6884.  
  6885.  
  6886.  
  6887.  
  6888.  
  6889.  
  6890.  
  6891.  
  6892.  
  6893.  
  6894.  
  6895.  
  6896.  
  6897.  
  6898.  
  6899.  
  6900.  
  6901.  
  6902.  
  6903.  
  6904.  
  6905.                                                                         110
  6906.  
  6907.  
  6908.  
  6909.  
  6910.  
  6911.           PALCOPY
  6912.  
  6913.             PROTOTYPE
  6914.  
  6915.             SUB PALCOPY (SrcPal AS RGBType, DestPal AS RGBType,
  6916.             FirstColr%, LastColr%)
  6917.  
  6918.             INPUT
  6919.  
  6920.             SrcPalette - RGBType array with 768 elements containing source
  6921.             palette
  6922.             FirstColor - index into palette where copy will begin
  6923.             LastColor - index into palette where copy will end
  6924.  
  6925.             OUTPUT
  6926.  
  6927.             no value returned
  6928.             DestPalette - RGBType array with 768 elements containing copy
  6929.             of source palette
  6930.  
  6931.             USAGE
  6932.  
  6933.             PALCOPY quickly copies a source palette into a second palette
  6934.             array.  The source and destination must both be defined as an
  6935.             RGBType array with 768 elements  or PALCOPY will return
  6936.             without making any copy.  A portion of a palette may be copied
  6937.             by specifying first and last colors.
  6938.  
  6939.             SEE ALSO
  6940.  
  6941.             BYTECOPY
  6942.  
  6943.             EXAMPLE
  6944.  
  6945.             REM SHOW PAL COPY
  6946.             $LINK "SVGAPB.PBL"
  6947.             $INCLUDE "SVGAPB.BI"
  6948.             DEFINT A-Z
  6949.             DIM PAL1(255) AS RGBType
  6950.             DIM PAL2(255) AS RGBType
  6951.             VMODE = VIDEOMODEGET
  6952.             IF WHICHVGA = 0 THEN STOP
  6953.             IF WHICHMEM < 512 THEN STOP
  6954.             DUMMY = RES640
  6955.             FOR I = 0 TO 255
  6956.                PAL1(I).R = I
  6957.                PAL1(I).G = I
  6958.                PAL1(I).B = I
  6959.             NEXT I
  6960.             COLR = 0
  6961.             FOR I = 0 TO 639
  6962.                DRWLINE 1, COLR, I, 0, I, 479
  6963.                COLR = COLR + 1
  6964.                IF COLR > 255 THEN COLR = 0
  6965.  
  6966.  
  6967.                                                                         111
  6968.  
  6969.  
  6970.  
  6971.  
  6972.  
  6973.             NEXT I
  6974.             PALCOPY PAL1(0), PAL2(0), 0, 255
  6975.             PALSET PAL2(0), 0, 255
  6976.             WHILE INKEY$ = ""
  6977.             WEND
  6978.             VIDEOMODESET VMODE
  6979.             END
  6980.  
  6981.  
  6982.  
  6983.  
  6984.  
  6985.  
  6986.  
  6987.  
  6988.  
  6989.  
  6990.  
  6991.  
  6992.  
  6993.  
  6994.  
  6995.  
  6996.  
  6997.  
  6998.  
  6999.  
  7000.  
  7001.  
  7002.  
  7003.  
  7004.  
  7005.  
  7006.  
  7007.  
  7008.  
  7009.  
  7010.  
  7011.  
  7012.  
  7013.  
  7014.  
  7015.  
  7016.  
  7017.  
  7018.  
  7019.  
  7020.  
  7021.  
  7022.  
  7023.  
  7024.  
  7025.  
  7026.  
  7027.  
  7028.  
  7029.                                                                         112
  7030.  
  7031.  
  7032.  
  7033.  
  7034.  
  7035.           PALDIMSTEP
  7036.  
  7037.             PROTOTYPE
  7038.  
  7039.             SUB PALDIMSTEP (Pal AS RGBType, FirstColr%, LastColr%,
  7040.             Percent%)
  7041.  
  7042.             INPUT
  7043.  
  7044.             Pal - RGBType array with 768 elements containing initial
  7045.             palette
  7046.             FirstColor - index into palette where dim will begin
  7047.             LastColor - index into palette where dim will end
  7048.             Percent - percent step from current palette to black
  7049.  
  7050.             OUTPUT
  7051.  
  7052.             no value returned
  7053.  
  7054.             USAGE
  7055.  
  7056.             PALDIMSTEP fades the specified palette to black by the given
  7057.             percentage between FirstColor and LastColor.  The percentage
  7058.             step from Pal to black is specified by Percent where 256 (100
  7059.             hex) is full black.  The valid range for Percent is 0 to 256.
  7060.             Values beyond this range cause the function to immediately
  7061.             return without making any changes.  Pal is not modified.
  7062.  
  7063.             SEE ALSO
  7064.  
  7065.             PALCHGAUTO, PALCHGSTEP, PALIOAUTO
  7066.  
  7067.             EXAMPLE
  7068.  
  7069.             REM STEP FADE OUT AND BACK IN FAST
  7070.             $LINK "SVGAPB.PBL"
  7071.             $INCLUDE "SVGAPB.BI"
  7072.             DEFINT A-Z
  7073.             DIM PAL(255) AS RGBType
  7074.             VMODE = VIDEOMODEGET
  7075.             IF WHICHVGA = 0 THEN STOP
  7076.             IF WHICHMEM < 512 THEN STOP
  7077.             DUMMY=RES640
  7078.             PALGET PAL(0), 0, 255
  7079.             COLR = 0
  7080.             FOR I = 0 TO 639
  7081.                DRWLINE 1, COLR, I, 0, I, 479
  7082.                COLR = COLR + 1
  7083.                IF COLR > 255 THEN COLR = 0
  7084.             NEXT I
  7085.             FOR I = 255 TO 0 STEP -2
  7086.                PALDIMSTEP PAL(0), 0, 255, I
  7087.             NEXT I
  7088.             FOR I = 1 TO 255 STEP 16
  7089.  
  7090.  
  7091.                                                                         113
  7092.  
  7093.  
  7094.  
  7095.  
  7096.  
  7097.                PALDIMSTEP PAL(0), 0, 255, I
  7098.             NEXT I
  7099.             WHILE INKEY$ = ""
  7100.             WEND
  7101.             VIDEOMODESET VMODE
  7102.             END
  7103.  
  7104.  
  7105.  
  7106.  
  7107.  
  7108.  
  7109.  
  7110.  
  7111.  
  7112.  
  7113.  
  7114.  
  7115.  
  7116.  
  7117.  
  7118.  
  7119.  
  7120.  
  7121.  
  7122.  
  7123.  
  7124.  
  7125.  
  7126.  
  7127.  
  7128.  
  7129.  
  7130.  
  7131.  
  7132.  
  7133.  
  7134.  
  7135.  
  7136.  
  7137.  
  7138.  
  7139.  
  7140.  
  7141.  
  7142.  
  7143.  
  7144.  
  7145.  
  7146.  
  7147.  
  7148.  
  7149.  
  7150.  
  7151.  
  7152.  
  7153.                                                                         114
  7154.  
  7155.  
  7156.  
  7157.  
  7158.  
  7159.           PALGET
  7160.  
  7161.             PROTOTYPE
  7162.  
  7163.             SUB PALGET (Pal AS RGBType, FirstColr%, LastColr%)
  7164.  
  7165.             INPUT
  7166.  
  7167.             FirstColor - index into palette where get will begin
  7168.             LastColor - index into palette where get will end
  7169.  
  7170.             OUTPUT
  7171.  
  7172.             Pal - RGBType array with 768 elements containing the current
  7173.             palette in the specified range
  7174.  
  7175.             USAGE
  7176.  
  7177.             PALGET returns in Pal the colors from the current palette
  7178.             between FirstColor and LastColor.  Only colors in the
  7179.             specified range are returned and all others in Pal are
  7180.             unchanged.  Pal must have a length of 768 elements despite the
  7181.             number of colors retrieved.
  7182.  
  7183.             SEE ALSO
  7184.  
  7185.             PALROTATE, PALSET
  7186.  
  7187.             EXAMPLE
  7188.  
  7189.             REM GET THE CURRENT PALETTE IN THE VARIABLE 'PAL'
  7190.             $LINK "SVGAPB.PBL"
  7191.             $INCLUDE "SVGAPB.BI"
  7192.             DEFINT A-Z
  7193.             DIM PAL AS STRING * 768
  7194.  
  7195.             VMODE = VIDEOMODEGET
  7196.             IF WHICHVGA = 0 THEN STOP
  7197.             IF WHICHMEM < 512 THEN STOP
  7198.             DUMMY=RES640
  7199.             PALGET PAL, 0, 255
  7200.             VIDEOMODESET VMODE
  7201.             CLS
  7202.             PRINT "GOT IT IN 'PAL'..."
  7203.             WHILE INKEY$ = ""
  7204.             WEND
  7205.             END
  7206.  
  7207.  
  7208.  
  7209.  
  7210.  
  7211.  
  7212.  
  7213.  
  7214.  
  7215.                                                                         115
  7216.  
  7217.  
  7218.  
  7219.  
  7220.  
  7221.           PALIOAUTO
  7222.  
  7223.             PROTOTYPE
  7224.  
  7225.             SUB PALIOAUTO (Pal AS RGBType, FirstColr%, LastColr%, Speed%)
  7226.  
  7227.             INPUT
  7228.  
  7229.             Pal - RGBType array with 768 elements containing initial
  7230.             palette
  7231.             FirstColor - index into palette where fade will begin
  7232.             LastColor - index into palette where fade will end
  7233.             Speed - speed of fade
  7234.  
  7235.             OUTPUT
  7236.  
  7237.             no value returned
  7238.  
  7239.             USAGE
  7240.  
  7241.             PALIOAUTO smoothly fades the colors between FirstColor and
  7242.             LastColor of Pal to or from solid black.  The speed of the
  7243.             fade is set by Speed which is the percentage change between
  7244.             each step of the fade.  A positive Speed corresponds to fading
  7245.             from Pal to black and a negative Speed fades from black to
  7246.             Pal.  Only values between -128 and +128 are valid where  1
  7247.             represents a one percent change between steps and  128 ( 80
  7248.             hex) represents fifty percent change between steps.  A Speed
  7249.             of 128 would then have only two steps.  A Speed outside of the
  7250.             valid range causes the function to immediately return without
  7251.             making any changes.  The time required to accomplish the
  7252.             entire fade is approximately equal to 0.033 seconds times 256
  7253.             divided by Speed.  PALIOAUTO does not modify Pal.
  7254.  
  7255.             SEE ALSO
  7256.  
  7257.             PALCHGAUTO, PALCHGSTEP, PALDIMSTEP
  7258.  
  7259.             EXAMPLE
  7260.  
  7261.             REM FADE OUT AND BACK IN FAST
  7262.             $LINK "SVGAPB.PBL"
  7263.             $INCLUDE "SVGAPB.BI"
  7264.             DEFINT A-Z
  7265.             DIM PAL AS STRING * 768
  7266.             VMODE = VIDEOMODEGET
  7267.             IF WHICHVGA = 0 THEN STOP
  7268.             IF WHICHMEM < 512 THEN STOP
  7269.             DUMMY=RES640
  7270.             PALGET PAL, 0, 255
  7271.             COLR = 0
  7272.             FOR I = 0 TO 639
  7273.                DRWLINE 1, COLR, I, 0, I, 479
  7274.                COLR = COLR + 1
  7275.  
  7276.  
  7277.                                                                         116
  7278.  
  7279.  
  7280.  
  7281.  
  7282.  
  7283.                IF COLR > 255 THEN COLR = 0
  7284.             NEXT I
  7285.             PALIOAUTO PAL, 0, 255, -2
  7286.             PALIOAUTO PAL, 0, 255, 16
  7287.             WHILE INKEY$ = "" : WEND
  7288.             VIDEOMODESET VMODE
  7289.             END
  7290.  
  7291.  
  7292.  
  7293.  
  7294.  
  7295.  
  7296.  
  7297.  
  7298.  
  7299.  
  7300.  
  7301.  
  7302.  
  7303.  
  7304.  
  7305.  
  7306.  
  7307.  
  7308.  
  7309.  
  7310.  
  7311.  
  7312.  
  7313.  
  7314.  
  7315.  
  7316.  
  7317.  
  7318.  
  7319.  
  7320.  
  7321.  
  7322.  
  7323.  
  7324.  
  7325.  
  7326.  
  7327.  
  7328.  
  7329.  
  7330.  
  7331.  
  7332.  
  7333.  
  7334.  
  7335.  
  7336.  
  7337.  
  7338.  
  7339.                                                                         117
  7340.  
  7341.  
  7342.  
  7343.  
  7344.  
  7345.           PALROTATE
  7346.  
  7347.             PROTOTYPE
  7348.  
  7349.             PALROTATE (Pal AS RGBType, FirstColr%, LastColr%, ColShift%)
  7350.  
  7351.             INPUT
  7352.  
  7353.             Pal - RGBType array with 768 elements containing current
  7354.             palette
  7355.             FirstColor - index into palette where shift will begin
  7356.             LastColor - index into palette where shift will end
  7357.             Shift - number of locations to shift colors
  7358.  
  7359.             OUTPUT
  7360.  
  7361.             no value returned
  7362.  
  7363.             USAGE
  7364.  
  7365.             PALROTATE shifts the colors between FirstColor and LastColor
  7366.             by a given number of locations.  The number of locations the
  7367.             colors are moved is specified by Shift which is between 1 and
  7368.             256.  Pal is not modified by PALROTATE.
  7369.  
  7370.             SEE ALSO
  7371.  
  7372.             PALGET, PALSET
  7373.  
  7374.             EXAMPLE
  7375.  
  7376.             REM ROTATE A FEW PALETTE ENTRIES AROUND
  7377.             $LINK "SVGAPB.PBL"
  7378.             $INCLUDE "SVGAPB.BI"
  7379.             DEFINT A-Z
  7380.             DIM PAL(255) AS RGBType
  7381.  
  7382.             VMODE = VIDEOMODEGET
  7383.             IF WHICHVGA = 0 THEN STOP
  7384.             IF WHICHMEM < 512 THEN STOP
  7385.             DUMMY=RES640
  7386.             PALGET PAL(0), 0, 255
  7387.             COLR = 0
  7388.             FOR I = 0 TO 639
  7389.                DRWLINE 1, COLR, I, 0, I, 479
  7390.                COLR = COLR + 1
  7391.                IF COLR > 255 THEN COLR = 0
  7392.             NEXT I
  7393.             FOR I = 0 TO 100
  7394.                PALROTATE PAL(0), 0, 127, 1
  7395.                PALGET PAL(0), 0, 255
  7396.             NEXT I
  7397.             WHILE INKEY$ = ""
  7398.             WEND
  7399.  
  7400.  
  7401.                                                                         118
  7402.  
  7403.  
  7404.  
  7405.  
  7406.  
  7407.             VIDEOMODESET VMODE
  7408.             END
  7409.  
  7410.  
  7411.  
  7412.  
  7413.  
  7414.  
  7415.  
  7416.  
  7417.  
  7418.  
  7419.  
  7420.  
  7421.  
  7422.  
  7423.  
  7424.  
  7425.  
  7426.  
  7427.  
  7428.  
  7429.  
  7430.  
  7431.  
  7432.  
  7433.  
  7434.  
  7435.  
  7436.  
  7437.  
  7438.  
  7439.  
  7440.  
  7441.  
  7442.  
  7443.  
  7444.  
  7445.  
  7446.  
  7447.  
  7448.  
  7449.  
  7450.  
  7451.  
  7452.  
  7453.  
  7454.  
  7455.  
  7456.  
  7457.  
  7458.  
  7459.  
  7460.  
  7461.  
  7462.  
  7463.                                                                         119
  7464.  
  7465.  
  7466.  
  7467.  
  7468.  
  7469.           PALSET
  7470.  
  7471.             PROTOTYPE
  7472.  
  7473.             SUB PALSET (Pal AS RGBType, FirstColr%, LastColr%)
  7474.  
  7475.             INPUT
  7476.  
  7477.             Pal - RGBType array with 768 elements containing the palette
  7478.             to set
  7479.             FirstColor - index into palette where set will begin
  7480.             LastColor - index into palette where set will end
  7481.  
  7482.             OUTPUT
  7483.  
  7484.             no value returned
  7485.  
  7486.             USAGE
  7487.  
  7488.             PALSET sets the specified range of colors in the current
  7489.             palette with the corresponding range in the palette Pal.
  7490.  
  7491.             SEE ALSO
  7492.  
  7493.             PALGET
  7494.  
  7495.             EXAMPLE
  7496.  
  7497.             REM SET A NEW PALETTE
  7498.             $LINK "SVGAPB.PBL"
  7499.             $INCLUDE "SVGAPB.BI"
  7500.             DEFINT A-Z
  7501.             DIM PAL(255) AS RGBType
  7502.             DIM NEWPAL(255) AS RGBType
  7503.  
  7504.             VMODE = VIDEOMODEGET
  7505.             IF WHICHVGA = 0 THEN STOP
  7506.             IF WHICHMEM < 512 THEN STOP
  7507.             DUMMY=RES640
  7508.             PALGET PAL(0), 0, 255
  7509.             FOR I = 0 TO 255
  7510.                NEWPAL(I).R = PAL(I).G
  7511.                NEWPAL(I).G = PAL(I).B
  7512.                NEWPAL(I).B = PAL(I).R
  7513.             NEXT I
  7514.             COLR = 0
  7515.             FOR I = 0 TO 639
  7516.                DRWLINE 1, COLR, I, 0, I, 479
  7517.                COLR = COLR + 1
  7518.                IF COLR > 255 THEN COLR = 0
  7519.             NEXT I
  7520.             PALSET NEWPAL(0), 0, 255
  7521.             WHILE INKEY$ = ""
  7522.             WEND
  7523.  
  7524.  
  7525.                                                                         120
  7526.  
  7527.  
  7528.  
  7529.  
  7530.  
  7531.             VIDEOMODESET VMODE
  7532.             END
  7533.  
  7534.  
  7535.  
  7536.  
  7537.  
  7538.  
  7539.  
  7540.  
  7541.  
  7542.  
  7543.  
  7544.  
  7545.  
  7546.  
  7547.  
  7548.  
  7549.  
  7550.  
  7551.  
  7552.  
  7553.  
  7554.  
  7555.  
  7556.  
  7557.  
  7558.  
  7559.  
  7560.  
  7561.  
  7562.  
  7563.  
  7564.  
  7565.  
  7566.  
  7567.  
  7568.  
  7569.  
  7570.  
  7571.  
  7572.  
  7573.  
  7574.  
  7575.  
  7576.  
  7577.  
  7578.  
  7579.  
  7580.  
  7581.  
  7582.  
  7583.  
  7584.  
  7585.  
  7586.  
  7587.                                                                         121
  7588.  
  7589.  
  7590.  
  7591.  
  7592.  
  7593.           RES320
  7594.  
  7595.             PROTOTYPE
  7596.  
  7597.             FUNCTION RES320% ()
  7598.  
  7599.             INPUT
  7600.  
  7601.             no input parameters
  7602.  
  7603.             OUTPUT
  7604.  
  7605.             RES320 always returns a 1.
  7606.  
  7607.             USAGE
  7608.  
  7609.             RES320 sets video mode 0x13 which is the VGA standard 320x200
  7610.             graphics mode with 256 colors.  This function can be called
  7611.             without calling WHICHVGA first as this function requires only
  7612.             that a VGA card is present, not a Super VGA card.  If a VGA is
  7613.             not present, the system may crash.
  7614.  
  7615.             SEE ALSO
  7616.  
  7617.             RES640, RES640L, RES800, RES1024, RES1280, WHICHVGA
  7618.  
  7619.             EXAMPLE
  7620.  
  7621.             REM SET THE VIDEO MODE TO 320x200x256
  7622.             $LINK "SVGAPB.PBL"
  7623.             $INCLUDE "SVGAPB.BI"
  7624.             DEFINT A-Z
  7625.  
  7626.             VMODE = VIDEOMODEGET
  7627.             IF WHICHVGA = 0 THEN STOP
  7628.             DUMMY=RES320
  7629.             DRWSTRING 1, 7, 0, "THIS IS THE 320x200x256 VIDEO MODE...", 0,
  7630.             0
  7631.             WHILE INKEY$ = ""
  7632.             WEND
  7633.             VIDEOMODESET VMODE
  7634.             END
  7635.  
  7636.  
  7637.  
  7638.  
  7639.  
  7640.  
  7641.  
  7642.  
  7643.  
  7644.  
  7645.  
  7646.  
  7647.  
  7648.  
  7649.                                                                         122
  7650.  
  7651.  
  7652.  
  7653.  
  7654.  
  7655.           RES640
  7656.  
  7657.             PROTOTYPE
  7658.  
  7659.             FUNCTION RES640% ()
  7660.  
  7661.             INPUT
  7662.  
  7663.             no input parameters
  7664.  
  7665.             OUTPUT
  7666.  
  7667.             RES640 returns 1 if successful, 0 otherwise.
  7668.  
  7669.             USAGE
  7670.  
  7671.             RES640 sets the video mode to 640x480 graphics mode with 256
  7672.             colors.  This function requires that a Super VGA card with at
  7673.             least 512K of video memory be present.  Also, WHICHVGA must be
  7674.             called first or the function will fail without changing the
  7675.             video mode.  If the video card does not have sufficient
  7676.             memory, RES640 will return without changing the video mode.
  7677.  
  7678.             SEE ALSO
  7679.  
  7680.             RES320, RES640L, RES800, RES1024, RES1280, WHICHVGA
  7681.  
  7682.             EXAMPLE
  7683.  
  7684.             REM SET THE VIDEO MODE TO 640x480x256
  7685.             $LINK "SVGAPB.PBL"
  7686.             $INCLUDE "SVGAPB.BI"
  7687.             DEFINT A-Z
  7688.  
  7689.             VMODE = VIDEOMODEGET
  7690.             IF WHICHVGA = 0 THEN STOP
  7691.             IF WHICHMEM < 512 THEN STOP
  7692.             DUMMY=RES640
  7693.             DRWSTRING 1, 7, 0, "THIS IS THE 640x480x256 VIDEO MODE...", 0,
  7694.             0
  7695.             WHILE INKEY$ = ""
  7696.             WEND
  7697.             VIDEOMODESET VMODE
  7698.             END
  7699.  
  7700.  
  7701.  
  7702.  
  7703.  
  7704.  
  7705.  
  7706.  
  7707.  
  7708.  
  7709.  
  7710.  
  7711.                                                                         123
  7712.  
  7713.  
  7714.  
  7715.  
  7716.  
  7717.           RES640L
  7718.  
  7719.             PROTOTYPE
  7720.  
  7721.             FUNCTION RES640L% ()
  7722.  
  7723.             INPUT
  7724.  
  7725.             no input parameters
  7726.  
  7727.             OUTPUT
  7728.  
  7729.             RES640L returns 1 if successful, 0 otherwise.
  7730.  
  7731.             USAGE
  7732.  
  7733.             RES640L sets the video mode to 640x400 graphics mode with 256
  7734.             colors.  This function requires that a Super VGA card with at
  7735.             least 256K of video memory be present.  Also, WHICHVGA must be
  7736.             called first or the function will fail without changing the
  7737.             video mode.  If the video card does not have sufficient
  7738.             memory, RES640L will return without changing the video mode.
  7739.  
  7740.             Note: 640x400 is a non-standard resolution.  Not all SVGA
  7741.             cards recognized by this library support this video mode.
  7742.  
  7743.             SEE ALSO
  7744.  
  7745.             RES320, RES640, RES800, RES1024, RES1280, WHICHVGA
  7746.  
  7747.             EXAMPLE
  7748.  
  7749.             REM SET THE VIDEO MODE TO 640x400x256
  7750.             $LINK "SVGAPB.PBL"
  7751.             $INCLUDE "SVGAPB.BI"
  7752.             DEFINT A-Z
  7753.  
  7754.             VMODE = VIDEOMODEGET
  7755.             IF WHICHVGA = 0 THEN STOP
  7756.             IF WHICHMEM < 256 THEN STOP
  7757.             DUMMY=RES640L
  7758.             DRWSTRING 1, 7, 0, "THIS IS THE 640x400x256 VIDEO MODE...", 0,
  7759.             0
  7760.             WHILE INKEY$ = ""
  7761.             WEND
  7762.             VIDEOMODESET VMODE
  7763.             END
  7764.  
  7765.  
  7766.  
  7767.  
  7768.  
  7769.  
  7770.  
  7771.  
  7772.  
  7773.                                                                         124
  7774.  
  7775.  
  7776.  
  7777.  
  7778.  
  7779.           RES800
  7780.  
  7781.             PROTOTYPE
  7782.  
  7783.             FUNCTION RES800% ()
  7784.  
  7785.             INPUT
  7786.  
  7787.             no input parameters
  7788.  
  7789.             OUTPUT
  7790.  
  7791.             RES800 returns 1 if successful, 0 otherwise.
  7792.  
  7793.             USAGE
  7794.  
  7795.             RES800 sets the video mode to 800x600 graphics mode with 256
  7796.             colors.  This function requires that a Super VGA card with at
  7797.             least 512K of video memory be present.  Also, WHICHVGA must be
  7798.             called first or the function will fail without changing the
  7799.             video mode.  If the video card does not have sufficient
  7800.             memory, RES800 will return without changing the video mode.
  7801.  
  7802.             SEE ALSO
  7803.  
  7804.             RES320, RES640, RES640L, RES1024, RES1280, WHICHVGA
  7805.  
  7806.             EXAMPLE
  7807.  
  7808.             REM SET THE VIDEO MODE TO 800x600x256
  7809.             $LINK "SVGAPB.PBL"
  7810.             $INCLUDE "SVGAPB.BI"
  7811.             DEFINT A-Z
  7812.  
  7813.             VMODE = VIDEOMODEGET
  7814.             IF WHICHVGA = 0 THEN STOP
  7815.             IF WHICHMEM < 512 THEN STOP
  7816.             DUMMY=RES800
  7817.             DRWSTRING 1, 7, 0, "THIS IS THE 800x600x256 VIDEO MODE...", 0,
  7818.             0
  7819.             WHILE INKEY$ = ""
  7820.             WEND
  7821.             VIDEOMODESET VMODE
  7822.             END
  7823.  
  7824.  
  7825.  
  7826.  
  7827.  
  7828.  
  7829.  
  7830.  
  7831.  
  7832.  
  7833.  
  7834.  
  7835.                                                                         125
  7836.  
  7837.  
  7838.  
  7839.  
  7840.  
  7841.           RES1024
  7842.  
  7843.             PROTOTYPE
  7844.  
  7845.             FUNCTION RES1024% ()
  7846.  
  7847.             INPUT
  7848.  
  7849.             no input parameters
  7850.  
  7851.             OUTPUT
  7852.  
  7853.             RES1024 returns 1 if successful, 0 otherwise.
  7854.  
  7855.             USAGE
  7856.  
  7857.             RES1024 sets the video mode to 1024x768 graphics mode with 256
  7858.             colors.  This function requires that a Super VGA card with at
  7859.             least 1 Megabyte of video memory be present.  Also, WHICHVGA
  7860.             must be called first or the function will fail without
  7861.             changing the video mode.  If the video card does not have
  7862.             sufficient memory, RES1024 will return without changing the
  7863.             video mode.
  7864.  
  7865.             SEE ALSO
  7866.  
  7867.             RES320, RES640, RES640L, RES800, RES1280, WHICHVGA
  7868.  
  7869.             EXAMPLE
  7870.  
  7871.             REM SET THE VIDEO MODE TO 1024x768x256
  7872.             $LINK "SVGAPB.PBL"
  7873.             $INCLUDE "SVGAPB.BI"
  7874.             DEFINT A-Z
  7875.  
  7876.             VMODE = VIDEOMODEGET
  7877.             IF WHICHVGA = 0 THEN STOP
  7878.             IF WHICHMEM < 1024 THEN STOP
  7879.             DUMMY=RES1024
  7880.             DRWSTRING 1, 7, 0, "THIS IS THE 1024x768x256 VIDEO MODE...",
  7881.             0, 0
  7882.             WHILE INKEY$ = ""
  7883.             WEND
  7884.             VIDEOMODESET VMODE
  7885.             END
  7886.  
  7887.  
  7888.  
  7889.  
  7890.  
  7891.  
  7892.  
  7893.  
  7894.  
  7895.  
  7896.  
  7897.                                                                         126
  7898.  
  7899.  
  7900.  
  7901.  
  7902.  
  7903.           RES1280
  7904.  
  7905.             PROTOTYPE
  7906.  
  7907.             FUNCTION RES1280% ()
  7908.  
  7909.             INPUT
  7910.  
  7911.             no input parameters
  7912.  
  7913.             OUTPUT
  7914.  
  7915.             RES1280 returns 1 if successful, 0 otherwise.
  7916.  
  7917.             USAGE
  7918.  
  7919.             RES1280 sets the video mode to 1280x1024 graphics mode with
  7920.             256 colors.  This function requires that a Super VGA card with
  7921.             at least 2 Megabytes of video memory be present.  Also,
  7922.             WHICHVGA must be called first or the function will fail
  7923.             without changing the video mode.  If the video card does not
  7924.             have sufficient memory, RES1280 will return without changing
  7925.             the video mode.
  7926.  
  7927.             SEE ALSO
  7928.  
  7929.             RES320, RES640, RES640L, RES800, RES1024, WHICHVGA
  7930.  
  7931.             EXAMPLE
  7932.  
  7933.             REM SET THE VIDEO MODE TO 1280x1024x256
  7934.             $LINK "SVGAPB.PBL"
  7935.             $INCLUDE "SVGAPB.BI"
  7936.             DEFINT A-Z
  7937.  
  7938.             VMODE = VIDEOMODEGET
  7939.             IF WHICHVGA = 0 THEN STOP
  7940.             IF WHICHMEM < 2048 THEN STOP
  7941.             DUMMY=RES1280
  7942.             DRWSTRING 1, 7, 0, "THIS IS THE 1280x1024x256 VIDEO MODE...",
  7943.             0, 0
  7944.             WHILE INKEY$ = ""
  7945.             WEND
  7946.             VIDEOMODESET VMODE
  7947.             END
  7948.  
  7949.  
  7950.  
  7951.  
  7952.  
  7953.  
  7954.  
  7955.  
  7956.  
  7957.  
  7958.  
  7959.                                                                         127
  7960.  
  7961.  
  7962.  
  7963.  
  7964.  
  7965.           RESTEXT
  7966.  
  7967.             PROTOTYPE
  7968.  
  7969.             FUNCTION RESTEXT% ()
  7970.  
  7971.             INPUT
  7972.  
  7973.             no input parameters
  7974.  
  7975.             OUTPUT
  7976.  
  7977.             RESTEXT always returns a 1.
  7978.  
  7979.             USAGE
  7980.  
  7981.             RESTEXT sets video mode three which is the VGA standard 80x25
  7982.             text mode.
  7983.  
  7984.             SEE ALSO
  7985.  
  7986.             VIDEOMODEGET, VIDEOMODESET
  7987.  
  7988.             EXAMPLE
  7989.  
  7990.             REM SET THE VIDEO MODE TO STANDARD DOS TEXT MODE 3
  7991.             $LINK "SVGAPB.PBL"
  7992.             $INCLUDE "SVGAPB.BI"
  7993.             DEFINT A-Z
  7994.  
  7995.             VMODE = VIDEOMODEGET
  7996.             RESTEXT
  7997.             PRINT "THIS IS THE TEXT VIDEO MODE (DOS VIDEO MODE 3)...
  7998.             WHILE INKEY$ = ""
  7999.             WEND
  8000.             VIDEOMODESET VMODE
  8001.             END
  8002.  
  8003.  
  8004.  
  8005.  
  8006.  
  8007.  
  8008.  
  8009.  
  8010.  
  8011.  
  8012.  
  8013.  
  8014.  
  8015.  
  8016.  
  8017.  
  8018.  
  8019.  
  8020.  
  8021.                                                                         128
  8022.  
  8023.  
  8024.  
  8025.  
  8026.  
  8027.           SCROLLDN
  8028.  
  8029.             PROTOTYPE
  8030.  
  8031.             SUB SCROLLDN (X1%, Y1%, X2%, Y2%, Num%, Colr%)
  8032.             INPUT
  8033.  
  8034.             X1, Y1 - top left corner of block
  8035.             X2, Y2 - bottom right corner of block
  8036.             Num - number of pixels to shift
  8037.             Color - index to color in current palette
  8038.  
  8039.             OUTPUT
  8040.  
  8041.             no value returned
  8042.  
  8043.             USAGE
  8044.  
  8045.             SCROLLDN shifts the contents of the box described by (X1, Y1)
  8046.             - (X2, Y2) down by the number of pixels specified by Num.  The
  8047.             empty pixels created at the top of the box are filled with
  8048.             Color.  The pixels that are shifted out of the box are lost.
  8049.             SCROLLDN enforces X2 X1 and Y2Y1.  When placed within a loop,
  8050.             SCROLLDN will create a scrolling effect.
  8051.  
  8052.             SEE ALSO
  8053.  
  8054.             SCROLLLT, SCROLLRT, SCROLLUP
  8055.  
  8056.             EXAMPLE
  8057.  
  8058.             REM SCROLL SOME TEXT DOWN
  8059.             $LINK "SVGAPB.PBL"
  8060.             $INCLUDE "SVGAPB.BI"
  8061.             DEFINT A-Z
  8062.  
  8063.             VMODE = VIDEOMODEGET
  8064.             IF WHICHVGA = 0 THEN STOP
  8065.             IF WHICHMEM < 512 THEN STOP
  8066.             DUMMY=RES640
  8067.             DRWBOX 1, 10, 0, 0, 100, 100
  8068.             DRWSTRING 1, 7, 0, "TEXT TEXT", 20, 43
  8069.             FOR I = 0 TO 40
  8070.                SCROLLDN 1, 1, 99, 99, 1, 0
  8071.                SDELAY 2
  8072.             NEXT I
  8073.             WHILE INKEY$ = ""
  8074.             WEND
  8075.             VIDEOMODESET VMODE
  8076.             END
  8077.  
  8078.  
  8079.  
  8080.  
  8081.  
  8082.  
  8083.                                                                         129
  8084.  
  8085.  
  8086.  
  8087.  
  8088.  
  8089.           SCROLLLT
  8090.  
  8091.             PROTOTYPE
  8092.  
  8093.             SUB SCROLLLT (X1%, Y1%, X2%, Y2%, Num%, Colr%)
  8094.  
  8095.             INPUT
  8096.  
  8097.             X1, Y1 - top left corner of block
  8098.             X2, Y2 - bottom right corner of block
  8099.             Num - number of pixels to shift
  8100.             Color - index to color in current palette
  8101.  
  8102.             OUTPUT
  8103.  
  8104.             no value returned
  8105.  
  8106.             USAGE
  8107.  
  8108.             SCROLLLT shifts the contents of the box described by (X1, Y1)
  8109.             - (X2, Y2) down by the number of pixels specified by Num.  The
  8110.             empty pixels created at the right of the box are filled with
  8111.             Color.  The pixels that are shifted out of the box are lost.
  8112.             SCROLLLT enforces X2 X1 and Y2Y1.  When placed within a loop,
  8113.             SCROLLRT will create a scrolling effect.
  8114.  
  8115.             SEE ALSO
  8116.  
  8117.             SCROLLDN, SCROLLRT, SCROLLUP
  8118.  
  8119.             EXAMPLE
  8120.  
  8121.             REM SCROLL SOME TEXT LEFT
  8122.             $LINK "SVGAPB.PBL"
  8123.             $INCLUDE "SVGAPB.BI"
  8124.             DEFINT A-Z
  8125.  
  8126.             VMODE = VIDEOMODEGET
  8127.             IF WHICHVGA = 0 THEN STOP
  8128.             IF WHICHMEM < 512 THEN STOP
  8129.             DUMMY=RES640
  8130.             DRWBOX 1, 10, 0, 0, 100, 100
  8131.             DRWSTRING 1, 7, 0, "TEXT TEXT", 20, 43
  8132.             FOR I = 0 TO 40
  8133.                SCROLLLT 1, 1, 99, 99, 1, 0
  8134.                SDELAY 2
  8135.             NEXT I
  8136.             WHILE INKEY$ = ""
  8137.             WEND
  8138.             VIDEOMODESET VMODE
  8139.             END
  8140.  
  8141.  
  8142.  
  8143.  
  8144.  
  8145.                                                                         130
  8146.  
  8147.  
  8148.  
  8149.  
  8150.  
  8151.           SCROLLRT
  8152.  
  8153.             PROTOTYPE
  8154.  
  8155.             SUB SCROLLRT (X1%, Y1%, X2%, Y2%, Num%, Colr%)
  8156.  
  8157.             INPUT
  8158.  
  8159.             X1, Y1 - top left corner of block
  8160.             X2, Y2 - bottom right corner of block
  8161.             Num - number of pixels to shift
  8162.             Color - index to color in current palette
  8163.  
  8164.             OUTPUT
  8165.  
  8166.             no value returned
  8167.  
  8168.             USAGE
  8169.  
  8170.             SCROLLRT shifts the contents of the box described by (X1, Y1)
  8171.             - (X2, Y2) down by the number of pixels specified by Num.  The
  8172.             empty pixels created at the left of the box are filled with
  8173.             Color.  The pixels that are shifted out of the box are lost.
  8174.             SCROLLRT enforces X2 X1 and Y2Y1.  When placed within a loop,
  8175.             SCROLLRT will create a scrolling effect.
  8176.  
  8177.             SEE ALSO
  8178.  
  8179.             SCROLLDN, SCROLLLT, SCROLLUP
  8180.  
  8181.             EXAMPLE
  8182.  
  8183.             REM SCROLL SOME TEXT RIGHT
  8184.             $LINK "SVGAPB.PBL"
  8185.             $INCLUDE "SVGAPB.BI"
  8186.             DEFINT A-Z
  8187.  
  8188.             VMODE = VIDEOMODEGET
  8189.             IF WHICHVGA = 0 THEN STOP
  8190.             IF WHICHMEM < 512 THEN STOP
  8191.             DUMMY=RES640
  8192.             DRWBOX 1, 10, 0, 0, 100, 100
  8193.             DRWSTRING 1, 7, 0, "TEXT TEXT", 20, 43
  8194.             FOR I = 0 TO 40
  8195.                SCROLLRT 1, 1, 99, 99, 1, 0
  8196.                SDELAY 2
  8197.             NEXT I
  8198.             WHILE INKEY$ = ""
  8199.             WEND
  8200.             VIDEOMODESET VMODE
  8201.             END
  8202.  
  8203.  
  8204.  
  8205.  
  8206.  
  8207.                                                                         131
  8208.  
  8209.  
  8210.  
  8211.  
  8212.  
  8213.           SCROLLUP
  8214.  
  8215.             PROTOTYPE
  8216.  
  8217.             SUB SCROLLUP (X1%, Y1%, X2%, Y2%, Num%, Colr%)
  8218.  
  8219.             INPUT
  8220.  
  8221.             X1, Y1 - top left corner of block
  8222.             X2, Y2 - bottom right corner of block
  8223.             Num - number of pixels to shift
  8224.             Color - index to color in current palette
  8225.  
  8226.             OUTPUT
  8227.  
  8228.             no value returned
  8229.  
  8230.             USAGE
  8231.  
  8232.             SCROLLUP shifts the contents of the box described by (X1, Y1)
  8233.             - (X2, Y2) down by the number of pixels specified by Num.  The
  8234.             empty pixels created at the bottom of the box are filled with
  8235.             Color.  The pixels that are shifted out of the box are lost.
  8236.             SCROLLUP enforces X2 X1 and Y2Y1.  When placed within a loop,
  8237.             SCROLLUP will create a scrolling effect.
  8238.  
  8239.             SEE ALSO
  8240.  
  8241.             SCROLLDN, SCROLLLT, SCROLLRT
  8242.  
  8243.             EXAMPLE
  8244.  
  8245.             REM SCROLL SOME TEXT UP
  8246.             $LINK "SVGAPB.PBL"
  8247.             $INCLUDE "SVGAPB.BI"
  8248.             DEFINT A-Z
  8249.  
  8250.             VMODE = VIDEOMODEGET
  8251.             IF WHICHVGA = 0 THEN STOP
  8252.             IF WHICHMEM < 512 THEN STOP
  8253.             DUMMY=RES640
  8254.             DRWBOX 1, 10, 0, 0, 100, 100
  8255.             DRWSTRING 1, 7, 0, "TEXT TEXT", 20, 43
  8256.             FOR I = 0 TO 40
  8257.                SCROLLUP 1, 1, 99, 99, 1, 0
  8258.                SDELAY 2
  8259.             NEXT I
  8260.             WHILE INKEY$ = ""
  8261.             WEND
  8262.             VIDEOMODESET VMODE
  8263.             END
  8264.  
  8265.  
  8266.  
  8267.  
  8268.  
  8269.                                                                         132
  8270.  
  8271.  
  8272.  
  8273.  
  8274.  
  8275.           SDELAY
  8276.  
  8277.             PROTOTYPE
  8278.  
  8279.             SUB SDELAY (Count%)
  8280.  
  8281.             INPUT
  8282.  
  8283.             Count - number of vertical syncs to wait
  8284.  
  8285.             OUTPUT
  8286.  
  8287.             no value returned
  8288.  
  8289.             USAGE
  8290.  
  8291.             SDELAY pauses execution of the program for a period of time
  8292.             specified by Count.  This delay remains approximately constant
  8293.             on all machines by using the vertical sync timer of the VGA
  8294.             graphics card which is about 60 - 70 Hz.
  8295.  
  8296.             EXAMPLE
  8297.  
  8298.             REM MAKE A DELAY ABOUT 3 SECONDS LONG
  8299.             $LINK "SVGAPB.PBL"
  8300.             $INCLUDE "SVGAPB.BI"
  8301.             DEFINT A-Z
  8302.  
  8303.             CLS
  8304.             PRINT "OK...STARTING DELAY NOW..."
  8305.             PRINT "SHOULD BE ABOUT 3 SECONDS..."
  8306.             PRINT
  8307.             TIM! = TIMER
  8308.             SDELAY 195
  8309.             TOT! = TIMER - TIM!
  8310.             PRINT "ACTUAL TIME WAS:"; TOT!
  8311.             WHILE INKEY$ = ""
  8312.             WEND
  8313.             END
  8314.  
  8315.  
  8316.  
  8317.  
  8318.  
  8319.  
  8320.  
  8321.  
  8322.  
  8323.  
  8324.  
  8325.  
  8326.  
  8327.  
  8328.  
  8329.  
  8330.  
  8331.                                                                         133
  8332.  
  8333.  
  8334.  
  8335.  
  8336.  
  8337.           SETCARD
  8338.  
  8339.             PROTOTYPE
  8340.  
  8341.             SUB SETCARD (Chip%, Mem%)
  8342.  
  8343.             INPUT
  8344.  
  8345.             Chip - code for certain SVGA chip type
  8346.             Mem - amount of video memory installed
  8347.  
  8348.             OUTPUT
  8349.  
  8350.             no value returned
  8351.  
  8352.             USAGE
  8353.  
  8354.             WARNING:  USING SETCARD IMPROPERLY MAY CAUSE A SYSTEM FAILURE
  8355.             OR DAMAGE.
  8356.             SETCARD sets the card type and installed video memory.  It can
  8357.             be used instead of the WHICHVGA function.  However, specifying
  8358.             an incorrect chip type or installed video memory may cause
  8359.             unpredictable results not excluding damage to the SVGA card
  8360.             and/or monitor.  Extreme caution is advised when using this
  8361.             function.  It is recommended that this function only be used
  8362.             when it is suspected that the identification process in
  8363.             WHICHVGA failed.  Be absolutely certain that the chip type
  8364.             specified is the actual chip type installed in the computer.
  8365.             Mem should be a value of 256, 512 or 1024 representing the
  8366.             kilobytes of video memory installed.  Use the following table
  8367.             to identify chip types:
  8368.  
  8369.           1  Acumos AVGA2/3 SuperVGA
  8370.           2  ATI Technologies 18/28/38/68800
  8371.              SuperVGA
  8372.           3  Ahead V5000 ver A SuperVGA
  8373.           4  Ahead V5000 ver B SuperVGA
  8374.           5  Chips and Technologies 82C45x SuperVGA
  8375.           6  Cirrus Logic CL-GD 5xx, 6xx, 28xx,
  8376.              54xx, 62xx SuperVGA
  8377.           7  Everex Micro Enhancer Ev236/6xx
  8378.              SuperVGA
  8379.           8  Genoa 61/62/63/64/6600 SuperVGA
  8380.           9  NCR 77C21/22/22E/22E+ SuperVGA
  8381.           10 Oak Technologies OTI-037C/067/077/087
  8382.              SuperVGA
  8383.           11 Paradise/Western Digital PVGA1A,
  8384.              WD90C00/1x/2x/3x SuperVGA
  8385.           12 Realtek RT3106 SuperVGA
  8386.           13 Trident 8800CS, 8900B/C/CL/CX, 90x0
  8387.              SuperVGA
  8388.           14 Tseng Labs ET3000-AX/BX/BP SuperVGA
  8389.           15 Tseng Labs ET4000/W32/W32I SuperVGA
  8390.           16 VESA compatible SuperVGA
  8391.  
  8392.  
  8393.                                                                         134
  8394.  
  8395.  
  8396.  
  8397.  
  8398.  
  8399.           17 Video 7 HT-208/16 SuperVGA
  8400.           18 Avance Logic AL2101 SuperVGA
  8401.           19 MXIC MX68000/10 SuperVGA
  8402.           20 Primus P2000 SuperVGA
  8403.  
  8404.             SEE ALSO
  8405.  
  8406.             WHICHVGA
  8407.  
  8408.             EXAMPLE
  8409.  
  8410.             REM
  8411.             !WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNI
  8412.             NG!
  8413.  
  8414.             REM USE THIS FUNCTION CAREFULLY. IT WORKS AROUND THE "WHICHVGA
  8415.             FUNCTION"
  8416.             REM IMPROPER USE (I.E. SETTING THE CARD ID AND MEMORY TO
  8417.             SOMETHING THAT
  8418.             REM THAT IS NOT VALID) MIGHT DAMAGE YOUR VIDEO CARD/VIDEO
  8419.             MONITOR OR
  8420.             REM CAUSE UNPREDICTABLE RESULTS. IT IS PROVIDED AS A METHOD TO
  8421.             FIND
  8422.             REM FAULTS IN THE VIDEO CARD/CHIP ID PROCESS.
  8423.  
  8424.             REM
  8425.             !WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNI
  8426.             NG!
  8427.  
  8428.             END
  8429.  
  8430.  
  8431.  
  8432.  
  8433.  
  8434.  
  8435.  
  8436.  
  8437.  
  8438.  
  8439.  
  8440.  
  8441.  
  8442.  
  8443.  
  8444.  
  8445.  
  8446.  
  8447.  
  8448.  
  8449.  
  8450.  
  8451.  
  8452.  
  8453.  
  8454.  
  8455.                                                                         135
  8456.  
  8457.  
  8458.  
  8459.  
  8460.  
  8461.           SETVIEW
  8462.  
  8463.             PROTOTYPE
  8464.  
  8465.             SUB SETVIEW (X1%, Y1%, X2%, Y2%)
  8466.  
  8467.             INPUT
  8468.  
  8469.             X1, Y1 - top, left corner of view port
  8470.             X2, Y2 - bottom, right corner of view port
  8471.  
  8472.             OUTPUT
  8473.  
  8474.             no value returned
  8475.  
  8476.             USAGE
  8477.  
  8478.             SETVIEW defines a viewport for clipping output on the screen.
  8479.             Nothing can be drawn outside of the currently defined
  8480.             viewport.  The RES### functions set the viewport to the full
  8481.             screen.  The restrictions on X1, Y1, X2 and Y2 are as follows:
  8482.  
  8483.             0   X1 < X2  (screen width)
  8484.             0   Y1 < Y2  (32767, effectively unbounded)
  8485.  
  8486.             SEE ALSO
  8487.  
  8488.             RES320, RES640, RES640L, RES800, RES1024, RES1280
  8489.  
  8490.             EXAMPLE
  8491.  
  8492.             REM DRAW SOME LINES CLIPPED TO A VIEWPORT
  8493.             $LINK "SVGAPB.PBL"
  8494.             $INCLUDE "SVGAPB.BI"
  8495.             DEFINT A-Z
  8496.  
  8497.             VMODE = VIDEOMODEGET
  8498.             IF WHICHVGA = 0 THEN STOP
  8499.             IF WHICHMEM < 512 THEN STOP
  8500.             DUMMY=RES640
  8501.             DRWBOX 1, 15, 100, 100, 539, 379
  8502.             SETVIEW 101, 101, 538, 378
  8503.             FOR I = 0 TO 300
  8504.                X1 = RND * 640
  8505.                Y1 = RND * 480
  8506.                X2 = RND * 640
  8507.                Y2 = RND * 480
  8508.                DRWLINE 1, 10, X1, Y1, X2, Y2
  8509.             NEXT I
  8510.             WHILE INKEY$ = ""
  8511.             WEND
  8512.             VIDEOMODESET VMODE
  8513.             END
  8514.  
  8515.  
  8516.  
  8517.                                                                         136
  8518.  
  8519.  
  8520.  
  8521.  
  8522.  
  8523.           SPRITECOLLDETECT
  8524.  
  8525.             PROTOTYPE
  8526.  
  8527.             FUNCTION SPRITECOLLDETECT% (TransColor%, X1%, Y1%, X2%, Y2%,
  8528.             GfxBlk1%, GfxBlk2%)
  8529.  
  8530.             INPUT
  8531.  
  8532.             TransColor - index to color in current palette
  8533.             X1, Y1 - top, left corner of sprite number 1
  8534.             X2, Y2 - top, left corner of sprite number 2
  8535.             GfxBlk1 - predefined integer array containing the sprite
  8536.             number 1
  8537.             GfxBlk2 - predefined integer array containing the sprite
  8538.             number 2
  8539.  
  8540.             OUTPUT
  8541.  
  8542.             SPRITECOLLDETECT returns the collision status of the two
  8543.             sprites.
  8544.  
  8545.             USAGE
  8546.  
  8547.             SPRITECOLLDETECT is used in sprite graphics or animation to
  8548.             report the collision status between two sprites.  GfxBlk1, a
  8549.             short integer array, contains the first sprite which should
  8550.             have been previously defined by BLKGET or similar function.
  8551.             GfxBlk2, likewise, contains the second sprite.  The top, left
  8552.             corner of the first and second sprites' locations are
  8553.             specified by X1, Y1 and X2, Y2, respectively.
  8554.  
  8555.             SPRITECOLLDETECT will return a zero if the sprites are not
  8556.             colliding and the blocks are not overlapping.  The return will
  8557.             be one if the blocks overlap, but the sprites are not
  8558.             colliding.  A return value of two indicates that the sprites
  8559.             have at least one overlapping pixel and are, therefore,
  8560.             colliding.
  8561.  
  8562.             Arrays should be passed by giving the element within the array
  8563.             from where the action should take place.  This allows the
  8564.             programmer to store more than one item within the same array
  8565.             or act on only a portion of the array.
  8566.  
  8567.             SEE ALSO
  8568.  
  8569.             BLKGET, BLKPUT, GETLASTSTRING, SPRITEGAP, SPRITEGET, SPRITEPUT
  8570.  
  8571.             EXAMPLE
  8572.  
  8573.             REM SHOW THE RESULTS OF THE SPRITE COLLISION DETECTION
  8574.             FUNCTION
  8575.             $LINK "SVGAPB.PBL"
  8576.             $INCLUDE "SVGAPB.BI"
  8577.  
  8578.  
  8579.                                                                         137
  8580.  
  8581.  
  8582.  
  8583.  
  8584.  
  8585.  
  8586.             DEFINT A-Z
  8587.  
  8588.             DIM D1(0 TO 4000) AS INTEGER
  8589.             DIM D2(0 TO 4000) AS INTEGER
  8590.  
  8591.             IF WHICHVGA < 0 THEN STOP
  8592.             ORGMODE = VIDEOMODEGET
  8593.             DUMMY=RES320
  8594.             X1 = 0
  8595.             Y1 = 0
  8596.             X2 = 24
  8597.             Y2 = 24
  8598.             DRWLINE 1, 8, X1, Y1, X2, Y1
  8599.             DRWLINE 1, 8, X2, Y1, X2, Y2
  8600.             DRWLINE 1, 8, X2, Y2, X1, Y2
  8601.             DRWLINE 1, 8, X1, Y2, X1, Y1
  8602.             FILLAREA X1 + 1, Y1 + 1, 8, 8
  8603.             DRWLINE 1, 10, X1, Y1, X2, Y2
  8604.             DRWLINE 1, 10, X2, Y1, X1, Y2
  8605.             BLKGET X1, Y1, X2, Y2, D1(0)
  8606.             BLKPUT 2, X1, Y1, D1(0)
  8607.             X1 = 0
  8608.             Y1 = 0
  8609.             X2 = 48
  8610.             Y2 = 48
  8611.             DRWLINE 1, 8, X1, Y1, X2, Y1
  8612.             DRWLINE 1, 8, X2, Y1, X2, Y2
  8613.             DRWLINE 1, 8, X2, Y2, X1, Y2
  8614.             DRWLINE 1, 8, X1, Y2, X1, Y1
  8615.             FILLAREA X1 + 1, Y1 + 1, 8, 8
  8616.             DRWCIRCLE 1, 10, X1 + 24, Y1 + 24, 24
  8617.             BLKGET X1, Y1, X2, Y2, D2(0)
  8618.             BLKPUT 2, X1, Y1, D2(0)
  8619.             X1 = 90
  8620.             Y1 = 90
  8621.             BLKPUT 2, X1, Y1, D2(0)
  8622.             FOR X = 50 TO 150
  8623.                BLKPUT 2, X, X, D1(0)
  8624.                A = SPRITECOLLDETECT(8, X, X, X1, Y1, D1(0), D2(0))
  8625.                A$ = STR$(A)
  8626.                IF LEN(A$) < 5 THEN A$ = A$ + " "
  8627.                DRWSTRING 1, 7, 0, A$, 0, 0
  8628.                WHILE INKEY$ = ""
  8629.                WEND
  8630.                BLKPUT 2, X, X, D1(0)
  8631.             NEXT X
  8632.             VIDEOMODESET ORGMODE
  8633.             END
  8634.  
  8635.  
  8636.  
  8637.  
  8638.  
  8639.  
  8640.  
  8641.                                                                         138
  8642.  
  8643.  
  8644.  
  8645.  
  8646.  
  8647.           SPRITEGAP
  8648.  
  8649.             PROTOTYPE
  8650.  
  8651.             SUB SPRITEGAP (TransColor%, X%, Y%, GfxBlk%, BkGndGfxBlk%)
  8652.  
  8653.             INPUT
  8654.  
  8655.             TransColor - index to color in current palette
  8656.             X, Y - top, left corner of block
  8657.             GfxBlk - predefined integer array containing the sprite
  8658.  
  8659.             OUTPUT
  8660.  
  8661.             no value returned
  8662.             BkGndGfxBlk - integer array holding the sprite background
  8663.  
  8664.             USAGE
  8665.  
  8666.             SPRITEGAP ("Sprite-Get-And-Put") is used in sprite graphics or
  8667.             animation to retrieve a sprite's background and then display
  8668.             the sprite.  GfxBlk, a short integer array, contains the
  8669.             sprite which should have been previously defined by BLKGET or
  8670.             similar function such as GETLASTSTRING.  TransColor is the
  8671.             transparent color assumed in GfxBlk.  BkGndGfxBlk, an empty
  8672.             short integer array the same size as GfxBlk, will receive the
  8673.             sprite's background.  The top, left corner of the sprite's
  8674.             location is specified by X, Y.
  8675.  
  8676.             Arrays should be passed by giving the element within the array
  8677.             from where the action should take place.  This allows the
  8678.             programmer to store more than one item within the same array
  8679.             or act on only a portion of the array.
  8680.  
  8681.             SEE ALSO
  8682.  
  8683.             BLKGET, BLKPUT, GETLASTSTRING, SPRITECOLLDETECT, SPRITEGET,
  8684.             SPRITEPUT
  8685.  
  8686.             EXAMPLE
  8687.  
  8688.             REM SHOW SPRITEGAP
  8689.             $LINK "SVGAPB.PBL"
  8690.             $INCLUDE "SVGAPB.BI"
  8691.             DEFINT A-Z
  8692.             DIM GFXBLK1(10000)
  8693.             DIM GFXBLK2(10000)
  8694.             DIM GFXBLK3(10000)
  8695.  
  8696.             IF WHICHVGA = 0 THEN STOP
  8697.             VMODE = VIDEOMODEGET
  8698.             IF RES640 <> 1 THEN
  8699.                VIDEOMODESET VMODE
  8700.                END
  8701.  
  8702.  
  8703.                                                                         139
  8704.  
  8705.  
  8706.  
  8707.  
  8708.  
  8709.             END IF
  8710.             Colr = 1
  8711.             FOR I = 0 TO GETMAXX \ 2
  8712.                DRWCIRCLE 1, Colr, GETMAXX \ 4 + I, GETMAXY \ 2, GETMAXY \ 5
  8713.                Colr = Colr + 1
  8714.                IF Colr > 15 THEN
  8715.                  Colr = 1
  8716.                END IF
  8717.             NEXT I
  8718.             XINC = GETMAXX \ 20
  8719.             YINC = GETMAXY \ 20
  8720.             X1 = GETMAXX \ 2 - XINC
  8721.             Y1 = GETMAXY \ 2 - YINC
  8722.             X2 = GETMAXX \ 2 + XINC
  8723.             Y2 = GETMAXY \ 2 + YINC
  8724.             X = (X2 - X1) \ 2 + X1
  8725.             Y = (Y2 - Y1) \ 2 + Y1
  8726.             BLKGET X1, Y1, X2, Y2, GFXBLK1(0)
  8727.             DRWBOX 1, 0, X1, Y1, X2, Y2
  8728.             FILLAREA X1 + 2, Y1 + 2, 0, 0
  8729.             BLKGET X1, Y1, X2, Y2, GFXBLK3(0)
  8730.             FOR I = 0 TO 360 STEP 3
  8731.                DUMMY = BLKROTATE(I, 1, GFXBLK1(0), GFXBLK2(0))
  8732.                SPRITEPUT 1, 1, X - GFXBLK3(0) \ 2, Y - GFXBLK3(1) \ 2,
  8733.             GFXBLK3(0)
  8734.                SPRITEGAP 1, X - GFXBLK2(0) \ 2, Y - GFXBLK2(1) \ 2,
  8735.             GFXBLK2(0), GFXBLK3(0)
  8736.                SDELAY 3
  8737.             NEXT I
  8738.             SPRITEPUT 1, 1, X - GFXBLK3(0) \ 2, Y - GFXBLK3(1) \ 2,
  8739.             GFXBLK3(0)
  8740.             BLKPUT 1, X1, Y1, GFXBLK1(0)
  8741.             VIDEOMODESET VMODE
  8742.             END
  8743.  
  8744.  
  8745.  
  8746.  
  8747.  
  8748.  
  8749.  
  8750.  
  8751.  
  8752.  
  8753.  
  8754.  
  8755.  
  8756.  
  8757.  
  8758.  
  8759.  
  8760.  
  8761.  
  8762.  
  8763.  
  8764.  
  8765.                                                                         140
  8766.  
  8767.  
  8768.  
  8769.  
  8770.  
  8771.           SPRITEGET
  8772.  
  8773.             PROTOTYPE
  8774.  
  8775.             SUB SPRITEGET (TransColor%, X%, Y%, GfxBlk%, BkGndGfxBlk%)
  8776.  
  8777.             INPUT
  8778.  
  8779.             TransColor - index to color in current palette
  8780.             X, Y - top, left corner of block
  8781.             GfxBlk - predefined integer array containing the sprite
  8782.  
  8783.             OUTPUT
  8784.  
  8785.             no value returned
  8786.             BkGndGfxBlk - integer array holding the sprite background
  8787.  
  8788.             USAGE
  8789.  
  8790.             SPRITEGET is used in sprite graphics or animation to retrieve
  8791.             the background for a sprite, normally just before using
  8792.             SPRITEPUT.  GfxBlk, a short integer array, contains the sprite
  8793.             which should have been previously defined by BLKGET or similar
  8794.             function.  TransColor is the transparent color assumed in
  8795.             GfxBlk.  BkGndGfxBlk, an empty short integer array of the same
  8796.             size as GfxBlk, will receive the sprite's background.  The
  8797.             top, left corner of the sprite's location is specified by X,
  8798.             Y.
  8799.  
  8800.             Arrays should be passed by giving the element within the array
  8801.             from where the action should take place.  This allows the
  8802.             programmer to store more than one item within the same array
  8803.             or act on only a portion of the array.
  8804.  
  8805.             SEE ALSO
  8806.  
  8807.             BLKGET, BLKPUT, GETLASTSTRING, SPRITECOLLDETECT, SPRITEGAP,
  8808.             SPRITEPUT
  8809.  
  8810.             EXAMPLE
  8811.  
  8812.             REM SHOW SPRITEGET
  8813.             $LINK "SVGAPB.PBL"
  8814.             $INCLUDE "SVGAPB.BI"
  8815.             DEFINT A-Z
  8816.             DIM GFXBLK1(10000)
  8817.             DIM GFXBLK2(10000)
  8818.             DIM GFXBLK3(10000)
  8819.  
  8820.             IF WHICHVGA = 0 THEN STOP
  8821.             VMODE = VIDEOMODEGET
  8822.             IF RES640 <> 1 THEN
  8823.                VIDEOMODESET VMODE
  8824.                END
  8825.  
  8826.  
  8827.                                                                         141
  8828.  
  8829.  
  8830.  
  8831.  
  8832.  
  8833.             END IF
  8834.             Colr = 1
  8835.             FOR I = 0 TO GETMAXX \ 2
  8836.                DRWCIRCLE 1, Colr, GETMAXX \ 4 + I, GETMAXY \ 2, GETMAXY \ 5
  8837.                Colr = Colr + 1
  8838.                IF Colr > 15 THEN
  8839.                  Colr = 1
  8840.                END IF
  8841.             NEXT I
  8842.             XINC = GETMAXX \ 20
  8843.             YINC = GETMAXY \ 20
  8844.             X1 = GETMAXX \ 2 - XINC
  8845.             Y1 = GETMAXY \ 2 - YINC
  8846.             X2 = GETMAXX \ 2 + XINC
  8847.             Y2 = GETMAXY \ 2 + YINC
  8848.             X = (X2 - X1) \ 2 + X1
  8849.             Y = (Y2 - Y1) \ 2 + Y1
  8850.             BLKGET X1, Y1, X2, Y2, GFXBLK1(0)
  8851.             DRWBOX 1, 0, X1, Y1, X2, Y2
  8852.             FILLAREA X1 + 2, Y1 + 2, 0, 0
  8853.             BLKGET X1, Y1, X2, Y2, GFXBLK3(0)
  8854.             FOR I = 0 TO 360 STEP 3
  8855.                DUMMY = BLKROTATE(I, 1, GFXBLK1(0), GFXBLK2(0))
  8856.                SPRITEPUT 1, 1, X - GFXBLK3(0) \ 2, Y - GFXBLK3(1) \ 2,
  8857.             GFXBLK3(0)
  8858.                SPRITEGET 1, X - GFXBLK2(0) \ 2, Y - GFXBLK2(1) \ 2,
  8859.             GFXBLK2(0), GFXBLK3(0)
  8860.                SPRITEPUT 1, 1, X - GFXBLK2(0) \ 2, Y - GFXBLK2(1) \ 2,
  8861.             GFXBLK2(0)
  8862.                SDELAY 3
  8863.             NEXT I
  8864.             SPRITEPUT 1, 1, X - GFXBLK3(0) \ 2, Y - GFXBLK3(1) \ 2,
  8865.             GFXBLK3(0)
  8866.             BLKPUT 1, X1, Y1, GFXBLK1(0)
  8867.             VIDEOMODESET VMODE
  8868.             END
  8869.  
  8870.  
  8871.  
  8872.  
  8873.  
  8874.  
  8875.  
  8876.  
  8877.  
  8878.  
  8879.  
  8880.  
  8881.  
  8882.  
  8883.  
  8884.  
  8885.  
  8886.  
  8887.  
  8888.  
  8889.                                                                         142
  8890.  
  8891.  
  8892.  
  8893.  
  8894.  
  8895.           SPRITEPUT
  8896.  
  8897.             PROTOTYPE
  8898.  
  8899.             SUB SPRITEPUT (Mode%, TransColor%, X%, Y%, GfxBlk%)
  8900.  
  8901.             INPUT
  8902.  
  8903.             Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  8904.             TransColor - index to color in current palette
  8905.             X, Y - top, left corner of block
  8906.             GfxBlk - predefined integer array containing the sprite
  8907.  
  8908.             OUTPUT
  8909.  
  8910.             no value returned
  8911.  
  8912.             USAGE
  8913.  
  8914.             SPRITEPUT is used in sprite graphics or animation to display a
  8915.             sprite or, more commonly, its background.  GfxBlk, a short
  8916.             integer array, contains the sprite which should have been
  8917.             previously defined by BLKGET,  SPRITEGAP or SPRITEGET.
  8918.             TransColor is the transparent color assumed in GfxBlk.  The
  8919.             top, left corner of the sprite's location is specified by X,
  8920.             Y.
  8921.  
  8922.             Arrays should be passed by giving the element within the array
  8923.             from where the action should take place.  This allows the
  8924.             programmer to store more than one item within the same array
  8925.             or act on only a portion of the array.
  8926.  
  8927.             SEE ALSO
  8928.  
  8929.             BLKGET, BLKPUT, GETLASTSTRING, SPRITECOLLDETECT, SPRITEGAP,
  8930.             SPRITEGET
  8931.  
  8932.             EXAMPLE
  8933.  
  8934.             See SPRITEGAP
  8935.  
  8936.  
  8937.  
  8938.  
  8939.  
  8940.  
  8941.  
  8942.  
  8943.  
  8944.  
  8945.  
  8946.  
  8947.  
  8948.  
  8949.  
  8950.  
  8951.                                                                         143
  8952.  
  8953.  
  8954.  
  8955.  
  8956.  
  8957.           VIDEOMODEGET
  8958.  
  8959.             PROTOTYPE
  8960.  
  8961.             FUNCTION VIDEOMODEGET% ()
  8962.  
  8963.             INPUT
  8964.  
  8965.             no input parameters
  8966.  
  8967.             OUTPUT
  8968.  
  8969.             VIDEOMODEGET returns the current video mode.
  8970.  
  8971.             USAGE
  8972.  
  8973.             VIDEOMODEGET returns the current video mode.  This function is
  8974.             best used to retrieve the video mode being used when a program
  8975.             begins.  When the program ends, this video mode can then be
  8976.             restored using VIDEOMODESET.
  8977.  
  8978.             SEE ALSO
  8979.  
  8980.             RES320, RES640, RES640L, RES800, RES1024, RES1280, RESTEXT,
  8981.             VIDEOMODESET
  8982.  
  8983.             EXAMPLE
  8984.  
  8985.             REM SAVE THE VIDEO MODE,SWITCH TO 640X480X256, RESTORE THE
  8986.             ORIGINAL MODE
  8987.             $LINK "SVGAPB.PBL"
  8988.             $INCLUDE "SVGAPB.BI"
  8989.             DEFINT A-Z
  8990.  
  8991.             VMODE = VIDEOMODEGET
  8992.             IF WHICHVGA = 0 THEN STOP
  8993.             IF WHICHMEM < 512 THEN STOP
  8994.             DUMMY=RES640
  8995.             DRWSTRING 1, 7, 0, "PRESS A KEY...", 0, 0
  8996.             WHILE INKEY$ = ""
  8997.             WEND
  8998.             VIDEOMODESET VMODE
  8999.             END
  9000.  
  9001.  
  9002.  
  9003.  
  9004.  
  9005.  
  9006.  
  9007.  
  9008.  
  9009.  
  9010.  
  9011.  
  9012.  
  9013.                                                                         144
  9014.  
  9015.  
  9016.  
  9017.  
  9018.  
  9019.           VIDEOMODESET
  9020.  
  9021.             PROTOTYPE
  9022.  
  9023.             SUB VIDEOMODESET (Mode%)
  9024.  
  9025.             INPUT
  9026.  
  9027.             Mode - number of video mode
  9028.  
  9029.             OUTPUT
  9030.  
  9031.             no value returned
  9032.  
  9033.             USAGE
  9034.  
  9035.             VIDEOMODESET sets the video mode specified by Mode.  This
  9036.             function is best used at the end of a program to restore the
  9037.             video mode to the mode in use when the program began.  The
  9038.             program should retrieve the video mode at the beginning by
  9039.             using VIDEOMODEGET.
  9040.  
  9041.             SEE ALSO
  9042.  
  9043.             RES320, RES640, RES640L, RES800, RES1024, RES1280, RESTEXT,
  9044.             VIDEOMODEGET
  9045.  
  9046.             EXAMPLE
  9047.  
  9048.             See VIDEOMODEGET
  9049.  
  9050.  
  9051.  
  9052.  
  9053.  
  9054.  
  9055.  
  9056.  
  9057.  
  9058.  
  9059.  
  9060.  
  9061.  
  9062.  
  9063.  
  9064.  
  9065.  
  9066.  
  9067.  
  9068.  
  9069.  
  9070.  
  9071.  
  9072.  
  9073.  
  9074.  
  9075.                                                                         145
  9076.  
  9077.  
  9078.  
  9079.  
  9080.  
  9081.           VIDEOOFF
  9082.  
  9083.             PROTOTYPE
  9084.  
  9085.             SUB VIDEOOFF ()
  9086.  
  9087.             INPUT
  9088.  
  9089.             no input parameters
  9090.  
  9091.             OUTPUT
  9092.  
  9093.             no value returned
  9094.  
  9095.             USAGE
  9096.  
  9097.             VIDEOOFF turns the output display off.  Graphics may still be
  9098.             drawn to the screen.  However, the computer's monitor will
  9099.             display nothing and appear black.  This function can be used
  9100.             to hide graphics being drawn by initially using VIDEOOFF and
  9101.             then later calling VIDEOON.
  9102.  
  9103.             SEE ALSO
  9104.  
  9105.             VIDEOON
  9106.  
  9107.             EXAMPLE
  9108.  
  9109.             REM DISABLE THE VIDEO FOR ABOUT 3 SEC
  9110.             $LINK "SVGAPB.PBL"
  9111.             $INCLUDE "SVGAPB.BI"
  9112.             DEFINT A-Z
  9113.  
  9114.             CLS
  9115.             PRINT "PRESS A KEY TO DISABLE THE VIDEO DISPLAY FOR 3 SECONDS"
  9116.             WHILE INKEY$ = ""
  9117.             WEND
  9118.             VIDEOOFF
  9119.             SDELAY 195
  9120.             VIDEOON
  9121.             PRINT "OK...WE ARE BACK!"
  9122.             WHILE INKEY$ = ""
  9123.             WEND
  9124.             END
  9125.  
  9126.  
  9127.  
  9128.  
  9129.  
  9130.  
  9131.  
  9132.  
  9133.  
  9134.  
  9135.  
  9136.  
  9137.                                                                         146
  9138.  
  9139.  
  9140.  
  9141.  
  9142.  
  9143.           VIDEOON
  9144.  
  9145.             PROTOTYPE
  9146.  
  9147.             SUB VIDEOON ()
  9148.  
  9149.             INPUT
  9150.  
  9151.             no input parameters
  9152.  
  9153.             OUTPUT
  9154.  
  9155.             no value returned
  9156.  
  9157.             USAGE
  9158.  
  9159.             VIDEOON turns the display back on.  All graphics that were
  9160.             drawn while the display was off are now visible.  This
  9161.             function can be used to hide graphics being drawn by initially
  9162.             using VIDEOOFF and then later calling VIDEOON.
  9163.  
  9164.             SEE ALSO
  9165.  
  9166.             VIDEOOFF
  9167.  
  9168.             EXAMPLE
  9169.  
  9170.             See VIDEOOFF
  9171.  
  9172.  
  9173.  
  9174.  
  9175.  
  9176.  
  9177.  
  9178.  
  9179.  
  9180.  
  9181.  
  9182.  
  9183.  
  9184.  
  9185.  
  9186.  
  9187.  
  9188.  
  9189.  
  9190.  
  9191.  
  9192.  
  9193.  
  9194.  
  9195.  
  9196.  
  9197.  
  9198.  
  9199.                                                                         147
  9200.  
  9201.  
  9202.  
  9203.  
  9204.  
  9205.           WHICHCPU
  9206.  
  9207.             PROTOTYPE
  9208.  
  9209.             FUNCTION WHICHCPU% ()
  9210.  
  9211.             INPUT
  9212.  
  9213.             no input parameters
  9214.  
  9215.             OUTPUT
  9216.  
  9217.             WHICHCPU returns the processor type.
  9218.  
  9219.             USAGE
  9220.  
  9221.             WHICHCPU returns the computer's processor type as 86, 286, 386
  9222.             or 486.  This function should be called by any program using
  9223.             this library's routines to insure that the computer is at
  9224.             least 386 compatible or better.
  9225.  
  9226.             SEE ALSO
  9227.  
  9228.             WHICHJOYSTICK, WHICHMOUSE, WHICHVGA
  9229.  
  9230.             EXAMPLE
  9231.  
  9232.             REM FIND OUT WHAT KIND OF MICROPROCESSOR WE HAVE
  9233.             $LINK "SVGAPB.PBL"
  9234.             $INCLUDE "SVGAPB.BI"
  9235.             DEFINT A-Z
  9236.  
  9237.             CLS
  9238.             CPU = WHICHCPU
  9239.             CPU$ = STR$(CPU)
  9240.             L = LEN(CPU$)
  9241.             CPU$ = RIGHT$(CPU$, L - 1)
  9242.             PRINT "Microprocessor is identified as a 80"; CPU$; "."
  9243.             END
  9244.  
  9245.  
  9246.  
  9247.  
  9248.  
  9249.  
  9250.  
  9251.  
  9252.  
  9253.  
  9254.  
  9255.  
  9256.  
  9257.  
  9258.  
  9259.  
  9260.  
  9261.                                                                         148
  9262.  
  9263.  
  9264.  
  9265.  
  9266.  
  9267.           WHICHJOYSTICK
  9268.  
  9269.             PROTOTYPE
  9270.  
  9271.             FUNCTION WHICHJOYSTICK% ()
  9272.  
  9273.             INPUT
  9274.  
  9275.             no input parameters
  9276.  
  9277.             OUTPUT
  9278.  
  9279.             WHICHJOYSTICK returns the available joystick support.
  9280.  
  9281.             USAGE
  9282.  
  9283.             WHICHJOYSTICK returns the joystick support available on the
  9284.             computer.  This function should be called prior to use of the
  9285.             joysticks to verify that joysticks are available.  If the
  9286.             function returns a -1, there is no joystick port present or no
  9287.             BIOS support for a joystick.  Joystick A is bit 1 and B is bit
  9288.             2.  Therefore, a return value of 1 means joystick A is
  9289.             available, a value of 2 means B is available and a value of 3
  9290.             means both are available.  If no bits are set, there are no
  9291.             joysticks present.
  9292.  
  9293.             SEE ALSO
  9294.  
  9295.             JOYSTICKINFO, WHICHCPU, WHICHMOUSE, WHICHVGA
  9296.  
  9297.             EXAMPLE
  9298.  
  9299.             REM FIND OUT IF WE HAVE ANY JOYSTICKS AVAILABLE
  9300.             $LINK "SVGAPB.PBL"
  9301.             $INCLUDE "SVGAPB.BI"
  9302.             DEFINT A-Z
  9303.  
  9304.             CLS
  9305.             JOYSTICK = WHICHJOYSTICK
  9306.             SELECT CASE JOYSTICK
  9307.                CASE IS = -1
  9308.                  A$ = "No joystick port detected or no joystick BIOS
  9309.             support present."
  9310.                CASE IS = 0
  9311.                  A$ = "No joystick detected."
  9312.                CASE IS = 1
  9313.                  A$ = "Joystick A is present and available."
  9314.                CASE IS = 2
  9315.                  A$ = "Joystick B is present and available."
  9316.                CASE IS = 3
  9317.                  A$ = "Both Joystick A and Joystick B are present and
  9318.             available."
  9319.             END SELECT
  9320.             PRINT A$
  9321.  
  9322.  
  9323.                                                                         149
  9324.  
  9325.  
  9326.  
  9327.  
  9328.  
  9329.             END
  9330.  
  9331.  
  9332.  
  9333.  
  9334.  
  9335.  
  9336.  
  9337.  
  9338.  
  9339.  
  9340.  
  9341.  
  9342.  
  9343.  
  9344.  
  9345.  
  9346.  
  9347.  
  9348.  
  9349.  
  9350.  
  9351.  
  9352.  
  9353.  
  9354.  
  9355.  
  9356.  
  9357.  
  9358.  
  9359.  
  9360.  
  9361.  
  9362.  
  9363.  
  9364.  
  9365.  
  9366.  
  9367.  
  9368.  
  9369.  
  9370.  
  9371.  
  9372.  
  9373.  
  9374.  
  9375.  
  9376.  
  9377.  
  9378.  
  9379.  
  9380.  
  9381.  
  9382.  
  9383.  
  9384.  
  9385.                                                                         150
  9386.  
  9387.  
  9388.  
  9389.  
  9390.  
  9391.           WHICHMEM
  9392.  
  9393.             PROTOTYPE
  9394.  
  9395.             FUNCTION WHICHMEM% ()
  9396.  
  9397.             INPUT
  9398.  
  9399.             no input parameters
  9400.  
  9401.             OUTPUT
  9402.  
  9403.             WHICHMEM returns the installed video memory in kilobytes.
  9404.  
  9405.             USAGE
  9406.  
  9407.             WHICHMEM returns the amount of installed video memory as
  9408.             previously determined by WHICHVGA.  WHICHVGA should be called
  9409.             prior to WHICHMEM.  This function should be called prior to
  9410.             any of the RES### functions to verify that there is enough
  9411.             memory to support the resolution.  If SETCARD was used to set
  9412.             the video card and memory, WHICHMEM will return the amount of
  9413.             memory as defined by SETCARD.
  9414.  
  9415.             SEE ALSO
  9416.  
  9417.             RES320, RES640, RES640L, RES800, RES1024, RES1280, SETCARD,
  9418.             WHICHVGA
  9419.  
  9420.             EXAMPLE
  9421.  
  9422.             REM FIND OUT HOW MUCH VIDEO MEMORY WE HAVE
  9423.             $LINK "SVGAPB.PBL"
  9424.             $INCLUDE "SVGAPB.BI"
  9425.             DEFINT A-Z
  9426.  
  9427.             CLS
  9428.             DUMMY = WHICHVGA
  9429.             PRINT "INSTALLED VIDEO MEMORY IS IDENTIFIED AS"; WHICHMEM; "k
  9430.             BYTES"
  9431.             END
  9432.  
  9433.  
  9434.  
  9435.  
  9436.  
  9437.  
  9438.  
  9439.  
  9440.  
  9441.  
  9442.  
  9443.  
  9444.  
  9445.  
  9446.  
  9447.                                                                         151
  9448.  
  9449.  
  9450.  
  9451.  
  9452.  
  9453.           WHICHMOUSE
  9454.  
  9455.             PROTOTYPE
  9456.  
  9457.             FUNCTION WHICHMOUSE% ()
  9458.  
  9459.             INPUT
  9460.  
  9461.             no input parameters
  9462.  
  9463.             OUTPUT
  9464.  
  9465.             WHICHMOUSE returns the number of buttons on mouse.
  9466.  
  9467.             USAGE
  9468.  
  9469.             WHICHMOUSE returns a value indicating whether a Microsoft
  9470.             compatible mouse is available.  If the function returns 0, no
  9471.             mouse is available.  A non zero value indicates a mouse and
  9472.             Microsoft compatible driver are installed and gives the number
  9473.             of buttons available.
  9474.  
  9475.             SEE ALSO
  9476.  
  9477.             MOUSEINFO, WHICHCPU, WHICHJOYSTICK, WHICHVGA
  9478.  
  9479.             EXAMPLE
  9480.  
  9481.             REM FIND OUT WHAT KIND OF MOUSE WE HAVE
  9482.             $LINK "SVGAPB.PBL"
  9483.             $INCLUDE "SVGAPB.BI"
  9484.             DEFINT A-Z
  9485.  
  9486.             CLS
  9487.             MOUSE = WHICHMOUSE
  9488.             IF MOUSE > 0 THEN
  9489.                MOUSEINFO MJV, MNV, TP, I
  9490.                VER$ = STR$(MNV)
  9491.                L = LEN(VER$)
  9492.                VER$ = STR$(MJV) + "." + RIGHT$(VER$, L - 1)
  9493.                VER$ = "Software driver version is" + VER$
  9494.                VER$ = VER$ + " (Microsoft equivalent version)."
  9495.                A$ = "Microsoft compatible mouse detected with"
  9496.                A$ = A$ + STR$(MOUSE) + " buttons on IRQ" + STR$(I) + "."
  9497.                PRINT A$
  9498.                PRINT VER$
  9499.             ELSE
  9500.                PRINT "No Microsoft compatible mouse detected."
  9501.             END IF
  9502.             END
  9503.  
  9504.  
  9505.  
  9506.  
  9507.  
  9508.  
  9509.                                                                         152
  9510.  
  9511.  
  9512.  
  9513.  
  9514.  
  9515.           WHICHVGA
  9516.  
  9517.             PROTOTYPE
  9518.  
  9519.             FUNCTION WHICHVGA% ()
  9520.  
  9521.             INPUT
  9522.  
  9523.             no input parameters
  9524.  
  9525.             OUTPUT
  9526.  
  9527.             WHICHVGA returns a code identifying the video card.
  9528.  
  9529.             USAGE
  9530.  
  9531.             WHICHVGA identifies the video card installed and the amount of
  9532.             video memory.  In addition this function sets up the default
  9533.             font and mouse cursor.  This function must be called before
  9534.             any other graphics function.  The code returned identifies the
  9535.             video card according to the following table:
  9536.  
  9537.           1  Acumos AVGA2/3 SuperVGA
  9538.           2  ATI Technologies 18/28/38/68800
  9539.              SuperVGA
  9540.           3  Ahead V5000 ver A SuperVGA
  9541.           4  Ahead V5000 ver B SuperVGA
  9542.           5  Chips and Technologies 82C45x SuperVGA
  9543.           6  Cirrus Logic CL-GD 5xx, 6xx, 28xx,
  9544.              54xx, 62xx SuperVGA
  9545.           7  Everex Micro Enhancer Ev236/6xx
  9546.              SuperVGA
  9547.           8  Genoa 61/62/63/64/6600 SuperVGA
  9548.           9  NCR 77C21/22/22E/22E+ SuperVGA
  9549.           10 Oak Technologies OTI-037C/067/077/087
  9550.              SuperVGA
  9551.           11 Paradise/Western Digital PVGA1A,
  9552.              WD90C00/1x/2x/3x SuperVGA
  9553.           12 Realtek RT3106 SuperVGA
  9554.           13 Trident 8800CS, 8900B/C/CL/CX, 90x0
  9555.              SuperVGA
  9556.           14 Tseng Labs ET3000-AX/BX/BP SuperVGA
  9557.           15 Tseng Labs ET4000/W32/W32I SuperVGA
  9558.           16 VESA compatible SuperVGA
  9559.           17 Video 7 HT-208/16 SuperVGA
  9560.           18 Avance Logic AL2101 SuperVGA
  9561.           19 MXIC MX68000/10 SuperVGA
  9562.           20 Primus P2000 SuperVGA
  9563.  
  9564.             Any value returned not found on this table represents an
  9565.             unidentified video card.
  9566.  
  9567.             No graphics functions should be called unless the video card
  9568.             is properly identified.
  9569.  
  9570.  
  9571.                                                                         153
  9572.  
  9573.  
  9574.  
  9575.  
  9576.  
  9577.  
  9578.             SEE ALSO
  9579.  
  9580.             SETCARD, WHICHCPU, WHICHJOYSTICK, WHICHMOUSE, WHICHMEM
  9581.  
  9582.             EXAMPLE
  9583.  
  9584.             REM FIND OUT WHAT KIND OF VIDEO CARD WE HAVE
  9585.             $LINK "SVGAPB.PBL"
  9586.             $INCLUDE "SVGAPB.BI"
  9587.             DEFINT A-Z
  9588.  
  9589.             CLS
  9590.             VGA = WHICHVGA
  9591.             SELECT CASE VGA
  9592.                  CASE = 1
  9593.                     VGA$ = "Acumos AVGA2/3 SuperVGA"
  9594.                  CASE = 2
  9595.                     VGA$ = "ATI Technologies 18/28/38/68800 SuperVGA"
  9596.                  CASE = 3
  9597.                       VGA$ = "Ahead V5000 ver A SuperVGA"
  9598.                  CASE = 4
  9599.                     VGA$ = "Ahead V5000 ver B SuperVGA"
  9600.                  CASE = 5
  9601.                     VGA$ = "Chips and Technologies 82C450/1/2/3/5/6/7
  9602.           SuperVGA"
  9603.                  CASE = 6
  9604.                     VGA$ = "Cirrus Logic CL-GD 5xx,6xx,28xx,54xx,62xx
  9605.           SuperVGA"
  9606.                  CASE = 7
  9607.                     VGA$ = "Everex Ev236/6xx Micro Enhancer SuperVGA"
  9608.                  CASE = 8
  9609.                     VGA$ = "Genoa 61/62/63/64/6600 SuperVGA"
  9610.                  CASE = 9
  9611.                     VGA$ = "NCR 77C21/22/22E/22E+ SuperVGA"
  9612.                  CASE = 10
  9613.                     VGA$ = "Oak Technologies OTI-037C/067/077/087 SuperVGA"
  9614.                  CASE = 11
  9615.                     VGA$ = "Paradise/Western Digital
  9616.           PVGA1A,WD90C00/1x/2x/3x SuperVGA"
  9617.                  CASE = 12
  9618.                     VGA$ = "Realtek RT3106 SuperVGA"
  9619.                  CASE = 13
  9620.                     VGA$ = "Trident 8800CS,8900B/C/CL/CX,90x0 SuperVGA"
  9621.                  CASE = 14
  9622.                     VGA$ = "Tseng Labs ET3000-AX/BX/BP SuperVGA"
  9623.                  CASE = 15
  9624.                     VGA$ = "Tseng Labs ET4000/W32/W32I SuperVGA"
  9625.                  CASE = 16
  9626.                     VGA$ = "VESA compatible SuperVGA"
  9627.                  CASE = 17
  9628.                     VGA$ = "Video 7 HT-208/16 SuperVGA"
  9629.                  CASE = 18
  9630.                     VGA$ = "Avance Logic AL2101 SuperVGA"
  9631.  
  9632.  
  9633.                                                                         154
  9634.  
  9635.  
  9636.  
  9637.  
  9638.  
  9639.                  CASE = 19
  9640.                     VGA$ = "MXIC MX68000/10 SuperVGA"
  9641.                  CASE = 20
  9642.                     VGA$ = "Primus P2000 SuperVGA"
  9643.                  CASE ELSE
  9644.                     VGA$ = "Unknown"
  9645.                     VGA = 0
  9646.             END SELECT
  9647.             PRINT "Video card/chip is identified as a "; VGA$; "."
  9648.             END
  9649.  
  9650.  
  9651.  
  9652.  
  9653.  
  9654.  
  9655.  
  9656.  
  9657.  
  9658.  
  9659.  
  9660.  
  9661.  
  9662.  
  9663.  
  9664.  
  9665.  
  9666.  
  9667.  
  9668.  
  9669.  
  9670.  
  9671.  
  9672.  
  9673.  
  9674.  
  9675.  
  9676.  
  9677.  
  9678.  
  9679.  
  9680.  
  9681.  
  9682.  
  9683.  
  9684.  
  9685.  
  9686.  
  9687.  
  9688.  
  9689.  
  9690.  
  9691.  
  9692.  
  9693.  
  9694.  
  9695.                                                                         155
  9696.  
  9697.  
  9698.  
  9699.  
  9700.  
  9701.           WHICHXMS
  9702.  
  9703.             PROTOTYPE
  9704.  
  9705.             FUNCTION WHICHXMS% (XmsKbytesAvailable%, XmsHandlesAvailable%)
  9706.  
  9707.             INPUT
  9708.  
  9709.             no input parameters
  9710.  
  9711.             OUTPUT
  9712.  
  9713.             WHICHXMS returns a 1 if extended memory support is detected, 0
  9714.             otherwise.
  9715.             XmsKBytesAvailable - number of free kilobytes in extended
  9716.             memory
  9717.             XmsHandlesAvailable - number of available free handles
  9718.  
  9719.             USAGE
  9720.  
  9721.             WHICHXMS detects the existence of extended memory support and
  9722.             sets up the library function calls.  This function must be
  9723.             called before any other extended memory functions.  WHICHXMS
  9724.             also returns the number of free kilobytes of extended memory
  9725.             and the number of available handles.  The number of available
  9726.             handles is limited, normally to 32.  This limit can be
  9727.             modified by changing the extended memory driver (Microsoft's
  9728.             HIMEM.SYS is the most common) command line in the CONFIG.SYS
  9729.             file.
  9730.  
  9731.             SEE ALSO
  9732.  
  9733.             XMSALLOCATE, XMSCOPY, XMSERROR, XMSFREE, XMSGET, XMSPUT
  9734.  
  9735.             EXAMPLE
  9736.  
  9737.             REM THIS WILL SHOW IF XMS MEMORY IS AVAILABLE AND HOW MUCH
  9738.             $LINK "SVGAPB.PBL"
  9739.             $INCLUDE "SVGAPB.BI"
  9740.             DEFINT A-Z
  9741.             IF WHICHXMS(MEM, HANDLES) = 1 THEN
  9742.                PRINT "AN XMS MEMORY MANAGER IS INSTALLED (SUCH AS
  9743.             'HIMEM.SYS')"
  9744.                IF MEM > 0 THEN
  9745.                  TOTMEM& = 1024
  9746.                  TOTMEM& = TOTMEM& * MEM
  9747.                  PRINT "A TOTAL OF"; TOTMEM&; "BYTES ARE AVAILABLE"
  9748.                  IF HANDLES > 0 THEN
  9749.                     PRINT "A TOTAL OF"; HANDLES; "HANDLES(S) ARE AVAILABLE"
  9750.                     PRINT "XMS MEMORY IS READY FOR USE"
  9751.                  ELSE
  9752.                     PRINT "SORRY...ALL XMS HANDLES ARE BEING USED"
  9753.                     PRINT "CHANGE (OR ADD) THE '/numhandles' SWITCH ON YOUR
  9754.             XMS MEMORY MANAGER"
  9755.  
  9756.  
  9757.                                                                         156
  9758.  
  9759.  
  9760.  
  9761.  
  9762.  
  9763.                  END IF
  9764.                ELSE
  9765.                  PRINT "SORRY...ALL XMS MEMORY IS ALLOCATED"
  9766.                END IF
  9767.             ELSE
  9768.                PRINT "SORRY...NO ACTIVE XMS MEMORY MANAGER FOUND"
  9769.                PRINT "MAKE SURE YOU HAVE AN XMS MEMORY MANAGER (SUCH AS
  9770.             'HIMEM.SYS' INSTALLED)"
  9771.             END IF
  9772.             END
  9773.  
  9774.  
  9775.  
  9776.  
  9777.  
  9778.  
  9779.  
  9780.  
  9781.  
  9782.  
  9783.  
  9784.  
  9785.  
  9786.  
  9787.  
  9788.  
  9789.  
  9790.  
  9791.  
  9792.  
  9793.  
  9794.  
  9795.  
  9796.  
  9797.  
  9798.  
  9799.  
  9800.  
  9801.  
  9802.  
  9803.  
  9804.  
  9805.  
  9806.  
  9807.  
  9808.  
  9809.  
  9810.  
  9811.  
  9812.  
  9813.  
  9814.  
  9815.  
  9816.  
  9817.  
  9818.  
  9819.                                                                         157
  9820.  
  9821.  
  9822.  
  9823.  
  9824.  
  9825.           XMSALLOCATE
  9826.  
  9827.             PROTOTYPE
  9828.  
  9829.             FUNCTION XMSALLOCATE% (RequestedKbytes%)
  9830.  
  9831.             INPUT
  9832.  
  9833.             RequestedKBytes - requested number of kilobytes of extended
  9834.             memory
  9835.  
  9836.             OUTPUT
  9837.  
  9838.             XMSALLOCATE returns the assigned memory handle if the
  9839.             allocation is successful, 0 otherwise.
  9840.  
  9841.             USAGE
  9842.  
  9843.             XMSALLOCATE attempts to allocate the requested number of
  9844.             kilobytes in extended memory.  If successful, the function
  9845.             returns the handle of the new memory block.  If the function
  9846.             returns zero, then the allocation was unsuccessful; check
  9847.             XMSERROR for error codes.
  9848.  
  9849.             All allocated blocks must be freed using XMSFREE before a
  9850.             program terminates or the memory is lost until the machine is
  9851.             rebooted.  Simply exiting a program will not free allocated
  9852.             extended memory blocks.
  9853.  
  9854.             SEE ALSO
  9855.  
  9856.             WHICHXMS, XMSCOPY, XMSERROR, XMSFREE, XMSGET, XMSPUT
  9857.  
  9858.             EXAMPLE
  9859.  
  9860.             See XMSCOPY
  9861.  
  9862.  
  9863.  
  9864.  
  9865.  
  9866.  
  9867.  
  9868.  
  9869.  
  9870.  
  9871.  
  9872.  
  9873.  
  9874.  
  9875.  
  9876.  
  9877.  
  9878.  
  9879.  
  9880.  
  9881.                                                                         158
  9882.  
  9883.  
  9884.  
  9885.  
  9886.  
  9887.           XMSCOPY
  9888.  
  9889.             PROTOTYPE
  9890.  
  9891.             FUNCTION XMSCOPY% (SrcXmsHandle%, SrcOffset&, DestXmsHandle%,
  9892.             DestOffset&, NumBytes&)
  9893.  
  9894.             INPUT
  9895.  
  9896.             SrcXmsHandle - handle of source extended memory block
  9897.             SrcOffset - number of bytes from beginning of source memory
  9898.             block
  9899.             DestXmsHandle - handle of destination extended memory block
  9900.             DestOffset - number of bytes from beginning of destination
  9901.             memory block
  9902.             NumBytes - number of bytes to copy from source to destination
  9903.             (must be even)
  9904.  
  9905.             OUTPUT
  9906.  
  9907.             XMSCOPY returns a 1 if copy was successful, 0 otherwise.
  9908.  
  9909.             USAGE
  9910.  
  9911.             XMSCOPY copies the number of bytes specified in NumBytes from
  9912.             the source extended memory block to the destination extended
  9913.             memory block.  NumBytes must be an even number.  The copy may
  9914.             begin and/or end offset from the beginning of the source and
  9915.             destination blocks by passing non zero values in SrcOffset
  9916.             and/or DestOffset.  The copy will occur faster if both offsets
  9917.             are divisible by four.  If the copy was unsuccessful, check
  9918.             XMSERROR for error codes.
  9919.  
  9920.             SEE ALSO
  9921.  
  9922.             WHICHXMS, XMSALLOCATE, XMSERROR, XMSFREE, XMSGET, XMSPUT
  9923.  
  9924.             EXAMPLE
  9925.  
  9926.             REM THIS WILL COPY ONE ARRAY INTO ONE XMS BLOCK AND THEN COPY
  9927.             IT
  9928.             REM TO A DIFFERENT XMS BLOCK, AND THEN COPY THAT BACK INTO
  9929.             ANOTHER ARRAY
  9930.             $LINK "SVGAPB.PBL"
  9931.             $INCLUDE "SVGAPB.BI"
  9932.             DEFINT A-Z
  9933.  
  9934.             REM *DIMENSION OUR SOURCE AND DESTINATION ARRAYS*
  9935.             DIM TEST1(0 TO 9) AS INTEGER
  9936.             DIM TEST2(0 TO 9) AS INTEGER
  9937.             CLS
  9938.  
  9939.             REM *MAKE SURE XMS IS READY AND AVAILBLE*
  9940.             IF WHICHXMS(MEM, HANDLES) = 1 THEN
  9941.  
  9942.  
  9943.                                                                         159
  9944.  
  9945.  
  9946.  
  9947.  
  9948.  
  9949.                IF MEM < 1 OR HANDLES < 1 THEN
  9950.                  PRINT "SORRY...THERE IS EITHER NO FREE XMS MEMORY OR NO
  9951.             FREE XMS HANDLES"
  9952.                  END
  9953.                END IF
  9954.             ELSE
  9955.                PRINT "SORRY...NO ACTIVE XMS MEMORY MANAGER FOUND"
  9956.                PRINT "MAKE SURE YOU HAVE A XMS MEMORY MANAGER (SUCH AS
  9957.             'HIMEM.SYS' INSTALLED)"
  9958.                END
  9959.             END IF
  9960.  
  9961.             REM *PUT SOME DATA INTO THE SOURCE ARRAY*
  9962.             FOR I = 0 TO 9
  9963.                TEST1(I) = I * 10
  9964.             NEXT I
  9965.  
  9966.             REM *ALLOCATE THE FIRST XMS MEMORY BLOCK*
  9967.             OurHandle1 = XMSALLOCATE(1)
  9968.             IF OurHandle1 = 0 THEN
  9969.                PRINT "OPPS..THERE IS SOME ERROR...UNABLE TO ALLOCATE XMS"
  9970.                PRINT "ERROR #"; XMSERROR
  9971.                ER = XMSFREE(OurHandle1)
  9972.                END
  9973.             END IF
  9974.  
  9975.             REM *ALLOCATE THE SECOND XMS MEMORY BLOCK*
  9976.             OurHandle2 = XMSALLOCATE(1)
  9977.             IF OurHandle2 = 0 THEN
  9978.                PRINT "OPPS..THERE IS SOME ERROR...UNABLE TO ALLOCATE XMS"
  9979.                PRINT "ERROR #"; XMSERROR
  9980.                ER = XMSFREE(OurHandle1)
  9981.                ER = XMSFREE(OurHandle2)
  9982.                END
  9983.             END IF
  9984.  
  9985.             REM *COPY OUR SOURCE ARRAY INTO OUR FIRST XMS BLOCK*
  9986.             I = XMSPUT(TEST1(0), OurHandle1, 0, 20)
  9987.             IF I = 0 THEN
  9988.                PRINT "OPPS..THERE IS SOME ERROR...SEE THE ERROR CODE
  9989.             LIST..."
  9990.                PRINT "ERROR #"; XMSERROR
  9991.                ER = XMSFREE(OurHandle1)
  9992.                ER = XMSFREE(OurHandle2)
  9993.                END
  9994.             END IF
  9995.  
  9996.             REM *COPY THE FIRST XMS BLOCK TO THE SECOND XMS BLOCK*
  9997.             IF XMSCOPY(OurHandle1, 0, OurHandle2, 0, 20) = 0 THEN
  9998.                PRINT "OPPS..THERE IS SOME ERROR...SEE THE ERROR CODE
  9999.             LIST..."
  10000.                PRINT "ERROR #"; XMSERROR
  10001.                ER = XMSFREE(OurHandle1)
  10002.                ER = XMSFREE(OurHandle2)
  10003.  
  10004.  
  10005.                                                                         160
  10006.  
  10007.  
  10008.  
  10009.  
  10010.  
  10011.                END
  10012.             END IF
  10013.  
  10014.             REM *COPY DATA FROM THE SECOND XMS BLOCK TO OUR DESTINATION
  10015.             ARRAY*
  10016.             IF XMSGET(OurHandle2, 0, TEST2(0), 20) = 0 THEN
  10017.                PRINT "OPPS..THERE IS SOME ERROR...SEE THE ERROR CODE
  10018.             LIST..."
  10019.                PRINT "ERROR #"; ER
  10020.                ER = XMSFREE(OurHandle1)
  10021.                ER = XMSFREE(OurHandle2)
  10022.                END
  10023.             END IF
  10024.  
  10025.             REM *FREE THE XMS BLOCKS WE HAVE ALLOCATED*
  10026.             ER = XMSFREE(OurHandle1)
  10027.             ER = XMSFREE(OurHandle2)
  10028.  
  10029.             REM *SHOW THE RESULTS*
  10030.             PRINT "OK...WE INITILIZED ONE ARRAY,PUT A COPY OF IT INTO
  10031.             XMS,"
  10032.             PRINT "THEN WE COPIED THAT XMS BLOCK TO ANOTHER XMS BLOCK,
  10033.             AND"
  10034.             PRINT "THEN PUT A COPY OF THE SECOND XMS BLOCK INTO A NEW
  10035.             ARRAY;"
  10036.             PRINT "HERE ARE THE RESULTS:"
  10037.             PRINT
  10038.             PRINT "SOURCE ARRAY", , "DESTINATION ARRAY"
  10039.             FOR I = 0 TO 9
  10040.                PRINT TEST1(I), , TEST2(I)
  10041.             NEXT I
  10042.             END
  10043.  
  10044.  
  10045.  
  10046.  
  10047.  
  10048.  
  10049.  
  10050.  
  10051.  
  10052.  
  10053.  
  10054.  
  10055.  
  10056.  
  10057.  
  10058.  
  10059.  
  10060.  
  10061.  
  10062.  
  10063.  
  10064.  
  10065.  
  10066.  
  10067.                                                                         161
  10068.  
  10069.  
  10070.  
  10071.  
  10072.  
  10073.           XMSERROR
  10074.  
  10075.             PROTOTYPE
  10076.  
  10077.             FUNCTION XMSERROR% ()
  10078.  
  10079.             INPUT
  10080.  
  10081.             no input parameters
  10082.  
  10083.             OUTPUT
  10084.  
  10085.             XMSERROR returns the error code from the most recent XMS
  10086.             function call.
  10087.  
  10088.             USAGE
  10089.  
  10090.             XMSERROR returns the error code from the most recent XMS
  10091.             function call.  Each XMS function resets the error code to
  10092.             zero.  Therefore, if there has been an error, the error code
  10093.             should be checked immediately.  The error code will be one of
  10094.             the following:
  10095.  
  10096.             0    no error
  10097.             1    WHICHXMS has not been
  10098.                  called
  10099.             2    number of bytes to
  10100.                  copy is zero
  10101.             3    number of bytes to
  10102.                  copy is odd
  10103.             4    offset into XMS block
  10104.                  is zero
  10105.             128  Function not
  10106.                  implemented
  10107.             129  VDISK device driver
  10108.                  was detected
  10109.             142  General driver error
  10110.             143  Unrecoverable driver
  10111.                  error
  10112.             146  DX is less than
  10113.                  /HMAMIN= parameter
  10114.             160  All extended memory is
  10115.                  allocated
  10116.             161  XMM handles are
  10117.                  exhausted
  10118.             162  Handle is invalid
  10119.             163  Source handle is
  10120.                  invalid
  10121.             164  Source offset is
  10122.                  invalid
  10123.             165  Destination handle is
  10124.                  invalid
  10125.             166  Destination offset is
  10126.                  invalid
  10127.  
  10128.  
  10129.                                                                         162
  10130.  
  10131.  
  10132.  
  10133.  
  10134.  
  10135.             167  Length is invalid
  10136.             168  Overlap in move
  10137.                  request is invalid
  10138.             169  Parity error detected
  10139.             171  Block locked
  10140.  
  10141.             SEE ALSO
  10142.  
  10143.             WHICHXMS, XMSALLOCATE, XMSCOPY, XMSFREE, XMSGET, XMSPUT
  10144.  
  10145.             EXAMPLE
  10146.  
  10147.             See XMSCOPY
  10148.  
  10149.  
  10150.  
  10151.  
  10152.  
  10153.  
  10154.  
  10155.  
  10156.  
  10157.  
  10158.  
  10159.  
  10160.  
  10161.  
  10162.  
  10163.  
  10164.  
  10165.  
  10166.  
  10167.  
  10168.  
  10169.  
  10170.  
  10171.  
  10172.  
  10173.  
  10174.  
  10175.  
  10176.  
  10177.  
  10178.  
  10179.  
  10180.  
  10181.  
  10182.  
  10183.  
  10184.  
  10185.  
  10186.  
  10187.  
  10188.  
  10189.  
  10190.  
  10191.                                                                         163
  10192.  
  10193.  
  10194.  
  10195.  
  10196.  
  10197.           XMSFREE
  10198.  
  10199.             PROTOTYPE
  10200.  
  10201.             FUNCTION XMSFREE% (XmsHandle%)
  10202.  
  10203.             INPUT
  10204.  
  10205.             XmsHandle - handle of extended memory block to free
  10206.  
  10207.             OUTPUT
  10208.  
  10209.             XMSFREE returns 1 if extended memory block was deallocated, 0
  10210.             otherwise.
  10211.  
  10212.             USAGE
  10213.  
  10214.             XMSFREE deallocates the specified extended memory block.  All
  10215.             allocated blocks must be freed before a program terminates or
  10216.             the memory is lost until the machine is rebooted.  Simply
  10217.             exiting a program will not free allocated extended memory
  10218.             blocks.  If the function was unsuccessful, check XMSERROR for
  10219.             error codes.
  10220.  
  10221.             SEE ALSO
  10222.  
  10223.             WHICHXMS, XMSALLOCATE, XMSCOPY, XMSERROR, XMSGET, XMSPUT
  10224.  
  10225.             EXAMPLE
  10226.  
  10227.             See XMSCOPY
  10228.  
  10229.  
  10230.  
  10231.  
  10232.  
  10233.  
  10234.  
  10235.  
  10236.  
  10237.  
  10238.  
  10239.  
  10240.  
  10241.  
  10242.  
  10243.  
  10244.  
  10245.  
  10246.  
  10247.  
  10248.  
  10249.  
  10250.  
  10251.  
  10252.  
  10253.                                                                         164
  10254.  
  10255.  
  10256.  
  10257.  
  10258.  
  10259.           XMSGET
  10260.  
  10261.             PROTOTYPE
  10262.  
  10263.             FUNCTION XMSGET% (SrcXmsHandle%, SrcOffset&, DestVariable%,
  10264.             NumBytes&)
  10265.  
  10266.             INPUT
  10267.  
  10268.             SrcXmsHandle - handle of source extended memory block
  10269.             SrcOffset - number of bytes from beginning of source memory
  10270.             block
  10271.             NumBytes - number of bytes to copy from extended memory to
  10272.             conventional memory (must be even)
  10273.  
  10274.             OUTPUT
  10275.  
  10276.             XMSGET returns 0 if the copy was successful, an error code
  10277.             otherwise.
  10278.             DestVariable - integer variable or array holding copied data
  10279.  
  10280.             USAGE
  10281.  
  10282.             XMSGET retrieves data from extended memory and places it in
  10283.             conventional memory.  The number of bytes copied must be an
  10284.             even number and cannot be larger than 65536.  The copy may
  10285.             begin off the beginning of the source extended memory block by
  10286.             specifying a non zero SrcOffset.  If the function was
  10287.             unsuccessful, check XMSERROR for error codes.
  10288.  
  10289.             SEE ALSO
  10290.  
  10291.             WHICHXMS, XMSALLOCATE, XMSCOPY, XMSERROR, XMSFREE, XMSPUT
  10292.  
  10293.             EXAMPLE
  10294.  
  10295.             See XMSCOPY
  10296.  
  10297.  
  10298.  
  10299.  
  10300.  
  10301.  
  10302.  
  10303.  
  10304.  
  10305.  
  10306.  
  10307.  
  10308.  
  10309.  
  10310.  
  10311.  
  10312.  
  10313.  
  10314.  
  10315.                                                                         165
  10316.  
  10317.  
  10318.  
  10319.  
  10320.  
  10321.           XMSPUT
  10322.  
  10323.             PROTOTYPE
  10324.  
  10325.             FUNCTION XMSPUT% (SrcVariable%, DestXmsHandle%, DestOffset&,
  10326.             NumBytes&)
  10327.  
  10328.             INPUT
  10329.  
  10330.             SrcVariable - source variable or array in conventional memory
  10331.             DestXmsHandle - handle of destination extended memory block
  10332.             DestOffset - number of bytes from beginning of destination
  10333.             memory block
  10334.             NumBytes - number of bytes to copy from conventional memory to
  10335.             extended memory (must be even)
  10336.  
  10337.             OUTPUT
  10338.  
  10339.             XMSPUT returns 1 if the copy was successful, 0 otherwise.
  10340.  
  10341.             USAGE
  10342.  
  10343.             XMSPUT copies data from conventional memory to extended
  10344.             memory.  The number of bytes copied must be an even number and
  10345.             cannot be larger than 65536.  The destination may begin off
  10346.             the beginning of the extended memory block by specifying a non
  10347.             zero DestOffset.  If the function was unsuccessful, check
  10348.             XMSERROR for error codes.
  10349.  
  10350.             SEE ALSO
  10351.  
  10352.             WHICHXMS, XMSALLOCATE, XMSCOPY, XMSERROR, XMSFREE, XMSGET
  10353.  
  10354.             EXAMPLE
  10355.  
  10356.             See XMSCOPY
  10357.  
  10358.  
  10359.  
  10360.  
  10361.  
  10362.  
  10363.  
  10364.  
  10365.  
  10366.  
  10367.  
  10368.  
  10369.  
  10370.  
  10371.  
  10372.  
  10373.  
  10374.  
  10375.  
  10376.  
  10377.                                                                         166
  10378.  
  10379.  
  10380.  
  10381.  
  10382.  
  10383.           APPENDIX A.  SVGAPB.BI
  10384.  
  10385.           This is the header file containing function declarations and
  10386.           structure definitions for SVGAPB.PBL.  This file should be
  10387.           included in every program that uses this library.  To properly
  10388.           include the header file, place the following line at the top of
  10389.           the every program module:
  10390.  
  10391.                                 $INCLUDE "SVGAPB.BI"
  10392.  
  10393.           Without these declarations and definitions, the Power Basic
  10394.           compiler will be unable to compile any program using the commands
  10395.           found in this library.
  10396.  
  10397.             REM SVGAPB GRAPHICS LIBRARY INCLUDE FILE FOR USE WITH
  10398.             REM SPECTRA PUBLISHING'S POWER BASIC 3.X
  10399.             REM COPYRIGHT 1993-1994 BY STEPHEN L. BALKUM AND DANIEL A.
  10400.                SILL
  10401.             REM ZEPHYR SOFTWARE P.O. BOX 7704, AUSTIN, TEXAS  78713-7704
  10402.             REM LAST UPDATE 5/1/94
  10403.  
  10404.             TYPE P2DType
  10405.                X AS INTEGER
  10406.                Y AS INTEGER
  10407.             END TYPE
  10408.  
  10409.             TYPE P3Dtype
  10410.                X AS INTEGER
  10411.                Y AS INTEGER
  10412.                Z AS INTEGER
  10413.             END TYPE
  10414.  
  10415.             TYPE PROJType
  10416.                EYEX AS INTEGER
  10417.                EYEY AS INTEGER
  10418.                EYEZ AS INTEGER
  10419.                SCRD AS INTEGER
  10420.                THETA AS INTEGER
  10421.                PHI AS INTEGER
  10422.             END TYPE
  10423.  
  10424.             TYPE RGBType
  10425.                R AS BYTE
  10426.                G AS BYTE
  10427.                B AS BYTE
  10428.             END TYPE
  10429.  
  10430.             DECLARE SUB BLKGET (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL
  10431.                Y2%, SEG GfxBlk%)
  10432.             DECLARE SUB BLKPUT (BYVAL Mode%, BYVAL X%, BYVAL Y%, SEG
  10433.                GfxBlk%)
  10434.             DECLARE SUB BLKRESIZE (BYVAL X%, BYVAL Y%, SEG SourceGfxBlk%,
  10435.                SEG DestGfxBlk%)
  10436.  
  10437.  
  10438.  
  10439.                                                                         167
  10440.  
  10441.  
  10442.  
  10443.  
  10444.  
  10445.             DECLARE FUNCTION BLKROTATE% (BYVAL Ang%, BYVAL BackFill%, SEG
  10446.                SourceGfxBlk%, SEG DestGfxBlk%)
  10447.             DECLARE FUNCTION BLKROTATESIZE& (BYVAL Ang%, SEG
  10448.                SourceGfxBlk%)
  10449.             DECLARE SUB BYTECOPY (SEG SourceArray%, SEG DestArray%, BYVAL
  10450.                NumOfBytes&)
  10451.             DECLARE SUB D2ROTATE (BYVAL Points%, BYVAL XOrigin%, BYVAL
  10452.                YOrigin%, BYVAL Ang%, SEG InAry%, SEG OutAry%)
  10453.             DECLARE SUB D2SCALE (BYVAL Points%, BYVAL XSCALE%, BYVAL
  10454.                YSCALE%, SEG InAry%, SEG OutAry%)
  10455.             DECLARE SUB D2TRANSLATE (BYVAL Points%, BYVAL XTRANS%, BYVAL
  10456.                YTRANS%, SEG InAry%, SEG OutAry%)
  10457.             DECLARE FUNCTION D3PROJECT% (BYVAL Points%, SEG ProjParms%,
  10458.                SEG InAry%, SEG OutAry%)
  10459.             DECLARE SUB D3ROTATE (BYVAL Points%, BYVAL XOrigin%, BYVAL
  10460.                YOrigin%, BYVAL ZOrigin%, BYVAL ZRAng%, BYVAL YRAng%, BYVAL
  10461.                XRAng%, SEG InAry%, SEG OutAry%)
  10462.             DECLARE SUB D3SCALE (BYVAL Points%, BYVAL XSCALE%, BYVAL
  10463.                YSCALE%, BYVAL ZScale%, SEG InAry%, SEG OutAry%)
  10464.             DECLARE SUB D3TRANSLATE (BYVAL Points%, BYVAL XTRANS%, BYVAL
  10465.                YTRANS%, BYVAL ZTrans%, SEG InAry%, SEG OutAry%)
  10466.             DECLARE SUB DRWBOX (BYVAL Mode%, BYVAL Colr%, BYVAL X1%, BYVAL
  10467.                Y1%, BYVAL X2%, BYVAL Y2%)
  10468.             DECLARE SUB DRWCIRCLE (BYVAL Mode%, BYVAL Colr%, BYVAL
  10469.                CenterX%, BYVAL CenterY%, BYVAL Radius%)
  10470.             DECLARE SUB DRWELLIPSE (BYVAL Mode%, BYVAL Colr%, BYVAL
  10471.                CenterX%, BYVAL CenterY%, BYVAL Radiusx%, BYVAL Radiusy%)
  10472.             DECLARE SUB DRWFILLBOX (BYVAL Mode%, BYVAL Colr%, BYVAL X1%,
  10473.                BYVAL Y1%, BYVAL X2%, BYVAL Y2%)
  10474.             DECLARE SUB DRWFILLCIRCLE (BYVAL Mode%, BYVAL Colr%, BYVAL
  10475.                CenterX%, BYVAL CenterY%, BYVAL Radius%)
  10476.             DECLARE SUB DRWFILLELLIPSE (BYVAL Mode%, BYVAL Colr%, BYVAL
  10477.                CenterX%, BYVAL CenterY%, BYVAL Radiusx%, BYVAL Radiusy%)
  10478.             DECLARE SUB DRWLINE (BYVAL Mode%, BYVAL Colr%, BYVAL X1%,
  10479.                BYVAL Y1%, BYVAL X2%, BYVAL Y2%)
  10480.             DECLARE SUB DRWPOINT (BYVAL Mode%, BYVAL Colr%, BYVAL X%,
  10481.                BYVAL Y%)
  10482.             DECLARE SUB DRWSTRING (BYVAL Mode%, BYVAL FColr%, BYVAL
  10483.                BColr%, Strng$, BYVAL X%, BYVAL Y%)
  10484.             DECLARE SUB DRWSTRINGDN (BYVAL Mode%, BYVAL FColr%, BYVAL
  10485.                BColr%, Strng$, BYVAL X%, BYVAL Y%)
  10486.             DECLARE SUB DRWSTRINGLT (BYVAL Mode%, BYVAL FColr%, BYVAL
  10487.                BColr%, Strng$, BYVAL X%, BYVAL Y%)
  10488.             DECLARE SUB DRWSTRINGRT (BYVAL Mode%, BYVAL FColr%, BYVAL
  10489.                BColr%, Strng$, BYVAL X%, BYVAL Y%)
  10490.             DECLARE SUB FILLAREA (BYVAL Xseed%, BYVAL Yseed%, BYVAL
  10491.                BorderColr%, BYVAL FillColr%)
  10492.             DECLARE SUB FILLCOLOR (BYVAL Xseed%, BYVAL Yseed%, BYVAL
  10493.                OldColr%, BYVAL NewColr%)
  10494.             DECLARE SUB FILLCONVEXPOLY (BYVAL Colr%, BYVAL Points%, SEG
  10495.                InAry%)
  10496.             DECLARE SUB FILLSCREEN (BYVAL Colr AS INTEGER)
  10497.             DECLARE SUB FILLPAGE (BYVAL Colr%)
  10498.             DECLARE SUB FILLVIEW (BYVAL Colr%)
  10499.  
  10500.  
  10501.                                                                         168
  10502.  
  10503.  
  10504.  
  10505.  
  10506.  
  10507.             DECLARE SUB FONTGETINFO (SEG WDTH%, SEG HGHT%)
  10508.             DECLARE SUB FONTSET (SEG FONT?)
  10509.             DECLARE SUB FONTSYSTEM ()
  10510.             DECLARE FUNCTION GETARCCOS% (BYVAL Value&)
  10511.             DECLARE FUNCTION GETARCSIN% (BYVAL Value&)
  10512.             DECLARE FUNCTION GETARCTAN% (BYVAL Value&)
  10513.             DECLARE FUNCTION GETCOS& (BYVAL Ang&)
  10514.             DECLARE FUNCTION GETSIN& (BYVAL Ang&)
  10515.             DECLARE FUNCTION GETTAN& (BYVAL Ang&)
  10516.             DECLARE FUNCTION GETSQRT& (BYVAL Number&)
  10517.             DECLARE FUNCTION GETMAXX% ()
  10518.             DECLARE FUNCTION GETMAXY% ()
  10519.             DECLARE SUB GETLASTSTRING (SEG StrngGfxBlk%)
  10520.             DECLARE FUNCTION GETPOINT% (BYVAL X%, BYVAL Y%)
  10521.             DECLARE FUNCTION GIFMAKE% (BYVAL X1%, BYVAL Y1%, BYVAL X2%,
  10522.                BYVAL Y2%,SEG FileName$)
  10523.             DECLARE FUNCTION GIFGETINFO% (SEG FileName$, SEG GifXSize%,
  10524.                SEG GifYSize%, SEG NumColors%, Pal AS RGBType)
  10525.             DECLARE FUNCTION GIFPUT% (BYVAL Mode%, BYVAL Xloc%, BYVAL
  10526.                Yloc%, SEG FileName$)
  10527.             DECLARE SUB JOYSTICKINFO (SEG JAX%, SEG JAY%, SEG JAButs%, SEG
  10528.                JBX%, SEG JBY%, SEG JBButs%)
  10529.             DECLARE SUB MOUSEBUTPRESS (BYVAL ReqBut%, SEG Xloc%, SEG
  10530.                Yloc%, SEG Num%, SEG MButs%)
  10531.             DECLARE SUB MOUSEBUTRELEASE (BYVAL ReqBut%, SEG Xloc%, SEG
  10532.                Yloc%, SEG Num%, SEG MButs%)
  10533.             DECLARE SUB MOUSECURSORDEFAULT ()
  10534.             DECLARE SUB MOUSECURSORSET (SEG MouseCursor?)
  10535.             DECLARE SUB MOUSEENTER ()
  10536.             DECLARE SUB MOUSEEXIT ()
  10537.             DECLARE SUB MOUSEHIDE ()
  10538.             DECLARE SUB MOUSEINFO (SEG DrvMajorVer%, SEG DrvMinorVer%, SEG
  10539.                MouseType%, SEG IRQnumber%)
  10540.             DECLARE SUB MOUSELOCSET (BYVAL Xloc%, BYVAL Yloc%)
  10541.             DECLARE SUB MOUSERANGESET (BYVAL X1%, BYVAL Y1%, BYVAL X2%,
  10542.                BYVAL Y2%)
  10543.             DECLARE SUB MOUSERESTORESTATE (SEG MouseBuf?)
  10544.             DECLARE SUB MOUSESAVESTATE (SEG MouseBuf?)
  10545.             DECLARE SUB MOUSESENSSET (BYVAL Xsens%, BYVAL Ysens%,BYVAL
  10546.                DblSpedThrshold%)
  10547.             DECLARE SUB MOUSESHOW ()
  10548.             DECLARE SUB MOUSESTATUS (SEG X%, SEG Y%, SEG MButs%)
  10549.             DECLARE FUNCTION MOUSESTORAGESIZE% ()
  10550.             DECLARE SUB OVERSCANSET (BYVAL Colr%)
  10551.             DECLARE FUNCTION PAGEDISPLAY% (BYVAL X%, BYVAL Y%, BYVAL
  10552.                Page%)
  10553.             DECLARE FUNCTION PAGEACTIVE% (BYVAL Page%)
  10554.             DECLARE SUB PALCHGAUTO (SEG Pal AS RGBType, SEG NewPal AS
  10555.                RGBType, BYVAL FirstColr%, BYVAL LastColr%, BYVAL Speed%)
  10556.             DECLARE SUB PALCHGSTEP (SEG Pal AS RGBType, SEG NewPal AS
  10557.                RGBType, BYVAL FirstColr%, BYVAL LastColr%, BYVAL Percent%)
  10558.             DECLARE SUB PALCOPY (SEG SourcePal AS RGBType, SEG DestPal AS
  10559.                RGBType, BYVAL FirstColr%, BYVAL LastColr%)
  10560.  
  10561.  
  10562.  
  10563.                                                                         169
  10564.  
  10565.  
  10566.  
  10567.  
  10568.  
  10569.             DECLARE SUB PALDIMSTEP (SEG Pal AS RGBType, BYVAL FirstColr%,
  10570.                BYVAL LastColr%, BYVAL Percent%)
  10571.             DECLARE SUB PALGET (SEG Pal AS RGBType, BYVAL FirstColr%,
  10572.                BYVAL LastColr%)
  10573.             DECLARE SUB PALIOAUTO (SEG Pal AS RGBType, BYVAL FirstColr%,
  10574.                BYVAL LastColr%, BYVAL Speed%)
  10575.             DECLARE SUB PALROTATE (SEG Pal AS RGBType, BYVAL FirstColr%,
  10576.                BYVAL LastColr%, BYVAL ColShift%)
  10577.             DECLARE SUB PALSET (SEG Pal AS RGBType, BYVAL FirstColr%,
  10578.                BYVAL LastColr%)
  10579.             DECLARE FUNCTION RES320% ()
  10580.             DECLARE FUNCTION RES640L% ()
  10581.             DECLARE FUNCTION RES640% ()
  10582.             DECLARE FUNCTION RES800% ()
  10583.             DECLARE FUNCTION RES1024% ()
  10584.             DECLARE FUNCTION RES1280% ()
  10585.             DECLARE FUNCTION RESTEXT% ()
  10586.             DECLARE SUB SCROLLDN (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL
  10587.                Y2%, BYVAL Num%, BYVAL Colr%)
  10588.             DECLARE SUB SCROLLLT (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL
  10589.                Y2%, BYVAL Num%, BYVAL Colr%)
  10590.             DECLARE SUB SCROLLRT (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL
  10591.                Y2%, BYVAL Num%, BYVAL Colr%)
  10592.             DECLARE SUB SCROLLUP (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL
  10593.                Y2%, BYVAL Num%, BYVAL Colr%)
  10594.             DECLARE SUB SDELAY (BYVAL Count%)
  10595.             DECLARE SUB SETCARD (BYVAL CHIP%, BYVAL MEM%)
  10596.             DECLARE SUB SETVIEW (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL
  10597.                Y2%)
  10598.             DECLARE SUB SPRITEGAP (BYVAL TransColr%, BYVAL X%, BYVAL Y%,
  10599.                SEG SpriteGfxBlk%, SEG BkgndGfxBlk%)
  10600.             DECLARE SUB SPRITEGET (BYVAL TransColr%, BYVAL X%, BYVAL Y%,
  10601.                SEG SpriteGfxBlk%, SEG BkgndGfxBlk%)
  10602.             DECLARE SUB SPRITEPUT (BYVAL Mode%, BYVAL TransColr%, BYVAL
  10603.                X%, BYVAL Y%, SEG SpriteGfxBlk%)
  10604.             DECLARE FUNCTION SPRITECOLLDETECT% (BYVAL TransColr%, BYVAL
  10605.                Sprite1LocX%, BYVAL Sprite1LocY%, BYVAL Sprite2LocX%, BYVAL
  10606.                Sprite2LocY%, SEG Sprite1GfxBlk%, SEG Sprite2GfxBlk%)
  10607.             DECLARE FUNCTION VIDEOMODEGET% ()
  10608.             DECLARE SUB VIDEOMODESET (BYVAL Mode%)
  10609.             DECLARE SUB VIDEOOFF ()
  10610.             DECLARE SUB VIDEOON ()
  10611.             DECLARE FUNCTION WHICHCPU% ()
  10612.             DECLARE FUNCTION WHICHJOYSTICK% ()
  10613.             DECLARE FUNCTION WHICHMEM% ()
  10614.             DECLARE FUNCTION WHICHMOUSE% ()
  10615.             DECLARE FUNCTION WHICHVGA% ()
  10616.             DECLARE FUNCTION WHICHXMS% (SEG XmsKbytesAvailable%, SEG
  10617.                XmsHandlesAvailable%)
  10618.             DECLARE FUNCTION XMSALLOCATE% (BYVAL ReqKbytesOfMem%)
  10619.             DECLARE FUNCTION XMSERROR% ()
  10620.             DECLARE FUNCTION XMSFREE% (BYVAL XmsHandle%)
  10621.             DECLARE FUNCTION XMSGET% (BYVAL XmsHandle%, BYVAL
  10622.                OffsetIntoXms&, SEG DestVar%, BYVAL NumOfBytes&)
  10623.  
  10624.  
  10625.                                                                         170
  10626.  
  10627.  
  10628.  
  10629.  
  10630.  
  10631.             DECLARE FUNCTION XMSPUT% (SEG SourceVar%, BYVAL XmsHandle%,
  10632.                BYVAL OffsetIntoXms&, BYVAL NumOfBytes&)
  10633.             DECLARE FUNCTION XMSCOPY% (BYVAL XmsHandle1%, BYVAL
  10634.                OffsetIntoXms1&, BYVAL XmsHandle2%, BYVAL OffsetIntoXms2&,
  10635.                BYVAL NumOfBytes&)
  10636.  
  10637.  
  10638.  
  10639.  
  10640.  
  10641.  
  10642.  
  10643.  
  10644.  
  10645.  
  10646.  
  10647.  
  10648.  
  10649.  
  10650.  
  10651.  
  10652.  
  10653.  
  10654.  
  10655.  
  10656.  
  10657.  
  10658.  
  10659.  
  10660.  
  10661.  
  10662.  
  10663.  
  10664.  
  10665.  
  10666.  
  10667.  
  10668.  
  10669.  
  10670.  
  10671.  
  10672.  
  10673.  
  10674.  
  10675.  
  10676.  
  10677.  
  10678.  
  10679.  
  10680.  
  10681.  
  10682.  
  10683.  
  10684.  
  10685.  
  10686.  
  10687.                                                                         171
  10688.  
  10689.  
  10690.  
  10691.  
  10692.  
  10693.           APPENDIX B.  JOYSTICK PORTS AND Y-CABLES
  10694.  
  10695.           SCHEMATIC WIRING DIAGRAM FOR A STANDARD JOYSTICK PORT
  10696.  
  10697.                                     DB15 male
  10698.                                     connector
  10699.                    Joystick B            ___       Joystick A
  10700.                                       __/   |
  10701.                                      /    o | 1 -------------------+
  10702.              +------------------  9 | o     |     ___Button A      |
  10703.              |     Button A___      |     o | 2 --o o-+            |
  10704.              |           +-o o-- 10 | o     |         |    X Axis  |
  10705.              |  X Axis   |          |     o | 3 -------------+     |
  10706.              |     +------------ 11 | o     |         |      |     |
  10707.              |     |     |          |     o | 4 ------+      |     |
  10708.              +--/\/\/\   +------ 12 | o     |         |    /\/\/\--+
  10709.              |           |          |     o | 5       |            |
  10710.              |     +------------ 13 | o     |         |            |
  10711.              |     |     | ___      |     o | 6 -------------+     |
  10712.              |     |     +-o o-- 14 | o     |     ___ |      |     |
  10713.              |     |    Button B    |     o | 7 --o o-+      |     |
  10714.              |     |             15 | o     |   Button B   /\/\/\--+
  10715.              +--/\/\/\               \__  o | 8            Y Axis
  10716.                Y Axis                   \___|
  10717.  
  10718.           Notes:
  10719.  
  10720.           1)This diagram comes with NO warranties expressed or implied.
  10721.             It is provided for information only.  In no event shall
  10722.             Stephen L. Balkum, Daniel A. Sill or Zephyr Software be held
  10723.             liable for damages resulting from use, misuse, or inability to
  10724.             use this information.
  10725.  
  10726.           2)The x and y axis potentiometers have a typical range of 0 to
  10727.             100k ohms.  Buttons are normally open and close when pressed.
  10728.  
  10729.           3)This diagram is correct for joystick ports that conform to the
  10730.             standard set forth by IBM. Some specialty joystick cards
  10731.             provide separate A and B joystick connectors.  For these
  10732.             cards, both connectors are wired to pins 1 through 8 as shown
  10733.             in the diagram.
  10734.  
  10735.           4)Many 'Super I/O' boards (2H/2F/2S/1P/1G) equipped with a
  10736.             joystick port will support only one joystick.  On these cards,
  10737.             pins 9 through 15 are not used.
  10738.  
  10739.           5)Commercially available joysticks are wired to use pins 1
  10740.             through 8 and, therefore, will always be 'Joystick A' if
  10741.             plugged directly into a dual joystick port connector.
  10742.  
  10743.           6)Many sound cards provide joystick ports; however, their
  10744.             connector wiring does not always conform to the standard shown
  10745.             above.  Some of these connectors may be used for other
  10746.  
  10747.  
  10748.  
  10749.                                                                         172
  10750.  
  10751.  
  10752.  
  10753.  
  10754.  
  10755.             purposes such as a MIDI port.  See the documentation that
  10756.             comes with the sound card.
  10757.  
  10758.           7)If there is more than one joystick port on a computer
  10759.             configured to operate the same joystick, only ONE port should
  10760.             be enabled at any given time for proper operation.  Disable
  10761.             all but one joystick port.  For example, if the computer has
  10762.             both a Super I/O card and a sound card, the joystick port on
  10763.             the Super I/O card should be disabled since the sound card's
  10764.             port probably supports two joysticks and the I/O card supports
  10765.             only one.
  10766.  
  10767.  
  10768.  
  10769.  
  10770.  
  10771.  
  10772.  
  10773.  
  10774.  
  10775.  
  10776.  
  10777.  
  10778.  
  10779.  
  10780.  
  10781.  
  10782.  
  10783.  
  10784.  
  10785.  
  10786.  
  10787.  
  10788.  
  10789.  
  10790.  
  10791.  
  10792.  
  10793.  
  10794.  
  10795.  
  10796.  
  10797.  
  10798.  
  10799.  
  10800.  
  10801.  
  10802.  
  10803.  
  10804.  
  10805.  
  10806.  
  10807.  
  10808.  
  10809.  
  10810.  
  10811.                                                                         173
  10812.  
  10813.  
  10814.  
  10815.  
  10816.  
  10817.           SCHEMATIC WIRING DIAGRAM FOR A JOYSTICK Y-CABLE
  10818.                                               ___
  10819.                          DB15 male         __/   |
  10820.                        connector to       /    o | 1 --------+
  10821.                        Joystick Port   9 | o     |           |
  10822.                         on computer      |     o | 2 --------|-+
  10823.                             +-------- 10 | o     |           | |
  10824.                             |            |     o | 3 --------|-|-+
  10825.                             | +------ 11 | o     |           | | |
  10826.                             | |          |     o | 4 --------|-|-|-+
  10827.                             | |       12 | o     |           | | | |
  10828.                             | |          |     o | 5         | | | |
  10829.                             | | +---- 13 | o     |           | | | |
  10830.                             | | |        |     o | 6 --------|-|-|-|-+
  10831.                             | | | +-- 14 | o     |           | | | | |
  10832.                             | | | |      |     o | 7 --------|-|-|-|-|-+
  10833.                             | | | |   15 | o     |           | | | | | |
  10834.                             | | | |       \__  o | 8         | | | | | |
  10835.                             | | | |          \___|           | | | | | |
  10836.                             | | | |                          | | | | | |
  10837.                             | | | |                          | | | | | |
  10838.                             | | | |  +-----------------------+ | | | | |
  10839.                             | | | |  |                       | | | | | |
  10840.                             | | | |  | +---------------------|-|-|-+ | |
  10841.                             | | | |  | |                     | | | | | |
  10842.                             | | | |  | |                     | | | | | |
  10843.            DB15 female      | | | |  | |     DB15 female     | | | | | |
  10844.            connector to     | | | |  | |     connector to    | | | | | |
  10845.             Joystick B      | | | |  | |      Joystick A     | | | | | |
  10846.                   ___       | | | |  | |            ___      | | | | | |
  10847.                __/   |      | | | |  | |         __/   |     | | | | | |
  10848.               /    o | 1 ---|-|-|-|--+ |        /    o | 1 --+ | | | | |
  10849.            9 | o     |      | | | |    |     9 | o     |       | | | | |
  10850.              |     o | 2 ---+ | | |    |       |     o | 2 ----+ | | | |
  10851.           10 | o     |        | | |    |    10 | o     |         | | | |
  10852.              |     o | 3 -----+ | |    |       |     o | 3 ------+ | | |
  10853.           11 | o     |          | |    |    11 | o     |           | | |
  10854.              |     o | 4 -------|-|----+       |     o | 4 --------+ | |
  10855.           12 | o     |          | |         12 | o     |             | |
  10856.              |     o | 5        | |            |     o | 5           | |
  10857.           13 | o     |          | |         13 | o     |             | |
  10858.              |     o | 6 -------+ |            |     o | 6 ----------+ |
  10859.           14 | o     |            |         14 | o     |               |
  10860.              |     o | 7 ---------+            |     o | 7 ------------+
  10861.           15 | o     |                      15 | o     |
  10862.               \__  o | 8                        \__  o | 8
  10863.                  \___|                             \___|
  10864.  
  10865.           Notes:
  10866.  
  10867.           1)This diagram comes with NO warranties expressed or implied.
  10868.             It is provided for information only.  In no event shall
  10869.             Stephen L. Balkum, Daniel A. Sill or Zephyr Software be held
  10870.  
  10871.  
  10872.  
  10873.                                                                         174
  10874.  
  10875.  
  10876.  
  10877.  
  10878.  
  10879.             liable for damages resulting from use, misuse, or inability to
  10880.             use this information.
  10881.  
  10882.           2)This cable has worked with a standard joystick port connector,
  10883.             a Sound Blaster port connector, and a Sound Blaster Pro
  10884.             joystick port connector.
  10885.  
  10886.  
  10887.  
  10888.  
  10889.  
  10890.  
  10891.  
  10892.  
  10893.  
  10894.  
  10895.  
  10896.  
  10897.  
  10898.  
  10899.  
  10900.  
  10901.  
  10902.  
  10903.  
  10904.  
  10905.  
  10906.  
  10907.  
  10908.  
  10909.  
  10910.  
  10911.  
  10912.  
  10913.  
  10914.  
  10915.  
  10916.  
  10917.  
  10918.  
  10919.  
  10920.  
  10921.  
  10922.  
  10923.  
  10924.  
  10925.  
  10926.  
  10927.  
  10928.  
  10929.  
  10930.  
  10931.  
  10932.  
  10933.  
  10934.  
  10935.                                                                         175
  10936.