home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 14 / CD_ASCQ_14_0694.iso / maj / 4524 / svgacc21.txt < prev    next >
Text File  |  1994-05-09  |  300KB  |  12,926 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.                                   REFERENCE MANUAL
  9.  
  10.  
  11.                                      FOR SVGACC
  12.  
  13.  
  14.                                     THE SUPER VGA
  15.  
  16.  
  17.                                   GRAPHICS LIBRARY
  18.  
  19.  
  20.                                     FOR USE WITH
  21.  
  22.  
  23.                                       MICROSOFT
  24.  
  25.  
  26.                                      AND BORLAND
  27.  
  28.  
  29.                                         C/C++
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.              1993-1994 by Zephyr Software - Stephen L. Balkum and Daniel
  50.             A. Sill
  51.  
  52.             All rights reserved.  No part of this book shall be reproduced
  53.             or transmitted by any means, electronic, mechanical,
  54.             photocopying, recording or otherwise, without written
  55.             permission from Zephyr Software - Stephen L. Balkum and Daniel
  56.             A. Sill.
  57.  
  58.             Although every effort has been made to insure the accuracy of
  59.             the material in this book, Zephyr Software, Stephen L. Balkum
  60.             and Daniel A. Sill assume no responsibility for errors or
  61.             omissions.  In addition no liability is assumed for damages
  62.             resulting from the use of the information contained herein.
  63.  
  64.             Printed in the United States of America
  65.  
  66.             Trademarks
  67.  
  68.             The Graphics Interchange Format (c) is the Copyright property
  69.             of CompuServe Incorporated.
  70.             GIF (sm) is a Service Mark property of CompuServe
  71.             Incorporated.
  72.             Sound Blaster and Sound Blaster Pro are trademarks of Creative
  73.             Labs, Inc.
  74.             All others are trademarks of their respective owners.
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.                                                                          ii
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.                               SOFTWARE LICENSE AGREEMENT
  99.  
  100.                    By using this software, you agree to the terms of
  101.                                     this agreement.
  102.  
  103.                  No warranties are expressed or implied.  In no event
  104.                  shall Zephyr Software, Stephen L. Balkum or Daniel
  105.                  A. Sill be held liable for damages resulting from
  106.                  the use or misuse of this product, including but not
  107.                  limited to implied warranties of fitness for a
  108.                  particular purpose.
  109.  
  110.                  The shareware version may be freely distributed as
  111.                  long as all files stay together and are not modified
  112.                  in any way.  No cost may be charged for the
  113.                  shareware version beyond normal and reasonable
  114.                  copying and distribution expenses.
  115.  
  116.                  No products developed with this software shall be
  117.                  sold unless this software has been registered with
  118.                  Zephyr Software, Stephen L. Balkum or Daniel A.
  119.                  Sill.
  120.  
  121.                  At no time for any reason shall this software be
  122.                  reverse engineered, decompiled or disassembled.
  123.  
  124.                  This software may not be rented or leased.
  125.  
  126.                  This software may be used only on one terminal or
  127.                  one computer at any one given moment in time.  This
  128.                  software may not be installed on a network of any
  129.                  type.  Contact Zephyr Software, Stephen L. Balkum or
  130.                  Daniel A. Sill for networking options.
  131.  
  132.                  United States Government Restricted Rights:
  133.                  Use, duplication or disclosure of this software and
  134.                  documentation by the U.S. Government is subject to
  135.                  the restrictions as set forth in subparagraph
  136.                  (c)(1)(ii) of the Rights in Technical Data and
  137.                  Computer Software clause at DFARS 252.227-7013.
  138.                  Contractor/manufacturer is Stephen L. Balkum and
  139.                  Daniel A. Sill, P.O. Box 7704, Austin, Texas 78713-
  140.                  7704.
  141.  
  142.                  The ownership of this software may be transferred as
  143.                  long as Zephyr Software, Stephen L. Balkum or Daniel
  144.                  A. Sill is notified in writing of the transfer date
  145.                  and new owner.  The new owner must agree to this
  146.                  contract.  The transfer must include all registered
  147.                  updates and previously registered versions.  The
  148.                  original owner may not retain any copies in any form
  149.                  of the registered software or its documents.
  150.  
  151.  
  152.  
  153.                                                                         iii
  154.  
  155.  
  156.  
  157.  
  158.  
  159.             INTRODUCTION
  160.  
  161.             We spent weeks searching the depths of the internet ftp sites
  162.             for a library that would allow the programmer full access to
  163.             the abilities of Super VGA.  We wanted the colors VGA could
  164.             provide and better resolution than EGA could provide.
  165.             Professionally developed libraries with this ability were
  166.             definitely out of our price range.  After our searches
  167.             continuously returned nothing, we decided to fill the apparent
  168.             void in the shareware market.
  169.  
  170.             Our searches did give two useful packages:  John Bridges'
  171.             VGAKIT and Finn Thoegersen's VGADOC.  We began with these two
  172.             works and developed a graphics library intended to allow the
  173.             programmer access to the huge world of high resolution
  174.             programming.
  175.  
  176.             On the surface the task appeared quite simple.  However, it
  177.             quickly became obvious that the routines in this library would
  178.             be required to affect extremely large amounts of data.
  179.             Operations must be quick to be successful.  Therefore, every
  180.             effort was made to create the fastest code possible - even at
  181.             the expense of size.  For this reason we opted to write code
  182.             with the 32 bit instructions of the 80386 and 80486 chips.  It
  183.             is our opinion that anyone with a hi-res card in a lesser
  184.             machine may have some priorities out of order. All routines
  185.             are written in assembly and use absolutely no floating point
  186.             values.  Anytime a real number was required, fixed point
  187.             notation was used.  In addition we attempted to write the
  188.             routines such that any reasonable argument passed can be
  189.             interpreted intelligently by the library.
  190.  
  191.             With the numerous Super VGA cards available and no well
  192.             established standard we chose John Bridges' identification and
  193.             bank switching routines as a beginning.  These two routines
  194.             have undergone some modification, but not enough to justify
  195.             copyrighting this portion of the library's code by Zephyr
  196.             Software.  We have no intentions of releasing our changes to
  197.             these routines into the public domain.  From that point onward
  198.             all code is original.  In some instances common algorithms
  199.             were researched and original code written according to that
  200.             algorithm.
  201.  
  202.             This Super VGA library gives the programmer transparent access
  203.             to twenty different Super VGA cards.  These cards include
  204.             Acumos, Ahead, ATI Technologies, Avance, Chips and
  205.             Technologies, Cirrus Logic, Everex, Genoa, MXIC, NCR, Oak
  206.             Technologies, Paradise/Western Digital, Primus, Realtek,
  207.             Trident, Tseng Labs, Video 7 and the VESA standard.  Please
  208.             see the WHICHVGA function for the specific chipsets.  The
  209.             programmer only needs to verify that the end user's card has
  210.             been identified, but not which card was recognized.  After
  211.             proper identification, all functions react in exactly the same
  212.             fashion.  The library contains functions to draw all of the
  213.  
  214.  
  215.                                                                           2
  216.  
  217.  
  218.  
  219.  
  220.  
  221.             major primitives.  In addition there are functions that modify
  222.             the screen palette, write text on the screen with a choice of
  223.             fonts and modify the reaction of the primitives.
  224.             Identification routines include not only the video card, but
  225.             also the amount of video memory, type of processor and
  226.             installed pointing devices.  Advanced functions provide full
  227.             mouse support (when used with a Microsoft compatible driver)
  228.             and joystick support.  Finally, support for two dimensional
  229.             and three dimensional coordinate systems is provided including
  230.             rotation, translation, scaling and projection.
  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.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.                                                                           3
  278.  
  279.  
  280.  
  281.  
  282.  
  283.             SUGGESTED METHODS FOR USING THIS LIBRARY
  284.  
  285.             VERIFICATION OF A COMPUTER'S HARDWARE
  286.  
  287.             It is strongly recommended that any program written with this
  288.             library first verifies that the computer is a 80386 or better
  289.             by calling the WHICHCPU function.  Many of the library's
  290.             functions use 386 exclusive code which may cause a computer
  291.             with a lesser processor to crash.  In addition WHICHMOUSE must
  292.             be called before calling any of the mouse functions.  Lastly,
  293.             it is recommended that WHICHJOYSTICK be called before a
  294.             program uses the joystick routines.
  295.  
  296.             It is required that a program call WHICHVGA prior to any
  297.             function that communicates with the video card.  If WHICHVGA
  298.             returns a zero for unknown card type, the program should not
  299.             call any graphics function.  Without proper identification of
  300.             the video card any graphics function will likely cause a
  301.             system failure.  It is recommended, although not necessary,
  302.             that a program call WHICHMEM prior to calling any RES
  303.             function.  Although the video card was properly identified, it
  304.             may not have sufficient onboard memory to support the desired
  305.             resolution.  As a second check the RES functions will do
  306.             nothing if the video card has not been identified or if the
  307.             video card does not support the specified resolution for
  308.             memory or hardware reasons.
  309.  
  310.             THE 256 COLOR PALETTE
  311.  
  312.             The 256 color palette of the Super VGA cards is a six bit
  313.             palette.  Each of the 256 colors of the palette are described
  314.             by three values representing the intensity of the colors red,
  315.             blue and green.  These values can range from 0 to 63.  Anytime
  316.             a value outside of this range is used, the video card simply
  317.             ignores the upper two bits.  Therefore, 64 is the same as 0.
  318.             This should be taken into consideration when manipulating the
  319.             palette or when importing a palette from an external source
  320.             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
  325.             written to best work on multiple points at once.  We refer to
  326.             these functions as object-oriented.  This means that the
  327.             points defining an object (a box, a house, etc.) should be
  328.             contained within one array or part of an array and calls to
  329.             the functions should act on all of the points in the array.
  330.             Calls to functions have a high speed overhead, therefore,
  331.             placing more than one object in the same array and passing the
  332.             entire array to the functions can be beneficial.  However,
  333.             these functions will work on a single point as well.
  334.  
  335.             A consequence of our object-oriented 2-D and 3-D functions is
  336.             the use of the scaling functions.  When scaling objects, we
  337.  
  338.  
  339.                                                                           4
  340.  
  341.  
  342.  
  343.  
  344.  
  345.             recommend the object be defined about the origin.  D2SCALE and
  346.             D3SCALE both work with respect to the origin.  This eliminates
  347.             a 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
  350.             rotated by 45 degrees at the center of the screen, the
  351.             recommended 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
  357.                  in RBOX,
  358.                scale RBOX by 50% (scaling factor would be 128, or 80 hex)
  359.                  and place output in SRBOX,
  360.                translate RBOX to the center of the screen - a translation
  361.                  of 320, 240 in 640x480 resolution - and place output in
  362.                  TRBOX,
  363.                translate SRBOX to the center of the screen - same
  364.                  translation as for RBOX - and place output in TSRBOX,
  365.                draw TRBOX and TSRBOX on the screen.
  366.  
  367.             Notice that by defining the box centered about the origin the
  368.             translation values were extremely intuitive.  Also notice that
  369.             if we had scaled the second box after the translation, it
  370.             would have been draw in the upper left quadrant of the screen
  371.             instead of the center.
  372.  
  373.             In mathematics and many sciences it is customary that in a 2-D
  374.             coordinate system the Y axis increases upward and the X axis
  375.             increases to the right.  The computer industry has decided the
  376.             Y axis should increase downward.  The 2-D functions are not
  377.             affected by the choice in coordinate systems.  However, it is
  378.             important to remember that a positive rotation in D2ROTATE
  379.             rotates from the positive X axis to the positive Y axis.
  380.             Therefore, when using mathematical conventions, a positive
  381.             rotation moves counter-clockwise.  On the computer screen a
  382.             positive rotation moves clockwise.
  383.  
  384.             The 3-D coordinate system follows mathematical conventions by
  385.             using a right-handed coordinate system.  The easiest way to
  386.             visualize this coordinate system is by using your right hand.
  387.             Place your index finger and thumb at a right angle to one
  388.             another as if to form an imaginary pistol.  Now place your
  389.             second finger at a right angle to your index finger.  It
  390.             should be at a right angle to your thumb as well.  This
  391.             represents the three axes.  The index finger is the X axis,
  392.             the second finger is the Y axis and the thumb is the Z axis.
  393.             The easiest way to remember rotation directions in this system
  394.             is cyclically.  A positive rotation about the X axis rotates
  395.             the Y axis into the Z axis.  A positive rotation about the Y
  396.             axis rotates the Z axis into the X axis.  A positive rotation
  397.             about the Z axis rotates the X axis into the Y axis.
  398.  
  399.  
  400.  
  401.                                                                           5
  402.  
  403.  
  404.  
  405.  
  406.  
  407.             After doing all necessary 3-D transformations, projection onto
  408.             the 2-D computer screen is required.  Although the computer
  409.             screen's coordinate system does not follow mathematical
  410.             conventions, the D3PROJECT function automatically takes care
  411.             of all conversions.  The programmer only needs to draw the
  412.             resulting object on the screen with FILLCONVEXPOLY or a series
  413.             of DRWLINEs.
  414.  
  415.             THE CONCEPT OF SPRITE GRAPHICS
  416.  
  417.             The key to sprite graphics is the assumption that only a small
  418.             percentage of the pixels in a graphics block are used by the
  419.             animation and the remaining pixels should be treated as
  420.             transparent, revealing the background behind the sprite.  The
  421.             sprite routines in this library only act on non-transparent
  422.             colors, thus, saving time by ignoring a large number of
  423.             pixels.  When retrieving the background for a sprite, prior
  424.             knowledge of the sprite itself permits obtaining background
  425.             only where it is necessary.
  426.  
  427.             The following steps outline an example of the recommended
  428.             procedure for using the sprite functions:
  429.  
  430.                1.draw the sprite on the screen - a white stick figure on a
  431.                  black background, for example
  432.                2.use BLKGET to place the sprite in an array STICK
  433.                3.use SPRITEGAP to simultaneously retrieve the background
  434.                  into BACKSTICK and place STICK on the screen, declaring
  435.                  black as the transparent color
  436.                4.use SPRITEPUT to replace the background BACKSTICK in the
  437.                  same location as step 3
  438.                5.repeat steps 3 and 4 as many times and in as many
  439.                  locations as desired
  440.  
  441.             GLOBAL VARIABLES
  442.  
  443.             Access to several global variables provided to the programmer.
  444.             The most important two variables are MAXX and MAXY.  These two
  445.             values give the current resolution and are set by the RES###
  446.             functions.  They should not be changed directly at any time by
  447.             the programmer.  Doing so may cause erratic results from many
  448.             of the graphics functions in this library.  These variables
  449.             initially contain 0.
  450.  
  451.             Four other variables, VIEWX1, VIEWY1, VIEWX2, VIEWY2, can be
  452.             accessed by the programmer.  They define the current viewport
  453.             used for clipping purposes.  These values, also, should not be
  454.             changed directly by the programmer.  The SETVIEW function
  455.             should be used to change these values as it performs important
  456.             error checking.  The viewport is defined as the whole screen
  457.             by the RES### functions.  If drawing on more or less than the
  458.             entire screen is desired, call SETVIEW as necessary.
  459.  
  460.  
  461.  
  462.  
  463.                                                                           6
  464.  
  465.  
  466.  
  467.  
  468.  
  469.             EXTENDED MEMORY SUPPORT
  470.  
  471.             With the higher screen resolutions, more memory may be needed
  472.             for data storage.  For this reason extended memory support is
  473.             provided.  Accessing extended memory requires the computer to
  474.             switch into protected mode.  The process of switching into
  475.             protected mode and returning is handled by the extended memory
  476.             manager, usually HIMEM.SYS.  The switch is relatively slow.
  477.             Therefore, it should be used as fast storage access since it
  478.             is much faster than disk access.
  479.  
  480.             Extended memory access is also limited by the number of
  481.             available handles.  The limit is controlled by a switch on the
  482.             extended memory manager's command line and normally defaults
  483.             to 32.  Also, it is imperative that all allocated extended
  484.             memory blocks be freed before the program terminates.  Unfreed
  485.             memory blocks will be unavailable until the computer is
  486.             rebooted.
  487.  
  488.             CONVENTIONS USED IN THIS MANUAL
  489.  
  490.             All parameters, other than pointers, passed to and from
  491.             functions and procedures in this graphics library are short
  492.             (two byte) integers  A byte variable type is assumed to be an
  493.             unsigned character.  No floating point values are used.  By
  494.             not using real numbers round-off error can be a concern.
  495.             Under most circumstances this error will not be a problem and
  496.             will not be noticed.  The use of large numbers in rotations is
  497.             recommended.
  498.  
  499.             No functions in this library allocate memory for the
  500.             programmer, except, of course, XMSALLOCATE.  It is the
  501.             programmer's responsibility to be sure all pointers reference
  502.             properly allocated memory of the appropriate size.
  503.  
  504.             Whenever a pixel is written on the screen, a mode is required.
  505.             Unless otherwise noted, there are five possible modes:
  506.             NO_ACTION, SET, XOR, OR and AND.  These modes are represented
  507.             by the numbers zero through four respectively.  NO_ACTION is
  508.             self-explanatory.  Technically, SET is the fastest mode.
  509.             However, XOR maybe the most useful.  XOR'ing a point twice
  510.             with the same color returns the original color.  This can be
  511.             used to cover and uncover graphics.  In addition when a
  512.             reference to a color index is made, only values between and
  513.             including 0 and 255 are valid.  Any integer will work, but
  514.             only the lowest eight bits are recognized.
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.                                                                           7
  526.  
  527.  
  528.  
  529.  
  530.  
  531.             BLKGET
  532.  
  533.                PROTOTYPE
  534.  
  535.                extern int far blkget (int x1, int y1, int x2, int y2,
  536.                RasterBlock far *gfxblk)
  537.  
  538.                INPUT
  539.  
  540.                X1, Y1 - top left corner of block
  541.                x2, y2 - bottom right corner of block
  542.  
  543.                OUTPUT
  544.  
  545.                BLKGET returns 1 if successful, 0 if failed.
  546.                gfxblk - retrieved bitmap
  547.  
  548.                USAGE
  549.  
  550.                BLKGET stores the pixel data contained within the block
  551.                defined by (X1, Y1)-(X2, Y2) in the variable referenced by
  552.                gfxblk.  Memory for gfxblk must be allocated as a
  553.                RasterBlock structure with a data size in bytes equal to
  554.  
  555.                                   [(X2-X1+1)*(Y2-Y1+1)]
  556.  
  557.                plus four bytes for the width and height integers of the
  558.                RasterBlock structure.
  559.  
  560.                Note, however, that gfxblk can be quite large.  If the size
  561.                of gfxblk is insufficient, BLKGET will overwrite any data in
  562.                memory contained beyond gfxblk and may possibly cause the
  563.                system to crash.  BLKGET enforces X2X1 and Y2 Y1.  Also,
  564.                the coordinates must be valid on the screen at the current
  565.                resolution.
  566.  
  567.                SEE ALSO
  568.  
  569.                BLKPUT, BLKRESIZE, BLKROTATE, GETLASTSTRING, SPRITEGAP,
  570.                SPRITEGET, SPRITEPUT
  571.  
  572.                EXAMPLE
  573.  
  574.                /*
  575.                 * Places 1/4 of a circle at the center of the screen
  576.                 */
  577.                #include <stdlib.h>
  578.                #include <conio.h>
  579.                #include "svgacc.h"
  580.  
  581.                void main(void)
  582.                {
  583.                  int vmode;
  584.                  int a,b,c,d;
  585.  
  586.  
  587.                                                                           8
  588.  
  589.  
  590.  
  591.  
  592.  
  593.                  RasterBlock *blkdata;
  594.  
  595.                  vmode = videomodeget();
  596.                  if ( !whichvga() || (whichmem() < 512))
  597.                     exit(1);
  598.                  res640();
  599.                  drwcircle(1,10,30,30,20);
  600.                  fillarea(30,30,10,7);
  601.                  a = b = 0;
  602.                  c = d = 30;
  603.                  blkdata = (RasterBlock *)malloc((c-a+1)*(d-b+1)+4);
  604.                  blkget(a,b,c,d,blkdata);
  605.                  blkput(1,320,240,blkdata);
  606.                  getch();
  607.                  videomodeset(vmode);
  608.                  exit(0);
  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.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.                                                                           9
  650.  
  651.  
  652.  
  653.  
  654.  
  655.             BLKPUT
  656.  
  657.                PROTOTYPE
  658.  
  659.                extern void far blkput (PixelMode mode, int x, int y,
  660.                RasterBlock far *gfxblk)
  661.  
  662.                INPUT
  663.  
  664.                mode - pixel write mode
  665.                x, y - location for top left corner of block
  666.                gfxblk - RasterBlock pointer to bitmap
  667.  
  668.                OUTPUT
  669.  
  670.                no value returned
  671.  
  672.                USAGE
  673.  
  674.                BLKPUT places the pixel data contained in the variable
  675.                referenced by gfxblk on the screen.  The top, left corner of
  676.                the block is specified by (X, Y).  Any (X, Y) is acceptable
  677.                and any portion of the block that lies outside of the
  678.                currently defined viewport will not be drawn.
  679.  
  680.                SEE ALSO
  681.  
  682.                BLKGET, BLKRESIZE, BLKROTATE, GETLASTSTRING, SPRITEGAP,
  683.                SPRITEGET, SPRITEPUT, GIFPUT, SETVIEW
  684.  
  685.                EXAMPLE
  686.  
  687.                See BLKGET
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.                                                                          10
  712.  
  713.  
  714.  
  715.  
  716.  
  717.             BLKRESIZE
  718.  
  719.                PROTOTYPE
  720.  
  721.                extern void far blkresize (unsigned newxsize, unsigned
  722.                  newysize, RasterBlock far *sourcegfxblk, RasterBlock far
  723.                  *destgfxblk)
  724.  
  725.                INPUT
  726.  
  727.                newxsize, newysize - size of resulting bitmap in destgfxblk
  728.                sourcegfxblk - RasterBlock pointer to source bitmap
  729.  
  730.                OUTPUT
  731.  
  732.                no value returned
  733.                destgfxblk - resized bitmap
  734.  
  735.                USAGE
  736.  
  737.                BLKRESIZE takes the bitmap in sourcegfxblk and scales it up
  738.                or down according the to values passed in newxsize and
  739.                newysize.  The resulting bitmap is returned in destgfxblk
  740.                which should already be declared with a size calculated
  741.                according to the equation in BLKGET.  Neither newxsize nor
  742.                newysize should be zero.
  743.  
  744.                SEE ALSO
  745.  
  746.                BLKGET, BLKPUT, BLKROTATE
  747.  
  748.                EXAMPLE
  749.  
  750.                /*
  751.                 * Show blkresize
  752.                 */
  753.                #include <stdlib.h>
  754.                #include <math.h>
  755.                #include <conio.h>
  756.                #include "svgacc.h"
  757.                #define randnum(size) (rand() % (int)(size))
  758.  
  759.                void main(void)
  760.                {
  761.                  int vmode, i, j, colr, x1, y1, x2, y2;
  762.                  RasterBlock *gfxblk1, *gfxblk2;
  763.  
  764.                  vmode = videomodeget();
  765.                  if ( !whichvga() || (whichmem() < 512))
  766.                     exit(1);
  767.                  if ( !res640() )
  768.                     exit(1);
  769.                  i=20000;
  770.                  gfxblk1 = (RasterBlock *)malloc(i);
  771.  
  772.  
  773.                                                                          11
  774.  
  775.  
  776.  
  777.  
  778.  
  779.                  if (!gfxblk1) {
  780.                     restext();
  781.                     printf("ERROR: Allocating memory for gfxblk1: %d
  782.                bytes\n",i);
  783.                     exit(1);
  784.                  }
  785.                  gfxblk2 = (RasterBlock *)malloc(i);
  786.                  if (!gfxblk2) {
  787.                     restext();
  788.                     printf("ERROR: Allocating memory for gfxblk2: %d
  789.                bytes\n",i);
  790.                     exit(1);
  791.                  }
  792.                  for(i=0;i<=25;i++) {
  793.                     x1 = randnum(50);
  794.                     y1 = randnum(50);
  795.                     x2 = randnum(50);
  796.                     y2 = randnum(50);
  797.                     colr = randnum(16);
  798.                     drwline(1,colr,x1,y1,x2,y2);
  799.                  }
  800.                  x1 = 0;
  801.                  y1 = 0;
  802.                  x2 = 50;
  803.                  y2 = 50;
  804.                  drwbox(1,15,x1,y1,x2,y2);
  805.                  blkget(x1,y1,x2,y2,gfxblk1);
  806.                  x1 = maxx / 2;
  807.                  y1 = maxy / 2;
  808.                  blkresize(50,50,gfxblk1,gfxblk2);
  809.                  blkput(2,x1-(gfxblk2->width)/2,y1-(gfxblk2-
  810.                >height)/2,gfxblk2);
  811.                  for(i=x2;i<=x2+50;i++) {
  812.                     blkput(2,x1-(gfxblk2->width)/2,y1-(gfxblk2-
  813.                >height)/2,gfxblk2);
  814.                     blkresize(i,i,gfxblk1,gfxblk2);
  815.                     blkput(2,x1-(gfxblk2->width)/2,y1-(gfxblk2-
  816.                >height)/2,gfxblk2);
  817.                     sdelay(3);
  818.                  }
  819.                  for(i=x2+50;i>=x2-50;i--) {
  820.                     blkput(2,x1-(gfxblk2->width)/2,y1-(gfxblk2-
  821.                >height)/2,gfxblk2);
  822.                     blkresize(i,i,gfxblk1,gfxblk2);
  823.                     blkput(2,x1-(gfxblk2->width)/2,y1-(gfxblk2-
  824.                >height)/2,gfxblk2);
  825.                     sdelay(3);
  826.                  }
  827.                  for(i=x2-50;i<=x2+1;i++) {
  828.                     blkput(2,x1-(gfxblk2->width)/2,y1-(gfxblk2-
  829.                >height)/2,gfxblk2);
  830.                     blkresize(i,i,gfxblk1,gfxblk2);
  831.                     blkput(2,x1-(gfxblk2->width)/2,y1-(gfxblk2-
  832.                >height)/2,gfxblk2);
  833.  
  834.  
  835.                                                                          12
  836.  
  837.  
  838.  
  839.  
  840.  
  841.                     sdelay(3);
  842.                  }
  843.                  getch();
  844.                  videomodeset(vmode);
  845.                  exit(0);
  846.                }
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.                                                                          13
  898.  
  899.  
  900.  
  901.  
  902.  
  903.             BLKROTATE
  904.  
  905.                PROTOTYPE
  906.  
  907.                extern int  far blkrotate (int ang, int backfill,
  908.                RasterBlock far *sourcegfxblk, RasterBlock far *destgfxblk)
  909.  
  910.                INPUT
  911.  
  912.                ang - integer degree to rotate source bitmap
  913.                backfill - index to color in current palette to fill blank
  914.                space in destgfxblk
  915.                sourcegfxblk - RasterBlock pointer to source bitmap
  916.  
  917.                OUTPUT
  918.  
  919.                BLKROTATE returns 1 if successful, 0 if unsuccessful.
  920.                destgfxblk - rotated bitmap
  921.  
  922.                USAGE
  923.  
  924.                BLKROTATE takes the bitmap in sourcegfxblk and rotates by
  925.                the number of degrees specified in ang.  The bitmap rotation
  926.                algorithm is a three-pass shear technique modified to make
  927.                efficient use of this library's internal buffers.  Blank
  928.                space around the newly rotated block is filled with the
  929.                color given by backfill.  The resulting bitmap is stored in
  930.                destgfxblk.  The size of destgfxblk should be at least as
  931.                big as given by BLKROTATESIZE.
  932.  
  933.                The function will fail if it calculates that the internal
  934.                buffers would be overflowed or if the destination array
  935.                would be larger than 65536 bytes.  BLKROTATESIZE should be
  936.                called first to ensure that buffer integrity is maintained.
  937.  
  938.                SEE ALSO
  939.  
  940.                BLKGET, BLKPUT, BLKRESIZE, BLKROTATESIZE
  941.  
  942.                EXAMPLE
  943.  
  944.                /*
  945.                 * Show blkrotate
  946.                 */
  947.                #include <stdlib.h>
  948.                #include <math.h>
  949.                #include <conio.h>
  950.                #include "svgacc.h"
  951.  
  952.                void main(void)
  953.                {
  954.                  int xinc, yinc, x1, y1, x2, y2, i, j, colr, vmode, cntx,
  955.                cnty, rot;
  956.                  RasterBlock *gfxblk, *gfxblk2, *spritebkgnd;
  957.  
  958.  
  959.                                                                          14
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.                  vmode = videomodeget();
  967.                  if ( !whichvga() || (whichmem() < 512))
  968.                     exit(1);
  969.                  if ( !res640() )
  970.                     exit(1);
  971.                  xinc = maxx/10;
  972.                  yinc = maxy/20;
  973.                  x1 = maxx/2-xinc;
  974.                  y1 = maxy/2-yinc;
  975.                  x2 = maxx/2+xinc;
  976.                  y2 = maxy/2+yinc;
  977.                  i = (x2-x1+1)*(y2-y1+1)+4;
  978.                  gfxblk = (RasterBlock *)malloc(i);
  979.                  if (!gfxblk) {
  980.                     restext();
  981.                     printf("ERROR: Allocating memory for gfxblk: %d
  982.                bytes\n",i);
  983.                     exit(1);
  984.                  }
  985.                  colr = 1;
  986.                  for(i=0;i<=maxx/2;i++) {
  987.                     drwcircle(1,colr,maxx/4+i,maxy/2,maxy/5);
  988.                     colr+=1;
  989.                     if(colr>15)
  990.                       colr = 1;
  991.                  }
  992.                  drwbox(1,0,x1,y1,x2,y2);
  993.                  blkget(x1,y1,x2,y2,gfxblk);
  994.                  cntx = (x2-x1) / 2 + x1;
  995.                  cnty = (y2-y1) / 2 + y1;
  996.                  fillarea(x1+2,y1+2,0,0);
  997.                  i = blkrotatesize(45,gfxblk);
  998.                  if ( !i ) {
  999.                     restext();
  1000.                     printf("ERROR: rotated sprite will be to large");
  1001.                     exit(1);
  1002.                  }
  1003.                  spritebkgnd = (RasterBlock *)malloc(i);
  1004.                  if (!spritebkgnd) {
  1005.                     restext();
  1006.                     printf("ERROR: Allocating memory for spritebkgnd: %d
  1007.                bytes\n",i);
  1008.                     exit(1);
  1009.                  }
  1010.                  gfxblk2 = (RasterBlock *)malloc(i);
  1011.                  if (!gfxblk2) {
  1012.                     restext();
  1013.                     printf("ERROR: Allocating memory for gfxblk2: %d
  1014.                bytes\n",i);
  1015.                     exit(1);
  1016.                  }
  1017.                  blkget(x1,y1,x2,y2,spritebkgnd);
  1018.                  setview(0,64,maxx,maxy);
  1019.  
  1020.  
  1021.                                                                          15
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.                  for(i=0;i<=360;i+=3) {
  1028.                     rot = blkrotate(i,1,gfxblk,gfxblk2);
  1029.                     spriteput(SET,1,cntx-(spritebkgnd->width)/2,cnty-
  1030.                (spritebkgnd->height)/2,spritebkgnd);
  1031.                     spritegap(1,cntx-(gfxblk2->width)/2,cnty-(gfxblk2-
  1032.                >height)/2,gfxblk2,spritebkgnd);
  1033.                     sdelay(3);
  1034.                  }
  1035.                  spriteput(SET,1,cntx-(spritebkgnd->width)/2,cnty-
  1036.                (spritebkgnd->height)/2,spritebkgnd);
  1037.                  blkput(SET,x1,y1,(RasterBlock *)gfxblk);
  1038.                  videomodeset(vmode);
  1039.                  exit(0);
  1040.                }
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083.                                                                          16
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  
  1089.             BLKROTATESIZE
  1090.  
  1091.                PROTOTYPE
  1092.  
  1093.                extern int  far blkrotatesize (int ang, RasterBlock far
  1094.                *sourcegfxblk)
  1095.  
  1096.                INPUT
  1097.  
  1098.                ang - integer degree to rotate source bitmap
  1099.                sourcegfxblk - RasterBlock pointer to source bitmap
  1100.  
  1101.                OUTPUT
  1102.  
  1103.                BLKROTATESIZE returns the number of bytes needed for the
  1104.                destination array if successful, 0 if unsuccessful.
  1105.  
  1106.                USAGE
  1107.  
  1108.                BLKROTATESIZE takes the bitmap in sourcegfxblk and
  1109.                calculates the required size of the output buffer needed
  1110.                when BLKROTATE is called.  It also insures that the internal
  1111.                library buffers are not overflowed.  The function will fail
  1112.                if it calculates that the internal buffers would be
  1113.                overflowed or if the destination buffer would be larger than
  1114.                65536 bytes.  BLKROTATESIZE should be called prior to
  1115.                BLKROTATE to insure that buffer integrity is maintained.
  1116.  
  1117.                SEE ALSO
  1118.  
  1119.                BLKGET, BLKPUT, BLKRESIZE, BLKROTATE
  1120.  
  1121.                EXAMPLE
  1122.  
  1123.                See BLKROTATE
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.                                                                          17
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.             BYTECOPY
  1152.  
  1153.                PROTOTYPE
  1154.  
  1155.                extern void far bytecopy (void far *src, void far *dst, long
  1156.                numbytes)
  1157.  
  1158.                INPUT
  1159.  
  1160.                src - pointer to array to be copied
  1161.                numbytes - number of bytes to copy from src (<65536)
  1162.  
  1163.                OUTPUT
  1164.  
  1165.                no value returned
  1166.                dst - copy of array
  1167.  
  1168.                USAGE
  1169.  
  1170.                BYTECOPY copies the specified number of bytes from src to
  1171.                dst.  It assumes that space for dst has been properly
  1172.                allocated.  It is much faster than using a FOR loop or
  1173.                MEMCPY.
  1174.  
  1175.                SEE ALSO
  1176.  
  1177.                PALCOPY
  1178.  
  1179.                EXAMPLE
  1180.  
  1181.                /*
  1182.                 * show byte copy
  1183.                 */
  1184.                #include <stdlib.h>
  1185.                #include <conio.h>
  1186.                #include "svgacc.h"
  1187.  
  1188.                void main(void)
  1189.                {
  1190.                  int i;
  1191.                  int test1[10], test2[10];
  1192.  
  1193.                  for(i=0;i<10;i++)
  1194.                  {
  1195.                     test1[i] = i;
  1196.                  }
  1197.                  bytecopy(test1,test2,sizeof(test1));
  1198.                  printf("ok...we initialized one array with data, copied
  1199.                that\n");
  1200.                  printf("array to an a new array...here are the
  1201.                results:\n");
  1202.                  printf(" \n");
  1203.                  printf("source array         destination array\n");
  1204.                  for(i=0;i<10;i++)
  1205.  
  1206.  
  1207.                                                                          18
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.                  {
  1214.                     printf(" %d
  1215.                %d\n",test1[i],test2[i]);
  1216.                  }
  1217.                  exit(0);
  1218.                }
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  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.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.                                                                          19
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.             D2ROTATE
  1276.  
  1277.                PROTOTYPE
  1278.  
  1279.                extern void far d2rotate (int points, int xorigin, int
  1280.                yorigin, int ang, D2Point far *inary, D2Point far *outary)
  1281.  
  1282.                INPUT
  1283.  
  1284.                numpoints - number of points to be rotated
  1285.                xorigin, yorigin - center of rotation
  1286.                angle - angle of rotation about center
  1287.                inary - D2Point pointer to array containing points to rotate
  1288.  
  1289.                OUTPUT
  1290.  
  1291.                no value returned
  1292.                outary - D2Point array of rotated values
  1293.  
  1294.                USAGE
  1295.  
  1296.                D2ROTATE takes the two dimensional points given in inary and
  1297.                rotates them by the specified angle about xorigin, yorigin.
  1298.                The results are returned in outary which can be the same as
  1299.                inary.  A positive angle causes a clockwise rotation on the
  1300.                screen, from the positive X axis to the positive Y axis.
  1301.                The function assumes space for outary has been properly
  1302.                allocated.
  1303.  
  1304.                SEE ALSO
  1305.  
  1306.                D2SCALE, D2TRANSLATE
  1307.  
  1308.                EXAMPLE
  1309.  
  1310.                /*
  1311.                 * shows d2rotate works
  1312.                 */
  1313.  
  1314.                #include <stdlib.h>
  1315.                #include <conio.h>
  1316.                #include "svgacc.h"
  1317.  
  1318.                D2Point tri[3];
  1319.                D2Point trio[3];
  1320.                D2Point tri2[3];
  1321.  
  1322.                void drwtri(void);
  1323.                void ertri(void);
  1324.  
  1325.                void main(void)
  1326.                {
  1327.                  int vmode,i;
  1328.  
  1329.  
  1330.  
  1331.                                                                          20
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.                  vmode = videomodeget();
  1338.                  if (!whichvga())
  1339.                     exit(1);
  1340.                  if (whichmem()<512)
  1341.                     exit(1);
  1342.                  res640();
  1343.                  trio[0].x = 0;
  1344.                  trio[0].y = 0;
  1345.                  trio[1].x = -80;
  1346.                  trio[1].y = 60;
  1347.                  trio[2].x = 80;
  1348.                  trio[2].y = 60;
  1349.                  drwtri();
  1350.                  for(i=0;i<=360;i+=2)
  1351.                  {
  1352.                     d2rotate(3,0,0,i,trio,tri);
  1353.                     drwtri();
  1354.                     sdelay(2);
  1355.                     ertri();
  1356.                  }
  1357.                  drwtri();
  1358.                  getch();
  1359.                  videomodeset(vmode);
  1360.                  exit(0);
  1361.                }
  1362.  
  1363.                void drwtri(void)
  1364.                {
  1365.                  d2translate(3,320,240,tri,tri2);
  1366.                  drwline(1,10,tri2[0].x,tri2[0].y,tri2[1].x,tri2[1].y);
  1367.                  drwline(1,10,tri2[1].x,tri2[1].y,tri2[2].x,tri2[2].y);
  1368.                  drwline(1,10,tri2[2].x,tri2[2].y,tri2[0].x,tri2[0].y);
  1369.                  return;
  1370.                }
  1371.  
  1372.                void ertri(void)
  1373.                {
  1374.                  d2translate(3,320,240,tri,tri2);
  1375.                  drwline(1,0,tri2[0].x,tri2[0].y,tri2[1].x,tri2[1].y);
  1376.                  drwline(1,0,tri2[1].x,tri2[1].y,tri2[2].x,tri2[2].y);
  1377.                  drwline(1,0,tri2[2].x,tri2[2].y,tri2[0].x,tri2[0].y);
  1378.                  return;
  1379.                }
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.                                                                          21
  1394.  
  1395.  
  1396.  
  1397.  
  1398.  
  1399.             D2SCALE
  1400.  
  1401.                PROTOTYPE
  1402.  
  1403.                extern void far d2scale (int points, int scalex, int scaley,
  1404.                D2Point far *inary, D2Point far *outary)
  1405.  
  1406.                INPUT
  1407.  
  1408.                numpoints - number of points to scale
  1409.                scalex - scale factor along X axis
  1410.                scaley - scale factor along Y axis
  1411.                inary - D2Point pointer to array containing points to scale
  1412.  
  1413.                OUTPUT
  1414.  
  1415.                no value returned
  1416.                outary - D2Point array of scaled values
  1417.  
  1418.                USAGE
  1419.  
  1420.                D2SCALE multiplies each coordinate in the two dimensional
  1421.                array inary by the corresponding scale factor scalex or
  1422.                scaley.  The results are stored in outary which can be the
  1423.                same as inary.  A scale factor of 256 (100 hex) is
  1424.                considered 100 percent and results in no change.  Therefore,
  1425.                128 (80 hex) reduces values by one half and 512 (200 hex)
  1426.                doubles values.  The function assumes space for outary has
  1427.                been properly allocated.
  1428.  
  1429.                SEE ALSO
  1430.  
  1431.                D2ROTATE, D2TRANSLATE
  1432.  
  1433.                EXAMPLE
  1434.  
  1435.                /*
  1436.                 * shows d2scale works
  1437.                 */
  1438.  
  1439.                #include <stdlib.h>
  1440.                #include <conio.h>
  1441.                #include "svgacc.h"
  1442.  
  1443.                D2Point tri[3];
  1444.                D2Point trio[3];
  1445.                D2Point tri2[3];
  1446.  
  1447.                void drwtri(void);
  1448.                void ertri(void);
  1449.  
  1450.                void main(void)
  1451.                {
  1452.                  int vmode,i;
  1453.  
  1454.  
  1455.                                                                          22
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462.                  vmode = videomodeget();
  1463.                  if (!whichvga())
  1464.                     exit(1);
  1465.                  if (whichmem()<512)
  1466.                     exit(1);
  1467.                  res640();
  1468.                  trio[0].x = 0;
  1469.                  trio[0].y = 0;
  1470.                  trio[1].x = -80;
  1471.                  trio[1].y = 60;
  1472.                  trio[2].x = 80;
  1473.                  trio[2].y = 60;
  1474.                  drwtri();
  1475.                  for(i=256;i<=512;i+=4)
  1476.                  {
  1477.                     d2scale(3,i,i,trio,tri);
  1478.                     drwtri();
  1479.                     sdelay(2);
  1480.                     ertri();
  1481.                  }
  1482.                  for(i=512;i>=128;i-=4)
  1483.                  {
  1484.                     d2scale(3,i,i,trio,tri);
  1485.                     drwtri();
  1486.                     sdelay(2);
  1487.                     ertri();
  1488.                  }
  1489.                  for(i=128;i<=256;i+=4)
  1490.                  {
  1491.                     d2scale(3,i,i,trio,tri);
  1492.                     drwtri();
  1493.                     sdelay(2);
  1494.                     ertri();
  1495.                  }
  1496.                  drwtri();
  1497.                  getch();
  1498.                  videomodeset(vmode);
  1499.                  exit(0);
  1500.                }
  1501.  
  1502.                void drwtri(void)
  1503.                {
  1504.                  d2translate(3,320,240,tri,tri2);
  1505.                  drwline(1,10,tri2[0].x,tri2[0].y,tri2[1].x,tri2[1].y);
  1506.                  drwline(1,10,tri2[1].x,tri2[1].y,tri2[2].x,tri2[2].y);
  1507.                  drwline(1,10,tri2[2].x,tri2[2].y,tri2[0].x,tri2[0].y);
  1508.                  return;
  1509.                }
  1510.  
  1511.                void ertri(void)
  1512.                {
  1513.                  d2translate(3,320,240,tri,tri2);
  1514.                  drwline(1,0,tri2[0].x,tri2[0].y,tri2[1].x,tri2[1].y);
  1515.  
  1516.  
  1517.                                                                          23
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.                  drwline(1,0,tri2[1].x,tri2[1].y,tri2[2].x,tri2[2].y);
  1524.                  drwline(1,0,tri2[2].x,tri2[2].y,tri2[0].x,tri2[0].y);
  1525.                  return;
  1526.                }
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.                                                                          24
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.             D2TRANSLATE
  1586.  
  1587.                PROTOTYPE
  1588.  
  1589.                extern void far d2translate (int points, int xtrans, int
  1590.                ytrans, D2Point far *inary, D2Point far *outary)
  1591.  
  1592.                INPUT
  1593.  
  1594.                numpoints - number of points to be translated
  1595.                xtrans - distance to translate along X axis
  1596.                ytrans - distance to translate along Y axis
  1597.                inary - D2Point pointer to array containing points to
  1598.                translate
  1599.  
  1600.                OUTPUT
  1601.  
  1602.                no value returned
  1603.                outary - D2Point array of translated values
  1604.  
  1605.                USAGE
  1606.  
  1607.                D2TRANSLATE takes the two dimensional points given in inary
  1608.                and translates them by the specified number of pixels along
  1609.                each axis.  The results are returned in outary which can be
  1610.                the same as inary.  The function assumes that space for
  1611.                outary has been properly allocated.
  1612.  
  1613.                SEE ALSO
  1614.  
  1615.                D2ROTATE, D2SCALE
  1616.  
  1617.                EXAMPLE
  1618.  
  1619.                /*
  1620.                 * shows d2translate works
  1621.                 */
  1622.  
  1623.                #include <stdlib.h>
  1624.                #include <conio.h>
  1625.                #include "svgacc.h"
  1626.  
  1627.                D2Point tri[3];
  1628.                D2Point trio[3];
  1629.                D2Point tri2[3];
  1630.  
  1631.                void drwtri(void);
  1632.                void ertri(void);
  1633.  
  1634.                void main(void)
  1635.                {
  1636.                  int vmode,i;
  1637.  
  1638.                  vmode = videomodeget();
  1639.  
  1640.  
  1641.                                                                          25
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.                  if (!whichvga())
  1648.                     exit(1);
  1649.                  if (whichmem()<512)
  1650.                     exit(1);
  1651.                  res640();
  1652.                  trio[0].x = 0;
  1653.                  trio[0].y = 0;
  1654.                  trio[1].x = -80;
  1655.                  trio[1].y = 60;
  1656.                  trio[2].x = 80;
  1657.                  trio[2].y = 60;
  1658.                  drwtri();
  1659.                  for(i=0;i<=100;i+=4)
  1660.                  {
  1661.                     d2translate(3,i,i,trio,tri);
  1662.                     drwtri();
  1663.                     sdelay(2);
  1664.                     ertri();
  1665.                  }
  1666.                  for(i=100;i>=0;i-=4)
  1667.                  {
  1668.                     d2translate(3,i,i,trio,tri);
  1669.                     drwtri();
  1670.                     sdelay(2);
  1671.                     ertri();
  1672.                  }
  1673.                  drwtri();
  1674.                  getch();
  1675.                  videomodeset(vmode);
  1676.                  exit(0);
  1677.                }
  1678.  
  1679.                void drwtri(void)
  1680.                {
  1681.                  d2translate(3,320,240,tri,tri2);
  1682.                  drwline(1,10,tri2[0].x,tri2[0].y,tri2[1].x,tri2[1].y);
  1683.                  drwline(1,10,tri2[1].x,tri2[1].y,tri2[2].x,tri2[2].y);
  1684.                  drwline(1,10,tri2[2].x,tri2[2].y,tri2[0].x,tri2[0].y);
  1685.                  return;
  1686.                }
  1687.  
  1688.                void ertri(void)
  1689.                {
  1690.                  d2translate(3,320,240,tri,tri2);
  1691.                  drwline(1,0,tri2[0].x,tri2[0].y,tri2[1].x,tri2[1].y);
  1692.                  drwline(1,0,tri2[1].x,tri2[1].y,tri2[2].x,tri2[2].y);
  1693.                  drwline(1,0,tri2[2].x,tri2[2].y,tri2[0].x,tri2[0].y);
  1694.                  return;
  1695.                }
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.                                                                          26
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.             D3PROJECT
  1710.  
  1711.                PROTOTYPE
  1712.  
  1713.                extern int far d3project (int points, ProjParameters far
  1714.                *params, D3Point far *inary, D2Point far *outary)
  1715.  
  1716.                INPUT
  1717.  
  1718.                numpoints - number of points to be projected
  1719.                params - pointer to ProjParameters structure containing
  1720.                parameters used in projection
  1721.                  eyex, eyey, eyez - 3D location of viewer
  1722.                  scrd - distance from viewer to projection screen
  1723.                  theta - angle from positive 3D X axis to viewing
  1724.                direction
  1725.                  phi - angle from positive 3D Z axis to viewing direction
  1726.                inary - D3Point pointer to array containing points to
  1727.                project
  1728.  
  1729.                OUTPUT
  1730.  
  1731.                Returns 1 if successful, 0 if any one point failed.
  1732.                outary - D2Point array of projected values
  1733.  
  1734.                USAGE
  1735.                                   +Z axis
  1736.                                      |                   /\
  1737.                                      |                  /  \
  1738.                                      |            !     \ * \
  1739.                                      |            !......X: /
  1740.                                      |            ! Phi / \/
  1741.                                      |            !    /  :
  1742.                                      |            !   /   :
  1743.                                      |            !  /    :
  1744.                                      |       EyeX ! /ScrD :
  1745.                                      |       EyeY !/      :
  1746.                                      |       EyeZ *- - - -:- - - - -
  1747.                                      |           / `      :
  1748.                                      |          /   `     :
  1749.                                      |         /      `   :
  1750.                                      |        /      ---` :
  1751.                                      |       /___----
  1752.                                      |      /     Theta
  1753.                                      |
  1754.                                      |_____________________________+Y axis
  1755.                                      /
  1756.                                     /
  1757.                                    /
  1758.                                   /
  1759.                                  /
  1760.                                 /
  1761.                                /
  1762.                            +X axis
  1763.  
  1764.  
  1765.                                                                          27
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.                D3PROJECT projects a specified number, numpoints, of three
  1773.                dimensional points starting at inary into two dimensions
  1774.                according to the parameters in params.  The two dimensional
  1775.                points are stored in outary.  The function assumes space for
  1776.                outary has been properly allocated.  The location of the
  1777.                viewer in this three dimensional space is given by eyex,
  1778.                eyey, eyez in the ProjParameters structure.  The direction
  1779.                the viewer is facing is specified with scrd, theta, phi in
  1780.                the ProjParameters structure using spherical coordinates.  A
  1781.                virtual set of axes parallel to the true axes are placed at
  1782.                the viewer's location.  scrd is the distance from the viewer
  1783.                to the center of the projection screen, i.e. the currently
  1784.                defined viewport on the monitor's screen.  Theta is the
  1785.                angle in the virtual X-Y plane from the virtual X axis to
  1786.                the projection screen.  Positive angles rotate counter-
  1787.                clockwise in the X-Y plane.  Lastly, the angle of elevation
  1788.                above or below the virtual X-Y plane is given by phi.
  1789.                Positive angles direct viewing above the plane; negative
  1790.                below.
  1791.  
  1792.                If a point is projected to a location behind the viewer,
  1793.                i.e. on the side of the viewer opposite the projection
  1794.                screen, D3PROJECT returns a zero indicating one or more
  1795.                failed points.  The returned values of the X and Y for
  1796.                failed points will be -32768 to make them easily identified.
  1797.  
  1798.                SEE ALSO
  1799.  
  1800.                D3ROTATE, D3TRANSLATE, D3SCALE, FILLCONVEXPOLY, SETVIEW
  1801.  
  1802.                EXAMPLE
  1803.  
  1804.                /* shows d3project works */
  1805.                #include <stdlib.h>
  1806.                #include <conio.h>
  1807.                #include "svgacc.h"
  1808.  
  1809.                D2Point plot[8];
  1810.                void drwcube(void);
  1811.  
  1812.                void main(void)
  1813.                {
  1814.                  int vmode,i,dummy;
  1815.                  ProjParameters proj;
  1816.                  D3Point cube[8] = { { 100,-100, 100},
  1817.                                    { 100,-100,-100},
  1818.                                    { 100, 100,-100},
  1819.                                    { 100, 100, 100},
  1820.                                    {-100,-100, 100},
  1821.                                    {-100,-100,-100},
  1822.                                    {-100, 100,-100},
  1823.                                    {-100, 100, 100}};
  1824.  
  1825.  
  1826.  
  1827.                                                                          28
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.                  vmode = videomodeget();
  1834.                  if (!whichvga())
  1835.                     exit(1);
  1836.                  if (whichmem()<512)
  1837.                     exit(1);
  1838.                  res640();
  1839.                  proj.eyex = -1040;
  1840.                  proj.eyey = -600;
  1841.                  proj.eyez = -1200;
  1842.                  proj.scrd = 1700;
  1843.                  proj.theta = 30;
  1844.                  proj.phi = 45;
  1845.                  dummy = d3project(8,&proj,cube,plot);
  1846.                  drwcube();
  1847.                  getch();
  1848.                  videomodeset(vmode);
  1849.                }
  1850.  
  1851.                void drwcube(void)
  1852.                {
  1853.                  int i;
  1854.  
  1855.                  for(i=0;i<=2;i++)
  1856.  
  1857.                  drwline(1,10,plot[i].x,plot[i].y,plot[i+1].x,plot[i+1].y)
  1858.                ;
  1859.                  drwline(1,10,plot[3].x,plot[3].y,plot[0].x,plot[0].y);
  1860.                  for(i=4;i<=6;i++)
  1861.  
  1862.                  drwline(1,10,plot[i].x,plot[i].y,plot[i+1].x,plot[i+1].y)
  1863.                ;
  1864.                  drwline(1,10,plot[7].x,plot[7].y,plot[4].x,plot[4].y);
  1865.                  for(i=0;i<=3;i++)
  1866.  
  1867.                  drwline(1,10,plot[i].x,plot[i].y,plot[i+4].x,plot[i+4].y)
  1868.                ;
  1869.                  return;
  1870.                }
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.                                                                          29
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.             D3ROTATE
  1896.  
  1897.                PROTOTYPE
  1898.  
  1899.                extern void far d3rotate (int points, int xorigin, int
  1900.                  yorigin, int zorigin, int zrang, int yrang, int xrang,
  1901.                  D3Point far *inary, D3Point far *outary)
  1902.  
  1903.                INPUT
  1904.  
  1905.                numpoints - number of points to be rotated
  1906.                xorigin, yorigin, zorigin - center of rotation
  1907.                zrang - angle of rotation about the Z axis
  1908.                yrang - angle of rotation about the Y axis
  1909.                xrang - angle of rotation about the X axis
  1910.                inary - D3Point pointer to array containing points to rotate
  1911.  
  1912.                OUTPUT
  1913.  
  1914.                no value returned
  1915.                outary - D3Point array of rotated values
  1916.  
  1917.                USAGE
  1918.  
  1919.                D3ROTATE takes the three dimensional points given in inary
  1920.                and rotates them by the specified angles about xorigin,
  1921.                yorigin, zorigin.  The results are returned in outary which
  1922.                can be the same as inary.  A virtual set of axes are placed
  1923.                at the origin of rotation and rotation takes place about
  1924.                these axes.  A positive angle causes a counter-clockwise
  1925.                rotation from the positive X axis to the positive Y axis.
  1926.                The function assumes space for outary has been properly
  1927.                allocated.
  1928.  
  1929.                SEE ALSO
  1930.  
  1931.                D3PROJECT, D3SCALE, D3TRANSLATE
  1932.  
  1933.                EXAMPLE
  1934.  
  1935.                /*
  1936.                 * shows d3rotate works
  1937.                 */
  1938.  
  1939.                #include <stdlib.h>
  1940.                #include <conio.h>
  1941.                #include "svgacc.h"
  1942.  
  1943.                D2Point plot[8];
  1944.  
  1945.                void drwcube(void);
  1946.  
  1947.                void main(void)
  1948.                {
  1949.  
  1950.  
  1951.                                                                          30
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.                  int vmode,i,dummy;
  1958.                  ProjParameters proj;
  1959.                  D3Point rcube[8];
  1960.                  D3Point cube[8] = { { 100,-100, 100},
  1961.                                    { 100,-100,-100},
  1962.                                    { 100, 100,-100},
  1963.                                    { 100, 100, 100},
  1964.                                    {-100,-100, 100},
  1965.                                    {-100,-100,-100},
  1966.                                    {-100, 100,-100},
  1967.                                    {-100, 100, 100}};
  1968.  
  1969.                  vmode = videomodeget();
  1970.                  if (!whichvga() || (whichmem() < 512))
  1971.                     exit(1);
  1972.                  res640();
  1973.  
  1974.                  proj.eyex = -1040;
  1975.                  proj.eyey = -600;
  1976.                  proj.eyez = -1200;
  1977.                  proj.scrd = 1700;
  1978.                  proj.theta = 30;
  1979.                  proj.phi = 45;
  1980.  
  1981.                  for(i=0;i<=360;i+=2)
  1982.                  {
  1983.                     d3rotate(8,0,0,0,i,i,i,cube,rcube);
  1984.                     dummy = d3project(8,&proj,rcube,plot);
  1985.                     drwcube();
  1986.                     sdelay(2);
  1987.                     drwcube();
  1988.                  }
  1989.  
  1990.                  drwcube();
  1991.  
  1992.                  getch();
  1993.  
  1994.                  videomodeset(vmode);
  1995.                }
  1996.  
  1997.                void drwcube(void)
  1998.                {
  1999.                  int j;
  2000.  
  2001.                  for(j=0;j<=2;j++)
  2002.  
  2003.                  drwline(2,10,plot[j].x,plot[j].y,plot[j+1].x,plot[j+1].y)
  2004.                ;
  2005.                  drwline(2,10,plot[3].x,plot[3].y,plot[0].x,plot[0].y);
  2006.  
  2007.                  for(j=4;j<=6;j++)
  2008.  
  2009.                  drwline(2,10,plot[j].x,plot[j].y,plot[j+1].x,plot[j+1].y)
  2010.                ;
  2011.  
  2012.  
  2013.                                                                          31
  2014.  
  2015.  
  2016.  
  2017.  
  2018.  
  2019.                  drwline(2,10,plot[7].x,plot[7].y,plot[4].x,plot[4].y);
  2020.  
  2021.                  for(j=0;j<=3;j++)
  2022.  
  2023.                  drwline(2,10,plot[j].x,plot[j].y,plot[j+4].x,plot[j+4].y)
  2024.                ;
  2025.  
  2026.                  return;
  2027.                }
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.  
  2054.  
  2055.  
  2056.  
  2057.  
  2058.  
  2059.  
  2060.  
  2061.  
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.                                                                          32
  2076.  
  2077.  
  2078.  
  2079.  
  2080.  
  2081.             D3SCALE
  2082.  
  2083.                PROTOTYPE
  2084.  
  2085.                extern void far d3scale (int points, int xscale, int yscale,
  2086.                  int zscale, D3Point far *inary, D3Point far *outary)
  2087.  
  2088.                INPUT
  2089.  
  2090.                numpoints - number of points to scale
  2091.                xscale - scale factor along X axis
  2092.                yscale - scale factor along Y axis
  2093.                zscale - scale factor along Z axis
  2094.                inary - D3Point pointer to array containing points to scale
  2095.  
  2096.                OUTPUT
  2097.  
  2098.                no value returned
  2099.                outary - D3Point array of scaled values
  2100.  
  2101.                USAGE
  2102.  
  2103.                D3SCALE multiplies each coordinate in the three dimensional
  2104.                array inary by the corresponding scale factor xscale, yscale
  2105.                or zscale.  The results are stored in outary which can be
  2106.                the same as inary.  A scale factor of 256 (100 hex) is
  2107.                considered 100 percent and results in no change.  Therefore,
  2108.                128 (80 hex) reduces values by one half and 512 (200 hex)
  2109.                doubles values.  The function assumes space for outary has
  2110.                been properly allocated.
  2111.  
  2112.                SEE ALSO
  2113.  
  2114.                D3PROJECT, D3ROTATE, D3TRANSLATE
  2115.  
  2116.                EXAMPLE
  2117.  
  2118.                /*
  2119.                 * shows d3scale works
  2120.                 */
  2121.  
  2122.                #include <stdlib.h>
  2123.                #include <conio.h>
  2124.                #include "svgacc.h"
  2125.  
  2126.                D2Point plot[8];
  2127.  
  2128.                void drwcube(void);
  2129.  
  2130.                void main(void)
  2131.                {
  2132.                  int vmode,i,dummy;
  2133.                  ProjParameters proj;
  2134.                  D3Point scube[8];
  2135.  
  2136.  
  2137.                                                                          33
  2138.  
  2139.  
  2140.  
  2141.  
  2142.  
  2143.                  D3Point cube[8] = { { 100,-100, 100},
  2144.                                    { 100,-100,-100},
  2145.                                    { 100, 100,-100},
  2146.                                    { 100, 100, 100},
  2147.                                    {-100,-100, 100},
  2148.                                    {-100,-100,-100},
  2149.                                    {-100, 100,-100},
  2150.                                    {-100, 100, 100}};
  2151.  
  2152.                  vmode = videomodeget();
  2153.                  if (!whichvga() || (whichmem() < 512))
  2154.                     exit(1);
  2155.                  res640();
  2156.  
  2157.                  proj.eyex = -1040;
  2158.                  proj.eyey = -600;
  2159.                  proj.eyez = -1200;
  2160.                  proj.scrd = 1700;
  2161.                  proj.theta = 30;
  2162.                  proj.phi = 45;
  2163.  
  2164.                  for(i=256;i>=128;i-=4)
  2165.                  {
  2166.                     d3scale(8,i,i,i,cube,scube);
  2167.                     dummy = d3project(8,&proj,scube,plot);
  2168.                     drwcube();
  2169.                     sdelay(2);
  2170.                     drwcube();
  2171.                  }
  2172.                  for(i=132;i<=256;i+=4)
  2173.                  {
  2174.                     d3scale(8,i,i,i,cube,scube);
  2175.                     dummy = d3project(8,&proj,scube,plot);
  2176.                     drwcube();
  2177.                     sdelay(2);
  2178.                     drwcube();
  2179.                  }
  2180.                  drwcube();
  2181.                  getch();
  2182.                  videomodeset(vmode);
  2183.                }
  2184.  
  2185.                void drwcube(void)
  2186.                {
  2187.                  int j;
  2188.  
  2189.                  for(j=0;j<=2;j++)
  2190.  
  2191.                  drwline(2,10,plot[j].x,plot[j].y,plot[j+1].x,plot[j+1].y)
  2192.                ;
  2193.                  drwline(2,10,plot[3].x,plot[3].y,plot[0].x,plot[0].y);
  2194.  
  2195.                  for(j=4;j<=6;j++)
  2196.  
  2197.  
  2198.  
  2199.                                                                          34
  2200.  
  2201.  
  2202.  
  2203.  
  2204.  
  2205.  
  2206.                  drwline(2,10,plot[j].x,plot[j].y,plot[j+1].x,plot[j+1].y)
  2207.                ;
  2208.                  drwline(2,10,plot[7].x,plot[7].y,plot[4].x,plot[4].y);
  2209.  
  2210.                  for(j=0;j<=3;j++)
  2211.  
  2212.                  drwline(2,10,plot[j].x,plot[j].y,plot[j+4].x,plot[j+4].y)
  2213.                ;
  2214.  
  2215.                  return;
  2216.                }
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.  
  2252.  
  2253.  
  2254.  
  2255.  
  2256.  
  2257.  
  2258.  
  2259.  
  2260.  
  2261.                                                                          35
  2262.  
  2263.  
  2264.  
  2265.  
  2266.  
  2267.             D3TRANSLATE
  2268.  
  2269.                PROTOTYPE
  2270.  
  2271.                extern void far d3translate (int points, int xtrans, int
  2272.                  ytrans, int ztrans, D3Point far *inary, D3Point far
  2273.                  *outary)
  2274.  
  2275.                INPUT
  2276.  
  2277.                numpoints - number of points to translate
  2278.                xtrans - distance to translate along X axis
  2279.                ytrans - distance to translate along Y axis
  2280.                ztrans - distance to translate along Z axis
  2281.                inary - D3Point pointer to array containing points to
  2282.                translate
  2283.  
  2284.                OUTPUT
  2285.  
  2286.                no value returned
  2287.                outary - D3Point array of translated points
  2288.  
  2289.                USAGE
  2290.  
  2291.                D3TRANSLATE takes the three dimensional points given in
  2292.                inary and translates them by the specified number of pixels
  2293.                along each axis.  The results are returned in outary which
  2294.                can be the same as inary.  The function assumes space for
  2295.                outary has been properly allocated.
  2296.  
  2297.                SEE ALSO
  2298.  
  2299.                D3PROJECT, D3ROTATE, D3SCALE
  2300.  
  2301.                EXAMPLE
  2302.  
  2303.                /*
  2304.                 * shows d3translate works
  2305.                 */
  2306.  
  2307.                #include <stdlib.h>
  2308.                #include <conio.h>
  2309.                #include "svgacc.h"
  2310.  
  2311.                D2Point plot[8];
  2312.  
  2313.                void drwcube(void);
  2314.  
  2315.                void main(void)
  2316.                {
  2317.                  int vmode,i,dummy;
  2318.                  ProjParameters proj;
  2319.                  D3Point tcube[8];
  2320.                  D3Point cube[8] = { { 100,-100, 100},
  2321.  
  2322.  
  2323.                                                                          36
  2324.  
  2325.  
  2326.  
  2327.  
  2328.  
  2329.                                    { 100,-100,-100},
  2330.                                    { 100, 100,-100},
  2331.                                    { 100, 100, 100},
  2332.                                    {-100,-100, 100},
  2333.                                    {-100,-100,-100},
  2334.                                    {-100, 100,-100},
  2335.                                    {-100, 100, 100}};
  2336.  
  2337.                  vmode = videomodeget();
  2338.                  if (!whichvga() || (whichmem() < 512))
  2339.                     exit(1);
  2340.                  res640();
  2341.  
  2342.                  proj.eyex = -1040;
  2343.                  proj.eyey = -600;
  2344.                  proj.eyez = -1200;
  2345.                  proj.scrd = 1700;
  2346.                  proj.theta = 30;
  2347.                  proj.phi = 45;
  2348.  
  2349.                  for(i=0;i<=400;i+=8)
  2350.                  {
  2351.                     d3translate(8,i,i,i,cube,tcube);
  2352.                     dummy = d3project(8,&proj,tcube,plot);
  2353.                     drwcube();
  2354.                     sdelay(2);
  2355.                     drwcube();
  2356.                  }
  2357.                  for(i=400;i>=0;i-=8)
  2358.                  {
  2359.                     d3translate(8,i,i,i,cube,tcube);
  2360.                     dummy = d3project(8,&proj,tcube,plot);
  2361.                     drwcube();
  2362.                     sdelay(2);
  2363.                     drwcube();
  2364.                  }
  2365.                  drwcube();
  2366.                  getch();
  2367.                  videomodeset(vmode);
  2368.                }
  2369.  
  2370.                void drwcube(void)
  2371.                {
  2372.                  int j;
  2373.  
  2374.                  for(j=0;j<=2;j++)
  2375.  
  2376.                  drwline(2,10,plot[j].x,plot[j].y,plot[j+1].x,plot[j+1].y)
  2377.                ;
  2378.                  drwline(2,10,plot[3].x,plot[3].y,plot[0].x,plot[0].y);
  2379.  
  2380.                  for(j=4;j<=6;j++)
  2381.  
  2382.  
  2383.  
  2384.  
  2385.                                                                          37
  2386.  
  2387.  
  2388.  
  2389.  
  2390.  
  2391.  
  2392.                  drwline(2,10,plot[j].x,plot[j].y,plot[j+1].x,plot[j+1].y)
  2393.                ;
  2394.                  drwline(2,10,plot[7].x,plot[7].y,plot[4].x,plot[4].y);
  2395.  
  2396.                  for(j=0;j<=3;j++)
  2397.  
  2398.                  drwline(2,10,plot[j].x,plot[j].y,plot[j+4].x,plot[j+4].y)
  2399.                ;
  2400.  
  2401.                  return;
  2402.                }
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.                                                                          38
  2448.  
  2449.  
  2450.  
  2451.  
  2452.  
  2453.             DRWBOX
  2454.  
  2455.                PROTOTYPE
  2456.  
  2457.                extern void far drwbox (PixelMode mode, int colr, int x1,
  2458.                int y1, int x2, int y2)
  2459.  
  2460.                INPUT
  2461.  
  2462.                mode - pixel write mode
  2463.                colr - index to color in current palette
  2464.                x1, y1 - location of top left corner
  2465.                x2, y2 - location of bottom right corner
  2466.  
  2467.                OUTPUT
  2468.  
  2469.                no value returned
  2470.  
  2471.                USAGE
  2472.  
  2473.                DRWBOX draws a rectangle with the specified color using mode
  2474.                with opposite vertices defined by (x1, y1) and (x2, y2).
  2475.                The vertices given do not need to be exactly the top left
  2476.                and bottom right.  They only have to reference opposite
  2477.                vertices of the rectangle.  Any portion of the rectangle
  2478.                that lies outside of the currently defined viewport will not
  2479.                be drawn.
  2480.  
  2481.                SEE ALSO
  2482.  
  2483.                DRWFILLBOX, DRWLINE, SETVIEW
  2484.  
  2485.                EXAMPLE
  2486.  
  2487.                /*
  2488.                 * Places a box around the whole screen
  2489.                 */
  2490.  
  2491.                #include <stdlib.h>
  2492.                #include <conio.h>
  2493.                #include "svgacc.h"
  2494.  
  2495.                void main(void)
  2496.                {
  2497.                  int vmode;
  2498.  
  2499.                  vmode = videomodeget();
  2500.                  if ( !whichvga() )
  2501.                     exit(1);
  2502.                  if ( whichmem() < 512)
  2503.                     exit(1);
  2504.                  res640();
  2505.                  drwbox (1,10,0,0,639,479);
  2506.                  getch();
  2507.  
  2508.  
  2509.                                                                          39
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.                  videomodeset(vmode);
  2516.                  exit(0);
  2517.                }
  2518.  
  2519.  
  2520.  
  2521.  
  2522.  
  2523.  
  2524.  
  2525.  
  2526.  
  2527.  
  2528.  
  2529.  
  2530.  
  2531.  
  2532.  
  2533.  
  2534.  
  2535.  
  2536.  
  2537.  
  2538.  
  2539.  
  2540.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.                                                                          40
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.             DRWCIRCLE
  2578.  
  2579.                PROTOTYPE
  2580.  
  2581.                extern void far drwcircle (PixelMode mode, int colr, int
  2582.                xcenter, int ycenter, int radius)
  2583.  
  2584.                INPUT
  2585.  
  2586.                mode - pixel write mode
  2587.                colr - index to color in current palette
  2588.                xcenter, ycenter - location of center of circle
  2589.                radius - distance from center to edge of circle
  2590.  
  2591.                OUTPUT
  2592.  
  2593.                no value returned
  2594.  
  2595.                USAGE
  2596.  
  2597.                DRWCIRCLE draws a circle of the specified color using mode
  2598.                with the center located at (xcenter, ycenter) and a radius
  2599.                of radius.  All values of xcenter, ycenter and radius are
  2600.                valid.  Any portion of the circle that lies outside of the
  2601.                currently defined viewport will not be drawn.
  2602.  
  2603.                SEE ALSO
  2604.  
  2605.                DRWELLIPSE, DRWFILLCIRCLE, SETVIEW
  2606.  
  2607.                EXAMPLE
  2608.  
  2609.                /*
  2610.                 * Places a circle at the center of the screen
  2611.                 */
  2612.  
  2613.                #include <stdlib.h>
  2614.                #include <conio.h>
  2615.                #include "svgacc.h"
  2616.  
  2617.                void main(void)
  2618.                {
  2619.                  int vmode;
  2620.  
  2621.                  vmode = videomodeget();
  2622.                  if ( !whichvga() )
  2623.                     exit(1);
  2624.                  if ( whichmem() < 512)
  2625.                     exit(1);
  2626.                  res640();
  2627.                  drwcircle (1,10,320,240,200);
  2628.                  getch();
  2629.                  videomodeset(vmode);
  2630.                  exit(0);
  2631.  
  2632.  
  2633.                                                                          41
  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.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.                                                                          42
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.             DRWELLIPSE
  2702.  
  2703.                PROTOTYPE
  2704.  
  2705.                extern void far drwellipse (PixelMode mode, int colr, int
  2706.                xcenter, int ycenter, int radiusx, int radiusy)
  2707.  
  2708.                INPUT
  2709.  
  2710.                mode - pixel write mode
  2711.                colr - index to color in current palette
  2712.                xcenter, ycenter - location of center of ellipse
  2713.                radiusx - radius parallel to X axis
  2714.                radiusy - radius parallel to Y axis
  2715.  
  2716.                OUTPUT
  2717.  
  2718.                no value returned
  2719.  
  2720.                USAGE
  2721.  
  2722.                DRWELLIPSE draws an ellipse of the specified color using
  2723.                mode with the center defined by (xcenter, ycenter).  The
  2724.                radius in the horizontal direction is raduisx and the radius
  2725.                in the vertical direction is radiusy.  All values of
  2726.                xcenter, ycenter, radiusx and radiusy are valid.  Any
  2727.                portion of the ellipse that lies outside of the currently
  2728.                defined viewport will not be drawn.
  2729.  
  2730.                SEE ALSO
  2731.  
  2732.                DRWCIRCLE, DRWFILLELLIPSE, SETVIEW
  2733.  
  2734.                EXAMPLE
  2735.  
  2736.                /*
  2737.                 * Places an ellipse at the center of the screen
  2738.                 */
  2739.  
  2740.                #include <stdlib.h>
  2741.                #include <conio.h>
  2742.                #include "svgacc.h"
  2743.  
  2744.                void main(void)
  2745.                {
  2746.                  int vmode;
  2747.  
  2748.                  vmode = videomodeget();
  2749.                  if ( !whichvga() )
  2750.                     exit(1);
  2751.                  if ( whichmem() < 512)
  2752.                     exit(1);
  2753.                  res640();
  2754.                  drwellipse (1,10,320,240,318,238);
  2755.  
  2756.  
  2757.                                                                          43
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.                  getch();
  2764.                  videomodeset(vmode);
  2765.                  exit(0);
  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.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.                                                                          44
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.             DRWFILLBOX
  2826.  
  2827.                PROTOTYPE
  2828.  
  2829.                extern void far drwfillbox (PixelMode mode, int colr, int
  2830.                x1, int y1, int x2, int y2)
  2831.  
  2832.                INPUT
  2833.  
  2834.                mode - pixel write mode
  2835.                colr - index to color in current palette
  2836.                x1, y1 - location of top left corner
  2837.                x2, y2 - location of bottom right corner
  2838.  
  2839.                OUTPUT
  2840.  
  2841.                no value returned
  2842.  
  2843.                USAGE
  2844.  
  2845.                DRWFILLBOX draws a solid rectangle with the specified color
  2846.                using mode with opposite vertices defined by (x1, y1) and
  2847.                (x2, y2).  The vertices given do not need to be exactly the
  2848.                top left and bottom right.  They only have to reference
  2849.                opposite vertices of the rectangle.  Any portion of the
  2850.                rectangle that lies outside of the currently defined
  2851.                viewport will not be drawn.
  2852.  
  2853.                SEE ALSO
  2854.  
  2855.                DRWBOX, DRWLINE, FILLCONVEXPOLY, SETVIEW
  2856.  
  2857.                EXAMPLE
  2858.  
  2859.                /*
  2860.                 * Places a filled box in the center of the screen
  2861.                 */
  2862.  
  2863.                #include <stdlib.h>
  2864.                #include <conio.h>
  2865.                #include "svgacc.h"
  2866.  
  2867.                void main(void)
  2868.                {
  2869.                  int vmode;
  2870.                  vmode = videomodeget();
  2871.                  if ( !whichvga() )
  2872.                     exit(1);
  2873.                  if ( whichmem() < 512)
  2874.                       exit(1);
  2875.                  if ( !res640() )
  2876.                       exit(1);
  2877.                  drwfillbox (1,10,270,190,370,290);
  2878.                  getch();
  2879.  
  2880.  
  2881.                                                                          45
  2882.  
  2883.  
  2884.  
  2885.  
  2886.  
  2887.                  videomodeset(vmode);
  2888.                  exit(0);
  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.  
  2938.  
  2939.  
  2940.  
  2941.  
  2942.  
  2943.                                                                          46
  2944.  
  2945.  
  2946.  
  2947.  
  2948.  
  2949.             DRWFILLCIRCLE
  2950.  
  2951.                PROTOTYPE
  2952.  
  2953.                extern void far drwfillcircle (PixelMode mode, int colr, int
  2954.                xcenter, int ycenter, int radius)
  2955.  
  2956.                INPUT
  2957.  
  2958.                mode - pixel write mode
  2959.                colr - index to color in current palette
  2960.                xcenter, ycenter - location of center of circle
  2961.                radius - distance from center to edge of circle
  2962.  
  2963.                OUTPUT
  2964.  
  2965.                no value returned
  2966.  
  2967.                USAGE
  2968.  
  2969.                DRWFILLCIRCLE draws a solid circle of the specified color
  2970.                using mode with the center located at (xcenter, ycenter) and
  2971.                a radius of radius.  All values of xcenter, ycenter and
  2972.                radius are valid.  Any portion of the circle that lies
  2973.                outside of the currently defined viewport will not be drawn.
  2974.  
  2975.                SEE ALSO
  2976.  
  2977.                DRWCIRCLE, SETVIEW
  2978.  
  2979.                EXAMPLE
  2980.  
  2981.                /*
  2982.                 * Places a filled circle at the center of the screen
  2983.                 */
  2984.  
  2985.                #include <stdlib.h>
  2986.                #include <conio.h>
  2987.                #include "svgacc.h"
  2988.  
  2989.                void main(void)
  2990.                {
  2991.                  int vmode;
  2992.                  vmode = videomodeget();
  2993.                  if ( !whichvga() )
  2994.                     exit(1);
  2995.                  if ( whichmem() < 512)
  2996.                     exit(1);
  2997.                  if ( !res640() )
  2998.                     exit(1);
  2999.                  drwfillcircle (1,10,320,240,100);
  3000.                  getch();
  3001.                  videomodeset(vmode);
  3002.                  exit(0);
  3003.  
  3004.  
  3005.                                                                          47
  3006.  
  3007.  
  3008.  
  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.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.                                                                          48
  3068.  
  3069.  
  3070.  
  3071.  
  3072.  
  3073.             DRWFILLELLIPSE
  3074.  
  3075.                PROTOTYPE
  3076.  
  3077.                extern void far drwfillellipse (PixelMode mode, int colr,
  3078.                int xcenter, int ycenter, int radiusx, int radiusy)
  3079.  
  3080.                INPUT
  3081.  
  3082.                mode - pixel write mode
  3083.                colr - index to color in current palette
  3084.                xcenter, ycenter - location of center of ellipse
  3085.                radiusx - radius parallel to X axis
  3086.                radiusy - radius parallel to Y axis
  3087.  
  3088.                OUTPUT
  3089.  
  3090.                no value returned
  3091.  
  3092.                USAGE
  3093.  
  3094.                DRWFILLELLIPSE draws an ellipse of the specified color using
  3095.                mode with the center defined by (xcenter, ycenter).  The
  3096.                radius in the horizontal direction is raduisx and the radius
  3097.                in the vertical direction is radiusy.  All values of
  3098.                xcenter, ycenter, radiusx and radiusy are valid.  Any
  3099.                portion of the ellipse that lies outside of the currently
  3100.                defined viewport will not be drawn.
  3101.  
  3102.                SEE ALSO
  3103.  
  3104.                DRWELLIPSE, SETVIEW
  3105.  
  3106.                EXAMPLE
  3107.  
  3108.                /*
  3109.                 * Places a filled ellipse at the center of the screen
  3110.                 */
  3111.  
  3112.                #include <stdlib.h>
  3113.                #include <conio.h>
  3114.                #include "svgacc.h"
  3115.  
  3116.                void main(void)
  3117.                {
  3118.                  int vmode;
  3119.                  vmode = videomodeget();
  3120.                  if ( !whichvga() )
  3121.                     exit(1);
  3122.                  if ( whichmem() < 512)
  3123.                     exit(1);
  3124.                  if ( !res640() )
  3125.                  exit(1);
  3126.                  drwfillellipse (1,10,320,240,218,138);
  3127.  
  3128.  
  3129.                                                                          49
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.                  getch();
  3136.                  videomodeset(vmode);
  3137.                  exit(0);
  3138.                }
  3139.  
  3140.  
  3141.  
  3142.  
  3143.  
  3144.  
  3145.  
  3146.  
  3147.  
  3148.  
  3149.  
  3150.  
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.  
  3164.  
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.  
  3173.  
  3174.  
  3175.  
  3176.  
  3177.  
  3178.  
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.                                                                          50
  3192.  
  3193.  
  3194.  
  3195.  
  3196.  
  3197.             DRWLINE
  3198.  
  3199.                PROTOTYPE
  3200.  
  3201.                extern void far drwline (PixelMode mode, int colr, int x1,
  3202.                int y1, int x2, int y2)
  3203.  
  3204.                INPUT
  3205.  
  3206.                mode - pixel write mode
  3207.                colr - index to color in current palette
  3208.                x1, y1 - location of one endpoint of line
  3209.                x2, y2 - location of other endpoint of line
  3210.  
  3211.                OUTPUT
  3212.  
  3213.                no value returned
  3214.  
  3215.                USAGE
  3216.  
  3217.                DRWLINE draws a line of the specified color using mode with
  3218.                endpoints located at (x1, y1) And (x2, y2).  All values of
  3219.                x1, y1, x2 and y2 are valid.  Any portion of the line that
  3220.                lies outside of the currently defined viewport will not be
  3221.                drawn.
  3222.  
  3223.                SEE ALSO
  3224.  
  3225.                DRWBOX, SETVIEW
  3226.  
  3227.                EXAMPLE
  3228.  
  3229.                /*
  3230.                 * Draws a line from 0,0 to the center of the screen
  3231.                 */
  3232.  
  3233.                #include <stdlib.h>
  3234.                #include <conio.h>
  3235.                #include "svgacc.h"
  3236.  
  3237.                void main(void)
  3238.                {
  3239.                  int vmode;
  3240.                  vmode = videomodeget();
  3241.                  if ( !whichvga() )
  3242.                     exit(1);
  3243.                  if ( whichmem() < 512)
  3244.                     exit(1);
  3245.                  res640();
  3246.                  drwline (1,10,0,0,320,240);
  3247.                  getch();
  3248.                  videomodeset(vmode);
  3249.                  exit(0);
  3250.                }
  3251.  
  3252.  
  3253.                                                                          51
  3254.  
  3255.  
  3256.  
  3257.  
  3258.  
  3259.             DRWPOINT
  3260.  
  3261.                PROTOTYPE
  3262.  
  3263.                extern void far drwpoint (PixelMode mode, int colr, int x,
  3264.                int y)
  3265.  
  3266.                INPUT
  3267.  
  3268.                mode - pixel write mode
  3269.                colr - index to color in current palette
  3270.                x, y - location of pixel to write
  3271.  
  3272.                OUTPUT
  3273.  
  3274.                no value returned
  3275.  
  3276.                USAGE
  3277.  
  3278.                DRWPOINT draws a single point of the specified color using
  3279.                mode at (x, y).  All values of x and y are valid.  If the
  3280.                point (x, y) lies outside of the currently defined viewport,
  3281.                no drawing will take place.
  3282.  
  3283.                SEE ALSO
  3284.  
  3285.                GETPOINT, SETVIEW
  3286.  
  3287.                EXAMPLE
  3288.  
  3289.                /*
  3290.                 * Draws a point at the center of the screen
  3291.                 */
  3292.  
  3293.                #include <stdlib.h>
  3294.                #include <conio.h>
  3295.                #include "svgacc.h"
  3296.  
  3297.                void main(void)
  3298.                {
  3299.                  int vmode;
  3300.  
  3301.                  vmode = videomodeget();
  3302.                  if ( !whichvga() )
  3303.                     exit(1);
  3304.                  if ( whichmem() < 512)
  3305.                     exit(1);
  3306.                  res640();
  3307.                  drwpoint (1,10,320,240);
  3308.                  getch();
  3309.                  videomodeset(vmode);
  3310.                  exit(0);
  3311.                }
  3312.  
  3313.  
  3314.  
  3315.                                                                          52
  3316.  
  3317.  
  3318.  
  3319.  
  3320.  
  3321.             DRWSTRING
  3322.  
  3323.                PROTOTYPE
  3324.  
  3325.                extern void far drwstring (PixelMode mode, int fcolr, int
  3326.                bcolr, const char far *strng, int x, int y)
  3327.  
  3328.                INPUT
  3329.  
  3330.                mode - pixel write mode
  3331.                fcolr - foreground index to color in current palette
  3332.                bcolr - background index to color in current palette
  3333.                strng - char pointer to string of ASCII characters to be
  3334.                drawn
  3335.                x, y - location of upper, left corner of block
  3336.  
  3337.                OUTPUT
  3338.  
  3339.                no value returned
  3340.  
  3341.                USAGE
  3342.  
  3343.                DRWSTRING takes the null terminated ASCII characters
  3344.                beginning at strng and creates a graphics block similar to
  3345.                the blocks used by blkget and blkput and places this block
  3346.                on the screen at the specified coordinates.  The characters
  3347.                are drawn with color fcolr using the current font and the
  3348.                background is color bcolr.  When mode 0, NO_ACTION, is used,
  3349.                the graphics block is created in memory, retrievable by
  3350.                GETLASTSTRING, but no text is actually drawn on the screen.
  3351.                (Note: the system font is automatically installed when
  3352.                WHICHVGA is called.)
  3353.  
  3354.                SEE ALSO
  3355.  
  3356.                FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRINGDN, DRWSTRINGLT,
  3357.                DRWSTRINGRT, GETLASTSTRING
  3358.  
  3359.                EXAMPLE
  3360.  
  3361.                /*
  3362.                 * Draws some normal text at the center of the screen
  3363.                 */
  3364.                #include <stdlib.h>
  3365.                #include <conio.h>
  3366.                #include "svgacc.h"
  3367.  
  3368.                void main(void)
  3369.                {
  3370.                  int vmode;
  3371.                  char text[]="hello world";
  3372.  
  3373.                  vmode = videomodeget();
  3374.                  if ( !whichvga() || (whichmem() < 512))
  3375.  
  3376.  
  3377.                                                                          53
  3378.  
  3379.  
  3380.  
  3381.  
  3382.  
  3383.                     exit(1);
  3384.                  res640();
  3385.                  drwstring(1,10,0,text,320,240);
  3386.                  getch();
  3387.                  videomodeset(vmode);
  3388.                  exit(0);
  3389.                }
  3390.  
  3391.  
  3392.  
  3393.  
  3394.  
  3395.  
  3396.  
  3397.  
  3398.  
  3399.  
  3400.  
  3401.  
  3402.  
  3403.  
  3404.  
  3405.  
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436.  
  3437.  
  3438.  
  3439.                                                                          54
  3440.  
  3441.  
  3442.  
  3443.  
  3444.  
  3445.             DRWSTRINGDN
  3446.  
  3447.                PROTOTYPE
  3448.  
  3449.                extern void far drwstringdn (PixelMode mode, int fcolr, int
  3450.                bcolr, const char far *strng, int x, int y)
  3451.  
  3452.                INPUT
  3453.  
  3454.                mode - pixel write mode
  3455.                fcolr - foreground index to color in current palette
  3456.                bcolr - background index to color in current palette
  3457.                strng - char pointer to string of ASCII characters to be
  3458.                drawn
  3459.                x, y - location of lower, right corner of block
  3460.  
  3461.                OUTPUT
  3462.  
  3463.                no value returned
  3464.  
  3465.                USAGE
  3466.  
  3467.                DRWSTRINGDN takes the null terminated ASCII characters
  3468.                beginning at strng and creates a graphics block similar to
  3469.                the blocks used by BLKGET and BLKPUT.  The characters are
  3470.                drawn with color fcolr using the current font and the
  3471.                background is color bcolr.  When mode 0, NO_ACTION, is used,
  3472.                the graphics block is created in memory retrievable by
  3473.                GETLASTSTRING, but no text is actually drawn on the screen.
  3474.                (Note: the system font is automatically installed when
  3475.                WHICHVGA is called.)  The text is drawn upside down with x,
  3476.                y specifying the lower, right corner.  This corner
  3477.                corresponds to the upper, left corner when the text is
  3478.                oriented upright.
  3479.  
  3480.                SEE ALSO
  3481.  
  3482.                FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRING, DRWSTRINGLT,
  3483.                DRWSTRINGRT, GETLASTSTRING
  3484.  
  3485.                EXAMPLE
  3486.  
  3487.                /* Draws some text rotated by 180 degrees at the center of
  3488.                the screen */
  3489.                #include <stdlib.h>
  3490.                #include <conio.h>
  3491.                #include "svgacc.h"
  3492.  
  3493.                void main(void)
  3494.                {
  3495.                  int vmode;
  3496.                  char text[]="hello world";
  3497.  
  3498.                  vmode = videomodeget();
  3499.  
  3500.  
  3501.                                                                          55
  3502.  
  3503.  
  3504.  
  3505.  
  3506.  
  3507.                  if ( !whichvga() || (whichmem() < 512))
  3508.                     exit(1);
  3509.                  res640();
  3510.                  drwstringdn(1,10,0,text,320,240);
  3511.                  getch();
  3512.                  videomodeset(vmode);
  3513.                  exit(0);
  3514.                }
  3515.  
  3516.  
  3517.  
  3518.  
  3519.  
  3520.  
  3521.  
  3522.  
  3523.  
  3524.  
  3525.  
  3526.  
  3527.  
  3528.  
  3529.  
  3530.  
  3531.  
  3532.  
  3533.  
  3534.  
  3535.  
  3536.  
  3537.  
  3538.  
  3539.  
  3540.  
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.  
  3560.  
  3561.  
  3562.  
  3563.                                                                          56
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.             DRWSTRINGLT
  3570.  
  3571.                PROTOTYPE
  3572.  
  3573.                extern void far drwstringlt (PixelMode mode, int fcolr, int
  3574.                bcolr, const char far *strng, int x, int y)
  3575.  
  3576.                INPUT
  3577.  
  3578.                mode - pixel write mode
  3579.                fcolr - foreground index to color in current palette
  3580.                bcolr - background index to color in current palette
  3581.                strng - char pointer to string of ASCII characters to be
  3582.                drawn
  3583.                x, y - location of lower, left corner of block
  3584.  
  3585.                OUTPUT
  3586.  
  3587.                no value returned
  3588.  
  3589.                USAGE
  3590.  
  3591.                DRWSTRINGLT takes the null terminated ASCII characters
  3592.                beginning at strng and creates a graphics block similar to
  3593.                the blocks used by BLKGET and BLKPUT.  The characters are
  3594.                drawn with color fcolr using the current font and the
  3595.                background is color bcolr.  When mode 0, NO_ACTION, is used,
  3596.                the graphics block is created in memory retrievable by
  3597.                GETLASTSTRING, but no text is actually drawn on the screen.
  3598.                (Note: the system font is automatically installed when
  3599.                WHICHVGA is called.)  The text block is rotated 90 to the
  3600.                left with x, y specifying the lower, left corner.  This
  3601.                corner corresponds to the upper, left corner when the text
  3602.                is oriented upright.
  3603.  
  3604.                SEE ALSO
  3605.  
  3606.                FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRING, DRWSTRINGDN,
  3607.                DRWSTRINGRT, GETLASTSTRING
  3608.  
  3609.                EXAMPLE
  3610.  
  3611.                /* Draws some text rotated 90 degrees to the left at center
  3612.                of screen */
  3613.                #include <stdlib.h>
  3614.                #include <conio.h>
  3615.                #include "svgacc.h"
  3616.  
  3617.                void main(void)
  3618.                {
  3619.                  int vmode;
  3620.                  char text[]="hello world";
  3621.  
  3622.                  vmode = videomodeget();
  3623.  
  3624.  
  3625.                                                                          57
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.                  if ( !whichvga() || (whichmem() < 512))
  3632.                     exit(1);
  3633.                  res640();
  3634.                  drwstringlt(1,10,0,text,320,240);
  3635.                  getch();
  3636.                  videomodeset(vmode);
  3637.                  exit(0);
  3638.                }
  3639.  
  3640.  
  3641.  
  3642.  
  3643.  
  3644.  
  3645.  
  3646.  
  3647.  
  3648.  
  3649.  
  3650.  
  3651.  
  3652.  
  3653.  
  3654.  
  3655.  
  3656.  
  3657.  
  3658.  
  3659.  
  3660.  
  3661.  
  3662.  
  3663.  
  3664.  
  3665.  
  3666.  
  3667.  
  3668.  
  3669.  
  3670.  
  3671.  
  3672.  
  3673.  
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679.  
  3680.  
  3681.  
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.                                                                          58
  3688.  
  3689.  
  3690.  
  3691.  
  3692.  
  3693.             DRWSTRINGRT
  3694.  
  3695.                PROTOTYPE
  3696.  
  3697.                extern void far drwstringrt (PixelMode mode, int fcolr, int
  3698.                bcolr, const char far *strng, int x, int y)
  3699.  
  3700.                INPUT
  3701.  
  3702.                mode - pixel write mode
  3703.                fcolr - foreground index to color in current palette
  3704.                bcolr - background index to color in current palette
  3705.                strng - char pointer to string of ASCII characters to be
  3706.                drawn
  3707.                x, y - location of upper, right corner of block
  3708.  
  3709.                OUTPUT
  3710.  
  3711.                no value returned
  3712.  
  3713.                USAGE
  3714.  
  3715.                DRWSTRINGRT takes the null terminated ASCII characters
  3716.                beginning at strng and creates a graphics block similar to
  3717.                the blocks used by BLKGET and BLKPUT.  The characters are
  3718.                drawn with color fcolr using the current font and the
  3719.                background is color bcolr.  When mode 0, NO_ACTION, is used,
  3720.                the graphics block is created in memory retrievable by
  3721.                GETLASTSTRING, but no text is actually drawn on the screen.
  3722.                (Note: the system font is automatically installed when
  3723.                WHICHVGA is called.)  The text block is rotated 90 to the
  3724.                right with x, y specifying the upper, right corner.  This
  3725.                corner corresponds to the upper, left corner if the text is
  3726.                oriented upright.
  3727.  
  3728.                SEE ALSO
  3729.  
  3730.                FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRING, DRWSTRINGDN,
  3731.                DRWSTRINGLT, GETLASTSTRING
  3732.  
  3733.                EXAMPLE
  3734.  
  3735.                /* Draws text rotated 90 degrees to the right at center of
  3736.                screen */
  3737.                #include <stdlib.h>
  3738.                #include <conio.h>
  3739.                #include "svgacc.h"
  3740.  
  3741.                void main(void)
  3742.                {
  3743.                  int vmode;
  3744.                  char text[]="hello world";
  3745.  
  3746.                  vmode = videomodeget();
  3747.  
  3748.  
  3749.                                                                          59
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.                  if ( !whichvga() || (whichmem() < 512))
  3756.                     exit(1);
  3757.                  res640();
  3758.                  drwstringrt(1,10,0,text,320,240);
  3759.                  getch();
  3760.                  videomodeset(vmode);
  3761.                  exit(0);
  3762.                }
  3763.  
  3764.  
  3765.  
  3766.  
  3767.  
  3768.  
  3769.  
  3770.  
  3771.  
  3772.  
  3773.  
  3774.  
  3775.  
  3776.  
  3777.  
  3778.  
  3779.  
  3780.  
  3781.  
  3782.  
  3783.  
  3784.  
  3785.  
  3786.  
  3787.  
  3788.  
  3789.  
  3790.  
  3791.  
  3792.  
  3793.  
  3794.  
  3795.  
  3796.  
  3797.  
  3798.  
  3799.  
  3800.  
  3801.  
  3802.  
  3803.  
  3804.  
  3805.  
  3806.  
  3807.  
  3808.  
  3809.  
  3810.  
  3811.                                                                          60
  3812.  
  3813.  
  3814.  
  3815.  
  3816.  
  3817.             FILLAREA
  3818.  
  3819.                PROTOTYPE
  3820.  
  3821.                extern void far fillarea (int xseed, int yseed, int
  3822.                bordercolr, int fillcolr)
  3823.  
  3824.                INPUT
  3825.  
  3826.                xseed, yseed - seed location to start fill
  3827.                bordercolr - index to color in current palette at which
  3828.                filling stops
  3829.                fillcolr - index to color in current palette to fill within
  3830.                the border
  3831.  
  3832.                OUTPUT
  3833.  
  3834.                no value returned
  3835.  
  3836.                USAGE
  3837.  
  3838.                FILLAREA fills a region with a new color specified by
  3839.                fillcolr.  The region is defined by any line or curve of the
  3840.                color bordercolr or fillcolr or by the edge of the viewport.
  3841.                All graphics within the region are lost and covered with the
  3842.                fillcolr.  The border is not effected.
  3843.  
  3844.                SEE ALSO
  3845.  
  3846.                DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLCOLOR,
  3847.                FILLCONVEXPOLY, FILLPAGE, FILLSCREEN, FILLVIEW, SETVIEW
  3848.  
  3849.                EXAMPLE
  3850.  
  3851.                /*
  3852.                 * fills a box with some color
  3853.                 */
  3854.  
  3855.                #include <stdlib.h>
  3856.                #include <conio.h>
  3857.                #include "svgacc.h"
  3858.  
  3859.                void main(void)
  3860.                {
  3861.                  int vmode;
  3862.  
  3863.                  vmode = videomodeget();
  3864.                  if ( !whichvga() )
  3865.                     exit(1);
  3866.                  if ( whichmem() < 512)
  3867.                     exit(1);
  3868.                  res640();
  3869.                  drwbox(1,10,0,0,100,100);
  3870.                  fillarea(1,1,10,7);
  3871.  
  3872.  
  3873.                                                                          61
  3874.  
  3875.  
  3876.  
  3877.  
  3878.  
  3879.                  getch();
  3880.                  videomodeset(vmode);
  3881.                  exit(0);
  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.  
  3930.  
  3931.  
  3932.  
  3933.  
  3934.  
  3935.                                                                          62
  3936.  
  3937.  
  3938.  
  3939.  
  3940.  
  3941.             FILLCOLOR
  3942.  
  3943.                PROTOTYPE
  3944.  
  3945.                extern void far fillcolor (int xseed, int yseed, int
  3946.                oldcolr, int newcolr)
  3947.  
  3948.                INPUT
  3949.  
  3950.                xseed, yseed - seed location to start fill
  3951.                oldcolr - index to color in current palette to change
  3952.                newcolr - index to color in current palette to replace
  3953.                oldcolr
  3954.  
  3955.                OUTPUT
  3956.  
  3957.                no value returned
  3958.  
  3959.                USAGE
  3960.  
  3961.                FILLCOLOR replaces every existence of oldcolr with newcolr
  3962.                within a region.  The region is defined as any pixel of
  3963.                oldcolr which has a path of pixels of oldcolr or newcolr
  3964.                with sides touching back to the seed point, (xseed, yseed).
  3965.                Therefore, only pixels of oldcolr are modified and no other
  3966.                information is changed.
  3967.  
  3968.                SEE ALSO
  3969.  
  3970.                DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  3971.                FILLCONVEXPOLY, FILLPAGE, FILLSCREEN, FILLVIEW, SETVIEW
  3972.  
  3973.                EXAMPLE
  3974.  
  3975.                /*
  3976.                 * replaces the black color with a new color
  3977.                 */
  3978.  
  3979.                #include <stdlib.h>
  3980.                #include <conio.h>
  3981.                #include "svgacc.h"
  3982.  
  3983.                void main(void)
  3984.                {
  3985.                  int vmode;
  3986.  
  3987.                  vmode = videomodeget();
  3988.                  if ( !whichvga() )
  3989.                     exit(1);
  3990.                  if ( whichmem() < 512)
  3991.                     exit(1);
  3992.                  res640();
  3993.                  drwbox(1,10,0,0,100,100);
  3994.                  drwbox(1,12,20,20,80,80);
  3995.  
  3996.  
  3997.                                                                          63
  3998.  
  3999.  
  4000.  
  4001.  
  4002.  
  4003.                  fillcolor(1,1,0,7);
  4004.                  getch();
  4005.                  videomodeset(vmode);
  4006.                  exit(0);
  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.  
  4054.  
  4055.  
  4056.  
  4057.  
  4058.  
  4059.                                                                          64
  4060.  
  4061.  
  4062.  
  4063.  
  4064.  
  4065.             FILLCONVEXPOLY
  4066.  
  4067.                PROTOTYPE
  4068.  
  4069.                SUB FILLCONVEXPOLY (PolyColor%, NumPoints%, PointArray%)
  4070.  
  4071.                INPUT
  4072.  
  4073.                PolyColor - index to color in current palette
  4074.                NumPoints - number of points in PointArray
  4075.                PointArray - P2DType array holding points of polygon
  4076.  
  4077.                OUTPUT
  4078.  
  4079.                no value returned
  4080.  
  4081.                USAGE
  4082.  
  4083.                FILLCONVEXPOLY draws a solid polygon outlined by the points
  4084.                given in PointArray.  The points are expected to be
  4085.                consecutive and the resulting polygon should be convex (ie.
  4086.                the polygon should not curve in on itself like a kidney
  4087.                bean).  The function also assumes that the last point in the
  4088.                array connects to the first.
  4089.  
  4090.                SEE ALSO
  4091.  
  4092.                D3PROJECT, DRWFILLBOX, FILLAREA, FILLCOLOR, FILLPAGE,
  4093.                FILLSCREEN, FILLVIEW
  4094.  
  4095.                EXAMPLE
  4096.  
  4097.                /*
  4098.                * Show fillconvexpoly
  4099.                */
  4100.  
  4101.                #include <stdlib.h>
  4102.                #include <math.h>
  4103.                #include <conio.h>
  4104.                #include "svgacc.h"
  4105.                #define randnum(size) (rand() % (int)(size))
  4106.  
  4107.                D2Point tri[3];
  4108.  
  4109.                void main(void)
  4110.                {
  4111.                  int vmode,colr,i;
  4112.  
  4113.                  vmode = videomodeget();
  4114.                  if ( !whichvga() )
  4115.                     exit(1);
  4116.                  if ( whichmem() < 512)
  4117.                     exit(1);
  4118.                  if ( !res640() )
  4119.  
  4120.  
  4121.                                                                          65
  4122.  
  4123.  
  4124.  
  4125.  
  4126.  
  4127.                     exit(1);
  4128.  
  4129.                  for(i=0;i<99;i++) {
  4130.                     tri[0].x = randnum(maxx);
  4131.                     tri[0].y = randnum(maxy);
  4132.                     tri[1].x = randnum(maxx);
  4133.                     tri[1].y = randnum(maxy);
  4134.                     tri[2].x = randnum(maxx);
  4135.                     tri[2].y = randnum(maxy);
  4136.                     colr = randnum(15);
  4137.                     fillconvexpoly(colr,3,tri);
  4138.                  }
  4139.  
  4140.                  getch();
  4141.                  videomodeset(vmode);
  4142.                  exit(0);
  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.  
  4178.  
  4179.  
  4180.  
  4181.  
  4182.  
  4183.                                                                          66
  4184.  
  4185.  
  4186.  
  4187.  
  4188.  
  4189.             FILLPAGE
  4190.  
  4191.                PROTOTYPE
  4192.  
  4193.                extern void far fillpage (int colr)
  4194.  
  4195.                INPUT
  4196.  
  4197.                colr - index to color in current palette
  4198.  
  4199.                OUTPUT
  4200.  
  4201.                no value is returned
  4202.  
  4203.                USAGE
  4204.  
  4205.                FILLPAGE clears the currently active page with the specified
  4206.                color.  All information on the page is lost.  (Note, a
  4207.                faster method to clear the page is to call any of the RES###
  4208.                functions.  These reset the graphics screen and
  4209.                automatically clear it to color index zero as well as reset
  4210.                the default palette.)
  4211.  
  4212.                SEE ALSO
  4213.  
  4214.                DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  4215.                FILLCOLOR, FILLCONVEXPOLY, FILLSCREEN, FILLVIEW
  4216.  
  4217.                EXAMPLE
  4218.  
  4219.                /*
  4220.                 * fill the page with a color
  4221.                 */
  4222.  
  4223.                #include <stdlib.h>
  4224.                #include <conio.h>
  4225.                #include "svgacc.h"
  4226.  
  4227.                void main(void)
  4228.                {
  4229.                  int vmode;
  4230.  
  4231.                  vmode = videomodeget();
  4232.                  if ( !whichvga() )
  4233.                     exit(1);
  4234.                  if ( whichmem() < 512)
  4235.                     exit(1);
  4236.                  res640();
  4237.                  fillpage(10);
  4238.                  getch();
  4239.                  videomodeset(vmode);
  4240.                  exit(0);
  4241.                }
  4242.  
  4243.  
  4244.  
  4245.                                                                          67
  4246.  
  4247.  
  4248.  
  4249.  
  4250.  
  4251.             FILLSCREEN
  4252.  
  4253.                PROTOTYPE
  4254.  
  4255.                extern void far fillscreen (int colr)
  4256.  
  4257.                INPUT
  4258.  
  4259.                colr - index to color in current palette
  4260.  
  4261.                OUTPUT
  4262.  
  4263.                no value is returned
  4264.  
  4265.                USAGE
  4266.  
  4267.                FILLSCREEN clears the entire screen with the specified
  4268.                color.  All information on the screen is lost.  (Note, a
  4269.                faster method to clear the screen is to call any of the
  4270.                RES### functions.  These reset the graphics screen and
  4271.                automatically clear it to color index zero as well as reset
  4272.                the default palette.)
  4273.  
  4274.                SEE ALSO
  4275.  
  4276.                DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  4277.                FILLCOLOR, FILLCONVEXPOLY, FILLPAGE, FILLVIEW
  4278.  
  4279.                EXAMPLE
  4280.  
  4281.                /*
  4282.                 * fill the screen with a color
  4283.                 */
  4284.  
  4285.                #include <stdlib.h>
  4286.                #include <conio.h>
  4287.                #include "svgacc.h"
  4288.  
  4289.                void main(void)
  4290.                {
  4291.                  int vmode;
  4292.  
  4293.                  vmode = videomodeget();
  4294.                  if ( !whichvga() )
  4295.                     exit(1);
  4296.                  if ( whichmem() < 512)
  4297.                     exit(1);
  4298.                  res640();
  4299.                  fillscreen(10);
  4300.                  getch();
  4301.                  videomodeset(vmode);
  4302.                  exit(0);
  4303.                }
  4304.  
  4305.  
  4306.  
  4307.                                                                          68
  4308.  
  4309.  
  4310.  
  4311.  
  4312.  
  4313.             FILLVIEW
  4314.  
  4315.                PROTOTYPE
  4316.  
  4317.                extern void far fillview (int colr)
  4318.  
  4319.                INPUT
  4320.  
  4321.                colr - index to color in current palette
  4322.  
  4323.                OUTPUT
  4324.  
  4325.                no value is returned
  4326.  
  4327.                USAGE
  4328.  
  4329.                FILLVIEW fills the currently defined viewport with the
  4330.                specified color.  All information in the viewport is lost.
  4331.  
  4332.                SEE ALSO
  4333.  
  4334.                DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  4335.                FILLCOLOR, FILLCONVEXPOLY, FILLPAGE, FILLSCREEN, SETVIEW
  4336.  
  4337.                EXAMPLE
  4338.  
  4339.                /*
  4340.                 * fill the viewport with a color
  4341.                 */
  4342.  
  4343.                #include <stdlib.h>
  4344.                #include <conio.h>
  4345.                #include "svgacc.h"
  4346.  
  4347.                void main(void)
  4348.                {
  4349.                  int vmode;
  4350.  
  4351.                  vmode = videomodeget();
  4352.                  if ( !whichvga() )
  4353.                     exit(1);
  4354.                  if ( whichmem() < 512)
  4355.                     exit(1);
  4356.                  res640();
  4357.                  setview(100,100,539,379);
  4358.                  fillview(10);
  4359.                  getch();
  4360.                  videomodeset(vmode);
  4361.                  exit(0);
  4362.                }
  4363.  
  4364.  
  4365.  
  4366.  
  4367.  
  4368.  
  4369.                                                                          69
  4370.  
  4371.  
  4372.  
  4373.  
  4374.  
  4375.             FONTGETINFO
  4376.  
  4377.                PROTOTYPE
  4378.  
  4379.                extern void far fontgetinfo (int far *wdth, int far *hght)
  4380.  
  4381.                INPUT
  4382.  
  4383.                no input parameters
  4384.  
  4385.                OUTPUT
  4386.  
  4387.                wdth - integer pointer to width in pixels of current font
  4388.                hght - integer pointer to height in pixels of current font
  4389.  
  4390.                USAGE
  4391.  
  4392.                FONTGETINFO returns in wdth and hght the dimensions of the
  4393.                currently loaded font.
  4394.  
  4395.                SEE ALSO
  4396.  
  4397.                FONTSET, FONTSYSTEM
  4398.  
  4399.                EXAMPLE
  4400.  
  4401.                /*
  4402.                 * display system font width and height
  4403.                 */
  4404.  
  4405.                #include <stdlib.h>
  4406.                #include <conio.h>
  4407.                #include "svgacc.h"
  4408.  
  4409.                void main(void)
  4410.                {
  4411.                  int vmode;
  4412.                  int fontwidth;
  4413.                  int fontheight;
  4414.                  char text[50];
  4415.  
  4416.                  vmode = videomodeget();
  4417.                  if ( !whichvga() )
  4418.                     exit(1);
  4419.                  if ( whichmem() < 512)
  4420.                     exit(1);
  4421.                  res640();
  4422.                  fontgetinfo(&fontwidth,&fontheight);
  4423.                  sprintf(text,"the system font width is: %d",fontwidth);
  4424.                  drwstring(1,7,0,text,0,0);
  4425.                  sprintf(text,"the system font height is: %d",fontheight);
  4426.                  drwstring(1,7,0,text,0,20);
  4427.                  getch();
  4428.                  videomodeset(vmode);
  4429.  
  4430.  
  4431.                                                                          70
  4432.  
  4433.  
  4434.  
  4435.  
  4436.  
  4437.                  exit(0);
  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.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492.  
  4493.                                                                          71
  4494.  
  4495.  
  4496.  
  4497.  
  4498.  
  4499.             FONTSET
  4500.  
  4501.                PROTOTYPE
  4502.  
  4503.                extern void far fontset (Font far *font)
  4504.  
  4505.                INPUT
  4506.  
  4507.                font - pointer to Font structure
  4508.  
  4509.                OUTPUT
  4510.  
  4511.                no value returned
  4512.  
  4513.                USAGE
  4514.  
  4515.                FONTSET loads the current font with the data found at font.
  4516.                The Font structure is 4098 bytes long with the first two
  4517.                bytes being the width and height of the font respectively.
  4518.  
  4519.                SEE ALSO
  4520.  
  4521.                FONTGETINFO, FONTSYSTEM
  4522.  
  4523.                EXAMPLE
  4524.  
  4525.                /*
  4526.                 * Load a font from disk and enable it
  4527.                 */
  4528.  
  4529.                #include <stdlib.h>
  4530.                #include <conio.h>
  4531.                #include <stdio.h>
  4532.                #include "svgacc.h"
  4533.  
  4534.                Font newfont;
  4535.  
  4536.                void main(void)
  4537.                {
  4538.                  int vmode;
  4539.                  char text[]="The Dragon Font!";
  4540.                  FILE *fontfile;
  4541.                  vmode = videomodeget();
  4542.                  if ( !whichvga() )
  4543.                     exit(1);
  4544.                  if ( whichmem() < 512)
  4545.                     exit(1);
  4546.                  if ( !res640() )
  4547.                     exit(1);
  4548.                  if( (fontfile = fopen("dragon.fnt","rb")) == NULL )
  4549.                     exit (1);
  4550.                  fread(&newfont,4098,1,fontfile);
  4551.                  fclose(fontfile);
  4552.                  fontset(&newfont);
  4553.  
  4554.  
  4555.                                                                          72
  4556.  
  4557.  
  4558.  
  4559.  
  4560.  
  4561.                  drwstring(1,10,0,text,0,0);
  4562.                  getch();
  4563.                  videomodeset(vmode);
  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.  
  4612.  
  4613.  
  4614.  
  4615.  
  4616.  
  4617.                                                                          73
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.             FONTSYSTEM
  4624.  
  4625.                PROTOTYPE
  4626.  
  4627.                extern void far fontsystem (void)
  4628.  
  4629.                INPUT
  4630.  
  4631.                no input parameters
  4632.  
  4633.                OUTPUT
  4634.  
  4635.                no value returned
  4636.  
  4637.                USAGE
  4638.  
  4639.                FONTSYSTEM sets the current font to the standard system
  4640.                font.  This font is automatically set when WHICHVGA is
  4641.                called.
  4642.  
  4643.                SEE ALSO
  4644.  
  4645.                WHICHVGA, FONTGETINFO, FONTSET
  4646.  
  4647.                EXAMPLE
  4648.  
  4649.                /* Load font from disk, enable it, and switch back to system
  4650.                font */
  4651.  
  4652.                #include <stdlib.h>
  4653.                #include <conio.h>
  4654.                #include <stdio.h>
  4655.                #include "svgacc.h"
  4656.  
  4657.                Font newfont;
  4658.  
  4659.                void main(void)
  4660.                {
  4661.                  int vmode;
  4662.                  char text1[]="The Dragon Font!";
  4663.                  char text2[]="The System Font!";
  4664.                  FILE *fontfile;
  4665.                  vmode = videomodeget();
  4666.                  if ( !whichvga() || (whichmem() < 512))
  4667.                     exit(1);
  4668.                  if ( !res640() )
  4669.                     exit(1);
  4670.                  if( (fontfile = fopen("dragon.fnt","rb")) == NULL )
  4671.                     exit(1);
  4672.                  fread(&newfont,4098,1,fontfile);
  4673.                  fclose(fontfile);
  4674.                  fontset(&newfont);
  4675.                  drwstring(1,10,0,text1,0,0);
  4676.                  fontsystem();
  4677.  
  4678.  
  4679.                                                                          74
  4680.  
  4681.  
  4682.  
  4683.  
  4684.  
  4685.                  drwstring(1,10,0,text2,0,20);
  4686.                  getch();
  4687.                  videomodeset(vmode);
  4688.                }
  4689.  
  4690.  
  4691.  
  4692.  
  4693.  
  4694.  
  4695.  
  4696.  
  4697.  
  4698.  
  4699.  
  4700.  
  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.  
  4736.  
  4737.  
  4738.  
  4739.  
  4740.  
  4741.                                                                          75
  4742.  
  4743.  
  4744.  
  4745.  
  4746.  
  4747.             GETARCCOS
  4748.  
  4749.                PROTOTYPE
  4750.  
  4751.                extern long far getarccos (long cosvalue)
  4752.  
  4753.                INPUT
  4754.  
  4755.                cosvalue - number between -1 and +1 scaled up by 13 bits
  4756.                (8192)
  4757.  
  4758.                OUTPUT
  4759.  
  4760.                GETARCCOS returns the arc cosine of cosvalue in degrees.
  4761.  
  4762.                USAGE
  4763.  
  4764.                GETARCCOS returns the arc cosine in degrees for the given
  4765.                value.  The return will be between 0 and 180 degrees.
  4766.                Cosvalue should be between -8192 and +8192 representing the
  4767.                range -1 to +1.  Input values outside this range are invalid
  4768.                and GETARCCOS will return -32768.  This function uses an
  4769.                integer lookup table stored within the library in order to
  4770.                produce the fastest possible results.  No floating point
  4771.                arithmetic is used.  The scale factor of 13 bits (8192) was
  4772.                chosen because this is the number of bits at which every
  4773.                change of one degree gives a change in the value of the sine
  4774.                (or cosine) function.
  4775.  
  4776.                SEE ALSO
  4777.  
  4778.                GETARCSIN, GETARCTAN, GETCOS, GETSIN, GETTAN
  4779.  
  4780.                EXAMPLE
  4781.  
  4782.                /*
  4783.                 * show getarccos
  4784.                 */
  4785.  
  4786.                #include <stdlib.h>
  4787.                #include <conio.h>
  4788.                #include "svgacc.h"
  4789.  
  4790.                void main(void)
  4791.                {
  4792.                  int ang;
  4793.                  long valueX8192;
  4794.                  float value;
  4795.  
  4796.                  for(value=0;value<1;value+=.05)
  4797.                  {
  4798.                     valueX8192 = 8192 * value;
  4799.                     ang = getarccos(valueX8192);
  4800.                     printf("arccos of %f = %d degrees\n",value,ang);
  4801.  
  4802.  
  4803.                                                                          76
  4804.  
  4805.  
  4806.  
  4807.  
  4808.  
  4809.                  }
  4810.                  exit(0);
  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.  
  4860.  
  4861.  
  4862.  
  4863.  
  4864.  
  4865.                                                                          77
  4866.  
  4867.  
  4868.  
  4869.  
  4870.  
  4871.             GETARCSIN
  4872.  
  4873.                PROTOTYPE
  4874.  
  4875.                extern long far getarcsin (long sinvalue)
  4876.  
  4877.                INPUT
  4878.  
  4879.                sinvalue - number between -1 and +1 scaled up by 13 bits
  4880.                (8192)
  4881.  
  4882.                OUTPUT
  4883.  
  4884.                GETARCSIN returns the arc sine of sinvalue in degrees.
  4885.  
  4886.                USAGE
  4887.  
  4888.                GETARCSIN returns the arc sine in degrees for the given
  4889.                value.  The return will be between -90 and +90 degrees.
  4890.                Sinvalue should be between -8192 and +8192 representing the
  4891.                range -1 to +1.  Input values outside this range are invalid
  4892.                and GETARCSIN will return -32768.  This function uses an
  4893.                integer lookup table stored within the library in order to
  4894.                produce the fastest possible results.  No floating point
  4895.                arithmetic is used.  The scale factor of 13 bits (8192) was
  4896.                chosen because this is the number of bits at which every
  4897.                change of one degree gives a change in the value of the sine
  4898.                (or cosine) function.
  4899.  
  4900.                SEE ALSO
  4901.  
  4902.                GETARCCOS, GETARCTAN, GETCOS, GETSIN, GETTAN
  4903.  
  4904.                EXAMPLE
  4905.  
  4906.                /*
  4907.                 * show getarcsin
  4908.                 */
  4909.  
  4910.                #include <stdlib.h>
  4911.                #include <conio.h>
  4912.                #include "svgacc.h"
  4913.  
  4914.                void main(void)
  4915.                {
  4916.                  int ang;
  4917.                  long valueX8192;
  4918.                  float value;
  4919.  
  4920.                  for(value=0;value<1;value+=.05)
  4921.                  {
  4922.                     valueX8192 = 8192 * value;
  4923.                     ang = getarcsin(valueX8192);
  4924.                     printf("arcsin of %f = %d degrees\n",value,ang);
  4925.  
  4926.  
  4927.                                                                          78
  4928.  
  4929.  
  4930.  
  4931.  
  4932.  
  4933.                  }
  4934.                  exit(0);
  4935.                }
  4936.  
  4937.  
  4938.  
  4939.  
  4940.  
  4941.  
  4942.  
  4943.  
  4944.  
  4945.  
  4946.  
  4947.  
  4948.  
  4949.  
  4950.  
  4951.  
  4952.  
  4953.  
  4954.  
  4955.  
  4956.  
  4957.  
  4958.  
  4959.  
  4960.  
  4961.  
  4962.  
  4963.  
  4964.  
  4965.  
  4966.  
  4967.  
  4968.  
  4969.  
  4970.  
  4971.  
  4972.  
  4973.  
  4974.  
  4975.  
  4976.  
  4977.  
  4978.  
  4979.  
  4980.  
  4981.  
  4982.  
  4983.  
  4984.  
  4985.  
  4986.  
  4987.  
  4988.  
  4989.                                                                          79
  4990.  
  4991.  
  4992.  
  4993.  
  4994.  
  4995.             GETARCTAN
  4996.  
  4997.                PROTOTYPE
  4998.  
  4999.                extern long far getarctan (long tanvalue)
  5000.  
  5001.                INPUT
  5002.  
  5003.                tanvalue - long integer representing a decimal scaled up by
  5004.                13 bits (8192)
  5005.  
  5006.                OUTPUT
  5007.  
  5008.                GETARCTAN returns the arc tangent of tanvalue in degrees.
  5009.  
  5010.                USAGE
  5011.  
  5012.                GETARCTAN returns the arc tangent in degrees for the given
  5013.                value.  The return will be between -89 and +89 degrees.
  5014.                Tanvalue can be any long integer.  It is interpreted as a
  5015.                decimal scaled up by 8192 (13 bits).  This function uses an
  5016.                integer lookup table stored within the library in order to
  5017.                produce the fastest possible results.  No floating point
  5018.                arithmetic is used.  The scale factor of 13 bits (8192) was
  5019.                chosen because this is the number of bits at which every
  5020.                change of one degree gives a change in the value of the sine
  5021.                (or cosine) function.
  5022.  
  5023.                SEE ALSO
  5024.  
  5025.                GETARCCOS, GETARCSIN, GETCOS, GETSIN, GETTAN
  5026.  
  5027.                EXAMPLE
  5028.  
  5029.                /*
  5030.                 * show getarctan
  5031.                 */
  5032.  
  5033.                #include <stdlib.h>
  5034.                #include <conio.h>
  5035.                #include "svgacc.h"
  5036.  
  5037.                void main(void)
  5038.                {
  5039.                  int tanang;
  5040.                  int ang;
  5041.                  long valueX8192;
  5042.                  float value;
  5043.  
  5044.                  for(value=0;value<2;value+=.1)
  5045.                  {
  5046.                     valueX8192 = 8192 * value;
  5047.                     ang = getarctan(valueX8192);
  5048.                     printf("arctan of %f = %d degrees\n",value,ang);
  5049.  
  5050.  
  5051.                                                                          80
  5052.  
  5053.  
  5054.  
  5055.  
  5056.  
  5057.                  }
  5058.                  exit(0);
  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.  
  5108.  
  5109.  
  5110.  
  5111.  
  5112.  
  5113.                                                                          81
  5114.  
  5115.  
  5116.  
  5117.  
  5118.  
  5119.             GETCOS
  5120.  
  5121.                PROTOTYPE
  5122.  
  5123.                extern long far getcos (long angle)
  5124.  
  5125.                INPUT
  5126.  
  5127.                angle - angle in degrees
  5128.  
  5129.                OUTPUT
  5130.  
  5131.                GETCOS returns the cosine of angle scaled up by 13 bits
  5132.                (8192).
  5133.  
  5134.                USAGE
  5135.  
  5136.                GETCOS returns the cosine of the specified angle.  Angle can
  5137.                be any long value.  The return value has been multiplied by
  5138.                8192.  This function uses an integer lookup table stored
  5139.                within the library in order to produce the fastest possible
  5140.                results.  No floating point arithmetic is used.  The scale
  5141.                factor of 13 bits (8192) was chosen because this is the
  5142.                number of bits at which every change of one degree gives a
  5143.                change in the value of the sine (or cosine) function.
  5144.  
  5145.                SEE ALSO
  5146.  
  5147.                GETARCCOS, GETARCSIN, GETARCTAN, GETSIN, GETTAN
  5148.  
  5149.                EXAMPLE
  5150.  
  5151.                /*
  5152.                 * show getcos
  5153.                 */
  5154.  
  5155.                #include <stdlib.h>
  5156.                #include <conio.h>
  5157.                #include "svgacc.h"
  5158.  
  5159.                void main(void)
  5160.                {
  5161.                  int ang;
  5162.                  float value;
  5163.  
  5164.                  for(ang=0;ang<90;ang+=5)
  5165.                  {
  5166.                     value = (float)getcos(ang) / 8192;
  5167.                     printf("cos of %d degrees = %f\n",ang,value);
  5168.                  }
  5169.                  exit(0);
  5170.                }
  5171.  
  5172.  
  5173.  
  5174.  
  5175.                                                                          82
  5176.  
  5177.  
  5178.  
  5179.  
  5180.  
  5181.             GETLASTSTRING
  5182.  
  5183.                PROTOTYPE
  5184.  
  5185.                extern void far getlaststring (RasterBlock far *strnggfxblk)
  5186.  
  5187.                INPUT
  5188.  
  5189.                no input parameters
  5190.  
  5191.                OUTPUT
  5192.  
  5193.                no value returned
  5194.                strnggfxblk - RasterBlock pointer to destination array
  5195.  
  5196.                USAGE
  5197.  
  5198.                GETLASTSTRING returns the text drawn on the screen by the
  5199.                last called DRWSTRING function.  The text is returned in
  5200.                strnggfxblk which may be used with BLKPUT or the sprite
  5201.                functions.  The text in strnggfxblk is oriented in the same
  5202.                manner as the last called DRWSTRING function.  The suggested
  5203.                practice is to call the DRWSTRING function using mode
  5204.                NO_ACTION which does not actually draw text on the screen.
  5205.                GETLASTSTRING should be called immediately after the desired
  5206.                DRWSTRING function to prevent possible loss of data caused
  5207.                by other functions.
  5208.  
  5209.                The number of bytes of raster data needed by strnggfxblk is
  5210.                equal to
  5211.  
  5212.                           (fontwidth*stringlength)*(fontheight)
  5213.  
  5214.                plus four bytes for the width and height integers in the
  5215.                RasterBlock structure.
  5216.  
  5217.                The font's dimensions can be obtained by calling FONTGETINFO
  5218.                and the string's length can be obtained using the STRLEN
  5219.                function.  Note, however, that strnggfxblk can be quite
  5220.                large.  If insufficient space is allocated for strnggfxblk,
  5221.                GETLASTSTRING will overwrite any data in memory contained
  5222.                beyond strnggfxblk and may possibly cause the system to
  5223.                crash.
  5224.  
  5225.                SEE ALSO
  5226.  
  5227.                BLKPUT, DRWSTRING, DRWSTRINGDN, DRWSTRINGLT, DRWSTRINGRT,
  5228.                FONTGETINFO
  5229.  
  5230.                EXAMPLE
  5231.  
  5232.                /*
  5233.                 * Draws some text using the 'NO-ACTION' mode then
  5234.                 * retrieve the raster data as a 'RasterBlock'
  5235.  
  5236.  
  5237.                                                                          83
  5238.  
  5239.  
  5240.  
  5241.  
  5242.  
  5243.                 */
  5244.  
  5245.                #include <stdlib.h>
  5246.                #include <conio.h>
  5247.                #include "svgacc.h"
  5248.  
  5249.                void main(void)
  5250.                {
  5251.                  int vmode,fontwidth,fontheight;
  5252.                  char text[]="hello world";
  5253.                  RasterBlock *blkdata;
  5254.                  vmode = videomodeget();
  5255.                  if ( !whichvga() || (whichmem() < 512))
  5256.                     exit(1);
  5257.                  if ( !res640() )
  5258.                     exit(1);
  5259.                  drwstringrt(NO_ACTION,10,0,text,320,240);
  5260.                  fontgetinfo(&fontwidth,&fontheight);
  5261.                  blkdata = (RasterBlock *)malloc(fontwidth*11*fontheight +
  5262.                4);
  5263.                  getlaststring(blkdata);
  5264.                  blkput(SET,0,0,blkdata);
  5265.                  getch();
  5266.                  videomodeset(vmode);
  5267.                }
  5268.  
  5269.  
  5270.  
  5271.  
  5272.  
  5273.  
  5274.  
  5275.  
  5276.  
  5277.  
  5278.  
  5279.  
  5280.  
  5281.  
  5282.  
  5283.  
  5284.  
  5285.  
  5286.  
  5287.  
  5288.  
  5289.  
  5290.  
  5291.  
  5292.  
  5293.  
  5294.  
  5295.  
  5296.  
  5297.  
  5298.  
  5299.                                                                          84
  5300.  
  5301.  
  5302.  
  5303.  
  5304.  
  5305.             GETPOINT
  5306.  
  5307.                PROTOTYPE
  5308.  
  5309.                extern int far getpoint (int x, int y)
  5310.  
  5311.                INPUT
  5312.  
  5313.                x, y - location of pixel to read
  5314.  
  5315.                OUTPUT
  5316.  
  5317.                GETPOINT returns the color index of the pixel at x, y.
  5318.  
  5319.                USAGE
  5320.  
  5321.                GETPOINT returns the value of the pixel at location x, y.
  5322.                This value is a color index into the current palette.
  5323.  
  5324.                SEE ALSO
  5325.  
  5326.                DRWPOINT
  5327.  
  5328.                EXAMPLE
  5329.  
  5330.                /*
  5331.                 * draw a point and check that it is there
  5332.                 */
  5333.  
  5334.                #include <stdlib.h>
  5335.                #include <conio.h>
  5336.                #include "svgacc.h"
  5337.  
  5338.                void main(void)
  5339.                {
  5340.                  int vmode;
  5341.                  int pointvalue;
  5342.                  char text[50];
  5343.  
  5344.                  vmode = videomodeget();
  5345.                  if ( !whichvga() )
  5346.                     exit(1);
  5347.                  if ( whichmem() < 512)
  5348.                     exit(1);
  5349.                  res640();
  5350.                  drwpoint(1,10,320,240);
  5351.                  pointvalue = getpoint(320,240);
  5352.                  sprintf(text,"the point value is: %d",pointvalue);
  5353.                  drwstring(1,7,0,text,0,0);
  5354.                  getch();
  5355.                  videomodeset(vmode);
  5356.                  exit(0);
  5357.                }
  5358.  
  5359.  
  5360.  
  5361.                                                                          85
  5362.  
  5363.  
  5364.  
  5365.  
  5366.  
  5367.             GETSIN
  5368.  
  5369.                PROTOTYPE
  5370.  
  5371.                extern long far getsin (long angle)
  5372.  
  5373.                INPUT
  5374.  
  5375.                angle - angle in degrees
  5376.  
  5377.                OUTPUT
  5378.  
  5379.                GETSIN returns the sine of angle scaled up by 13 bits
  5380.                (8192).
  5381.  
  5382.                USAGE
  5383.  
  5384.                GETSIN returns the sine of the specified angle.  Angle can
  5385.                be any long value.  The return value has been multiplied by
  5386.                8192.  This function uses an integer lookup table stored
  5387.                within the library in order to produce the fastest possible
  5388.                results.  No floating point arithmetic is used.  The scale
  5389.                factor of 13 bits (8192) was chosen because this is the
  5390.                number of bits at which every change of one degree gives a
  5391.                change in the value of the sine (or cosine) function.
  5392.  
  5393.                SEE ALSO
  5394.  
  5395.                GETARCCOS, GETARCSIN, GETARCTAN, GETCOS, GETTAN
  5396.  
  5397.                EXAMPLE
  5398.  
  5399.                /*
  5400.                 * show getsin
  5401.                 */
  5402.  
  5403.                #include <stdlib.h>
  5404.                #include <conio.h>
  5405.                #include "svgacc.h"
  5406.  
  5407.                void main(void)
  5408.                {
  5409.                  int sinang, ang;
  5410.                  float value;
  5411.  
  5412.                  for(ang=0;ang<90;ang+=5)
  5413.                  {
  5414.                     value = (float)getsin(ang) / 8192;
  5415.                     printf("sin of %d degrees = %f\n",ang,value);
  5416.                  }
  5417.                  exit(0);
  5418.                }
  5419.  
  5420.  
  5421.  
  5422.  
  5423.                                                                          86
  5424.  
  5425.  
  5426.  
  5427.  
  5428.  
  5429.             GETTAN
  5430.  
  5431.                PROTOTYPE
  5432.  
  5433.                extern long far gettan (long angle)
  5434.  
  5435.                INPUT
  5436.  
  5437.                angle - angle in degrees
  5438.  
  5439.                OUTPUT
  5440.  
  5441.                GETTAN returns the tangent of angle scaled up by 13 bits
  5442.                (8192)
  5443.  
  5444.                USAGE
  5445.  
  5446.                GETTAN returns the tangent of the specified angle.  Angle
  5447.                can be any long value except +(90+n*180), where n is an
  5448.                integer.  The return value has been multiplied by 8192.  If
  5449.                an invalid angle is given, the GETTAN will return &H80000000
  5450.                (-2147483648).  This function uses an integer lookup table
  5451.                stored within the library in order to produce the fastest
  5452.                possible results.  No floating point arithmetic is used.
  5453.                The scale factor of 13 bits (8192) was chosen because this
  5454.                is the number of bits at which every change of one degree
  5455.                gives a change in the value of the sine (or cosine)
  5456.                function.
  5457.  
  5458.                SEE ALSO
  5459.  
  5460.                GETARCCOS, GETARCSIN, GETARCTAN, GETCOS, GETSIN
  5461.  
  5462.                EXAMPLE
  5463.  
  5464.                /*
  5465.                 * show gettan
  5466.                 */
  5467.  
  5468.                #include <stdlib.h>
  5469.                #include <conio.h>
  5470.                #include "svgacc.h"
  5471.  
  5472.                void main(void)
  5473.                {
  5474.                  int tanang, ang;
  5475.                  float value;
  5476.  
  5477.                  for(ang=0;ang<90;ang+=5)
  5478.                  {
  5479.                     value = (float)gettan(ang) / 8192;
  5480.                     printf("tan of %d degrees = %f\n",ang,value);
  5481.                  }
  5482.                  exit(0);
  5483.  
  5484.  
  5485.                                                                          87
  5486.  
  5487.  
  5488.  
  5489.  
  5490.  
  5491.                }
  5492.  
  5493.  
  5494.  
  5495.  
  5496.  
  5497.  
  5498.  
  5499.  
  5500.  
  5501.  
  5502.  
  5503.  
  5504.  
  5505.  
  5506.  
  5507.  
  5508.  
  5509.  
  5510.  
  5511.  
  5512.  
  5513.  
  5514.  
  5515.  
  5516.  
  5517.  
  5518.  
  5519.  
  5520.  
  5521.  
  5522.  
  5523.  
  5524.  
  5525.  
  5526.  
  5527.  
  5528.  
  5529.  
  5530.  
  5531.  
  5532.  
  5533.  
  5534.  
  5535.  
  5536.  
  5537.  
  5538.  
  5539.  
  5540.  
  5541.  
  5542.  
  5543.  
  5544.  
  5545.  
  5546.  
  5547.                                                                          88
  5548.  
  5549.  
  5550.  
  5551.  
  5552.  
  5553.             GIFGETINFO
  5554.  
  5555.                PROTOTYPE
  5556.  
  5557.                extern int far gifgetinfo (const char far *name, int far
  5558.                  *gifxsize, int far *gifysize, int far *numcolors, RGB far
  5559.                  *pal)
  5560.  
  5561.                INPUT
  5562.  
  5563.                name - char pointer to the filename of the GIF image to read
  5564.  
  5565.                OUTPUT
  5566.  
  5567.                GIFGETINFO returns 1 if successful, error code otherwise.
  5568.                gifxsize - width in pixels of the image
  5569.                gifysize - height in pixels of the image
  5570.                numcolors - number of colors in the image palette
  5571.                palette - copy of image palette
  5572.  
  5573.                USAGE
  5574.  
  5575.                GIFGETINFO reads name and returns the characteristics of the
  5576.                image.  The dimensions of the image are returned in
  5577.                gifxsize, gifysize.  The number of colors in the image's
  5578.                palette is returned in numcolors and the palette is returned
  5579.                in palette.  Although the image's palette may contain less
  5580.                than 256 colors, palette must be 768 bytes in length.  The
  5581.                image's palette will begin with the first color in Palette.
  5582.  
  5583.                For ease of programming the GIF decoder requires that the
  5584.                image be non-interlaced, use only a global color map and be
  5585.                compressed according to GIF87A specifications.
  5586.  
  5587.                If GIFGETINFO determines that Filename is a satisfactory
  5588.                file, the function will return a one.  Otherwise, the
  5589.                function will return one of several error codes as listed
  5590.                below:
  5591.  
  5592.                0 =  does not exist or there is some disk I/O problem
  5593.                -1 = does not have the GIF87A signature
  5594.                -2 = image is interlaced
  5595.                -3 = does not use a global color map
  5596.                -4 = has some general error
  5597.  
  5598.                SEE ALSO
  5599.  
  5600.                GIFMAKE, GIFPUT
  5601.  
  5602.                EXAMPLE
  5603.  
  5604.                /*
  5605.                 * show the info on the 'uttower.gif' GIF file
  5606.                 */
  5607.  
  5608.  
  5609.                                                                          89
  5610.  
  5611.  
  5612.  
  5613.  
  5614.  
  5615.  
  5616.                #include <stdlib.h>
  5617.                #include <conio.h>
  5618.                #include "svgacc.h"
  5619.  
  5620.                void main(void)
  5621.                {
  5622.                  int vmode, xsize, ysize, numcol, ok;
  5623.                  int i, darkcolor, britecolor, currcolor;
  5624.                  PaletteData gifpal;
  5625.                  char buf[80];
  5626.                  char fname[] = "uttower.gif";
  5627.  
  5628.                  vmode = videomodeget();
  5629.                  if ( !whichvga() || (whichmem() < 512))
  5630.                     exit(1);
  5631.  
  5632.                  ok = gifgetinfo(fname,&xsize,&ysize,&numcol,gifpal);
  5633.  
  5634.                  if (ok == 1) {
  5635.                     if ( !res640() )
  5636.                       exit(1);
  5637.  
  5638.                     /* we have an unknown 8 bit palette and we must cut it
  5639.                down to
  5640.                        6 bits and find the brightest and darkest colors */
  5641.                     darkcolor = 0 + 0 + 0;
  5642.                     britecolor = 63 + 63 + 63;
  5643.                     for(i=0;i<255;i++) {
  5644.                       gifpal[i].r >>= 2;
  5645.                       gifpal[i].g >>= 2;
  5646.                       gifpal[i].b >>= 2;
  5647.                       currcolor = gifpal[i].r + gifpal[i].g + gifpal[i].b;
  5648.                       if (currcolor > darkcolor)
  5649.                          darkcolor = currcolor;
  5650.                       if (currcolor < britecolor)
  5651.                          britecolor = currcolor;
  5652.                     }
  5653.                     palset(gifpal,0,255);
  5654.                     fillscreen(darkcolor);
  5655.                     sprintf(buf,"'%s' is identified as a 'Non-interlaced'
  5656.                type 'GIF87a' GIF image.",fname);
  5657.                     drwstring(1,britecolor,darkcolor,buf,0,0);
  5658.                     sprintf(buf,"Dimensions are: %d pixels wide and %d
  5659.                pixels high.",xsize,ysize);
  5660.                     drwstring(1,britecolor,darkcolor,buf,0,16);
  5661.                     sprintf(buf,"Number of colors: %d.",numcol);
  5662.                     drwstring(1,britecolor,darkcolor,buf,0,32);
  5663.                     gifput(SET,100,100,fname);
  5664.                  } else {
  5665.                     printf("error in GIF file, error code: %d\n",ok);
  5666.                  }
  5667.                  getch();
  5668.                  videomodeset(vmode);
  5669.  
  5670.  
  5671.                                                                          90
  5672.  
  5673.  
  5674.  
  5675.  
  5676.  
  5677.                }
  5678.  
  5679.  
  5680.  
  5681.  
  5682.  
  5683.  
  5684.  
  5685.  
  5686.  
  5687.  
  5688.  
  5689.  
  5690.  
  5691.  
  5692.  
  5693.  
  5694.  
  5695.  
  5696.  
  5697.  
  5698.  
  5699.  
  5700.  
  5701.  
  5702.  
  5703.  
  5704.  
  5705.  
  5706.  
  5707.  
  5708.  
  5709.  
  5710.  
  5711.  
  5712.  
  5713.  
  5714.  
  5715.  
  5716.  
  5717.  
  5718.  
  5719.  
  5720.  
  5721.  
  5722.  
  5723.  
  5724.  
  5725.  
  5726.  
  5727.  
  5728.  
  5729.  
  5730.  
  5731.  
  5732.  
  5733.                                                                          91
  5734.  
  5735.  
  5736.  
  5737.  
  5738.  
  5739.             GIFMAKE
  5740.  
  5741.                PROTOTYPE
  5742.  
  5743.                extern int far gifmake (int x1, int y1, int x2, int y2,
  5744.                const char far *name)
  5745.  
  5746.                INPUT
  5747.  
  5748.                x1, y1 - the location of the top, left corner of the image
  5749.                x2, y2 - the bottom, right corner of the image
  5750.                name - filename to store the GIF image
  5751.  
  5752.                OUTPUT
  5753.  
  5754.                GIFMAKE returns a 1 if successful, 0 if unsuccessful.
  5755.  
  5756.                USAGE
  5757.  
  5758.                GIFMAKE takes the bitmap enclosed in the box defined by (x1,
  5759.                y1) - (x2, y2) and writes a GIF with the filename specified
  5760.                by name.  The resulting file uses the GIF87a compression
  5761.                specifications.  The values x1, y1, x2 and y2 must be valid
  5762.                coordinates on the currently active page.  Name may specify
  5763.                a full path and drive letter, if necessary.
  5764.  
  5765.                SEE ALSO
  5766.  
  5767.                GIFGETINFO, GIFPUT
  5768.  
  5769.                EXAMPLE
  5770.  
  5771.                /*
  5772.                 * Make a simple GIF file
  5773.                 */
  5774.  
  5775.                #include <stdlib.h>
  5776.                #include <conio.h>
  5777.                #include "svgacc.h"
  5778.                #define randnum(size) (rand() % (int)(size))
  5779.  
  5780.                void main(void)
  5781.                {
  5782.                  int vmode,colr,num,i;
  5783.                  int x1,y1,x2,y2,er;
  5784.                  char text[]="This GIF was made using Zephyr Software's
  5785.                GIFMAKE function!";
  5786.                  char fname[]="test.gif";
  5787.  
  5788.                  vmode = videomodeget();
  5789.                  if ( !whichvga() || (whichmem() < 512))
  5790.                     exit(1);
  5791.                  if ( !res640() )
  5792.                     exit(1);
  5793.  
  5794.  
  5795.                                                                          92
  5796.  
  5797.  
  5798.  
  5799.  
  5800.  
  5801.                  fillscreen(10);
  5802.                  colr = 1;
  5803.                  for(i=0;i<200;i++) {
  5804.                     x1 = randnum(maxx);
  5805.                     y1 = randnum(maxy);
  5806.                     x2 = randnum(maxx);
  5807.                     y2 = randnum(maxy);
  5808.                     drwline(1,colr++,x1,y1,x2,y2);
  5809.                     if (colr>15)
  5810.                       colr = 1;
  5811.                  }
  5812.                  drwbox(SET,15,0,0,maxx,maxy);
  5813.                  drwstring(1,15,0,text,60,10);
  5814.                  er = gifmake(0,0,maxx,maxy,fname);
  5815.                  if (er != 1 ) {
  5816.                     videomodeset(vmode);
  5817.                     exit(1);
  5818.                  }
  5819.  
  5820.                  videomodeset(vmode);
  5821.                  exit(0);
  5822.                } 
  5823.  
  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.  
  5852.  
  5853.  
  5854.  
  5855.  
  5856.  
  5857.                                                                          93
  5858.  
  5859.  
  5860.  
  5861.  
  5862.  
  5863.             GIFPUT
  5864.  
  5865.                PROTOTYPE
  5866.  
  5867.                extern int far gifput (PixelMode mode, int xloc, int yloc,
  5868.                const char far *name)
  5869.  
  5870.                INPUT
  5871.  
  5872.                mode - pixel write mode
  5873.                xloc, yloc - the location of the top, left corner of the GIF
  5874.                image
  5875.                name - char pointer to filename of the GIF image to read
  5876.  
  5877.                OUTPUT
  5878.  
  5879.                GIFPUT returns 1 if successful, error code otherwise.
  5880.  
  5881.                USAGE
  5882.  
  5883.                GIFPUT reads the GIF image from name and places it on the
  5884.                screen with the top, left corner at xloc, yloc.  The image
  5885.                is automatically clipped to the currently defined viewport.
  5886.                The image's palette should be previously obtained by using
  5887.                GIFGETINFO.
  5888.  
  5889.                For ease of programming the GIF decoder requires that the
  5890.                image be non-interlaced, use only a global color map and be
  5891.                compressed according to the GIF87A specifications.
  5892.  
  5893.                If GIFPUT encounters no problems, the function will return a
  5894.                one.  Otherwise, the function will return one of several
  5895.                error codes as listed below:
  5896.  
  5897.                0 =  does not exist or there is some disk I/O problem
  5898.                -1 = does not have the GIF87A signature
  5899.                -2 = image is interlaced
  5900.                -3 = does not use a global color map
  5901.                -4 = has some general error
  5902.  
  5903.                SEE ALSO
  5904.  
  5905.                GIFGETINFO, GIFMAKE, SETVIEW
  5906.  
  5907.                EXAMPLE
  5908.  
  5909.                See GIFGETINFO
  5910.  
  5911.  
  5912.  
  5913.  
  5914.  
  5915.  
  5916.  
  5917.  
  5918.  
  5919.                                                                          94
  5920.  
  5921.  
  5922.  
  5923.  
  5924.  
  5925.             JOYSTICKINFO
  5926.  
  5927.                PROTOTYPE
  5928.  
  5929.                extern void far joystickinfo (int far *jax, int far *jay,
  5930.                int far *jabuts, int far *jbx, int far *jby, int far
  5931.                *jbbuts)
  5932.  
  5933.                INPUT
  5934.  
  5935.                no input parameters
  5936.  
  5937.                OUTPUT
  5938.  
  5939.                jax, jay - horizontal and vertical values of joystick A
  5940.                jabuts - button status of joystick A
  5941.                jbx, jby - horizontal and vertical values of joystick B
  5942.                jbbuts - button status of joystick B
  5943.  
  5944.                USAGE
  5945.  
  5946.                JOYSTICKINFO returns the current status of the two
  5947.                joysticks' position and buttons.  The position is returned
  5948.                in jax, jay for joystick A and jbx, jby for joystick B.  The
  5949.                buttons' status is held in jabuts and jbbuts.  For each
  5950.                joystick, button A - usually the fire button - is held in
  5951.                bit zero and button B is in bit one.  Button status is most
  5952.                easily checked with a bitwise AND of jabuts (or jbbuts) and
  5953.                the desired bit.
  5954.  
  5955.                Not all joysticks are constructed with the same components.
  5956.                In addition, joysticks are not linear devices.  The value of
  5957.                a joystick's center will not necessarily be the mean of its
  5958.                extreme values.  Therefore, it is recommended that any
  5959.                program using the joystick for more than just directional
  5960.                control complete a calibration of the joystick prior to
  5961.                usage.  For an example of joystick calibration, see the
  5962.                SVGADEMO.EXE source code.
  5963.  
  5964.                It is recommended, though not required, to call
  5965.                WHICHJOYSTICK, prior to using the joysticks in order to
  5966.                verify the existence of the hardware.
  5967.  
  5968.                SEE ALSO
  5969.  
  5970.                WHICHJOYSTICK
  5971.  
  5972.                EXAMPLE
  5973.  
  5974.                /*
  5975.                 * show joysticks port readings
  5976.                 */
  5977.  
  5978.                #include <stdlib.h>
  5979.  
  5980.  
  5981.                                                                          95
  5982.  
  5983.  
  5984.  
  5985.  
  5986.  
  5987.                #include <conio.h>
  5988.                #include "svgacc.h"
  5989.  
  5990.                void main(void)
  5991.                {
  5992.                  int vmode;
  5993.                  int jax, jay, jabuts, jbx, jby, jbbuts;
  5994.  
  5995.                  printf("A:  X    Y  btn | B:  X    Y  btn\n  ");
  5996.                  while(!kbhit()) {
  5997.                     joystickinfo(&jax,&jay,&jabuts,&jbx,&jby,&jbbuts);
  5998.                     printf("%04d %04d  %1d  |   ",jax,jay,jabuts);
  5999.                     printf("%04d %04d  %1d",jbx,jby,jbbuts);
  6000.                     printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
  6001.                     printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
  6002.                  }
  6003.                  getch();
  6004.                }
  6005.  
  6006.  
  6007.  
  6008.  
  6009.  
  6010.  
  6011.  
  6012.  
  6013.  
  6014.  
  6015.  
  6016.  
  6017.  
  6018.  
  6019.  
  6020.  
  6021.  
  6022.  
  6023.  
  6024.  
  6025.  
  6026.  
  6027.  
  6028.  
  6029.  
  6030.  
  6031.  
  6032.  
  6033.  
  6034.  
  6035.  
  6036.  
  6037.  
  6038.  
  6039.  
  6040.  
  6041.  
  6042.  
  6043.                                                                          96
  6044.  
  6045.  
  6046.  
  6047.  
  6048.  
  6049.             MOUSEBUTPRESS
  6050.  
  6051.                PROTOTYPE
  6052.  
  6053.                extern void far mousebutpress (int reqbut, int far *xloc,
  6054.                int far *yloc, int far *num, int far *mbuts)
  6055.  
  6056.                INPUT
  6057.  
  6058.                reqbut - button for which information is requested
  6059.  
  6060.                OUTPUT
  6061.  
  6062.                x, y - current location of mouse cursor
  6063.                num - number of times requested button has been pressed
  6064.                since last request
  6065.                mbuts - current status of mouse buttons
  6066.  
  6067.                USAGE
  6068.  
  6069.                MOUSEBUTPRESS returns in Num the number of times a mouse
  6070.                button has been pressed since the last call to
  6071.                MOUSEBUTPRESS.  In addition the current status of the mouse
  6072.                cursor and buttons is returned.  The position is returned in
  6073.                X, Y.  The buttons' status is held in mbuts.  The left
  6074.                button is held in bit zero, right button in bit one and
  6075.                center button - for three button mice - in bit two.  Button
  6076.                status is most easily checked with a bitwise AND of mbuts
  6077.                and the desired bit.  The button for which a history is
  6078.                desired is identified by the bits in reqbut.  However, only
  6079.                one bit in reqbut may be set.  Therefore, only the values of
  6080.                1, 2 and 4 are permitted.  If more than one bit in reqbut is
  6081.                set, the function will exit and no information will be
  6082.                returned.
  6083.  
  6084.                SEE ALSO
  6085.  
  6086.                MOUSEBUTRELEASE, MOUSESTATUS
  6087.  
  6088.                EXAMPLE
  6089.  
  6090.                /* enable,show mouse / display left button press history for
  6091.                the last 2
  6092.                 * seconds
  6093.                 */
  6094.  
  6095.                #include <stdlib.h>
  6096.                #include <conio.h>
  6097.                #include "svgacc.h"
  6098.  
  6099.                void main(void)
  6100.                {
  6101.                  int vmode, x, y, n, mbuts;
  6102.                  char text[50];
  6103.  
  6104.  
  6105.                                                                          97
  6106.  
  6107.  
  6108.  
  6109.  
  6110.  
  6111.                  char textclr[]="
  6112.                ";
  6113.  
  6114.                  vmode = videomodeget();
  6115.                  if ( !whichvga() )
  6116.                     exit(1);
  6117.                  if ( whichmem() < 512)
  6118.                     exit(1);
  6119.                  if ( !whichmouse())
  6120.                     exit(1);
  6121.                  res640();
  6122.                  mousecursordefault();
  6123.                  mouseenter();
  6124.                  mouseshow();
  6125.                  while(!kbhit())
  6126.                  {
  6127.                     mousebutpress(1,&x,&y,&n,&mbuts);
  6128.                     sprintf(text,"mouse x loc: %3d, y loc: %3d, number of
  6129.                times: %2d",x,y,n);
  6130.                     mousehide();
  6131.                     drwstring(1,15,8,text,0,0);
  6132.                     mouseshow();
  6133.                     sdelay(80);
  6134.                     mousehide();
  6135.                     drwstring(1,15,8,textclr,0,0);
  6136.                     mouseshow();
  6137.                  }
  6138.                  mousehide();
  6139.                  mouseexit();
  6140.                  videomodeset(vmode);
  6141.                  exit(0);
  6142.                }
  6143.  
  6144.  
  6145.  
  6146.  
  6147.  
  6148.  
  6149.  
  6150.  
  6151.  
  6152.  
  6153.  
  6154.  
  6155.  
  6156.  
  6157.  
  6158.  
  6159.  
  6160.  
  6161.  
  6162.  
  6163.  
  6164.  
  6165.  
  6166.  
  6167.                                                                          98
  6168.  
  6169.  
  6170.  
  6171.  
  6172.  
  6173.             MOUSEBUTRELEASE
  6174.  
  6175.                PROTOTYPE
  6176.  
  6177.                extern void far mousebutrelease (int reqbut, int far *xloc,
  6178.                int far *yloc, int far *num, int far *mbuts)
  6179.  
  6180.                INPUT
  6181.  
  6182.                reqbut - button for which information is requested
  6183.  
  6184.                OUTPUT
  6185.  
  6186.                x, y - current location of mouse cursor
  6187.                num - number of times requested button has been released
  6188.                since last request
  6189.                mbuts - current status of mouse buttons
  6190.  
  6191.                USAGE
  6192.  
  6193.                MOUSEBUTRELEASE returns in Num the number of times a mouse
  6194.                button has been released since the last call to
  6195.                MOUSEBUTRELEASE.  In addition the current status of the
  6196.                mouse cursor and buttons is returned.  The position is
  6197.                returned in x, y.  The buttons' status is held in mbuts.
  6198.                The left button is held in bit zero, right button in bit one
  6199.                and center button - for three button mice - in bit two.
  6200.                Button status is most easily checked with a bitwise AND of
  6201.                mbuts and the desired bit.  The button for which a history
  6202.                is desired is identified by the bits in reqbut.  However,
  6203.                only one bit in reqbut may be set.  Therefore, only the
  6204.                values of 1, 2 and 4 are permitted.  If more than one bit in
  6205.                reqbut is set, the function will exit and no information
  6206.                will be returned.
  6207.  
  6208.                SEE ALSO
  6209.  
  6210.                MOUSEBUTPRESS, MOUSESTATUS
  6211.  
  6212.                EXAMPLE
  6213.  
  6214.                /* enable,show mouse / display left button release history
  6215.                for the last
  6216.                 * 2 seconds
  6217.                 */
  6218.  
  6219.                #include <stdlib.h>
  6220.                #include <conio.h>
  6221.                #include "svgacc.h"
  6222.  
  6223.                void main(void)
  6224.                {
  6225.                  int vmode, x, y, n, mbuts;
  6226.                  char text[50];
  6227.  
  6228.  
  6229.                                                                          99
  6230.  
  6231.  
  6232.  
  6233.  
  6234.  
  6235.                  char textclr[]="
  6236.                ";
  6237.  
  6238.                  vmode = videomodeget();
  6239.                  if ( !whichvga() )
  6240.                     exit(1);
  6241.                  if ( whichmem() < 512)
  6242.                     exit(1);
  6243.                  if ( !whichmouse())
  6244.                     exit(1);
  6245.                  res640();
  6246.                  mousecursordefault();
  6247.                  mouseenter();
  6248.                  mouseshow();
  6249.                  while(!kbhit())
  6250.                  {
  6251.                     mousebutrelease(1,&x,&y,&n,&mbuts);
  6252.                     sprintf(text,"mouse x loc: %3d, y loc: %3d, number of
  6253.                times: %2d",x,y,n);
  6254.                     mousehide();
  6255.                     drwstring(1,15,8,text,0,0);
  6256.                     mouseshow();
  6257.                     sdelay(80);
  6258.                     mousehide();
  6259.                     drwstring(1,15,8,textclr,0,0);
  6260.                     mouseshow();
  6261.                  }
  6262.                  mousehide();
  6263.                  mouseexit();
  6264.                  videomodeset(vmode);
  6265.                  exit(0);
  6266.                }
  6267.  
  6268.  
  6269.  
  6270.  
  6271.  
  6272.  
  6273.  
  6274.  
  6275.  
  6276.  
  6277.  
  6278.  
  6279.  
  6280.  
  6281.  
  6282.  
  6283.  
  6284.  
  6285.  
  6286.  
  6287.  
  6288.  
  6289.  
  6290.  
  6291.                                                                         100
  6292.  
  6293.  
  6294.  
  6295.  
  6296.  
  6297.             MOUSECURSORSET
  6298.  
  6299.                PROTOTYPE
  6300.  
  6301.                extern void far mousecursorset (MouseCursor far
  6302.                *mousecursor)
  6303.  
  6304.                INPUT
  6305.  
  6306.                mousecursor - MouseCursor pointer to mouse cursor data
  6307.  
  6308.                OUTPUT
  6309.  
  6310.                no value returned
  6311.  
  6312.                USAGE
  6313.  
  6314.                MOUSECURSORSET defines the cursor according to the data in
  6315.                the MouseCursor structure.  The hot spot for the cursor is
  6316.                set by mousecursor.hotspotx, mousecursor.hotspoty.  The
  6317.                values for mousecursor.hotspotx and mousecursor.hotspoty
  6318.                must be within the cursor.  Valid mousecursor.hotspotx
  6319.                values are from 0 to 15 and mousecursor.hotspoty ranges from
  6320.                0 to 23.
  6321.  
  6322.                SEE ALSO
  6323.  
  6324.                MOUSECURSORDEFAULT, MOUSEENTER, MOUSESHOW
  6325.  
  6326.                EXAMPLE
  6327.  
  6328.                /*
  6329.                 * enable,show mouse, and switch to a different mouse cursor
  6330.                 */
  6331.  
  6332.                #include <stdlib.h>
  6333.                #include <conio.h>
  6334.                #include "svgacc.h"
  6335.  
  6336.                void main(void)
  6337.                {
  6338.                  int vmode;
  6339.  
  6340.                  MouseCursor bigmousecursor = {
  6341.                     1,1,
  6342.  
  6343.                  0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255
  6344.                ,
  6345.  
  6346.                  0,15,15,0,0,255,255,255,255,255,255,255,255,255,255,255,
  6347.                     0,15,15,15,15,0,0,0,255,255,255,255,255,255,255,255,
  6348.                     0,15,15,15,15,15,15,15,0,0,255,255,255,255,255,255,
  6349.                     0,15,15,15,15,15,15,15,15,15,0,0,0,255,255,255,
  6350.                     0,15,15,15,15,15,15,15,15,15,15,15,15,0,0,255,
  6351.  
  6352.  
  6353.                                                                         101
  6354.  
  6355.  
  6356.  
  6357.  
  6358.  
  6359.                     0,15,15,15,15,15,15,15,15,15,15,15,15,15,0,255,
  6360.                     0,15,15,15,15,15,15,15,15,15,15,15,0,0,255,255,
  6361.                     0,15,15,15,15,15,15,15,15,15,15,0,255,255,255,255,
  6362.                     0,15,15,15,15,15,15,15,15,0,0,255,255,255,255,255,
  6363.                     0,15,15,15,15,15,15,15,15,0,255,255,255,255,255,255,
  6364.                     0,15,15,15,15,15,0,15,15,15,0,255,255,255,255,255,
  6365.                     0,15,15,15,15,0,0,15,15,15,0,255,255,255,255,255,
  6366.                     0,15,15,0,0,255,255,0,15,15,15,0,255,255,255,255,
  6367.                     0,15,0,255,255,255,255,0,15,15,15,0,255,255,255,255,
  6368.                     0,0,255,255,255,255,255,255,0,15,15,15,0,255,255,255,
  6369.  
  6370.                  255,255,255,255,255,255,255,255,255,0,15,15,15,0,255,255,
  6371.  
  6372.                  255,255,255,255,255,255,255,255,255,0,15,15,15,0,255,255,
  6373.  
  6374.                  255,255,255,255,255,255,255,255,255,255,0,15,15,15,0,255,
  6375.  
  6376.                  255,255,255,255,255,255,255,255,255,255,255,0,15,15,15,0,
  6377.  
  6378.                  255,255,255,255,255,255,255,255,255,255,255,0,15,15,15,0,
  6379.  
  6380.                  255,255,255,255,255,255,255,255,255,255,255,255,0,15,15,0
  6381.                ,
  6382.  
  6383.                  255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0
  6384.                ,
  6385.  
  6386.                  255,255,255,255,255,255,255,255,255,255,255,255,255,255,2
  6387.                55,255
  6388.                  };
  6389.  
  6390.                  vmode = videomodeget();
  6391.                  if ( !whichvga() )
  6392.                     exit(1);
  6393.                  if ( whichmem() < 512)
  6394.                     exit(1);
  6395.                  if ( !whichmouse())
  6396.                     exit(1);
  6397.                  res640();
  6398.                  mouseenter();
  6399.                  drwstring(1,7,0,"press a key to return to default
  6400.                cursor",0,0);
  6401.                  mousecursorset(bigmousecursor);
  6402.                  mouseshow();
  6403.                  getch();
  6404.                  mousecursordefault();
  6405.                  drwstring(1,7,0,"press a key to end
  6406.                ",0,0);
  6407.                  getch();
  6408.                  mousehide();
  6409.                  mouseexit();
  6410.                  videomodeset(vmode);
  6411.                  exit(0);
  6412.                }
  6413.  
  6414.  
  6415.                                                                         102
  6416.  
  6417.  
  6418.  
  6419.  
  6420.  
  6421.             MOUSECURSORDEFAULT
  6422.  
  6423.                PROTOTYPE
  6424.  
  6425.                extern void far mousecursordefault (void)
  6426.  
  6427.                INPUT
  6428.  
  6429.                no input parameters
  6430.  
  6431.                OUTPUT
  6432.  
  6433.                no value returned
  6434.  
  6435.                USAGE
  6436.  
  6437.                MOUSECURSORDEFAULT defines the mouse cursor to be a small
  6438.                arrow with the hot spot in the upper, left corner.  This is
  6439.                the cursor set when MOUSEENTER is called.
  6440.  
  6441.                SEE ALSO
  6442.  
  6443.                MOUSECURSORSET, MOUSEENTER
  6444.  
  6445.                EXAMPLE
  6446.  
  6447.                See MOUSECURSORSET
  6448.  
  6449.  
  6450.  
  6451.  
  6452.  
  6453.  
  6454.  
  6455.  
  6456.  
  6457.  
  6458.  
  6459.  
  6460.  
  6461.  
  6462.  
  6463.  
  6464.  
  6465.  
  6466.  
  6467.  
  6468.  
  6469.  
  6470.  
  6471.  
  6472.  
  6473.  
  6474.  
  6475.  
  6476.  
  6477.                                                                         103
  6478.  
  6479.  
  6480.  
  6481.  
  6482.  
  6483.             MOUSEENTER
  6484.  
  6485.                PROTOTYPE
  6486.  
  6487.                extern void far mouseenter (void)
  6488.  
  6489.                INPUT
  6490.  
  6491.                no input parameters
  6492.  
  6493.                OUTPUT
  6494.  
  6495.                no value returned
  6496.  
  6497.                USAGE
  6498.  
  6499.                MOUSEENTER must be called before any other mouse functions.
  6500.                It initializes all of the mouse abilities including
  6501.                installing the Zephyr mouse display driver.  MOUSEENTER
  6502.                initializes the default mouse cursor, the default
  6503.                sensitivity and sets the range to the current screen
  6504.                resolution.  The mouse cursor location is set to the middle
  6505.                of the screen.
  6506.  
  6507.                SEE ALSO
  6508.  
  6509.                MOUSEEXIT, MOUSEHIDE, MOUSESHOW
  6510.  
  6511.                EXAMPLE
  6512.  
  6513.                /*
  6514.                 * enable,show mouse
  6515.                 */
  6516.                #include <stdlib.h>
  6517.                #include <conio.h>
  6518.                #include "svgacc.h"
  6519.  
  6520.                void main(void)
  6521.                {
  6522.                  int vmode;
  6523.  
  6524.                  vmode = videomodeget();
  6525.                  if ( !whichvga() )
  6526.                     exit(1);
  6527.                  if ( whichmem() < 512)
  6528.                     exit(1);
  6529.                  if ( !whichmouse())
  6530.                     exit(1);
  6531.                  res640();
  6532.                  mouseenter();
  6533.                  mouseshow();
  6534.                  getch();
  6535.                  mousehide();
  6536.                  mouseexit();
  6537.  
  6538.  
  6539.                                                                         104
  6540.  
  6541.  
  6542.  
  6543.  
  6544.  
  6545.                  videomodeset(vmode);
  6546.                  exit(0);
  6547.                }
  6548.  
  6549.  
  6550.  
  6551.  
  6552.  
  6553.  
  6554.  
  6555.  
  6556.  
  6557.  
  6558.  
  6559.  
  6560.  
  6561.  
  6562.  
  6563.  
  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.  
  6596.  
  6597.  
  6598.  
  6599.  
  6600.  
  6601.                                                                         105
  6602.  
  6603.  
  6604.  
  6605.  
  6606.  
  6607.             MOUSEEXIT
  6608.  
  6609.                PROTOTYPE
  6610.  
  6611.                extern void far mouseexit (void)
  6612.  
  6613.                INPUT
  6614.  
  6615.                no input parameters
  6616.  
  6617.                OUTPUT
  6618.  
  6619.                no value returned
  6620.  
  6621.                USAGE
  6622.  
  6623.                MOUSEEXIT properly disables all of the mouse abilities.
  6624.                This function also removes the Zephyr mouse display driver.
  6625.                This function should be called prior to exiting any program
  6626.                that previously called MOUSEENTER.
  6627.  
  6628.                SEE ALSO
  6629.  
  6630.                MOUSEENTER, MOUSEHIDE, MOUSESHOW
  6631.  
  6632.                EXAMPLE
  6633.  
  6634.                /*
  6635.                 * enable,show mouse, then disable it
  6636.                 */
  6637.                #include <stdlib.h>
  6638.                #include <conio.h>
  6639.                #include "svgacc.h"
  6640.  
  6641.                void main(void)
  6642.                {
  6643.                  int vmode;
  6644.  
  6645.                  vmode = videomodeget();
  6646.                  if ( !whichvga() )
  6647.                     exit(1);
  6648.                  if ( whichmem() < 512)
  6649.                     exit(1);
  6650.                  if ( !whichmouse())
  6651.                     exit(1);
  6652.                  res640();
  6653.                  mousecursordefault();
  6654.                  mouseenter();
  6655.                  mouseshow();
  6656.                  getch();
  6657.                  mousehide();
  6658.                  mouseexit();
  6659.                  videomodeset(vmode);
  6660.                  exit(0);
  6661.  
  6662.  
  6663.                                                                         106
  6664.  
  6665.  
  6666.  
  6667.  
  6668.  
  6669.                }
  6670.  
  6671.  
  6672.  
  6673.  
  6674.  
  6675.  
  6676.  
  6677.  
  6678.  
  6679.  
  6680.  
  6681.  
  6682.  
  6683.  
  6684.  
  6685.  
  6686.  
  6687.  
  6688.  
  6689.  
  6690.  
  6691.  
  6692.  
  6693.  
  6694.  
  6695.  
  6696.  
  6697.  
  6698.  
  6699.  
  6700.  
  6701.  
  6702.  
  6703.  
  6704.  
  6705.  
  6706.  
  6707.  
  6708.  
  6709.  
  6710.  
  6711.  
  6712.  
  6713.  
  6714.  
  6715.  
  6716.  
  6717.  
  6718.  
  6719.  
  6720.  
  6721.  
  6722.  
  6723.  
  6724.  
  6725.                                                                         107
  6726.  
  6727.  
  6728.  
  6729.  
  6730.  
  6731.             MOUSEHIDE
  6732.  
  6733.                PROTOTYPE
  6734.  
  6735.                extern void far mousehide (void)
  6736.  
  6737.                INPUT
  6738.  
  6739.                no input parameters
  6740.  
  6741.                OUTPUT
  6742.  
  6743.                no value returned
  6744.  
  6745.                USAGE
  6746.  
  6747.                MOUSEHIDE turns off the mouse display driver and removes the
  6748.                cursor from the display.  It is recommended to hide the
  6749.                mouse any time something will be drawn in its general
  6750.                vicinity.  Note, however, that although the cursor is not
  6751.                visible, all other mouse abilities remain active.
  6752.  
  6753.                SEE ALSO
  6754.  
  6755.                MOUSEENTER, MOUSEEXIT, MOUSESHOW
  6756.  
  6757.                EXAMPLE
  6758.  
  6759.                /*
  6760.                 * enable,show mouse,hide mouse
  6761.                 */
  6762.                #include <stdlib.h>
  6763.                #include <conio.h>
  6764.                #include "svgacc.h"
  6765.                void main(void)
  6766.                {
  6767.                  int vmode;
  6768.  
  6769.                  vmode = videomodeget();
  6770.                  if ( !whichvga() )
  6771.                     exit(1);
  6772.                  if ( whichmem() < 512)
  6773.                     exit(1);
  6774.                  if ( !whichmouse())
  6775.                     exit(1);
  6776.                  res640();
  6777.                  mousecursordefault();
  6778.                  mouseenter();
  6779.                  mouseshow();
  6780.                  getch();
  6781.                  mousehide();
  6782.                  getch();
  6783.                  mouseexit();
  6784.                  videomodeset(vmode);
  6785.  
  6786.  
  6787.                                                                         108
  6788.  
  6789.  
  6790.  
  6791.  
  6792.  
  6793.                  exit(0);
  6794.                }
  6795.  
  6796.  
  6797.  
  6798.  
  6799.  
  6800.  
  6801.  
  6802.  
  6803.  
  6804.  
  6805.  
  6806.  
  6807.  
  6808.  
  6809.  
  6810.  
  6811.  
  6812.  
  6813.  
  6814.  
  6815.  
  6816.  
  6817.  
  6818.  
  6819.  
  6820.  
  6821.  
  6822.  
  6823.  
  6824.  
  6825.  
  6826.  
  6827.  
  6828.  
  6829.  
  6830.  
  6831.  
  6832.  
  6833.  
  6834.  
  6835.  
  6836.  
  6837.  
  6838.  
  6839.  
  6840.  
  6841.  
  6842.  
  6843.  
  6844.  
  6845.  
  6846.  
  6847.  
  6848.  
  6849.                                                                         109
  6850.  
  6851.  
  6852.  
  6853.  
  6854.  
  6855.             MOUSEINFO
  6856.  
  6857.                PROTOTYPE
  6858.  
  6859.                extern void far mouseinfo (int far *drvmajorver, int far
  6860.                *drvminorver, int far *mousetype, int far *irqnumber)
  6861.  
  6862.                INPUT
  6863.  
  6864.                no input parameters
  6865.  
  6866.                OUTPUT
  6867.  
  6868.                drvmajorver - Microsoft compatible mouse driver major
  6869.                version number
  6870.                drvminorver - Microsoft compatible mouse driver minor
  6871.                version number
  6872.                mousetype - type of mouse installed
  6873.                irqnumber - interrupt used by the mouse
  6874.  
  6875.                USAGE
  6876.  
  6877.                MOUSEINFO returns information about the mouse and its
  6878.                installed driver.  The driver must be Microsoft compatible.
  6879.                This information can be used to determine whether the mouse
  6880.                functions in this library will operate correctly.  For
  6881.                proper operation the driver version number must be greater
  6882.                than 1.00.  Irqnumber gives the interrupt number of the
  6883.                mouse.  Mousetype returns information about the type of
  6884.                hardware installed according to the following table:
  6885.  
  6886.                0 =  unknown type
  6887.                1 =  bus mouse
  6888.                2 =  serial mouse
  6889.                3 =  Inport mouse
  6890.                4 =  PS/2 mouse
  6891.                5 =  HP mouse
  6892.  
  6893.                SEE ALSO
  6894.  
  6895.                WHICHMOUSE
  6896.  
  6897.                EXAMPLE
  6898.  
  6899.                /*
  6900.                 * id any installed mouse
  6901.                 */
  6902.  
  6903.                #include <stdlib.h>
  6904.                #include <conio.h>
  6905.                #include "svgacc.h"
  6906.  
  6907.                void main(void)
  6908.                {
  6909.  
  6910.  
  6911.                                                                         110
  6912.  
  6913.  
  6914.  
  6915.  
  6916.  
  6917.                  int mjv, mnv, tp, i, mouse;
  6918.                  char buf[100];
  6919.  
  6920.                  mouse = whichmouse();
  6921.                  if (mouse > 0) {
  6922.                     mouseinfo(&mjv, &mnv, &tp, &i);
  6923.                     switch (tp) {
  6924.                       case 1:
  6925.                          sprintf(buf,"bus mouse");
  6926.                          break;
  6927.                       case 2:
  6928.                          sprintf(buf,"serial mouse");
  6929.                          break;
  6930.                       case 3:
  6931.                          sprintf(buf,"Inport mouse");
  6932.                          break;
  6933.                       case 4:
  6934.                          sprintf(buf,"PS/2 mouse");
  6935.                          break;
  6936.                       case 5:
  6937.                          sprintf(buf,"HP mouse");
  6938.                          break;
  6939.                       default:
  6940.                          sprintf(buf,"unknown type");
  6941.                     }
  6942.                     printf("Microsoft compatible %s detected with %d
  6943.                buttons on IRQ %d.\n", &buf, mouse, i);
  6944.                     printf("Software driver version is %d.%d (Microsoft
  6945.                equivalent version).\n\n", mjv, mnv);
  6946.  
  6947.                  } else
  6948.                     printf("No Microsoft compatible mouse detected.\n\n");
  6949.                }
  6950.  
  6951.  
  6952.  
  6953.  
  6954.  
  6955.  
  6956.  
  6957.  
  6958.  
  6959.  
  6960.  
  6961.  
  6962.  
  6963.  
  6964.  
  6965.  
  6966.  
  6967.  
  6968.  
  6969.  
  6970.  
  6971.  
  6972.  
  6973.                                                                         111
  6974.  
  6975.  
  6976.  
  6977.  
  6978.  
  6979.             MOUSELOCSET
  6980.  
  6981.                PROTOTYPE
  6982.  
  6983.                extern void far mouselocset (int xloc, int yloc)
  6984.  
  6985.                INPUT
  6986.  
  6987.                x, y - location on screen
  6988.  
  6989.                OUTPUT
  6990.  
  6991.                no value returned
  6992.  
  6993.                USAGE
  6994.  
  6995.                MOUSELOCSET moves the mouse cursor the location on the
  6996.                screen specified by x, y.  If either x or y is outside of
  6997.                the currently permitted mouse range, it is set to the
  6998.                closest border.  The currently permitted mouse range is the
  6999.                current screen resolution or the last called MOUSERANGESET.
  7000.  
  7001.                SEE ALSO
  7002.  
  7003.                MOUSEENTER, MOUSERANGESET
  7004.  
  7005.                EXAMPLE
  7006.  
  7007.                /*
  7008.                 * enable,show mouse then move it to the origin
  7009.                 */
  7010.                #include <stdlib.h>
  7011.                #include <conio.h>
  7012.                #include "svgacc.h"
  7013.                void main(void)
  7014.                {
  7015.                  int vmode;
  7016.                  vmode = videomodeget();
  7017.                  if ( !whichvga() )
  7018.                     exit(1);
  7019.                  if ( whichmem() < 512)
  7020.                     exit(1);
  7021.                  if ( !whichmouse())
  7022.                     exit(1);
  7023.                  res640();
  7024.                  mousecursordefault();
  7025.                  mouseenter();
  7026.                  mouseshow();
  7027.                  getch();
  7028.                  mouselocset(0,0);
  7029.                  getch();
  7030.                  mousehide();
  7031.                  mouseexit();
  7032.                  videomodeset(vmode);
  7033.  
  7034.  
  7035.                                                                         112
  7036.  
  7037.  
  7038.  
  7039.  
  7040.  
  7041.                  exit(0);
  7042.                }
  7043.  
  7044.  
  7045.  
  7046.  
  7047.  
  7048.  
  7049.  
  7050.  
  7051.  
  7052.  
  7053.  
  7054.  
  7055.  
  7056.  
  7057.  
  7058.  
  7059.  
  7060.  
  7061.  
  7062.  
  7063.  
  7064.  
  7065.  
  7066.  
  7067.  
  7068.  
  7069.  
  7070.  
  7071.  
  7072.  
  7073.  
  7074.  
  7075.  
  7076.  
  7077.  
  7078.  
  7079.  
  7080.  
  7081.  
  7082.  
  7083.  
  7084.  
  7085.  
  7086.  
  7087.  
  7088.  
  7089.  
  7090.  
  7091.  
  7092.  
  7093.  
  7094.  
  7095.  
  7096.  
  7097.                                                                         113
  7098.  
  7099.  
  7100.  
  7101.  
  7102.  
  7103.             MOUSERANGESET
  7104.  
  7105.                PROTOTYPE
  7106.  
  7107.                extern void far mouserangeset (int x1, int y1, int x2, int
  7108.                y2)
  7109.  
  7110.                INPUT
  7111.  
  7112.                x1, y1 - location on screen of top, left corner of range
  7113.                x2, y2 - location on screen of bottom, right corner of range
  7114.  
  7115.                OUTPUT
  7116.  
  7117.                no value returned
  7118.  
  7119.                USAGE
  7120.  
  7121.                MOUSERANGESET defines a permissible range on the screen for
  7122.                mouse movement.  The mouse is automatically positioned in
  7123.                the center of this range.
  7124.  
  7125.                SEE ALSO
  7126.  
  7127.                MOUSELOCSET, MOUSESTATUS
  7128.  
  7129.                EXAMPLE
  7130.  
  7131.                /*
  7132.                 * enable,show and set a range for the mouse
  7133.                 */
  7134.  
  7135.                #include <stdlib.h>
  7136.                #include <conio.h>
  7137.                #include "svgacc.h"
  7138.  
  7139.                void main(void)
  7140.                {
  7141.                  int vmode;
  7142.                  vmode = videomodeget();
  7143.                  if ( !whichvga() )
  7144.                     exit(1);
  7145.                  if ( whichmem() < 512)
  7146.                     exit(1);
  7147.                  if ( !whichmouse())
  7148.                     exit(1);
  7149.                  if ( !res640() )
  7150.                     exit(1);
  7151.                  mouseenter();
  7152.                  drwbox(1,10,100,100,539,379);
  7153.                  mouserangeset(100,100,539,379);
  7154.                  mouseshow();
  7155.                  getch();
  7156.                  mousehide();
  7157.  
  7158.  
  7159.                                                                         114
  7160.  
  7161.  
  7162.  
  7163.  
  7164.  
  7165.                  mouseexit();
  7166.                  videomodeset(vmode);
  7167.                  exit(0);
  7168.                }
  7169.  
  7170.  
  7171.  
  7172.  
  7173.  
  7174.  
  7175.  
  7176.  
  7177.  
  7178.  
  7179.  
  7180.  
  7181.  
  7182.  
  7183.  
  7184.  
  7185.  
  7186.  
  7187.  
  7188.  
  7189.  
  7190.  
  7191.  
  7192.  
  7193.  
  7194.  
  7195.  
  7196.  
  7197.  
  7198.  
  7199.  
  7200.  
  7201.  
  7202.  
  7203.  
  7204.  
  7205.  
  7206.  
  7207.  
  7208.  
  7209.  
  7210.  
  7211.  
  7212.  
  7213.  
  7214.  
  7215.  
  7216.  
  7217.  
  7218.  
  7219.  
  7220.  
  7221.                                                                         115
  7222.  
  7223.  
  7224.  
  7225.  
  7226.  
  7227.             MOUSERESTORESTATE
  7228.  
  7229.                PROTOTYPE
  7230.  
  7231.                extern void far mouserestorestate (byte far *mousebuf)
  7232.  
  7233.                INPUT
  7234.  
  7235.                mousebuf - byte pointer to buffer holding complete mouse
  7236.                status information
  7237.  
  7238.                OUTPUT
  7239.  
  7240.                no value returned
  7241.  
  7242.                USAGE
  7243.  
  7244.                MOUSERESTORESTATE completely restores a previously saved
  7245.                mouse status as contained in mousebuf.  The mouse status
  7246.                must have been already stored in mousebuf by MOUSESAVESTATE.
  7247.  
  7248.                SEE ALSO
  7249.  
  7250.                MOUSESAVESTATE, MOUSESTORAGESIZE
  7251.  
  7252.                EXAMPLE
  7253.  
  7254.                /*
  7255.                 * save the mouse driver state,shell out to DOS, restore the
  7256.                driver state
  7257.                 */
  7258.  
  7259.                #include <stdlib.h>
  7260.                #include <conio.h>
  7261.                #include <process.h>
  7262.                #include "svgacc.h"
  7263.  
  7264.                void main(void)
  7265.                {
  7266.                  int rt, bufsiz;
  7267.                  byte *mousedriverdata;
  7268.                  char cmdcom[]="C:\COMMAND.COM";
  7269.                  char *args[1];
  7270.  
  7271.                  if ( !whichmouse())
  7272.                     exit(1);
  7273.                  bufsiz=mousestoragesize();
  7274.                  mousedriverdata = (byte *)malloc(bufsiz);
  7275.                  mousesavestate(mousedriverdata);
  7276.                  printf("* Type Exit To Return To Program *");
  7277.                  args[0]=NULL;
  7278.                  rt=spawnv(P_WAIT,cmdcom,args);
  7279.                  mouserestorestate(mousedriverdata);
  7280.                  printf("mouse driver data restored...");
  7281.  
  7282.  
  7283.                                                                         116
  7284.  
  7285.  
  7286.  
  7287.  
  7288.  
  7289.                  exit(0);
  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.  
  7340.  
  7341.  
  7342.  
  7343.  
  7344.  
  7345.                                                                         117
  7346.  
  7347.  
  7348.  
  7349.  
  7350.  
  7351.             MOUSESAVESTATE
  7352.  
  7353.                PROTOTYPE
  7354.  
  7355.                extern void far mousesavestate (byte far *mousebuf)
  7356.  
  7357.                INPUT
  7358.  
  7359.                no input parameters
  7360.  
  7361.                OUTPUT
  7362.  
  7363.                no value returned
  7364.                mousebuf - buffer holding complete mouse status information
  7365.  
  7366.                USAGE
  7367.  
  7368.                MOUSESAVESTATE saves the complete mouse status in mousebuf.
  7369.                The size of mousebuf in bytes is defined by MOUSESTORAGESIZE
  7370.                which should called first.
  7371.  
  7372.                SEE ALSO
  7373.  
  7374.                MOUSERESTORESTATE, MOUSESTORAGESIZE
  7375.  
  7376.                EXAMPLE
  7377.  
  7378.                See MOUSERESTORESTATE
  7379.  
  7380.  
  7381.  
  7382.  
  7383.  
  7384.  
  7385.  
  7386.  
  7387.  
  7388.  
  7389.  
  7390.  
  7391.  
  7392.  
  7393.  
  7394.  
  7395.  
  7396.  
  7397.  
  7398.  
  7399.  
  7400.  
  7401.  
  7402.  
  7403.  
  7404.  
  7405.  
  7406.  
  7407.                                                                         118
  7408.  
  7409.  
  7410.  
  7411.  
  7412.  
  7413.             MOUSESENSSET
  7414.  
  7415.                PROTOTYPE
  7416.  
  7417.                extern void far mousesensset (int xsens, int ysens, int
  7418.                dblspdthresh)
  7419.  
  7420.                INPUT
  7421.  
  7422.                xsens = number of mickeys per 8 pixels horizontally (default
  7423.                = 8 mickeys per 8 pixels)
  7424.                ysens = number of mickeys per 8 pixels vertically (default =
  7425.                16 mickeys per 8 pixels)
  7426.                dblspdthresh=number of mickeys per second at which speed is
  7427.                doubled (default = 64)
  7428.  
  7429.                OUTPUT
  7430.  
  7431.                no value returned
  7432.  
  7433.                USAGE
  7434.  
  7435.                MOUSESENSSET defines the relationship between mouse movement
  7436.                and cursor movement on the screen.  A mickey is defined as
  7437.                1/200th of an inch.  The ratio between mickeys and pixels is
  7438.                specified by xsens and ysens in the horizontal and vertical
  7439.                directions respectively.  When the mouse movement is faster
  7440.                than DblSpdThresh in mickeys per second, the speed is
  7441.                doubled.  The default values are assigned whenever
  7442.                MOUSEENTER or MOUSEEXIT are called.
  7443.  
  7444.                SEE ALSO
  7445.  
  7446.                MOUSEENTER, MOUSEEXIT, MOUSESTATUS
  7447.  
  7448.                EXAMPLE
  7449.  
  7450.                /*
  7451.                 * enable,show the mouse and make it very sensitive
  7452.                 */
  7453.  
  7454.                #include <stdlib.h>
  7455.                #include <conio.h>
  7456.                #include "svgacc.h"
  7457.                void main(void)
  7458.                {
  7459.                  int vmode;
  7460.                  vmode = videomodeget();
  7461.                  if ( !whichvga() )
  7462.                     exit(1);
  7463.                  if ( whichmem() < 512)
  7464.                     exit(1);
  7465.                  if ( !whichmouse())
  7466.                     exit(1);
  7467.  
  7468.  
  7469.                                                                         119
  7470.  
  7471.  
  7472.  
  7473.  
  7474.  
  7475.                  res640();
  7476.                  mousecursordefault();
  7477.                  mouseenter();
  7478.                  mouseshow();
  7479.                  mousesensset(100,100);
  7480.                  getch();
  7481.                  mousehide();
  7482.                  mouseexit();
  7483.                  videomodeset(vmode);
  7484.                  exit(0);
  7485.                }
  7486.  
  7487.  
  7488.  
  7489.  
  7490.  
  7491.  
  7492.  
  7493.  
  7494.  
  7495.  
  7496.  
  7497.  
  7498.  
  7499.  
  7500.  
  7501.  
  7502.  
  7503.  
  7504.  
  7505.  
  7506.  
  7507.  
  7508.  
  7509.  
  7510.  
  7511.  
  7512.  
  7513.  
  7514.  
  7515.  
  7516.  
  7517.  
  7518.  
  7519.  
  7520.  
  7521.  
  7522.  
  7523.  
  7524.  
  7525.  
  7526.  
  7527.  
  7528.  
  7529.  
  7530.  
  7531.                                                                         120
  7532.  
  7533.  
  7534.  
  7535.  
  7536.  
  7537.             MOUSESHOW
  7538.  
  7539.                PROTOTYPE
  7540.  
  7541.                extern void far mouseshow (void)
  7542.  
  7543.                INPUT
  7544.  
  7545.                no input parameters
  7546.  
  7547.                OUTPUT
  7548.  
  7549.                no value returned
  7550.  
  7551.                USAGE
  7552.  
  7553.                MOUSESHOW enables the mouse display driver and places the
  7554.                cursor on the screen.  The cursor is only updated when the
  7555.                mouse is moved.  Therefore, it is recommended to hide the
  7556.                cursor when drawing on the screen to avoid unexpected
  7557.                results.
  7558.  
  7559.                SEE ALSO
  7560.  
  7561.                MOUSEENTER, MOUSEEXIT, MOUSEHIDE
  7562.  
  7563.                EXAMPLE
  7564.  
  7565.                See MOUSEHIDE
  7566.  
  7567.  
  7568.  
  7569.  
  7570.  
  7571.  
  7572.  
  7573.  
  7574.  
  7575.  
  7576.  
  7577.  
  7578.  
  7579.  
  7580.  
  7581.  
  7582.  
  7583.  
  7584.  
  7585.  
  7586.  
  7587.  
  7588.  
  7589.  
  7590.  
  7591.  
  7592.  
  7593.                                                                         121
  7594.  
  7595.  
  7596.  
  7597.  
  7598.  
  7599.             MOUSESTATUS
  7600.  
  7601.                PROTOTYPE
  7602.  
  7603.                extern void far mousestatus (int far *x, int far *y, int far
  7604.                *mbuts)
  7605.  
  7606.                INPUT
  7607.  
  7608.                no input parameters
  7609.  
  7610.                OUTPUT
  7611.  
  7612.                x, y - mouse position on screen
  7613.                mbuts - status of mouse buttons
  7614.  
  7615.                USAGE
  7616.  
  7617.                MOUSESTATUS returns the current status of the mouse position
  7618.                and buttons.  The position is returned in x, y.  The
  7619.                buttons' status is held in mbuts.  The left button is held
  7620.                in bit zero, right button in bit one and center button - for
  7621.                three button mice - in bit two.  Button status is most
  7622.                easily checked with a bitwise AND of mbuts and the desired
  7623.                bit.
  7624.  
  7625.                SEE ALSO
  7626.  
  7627.                MOUSERANGESET, MOUSESENSSET
  7628.  
  7629.                EXAMPLE
  7630.  
  7631.                /* enable,show mouse & display status */
  7632.                #include <stdlib.h>
  7633.                #include <conio.h>
  7634.                #include "svgacc.h"
  7635.  
  7636.                void main(void)
  7637.                {
  7638.                  int vmode, x, y, mbuts;
  7639.                  char buf[100];
  7640.  
  7641.                  vmode = videomodeget();
  7642.                  if ( !whichvga() || (whichmem() < 512))
  7643.                     exit(1);
  7644.                  if ( !whichmouse())
  7645.                     exit(1);
  7646.                  res640();
  7647.                  mouseenter();
  7648.                  mouseshow();
  7649.                  while(!kbhit()) {
  7650.                     mousestatus(&x,&y,&mbuts);
  7651.                     sprintf(buf,"X= %4d  Y= %4d  LB= %1d  CB= %1d  RB=
  7652.                %1d\0",x,y,(mbuts & 1),(mbuts & 2),(mbuts & 4));
  7653.  
  7654.  
  7655.                                                                         122
  7656.  
  7657.  
  7658.  
  7659.  
  7660.  
  7661.                     drwstring(1,15,8,buf,10,32);
  7662.                  }
  7663.                  mousehide();
  7664.                  mouseexit();
  7665.                  videomodeset(vmode);
  7666.                }
  7667.  
  7668.  
  7669.  
  7670.  
  7671.  
  7672.  
  7673.  
  7674.  
  7675.  
  7676.  
  7677.  
  7678.  
  7679.  
  7680.  
  7681.  
  7682.  
  7683.  
  7684.  
  7685.  
  7686.  
  7687.  
  7688.  
  7689.  
  7690.  
  7691.  
  7692.  
  7693.  
  7694.  
  7695.  
  7696.  
  7697.  
  7698.  
  7699.  
  7700.  
  7701.  
  7702.  
  7703.  
  7704.  
  7705.  
  7706.  
  7707.  
  7708.  
  7709.  
  7710.  
  7711.  
  7712.  
  7713.  
  7714.  
  7715.  
  7716.  
  7717.                                                                         123
  7718.  
  7719.  
  7720.  
  7721.  
  7722.  
  7723.             MOUSESTORAGESIZE
  7724.  
  7725.                PROTOTYPE
  7726.  
  7727.                extern int far mousestoragesize (void)
  7728.  
  7729.                INPUT
  7730.  
  7731.                no input parameters
  7732.  
  7733.                OUTPUT
  7734.  
  7735.                MOUSESTORAGESIZE returns the size of buffer in bytes to
  7736.                store complete mouse status
  7737.  
  7738.                USAGE
  7739.  
  7740.                MOUSESTORAGESIZE determines the proper size buffer to hold
  7741.                the complete mouse status information.  This buffer should
  7742.                be allocated before calling MOUSESAVESTATE.
  7743.  
  7744.                SEE ALSO
  7745.  
  7746.                MOUSERESTORESTATE, MOUSESAVESTATE
  7747.  
  7748.                EXAMPLE
  7749.  
  7750.                /*
  7751.                 * return the size in bytes need to save the mouse driver
  7752.                status
  7753.                 */
  7754.  
  7755.                #include <stdlib.h>
  7756.                #include <conio.h>
  7757.                #include "svgacc.h"
  7758.  
  7759.                void main(void)
  7760.                {
  7761.                  int bufsiz;
  7762.                  char buf[50];
  7763.  
  7764.                  if ( !whichmouse())
  7765.                     exit(1);
  7766.  
  7767.                  bufsiz=mousestoragesize();
  7768.                  sprintf(buf,"%d bytes are required to save mouse driver
  7769.                status...",bufsiz);
  7770.                  printf("%s", &buf);
  7771.                  exit(0);
  7772.                }
  7773.  
  7774.  
  7775.  
  7776.  
  7777.  
  7778.  
  7779.                                                                         124
  7780.  
  7781.  
  7782.  
  7783.  
  7784.  
  7785.             OVERSCANSET
  7786.  
  7787.                PROTOTYPE
  7788.  
  7789.                extern void far overscanset (int colr)
  7790.  
  7791.                INPUT
  7792.  
  7793.                colr - index to color in current palette
  7794.  
  7795.                OUTPUT
  7796.  
  7797.                no value returned
  7798.  
  7799.                USAGE
  7800.  
  7801.                OVERSCANSET sets the overscan region to the specified color.
  7802.                The overscan region is the area between the usable pixel
  7803.                area and the region not scanned by the monitor.  Normally,
  7804.                the overscan is color zero which is defined as black the
  7805.                majority of the time.  The overscan color is reset to zero
  7806.                anytime a RES### function is called.
  7807.  
  7808.                Note: OVERSCANSET always works in the 320x200 resolution.
  7809.                In the higher resolutions on many common SVGA cards this
  7810.                function is ignored.  Instead, the card always assigns the
  7811.                overscan region to color zero.  Therefore, it is recommended
  7812.                to not use OVERSCANSET, but assign color zero as needed.
  7813.  
  7814.                EXAMPLE
  7815.  
  7816.                /*
  7817.                 * set the overscan color to green
  7818.                 */
  7819.  
  7820.                #include <stdlib.h>
  7821.                #include <conio.h>
  7822.                #include "svgacc.h"
  7823.  
  7824.                void main(void)
  7825.                {
  7826.                  int vmode;
  7827.                  vmode = videomodeget();
  7828.                  if ( !whichvga() )
  7829.                     exit(1);
  7830.                  res320();
  7831.                  overscanset(10);
  7832.                  getch();
  7833.                  videomodeset(vmode);
  7834.                  exit(0);
  7835.                }
  7836.  
  7837.  
  7838.  
  7839.  
  7840.  
  7841.                                                                         125
  7842.  
  7843.  
  7844.  
  7845.  
  7846.  
  7847.             PAGEACTIVE
  7848.  
  7849.                PROTOTYPE
  7850.  
  7851.                extern int far pageactive (int page)
  7852.  
  7853.                INPUT
  7854.  
  7855.                page - number of page to make active
  7856.  
  7857.                OUTPUT
  7858.  
  7859.                PAGEACTIVE returns a 1 if successful, 0 if unsuccessful.
  7860.  
  7861.                USAGE
  7862.  
  7863.                PAGEACTIVE sets the active page as specified by page.  It
  7864.                works by creating an offset to be added when any bank
  7865.                switching is performed.  This function does not affect the
  7866.                actual display.  A page is defined as the number of 64K
  7867.                blocks necessary to contain the current screen resolution.
  7868.                For example, 640x480 requires 307,200 bytes which is a
  7869.                little more than 4.5 64K blocks.  One page in this
  7870.                resolution will be 5 banks.
  7871.  
  7872.                PAGEACTIVE does not work in 320x200 mode since this mode
  7873.                uses no bank switching.
  7874.  
  7875.                SEE ALSO
  7876.  
  7877.                FILLPAGE, PAGEDISPLAY
  7878.  
  7879.                EXAMPLE
  7880.  
  7881.                /*
  7882.                * Show pageactive (video card needs 1meg to show pages in
  7883.                640x480x256)
  7884.                */
  7885.  
  7886.                #include <stdlib.h>
  7887.                #include <math.h>
  7888.                #include <conio.h>
  7889.                #include "svgacc.h"
  7890.  
  7891.                void main(void)
  7892.                {
  7893.                  int vmode,er;
  7894.                  char text[]="press a key...";
  7895.                  char buf[20];
  7896.                  vmode = videomodeget();
  7897.                  if ( !whichvga() )
  7898.                     exit(1);
  7899.                  if ( whichmem() < 1024)
  7900.                     exit(1);
  7901.  
  7902.  
  7903.                                                                         126
  7904.  
  7905.  
  7906.  
  7907.  
  7908.  
  7909.                  if ( !res640() )
  7910.                     exit(1);
  7911.                  /* make sure video card supports page flipping */
  7912.                  if ( !pagedisplay(0,0,0) ) {
  7913.                     videomodeset(vmode);
  7914.                     exit(1);
  7915.                  }
  7916.                  er = pageactive(0);
  7917.                  fillpage(0);
  7918.                  drwstring(1,10,0,text,0,300);
  7919.                  sprintf(buf,"Page 0");
  7920.                  drwstring(1,10,0,buf,0,0);
  7921.                  er = pageactive(1);
  7922.                  fillpage(0);
  7923.                  drwstring(1,12,0,text,0,300);
  7924.                  sprintf(buf,"Page 1");
  7925.                  drwstring(1,12,0,buf,0,20);
  7926.                  er = pageactive(2);
  7927.                  fillpage(0);
  7928.                  drwstring(1,13,0,text,0,300);
  7929.                  sprintf(buf,"Page 2");
  7930.                  drwstring(1,13,0,buf,0,40);
  7931.                  er = pageactive(0);
  7932.                  er = pagedisplay(0,0,0);
  7933.                  getch();
  7934.                  er = pagedisplay(0,0,1);
  7935.                  getch();
  7936.                  er = pagedisplay(0,0,2);
  7937.                  getch();
  7938.                  videomodeset(vmode);
  7939.                  exit(0);
  7940.                }
  7941.  
  7942.  
  7943.  
  7944.  
  7945.  
  7946.  
  7947.  
  7948.  
  7949.  
  7950.  
  7951.  
  7952.  
  7953.  
  7954.  
  7955.  
  7956.  
  7957.  
  7958.  
  7959.  
  7960.  
  7961.  
  7962.  
  7963.  
  7964.  
  7965.                                                                         127
  7966.  
  7967.  
  7968.  
  7969.  
  7970.  
  7971.             PAGEDISPLAY
  7972.  
  7973.                PROTOTYPE
  7974.  
  7975.                extern int far pagedisplay (int x, int y, int page)
  7976.  
  7977.                INPUT
  7978.  
  7979.                x, y - coordinate to place at top, left of display
  7980.                page - number of page to make active
  7981.  
  7982.                OUTPUT
  7983.  
  7984.                PAGEDISPLAY returns a 1 if successful, 0 if unsuccessful.
  7985.  
  7986.                USAGE
  7987.  
  7988.                PAGEDISPLAY tells the video card where in video memory to
  7989.                begin the display.  This display offset is calculated from
  7990.                the specified page, x and y.  This is done by multiplying y
  7991.                times the width of the current resolution, adding x and then
  7992.                adding the appropriate number of 64K blocks for page.  X, y
  7993.                and page must all be positive numbers, but are otherwise not
  7994.                restricted.  The display will wrap if the values are
  7995.                abnormally large.  Wrapping will happen from side to side as
  7996.                well as from top of memory to bottom of memory.
  7997.  
  7998.                PAGEDISPLAY does not work in 320x200 mode since this mode
  7999.                uses no bank switching.  In addition, older models of some
  8000.                SVGA cards operating in native mode do not support paging.
  8001.                In this library these cards are: Acumos, Ahead version A,
  8002.                Everex and Genoa.  To ensure compatibility, a program should
  8003.                make a call similar to:
  8004.  
  8005.                  if ( !pagedisplay(0,0,0) )
  8006.                     printf("PAGING NOT SUPPORTED\n");
  8007.  
  8008.                Note: SVGA cards by ATI Technologies appear to ignore bit 4
  8009.                (counting from 0 to 19) in its linear addressing mode and
  8010.                assume it is zero.  Therefore, bit 4 of the x parameter will
  8011.                be ignored by ATI chipsets.
  8012.  
  8013.                SEE ALSO
  8014.  
  8015.                FILLPAGE, PAGEACTIVE
  8016.  
  8017.                EXAMPLE
  8018.  
  8019.                See PAGEACTIVE
  8020.  
  8021.  
  8022.  
  8023.  
  8024.  
  8025.  
  8026.  
  8027.                                                                         128
  8028.  
  8029.  
  8030.  
  8031.  
  8032.  
  8033.             PALCHGAUTO
  8034.  
  8035.                PROTOTYPE
  8036.  
  8037.                extern void far palchgauto (RGB far *pal, RGB far *newpal,
  8038.                int firstcolr, int lastcolr, int speed)
  8039.  
  8040.                INPUT
  8041.  
  8042.                pal - initial palette
  8043.                newpal - new palette
  8044.                firstcolr - index into palette where change will begin
  8045.                lastcolr - index into palette where change will end
  8046.                speed - speed of change
  8047.  
  8048.                OUTPUT
  8049.  
  8050.                no value returned
  8051.  
  8052.                USAGE
  8053.  
  8054.                PALCHGAUTO smoothly fades the colors between firstcolr and
  8055.                lastcolr from the palette pal to newpal.  The speed of the
  8056.                fade is set by speed which is percentage change between each
  8057.                step of the fade.  Only values between 1 and 128 are valid
  8058.                where 1 represents a one percent change between steps and
  8059.                128 (80 hex) represents fifty percent change between steps.
  8060.                A speed of 128 would then have only two steps.  A speed
  8061.                outside of the valid range causes the function to
  8062.                immediately return without making any changes.  The time
  8063.                required to accomplish the entire fade is approximately
  8064.                equal to 0.033 seconds times 256 divided by speed.
  8065.                PALCHGAUTO does not modify either pal or newpal.
  8066.  
  8067.                SEE ALSO
  8068.  
  8069.                PALCHGSTEP, PALDIMSTEP, PALIOAUTO
  8070.  
  8071.                EXAMPLE
  8072.  
  8073.                /*
  8074.                 * autofade from one palette to another and back again
  8075.                 */
  8076.  
  8077.                #include <stdlib.h>
  8078.                #include <conio.h>
  8079.                #include "svgacc.h"
  8080.  
  8081.                void main(void)
  8082.                {
  8083.                  int vmode, colr, y, i, index;
  8084.                  PaletteData orgpal, newpal;
  8085.  
  8086.                  vmode = videomodeget();
  8087.  
  8088.  
  8089.                                                                         129
  8090.  
  8091.  
  8092.  
  8093.  
  8094.  
  8095.                  if ( !whichvga() )
  8096.                     exit(1);
  8097.                  if ( whichmem() < 512)
  8098.                     exit(1);
  8099.                  res640();
  8100.                  palget(orgpal,0,255);
  8101.                  for (index=0;index<256;index++) {
  8102.                     newpal[index].r = index / 4;
  8103.                     newpal[index].g = index / 4;
  8104.                     newpal[index].b = index / 4;
  8105.                  }
  8106.                  colr = 0;
  8107.                  for (y=0;y<480;y++) {
  8108.                     drwline(1,colr++,0,y,639,y);
  8109.                     if (colr>255)
  8110.                       colr = 0;
  8111.                  }
  8112.                  palchgauto(orgpal,newpal,0,255,2);
  8113.                  palchgauto(newpal,orgpal,0,255,2);
  8114.                  getch();
  8115.                  videomodeset(vmode);
  8116.                  exit(0);
  8117.                }
  8118.  
  8119.  
  8120.  
  8121.  
  8122.  
  8123.  
  8124.  
  8125.  
  8126.  
  8127.  
  8128.  
  8129.  
  8130.  
  8131.  
  8132.  
  8133.  
  8134.  
  8135.  
  8136.  
  8137.  
  8138.  
  8139.  
  8140.  
  8141.  
  8142.  
  8143.  
  8144.  
  8145.  
  8146.  
  8147.  
  8148.  
  8149.  
  8150.  
  8151.                                                                         130
  8152.  
  8153.  
  8154.  
  8155.  
  8156.  
  8157.             PALCHGSTEP
  8158.  
  8159.                PROTOTYPE
  8160.  
  8161.                extern void far palchgstep (RGB far *pal, RGB far *newpal,
  8162.                int firstcolr, int lastcolr, int percent)
  8163.  
  8164.                INPUT
  8165.  
  8166.                pal - initial palette
  8167.                newpal - new palette
  8168.                firstcolr - index into palette where change will begin
  8169.                lastcolr - index into palette where change will end
  8170.                percent - percent step from current palette to new palette
  8171.  
  8172.                OUTPUT
  8173.  
  8174.                no value returned
  8175.  
  8176.                USAGE
  8177.  
  8178.                PALCHGSTEP changes the palette colors between firstcolr and
  8179.                lastcolr by percent from pal to newpal.  This function works
  8180.                very much like PALCHGAUTO except it only takes a single step
  8181.                and returns.  The step taken is a percentage specified by
  8182.                Percent where 256 (100 hex) is a 100 percent change.  The
  8183.                valid range for Percent is 0 to 256.  Values beyond this
  8184.                range cause the function to immediately return without
  8185.                making any changes.  A loop from 4 to 256 by fours using
  8186.                PALCHGSTEP would have similar results as PALCHGAUTO with a
  8187.                speed of 4.  Neither pal, nor newpal are modified.
  8188.  
  8189.                SEE ALSO
  8190.  
  8191.                PALCHGAUTO, PALDIMSTEP, PALIOAUTO
  8192.  
  8193.                EXAMPLE
  8194.  
  8195.                /*
  8196.                 * step fade from one palette to another and back again
  8197.                 */
  8198.  
  8199.                #include <stdlib.h>
  8200.                #include <conio.h>
  8201.                #include "svgacc.h"
  8202.  
  8203.                void main(void)
  8204.                {
  8205.                  int vmode, colr, y, i, index;
  8206.                  PaletteData orgpal, newpal;
  8207.  
  8208.                  vmode = videomodeget();
  8209.                  if ( !whichvga() )
  8210.                     exit(1);
  8211.  
  8212.  
  8213.                                                                         131
  8214.  
  8215.  
  8216.  
  8217.  
  8218.  
  8219.                  if ( whichmem() < 512)
  8220.                     exit(1);
  8221.                  res640();
  8222.  
  8223.                  palget(orgpal,0,255);
  8224.                  for (index=0;index<256;index++)
  8225.                  {
  8226.                     newpal[index].r = index / 4;
  8227.                     newpal[index].g = index / 4;
  8228.                     newpal[index].b = index / 4;
  8229.                  }
  8230.                  colr = 0;
  8231.                  for (y=0;y<480;y++)
  8232.                  {
  8233.                     drwline(1,colr++,0,y,639,y);
  8234.                     if (colr>255)
  8235.                       colr = 0;
  8236.                  }
  8237.                  for (index=0;index<256;index++)
  8238.                  {
  8239.                     palchgstep(orgpal,newpal,0,255,index);
  8240.                  }
  8241.                  for (index=256;index>=-1;index--)
  8242.                  {
  8243.                     palchgstep(orgpal,newpal,0,255,index);
  8244.                  }
  8245.                  getch();
  8246.                  videomodeset(vmode);
  8247.                  exit(0);
  8248.                }
  8249.  
  8250.  
  8251.  
  8252.  
  8253.  
  8254.  
  8255.  
  8256.  
  8257.  
  8258.  
  8259.  
  8260.  
  8261.  
  8262.  
  8263.  
  8264.  
  8265.  
  8266.  
  8267.  
  8268.  
  8269.  
  8270.  
  8271.  
  8272.  
  8273.  
  8274.  
  8275.                                                                         132
  8276.  
  8277.  
  8278.  
  8279.  
  8280.  
  8281.             PALCOPY
  8282.  
  8283.                PROTOTYPE
  8284.  
  8285.                extern void far palcopy (RGB far *srcpal, RGB far *destpal,
  8286.                int firstcolr, int lastcolr)
  8287.  
  8288.                INPUT
  8289.  
  8290.                srcpal - source palette
  8291.                firstcolr - index into palette where copy will begin
  8292.                lastcolr - index into palette where copy will end
  8293.  
  8294.                OUTPUT
  8295.  
  8296.                no value returned
  8297.                destpal - copy of srcpal
  8298.  
  8299.                USAGE
  8300.  
  8301.                PALCOPY quickly copies a source palette into a second
  8302.                palette array.  Destpal must be previously allocated.  A
  8303.                portion of a palette may be copied by specifying first and
  8304.                last colors.  If firstcolr is greater than lastcolr, no copy
  8305.                will occur.
  8306.  
  8307.                SEE ALSO
  8308.  
  8309.                BYTECOPY
  8310.  
  8311.                EXAMPLE
  8312.  
  8313.                /*
  8314.                 * create a color palette(grayscale) and copy it to a
  8315.                palette
  8316.                 * of a different name
  8317.                 */
  8318.  
  8319.                #include <stdlib.h>
  8320.                #include <conio.h>
  8321.                #include "svgacc.h"
  8322.  
  8323.                void main(void)
  8324.                {
  8325.                  int vmode,colr,y,i,index;
  8326.                  PaletteData pal, newpal;
  8327.  
  8328.                  vmode = videomodeget();
  8329.                  if ( !whichvga() )
  8330.                     exit(1);
  8331.                  if ( whichmem() < 512)
  8332.                     exit(1);
  8333.                  if ( !res640() )
  8334.                     exit(1);
  8335.  
  8336.  
  8337.                                                                         133
  8338.  
  8339.  
  8340.  
  8341.  
  8342.  
  8343.                  for (index=0;index<256;index++) {
  8344.                     pal[index].r = index / 4;
  8345.                     pal[index].g = index / 4;
  8346.                     pal[index].b = index / 4;
  8347.                  }
  8348.                  colr = 0;
  8349.                  palcopy(pal,newpal,0,255);
  8350.                  for (y=0;y<480;y++) {
  8351.                     drwline(1,colr++,0,y,639,y);
  8352.                     if (colr>255)
  8353.                       colr = 0;
  8354.                  }
  8355.                  palset(newpal,0,255);
  8356.                  getch();
  8357.                  videomodeset(vmode);
  8358.                  exit(0);
  8359.                }
  8360.  
  8361.  
  8362.  
  8363.  
  8364.  
  8365.  
  8366.  
  8367.  
  8368.  
  8369.  
  8370.  
  8371.  
  8372.  
  8373.  
  8374.  
  8375.  
  8376.  
  8377.  
  8378.  
  8379.  
  8380.  
  8381.  
  8382.  
  8383.  
  8384.  
  8385.  
  8386.  
  8387.  
  8388.  
  8389.  
  8390.  
  8391.  
  8392.  
  8393.  
  8394.  
  8395.  
  8396.  
  8397.  
  8398.  
  8399.                                                                         134
  8400.  
  8401.  
  8402.  
  8403.  
  8404.  
  8405.             PALDIMSTEP
  8406.  
  8407.                PROTOTYPE
  8408.  
  8409.                extern void far paldimstep (RGB far *pal, int firstcolr, int
  8410.                lastcolr, int percent)
  8411.  
  8412.                INPUT
  8413.  
  8414.                pal - initial palette
  8415.                firstcolr - index into palette where dim will begin
  8416.                lastcolr - index into palette where dim will end
  8417.                percent - percent step from current palette to black
  8418.  
  8419.                OUTPUT
  8420.  
  8421.                no value returned
  8422.  
  8423.                USAGE
  8424.  
  8425.                PALDIMSTEP fades the specified palette to black by the given
  8426.                percentage between firstcolr and lastcolr.  The percentage
  8427.                step from pal to black is specified by percent where 256
  8428.                (100 hex) is full black.  The valid range for Percent is 0
  8429.                to 256.  Values beyond this range cause the function to
  8430.                immediately return without making any changes.  pal is not
  8431.                modified.
  8432.  
  8433.                SEE ALSO
  8434.  
  8435.                PALCHGAUTO, PALCHGSTEP, PALIOAUTO
  8436.  
  8437.                EXAMPLE
  8438.  
  8439.                /*
  8440.                 * step dim from a palette to black and back again
  8441.                 */
  8442.  
  8443.                #include <stdlib.h>
  8444.                #include <conio.h>
  8445.                #include "svgacc.h"
  8446.  
  8447.                void main(void)
  8448.                {
  8449.                  int vmode;
  8450.                  int colr;
  8451.                  int y;
  8452.                  int i;
  8453.                  int index;
  8454.                  PaletteData orgpal;
  8455.  
  8456.                  vmode = videomodeget();
  8457.                  if ( !whichvga() )
  8458.                     exit(1);
  8459.  
  8460.  
  8461.                                                                         135
  8462.  
  8463.  
  8464.  
  8465.  
  8466.  
  8467.                  if ( whichmem() < 512)
  8468.                     exit(1);
  8469.                  res640();
  8470.                  palget(orgpal,0,255);
  8471.                  colr = 0;
  8472.                  for (y=0;y<480;y++)
  8473.                  {
  8474.                     drwline(1,colr++,0,y,639,y);
  8475.                     if (colr>255)
  8476.                       colr = 0;
  8477.                  }
  8478.                  for (index=0;index<256;index++)
  8479.                  {
  8480.                     paldimstep(orgpal,0,255,index);
  8481.                  }
  8482.                  for (index=256;index>=-1;index--)
  8483.                  {
  8484.                     paldimstep(orgpal,0,255,index);
  8485.                  }
  8486.                  getch();
  8487.                  videomodeset(vmode);
  8488.                  exit(0);
  8489.                }
  8490.  
  8491.  
  8492.  
  8493.  
  8494.  
  8495.  
  8496.  
  8497.  
  8498.  
  8499.  
  8500.  
  8501.  
  8502.  
  8503.  
  8504.  
  8505.  
  8506.  
  8507.  
  8508.  
  8509.  
  8510.  
  8511.  
  8512.  
  8513.  
  8514.  
  8515.  
  8516.  
  8517.  
  8518.  
  8519.  
  8520.  
  8521.  
  8522.  
  8523.                                                                         136
  8524.  
  8525.  
  8526.  
  8527.  
  8528.  
  8529.             PALGET
  8530.  
  8531.                PROTOTYPE
  8532.  
  8533.                extern void far palget (RGB far *pal, int firstcolr, int
  8534.                lastcolr)
  8535.  
  8536.                INPUT
  8537.  
  8538.                firstcolr - index into palette where get will begin
  8539.                lastcolr - index into palette where get will end
  8540.  
  8541.                OUTPUT
  8542.  
  8543.                pal - copy of the current palette in the specified range
  8544.  
  8545.                USAGE
  8546.  
  8547.                PALGET returns in pal the colors from the current palette
  8548.                between firstcolr and lastcolr.  Only colors in the
  8549.                specified range are returned and all others in pal are
  8550.                unchanged.  Pal must be 768 bytes in length despite the
  8551.                number of colors retrieved.
  8552.  
  8553.                SEE ALSO
  8554.  
  8555.                PALROTATE, PALSET
  8556.  
  8557.                EXAMPLE
  8558.  
  8559.                See PALCHGAUTO
  8560.  
  8561.  
  8562.  
  8563.  
  8564.  
  8565.  
  8566.  
  8567.  
  8568.  
  8569.  
  8570.  
  8571.  
  8572.  
  8573.  
  8574.  
  8575.  
  8576.  
  8577.  
  8578.  
  8579.  
  8580.  
  8581.  
  8582.  
  8583.  
  8584.  
  8585.                                                                         137
  8586.  
  8587.  
  8588.  
  8589.  
  8590.  
  8591.             PALIOAUTO
  8592.  
  8593.                PROTOTYPE
  8594.  
  8595.                extern void far palioauto (RGB far *pal, int firstcolr, int
  8596.                lastcolr, int speed)
  8597.  
  8598.                INPUT
  8599.  
  8600.                pal - initial palette
  8601.                firstcolr - index into palette where fade will begin
  8602.                lastcolr - index into palette where fade will end
  8603.                speed - speed of fade
  8604.  
  8605.                OUTPUT
  8606.  
  8607.                no value returned
  8608.  
  8609.                USAGE
  8610.  
  8611.                PALIOAUTO smoothly fades the colors between firstcolr and
  8612.                lastcolr of pal to or from solid black.  The speed of the
  8613.                fade is set by speed which is the percentage change between
  8614.                each step of the fade.  A positive speed corresponds to
  8615.                fading from pal to black and a negative speed fades from
  8616.                black to Pal.  Only values between -128 and +128 are valid
  8617.                where 1 represents a one percent change between steps and 
  8618.                128 (80 hex) represents fifty percent change between steps.
  8619.                A speed of 128 would then have only two steps.  A speed
  8620.                outside of the valid range causes the function to
  8621.                immediately return without making any changes.  The time
  8622.                required to accomplish the entire fade is approximately
  8623.                equal to 0.033 seconds times 256 divided by speed.
  8624.                PALIOAUTO does not modify pal.
  8625.  
  8626.                SEE ALSO
  8627.  
  8628.                PALCHGAUTO, PALCHGSTEP, PALDIMSTEP
  8629.  
  8630.                EXAMPLE
  8631.  
  8632.                /*
  8633.                 * autofade a palette to black and back again
  8634.                 */
  8635.  
  8636.                #include <stdlib.h>
  8637.                #include <conio.h>
  8638.                #include "svgacc.h"
  8639.  
  8640.                void main(void)
  8641.                {
  8642.                  int vmode, colr, y;
  8643.                  PaletteData orgpal;
  8644.  
  8645.  
  8646.  
  8647.                                                                         138
  8648.  
  8649.  
  8650.  
  8651.  
  8652.  
  8653.                  vmode = videomodeget();
  8654.                  if ( !whichvga() )
  8655.                     exit(1);
  8656.                  if ( whichmem() < 512)
  8657.                     exit(1);
  8658.                  res640();
  8659.                  colr = 0;
  8660.                  palget(orgpal,0,255);
  8661.                  for (y=0;y<480;y++) {
  8662.                     drwline(1,colr++,0,y,639,y);
  8663.                     if (colr>255)
  8664.                       colr = 0;
  8665.                  }
  8666.                  palioauto(orgpal,0,255,-2);
  8667.                  palioauto(orgpal,0,255,2);
  8668.                  getch();
  8669.                  videomodeset(vmode);
  8670.                  exit(0);
  8671.                }
  8672.  
  8673.  
  8674.  
  8675.  
  8676.  
  8677.  
  8678.  
  8679.  
  8680.  
  8681.  
  8682.  
  8683.  
  8684.  
  8685.  
  8686.  
  8687.  
  8688.  
  8689.  
  8690.  
  8691.  
  8692.  
  8693.  
  8694.  
  8695.  
  8696.  
  8697.  
  8698.  
  8699.  
  8700.  
  8701.  
  8702.  
  8703.  
  8704.  
  8705.  
  8706.  
  8707.  
  8708.  
  8709.                                                                         139
  8710.  
  8711.  
  8712.  
  8713.  
  8714.  
  8715.             PALROTATE
  8716.  
  8717.                PROTOTYPE
  8718.  
  8719.                extern void far palrotate (RGB far *pal, int firstcolr, int
  8720.                lastcolr, int shift)
  8721.  
  8722.                INPUT
  8723.  
  8724.                pal - PaletteData pointer to current palette
  8725.                firstcolr - index into palette where shift will begin
  8726.                lastcolr - index into palette where shift will end
  8727.                shift - number of locations to shift colors
  8728.  
  8729.                OUTPUT
  8730.  
  8731.                no value returned
  8732.  
  8733.                USAGE
  8734.  
  8735.                PALROTATE shifts the colors in pal between firstcolr and
  8736.                lastcolr by a given number of locations and sets this new
  8737.                palette.  The number of locations the colors are moved is
  8738.                specified by shift which is between 1 and 256.  Pal is not
  8739.                modified by PALROTATE.
  8740.  
  8741.                SEE ALSO
  8742.  
  8743.                PALGET, PALSET
  8744.  
  8745.                EXAMPLE
  8746.  
  8747.                /*
  8748.                 * rotate a few palette entries around
  8749.                 */
  8750.  
  8751.                #include <stdlib.h>
  8752.                #include <conio.h>
  8753.                #include "svgacc.h"
  8754.  
  8755.                void main(void)
  8756.                {
  8757.                  int vmode, colr, y, i, index;
  8758.                  PaletteData orgpal;
  8759.  
  8760.                  vmode = videomodeget();
  8761.                  if ( !whichvga() )
  8762.                     exit(1);
  8763.                  if ( whichmem() < 512)
  8764.                     exit(1);
  8765.                  res640();
  8766.                  colr = 0;
  8767.                  palget(orgpal,0,255);
  8768.                  for (y=0;y<480;y++) {
  8769.  
  8770.  
  8771.                                                                         140
  8772.  
  8773.  
  8774.  
  8775.  
  8776.  
  8777.                     drwline(1,colr++,0,y,639,y);
  8778.                     if (colr>255)
  8779.                       colr = 0;
  8780.                  }
  8781.                  for (i=0;i<200;i++) {
  8782.                     palrotate(orgpal,1,127,1);
  8783.                     palget(orgpal,0,255);
  8784.                  }
  8785.                  getch();
  8786.                  videomodeset(vmode);
  8787.                  exit(0);
  8788.                }
  8789.  
  8790.  
  8791.  
  8792.  
  8793.  
  8794.  
  8795.  
  8796.  
  8797.  
  8798.  
  8799.  
  8800.  
  8801.  
  8802.  
  8803.  
  8804.  
  8805.  
  8806.  
  8807.  
  8808.  
  8809.  
  8810.  
  8811.  
  8812.  
  8813.  
  8814.  
  8815.  
  8816.  
  8817.  
  8818.  
  8819.  
  8820.  
  8821.  
  8822.  
  8823.  
  8824.  
  8825.  
  8826.  
  8827.  
  8828.  
  8829.  
  8830.  
  8831.  
  8832.  
  8833.                                                                         141
  8834.  
  8835.  
  8836.  
  8837.  
  8838.  
  8839.             PALSET
  8840.  
  8841.                PROTOTYPE
  8842.  
  8843.                extern void far palset (RGB far *pal, int firstcolr, int
  8844.                lastcolr)
  8845.  
  8846.                INPUT
  8847.  
  8848.                pal - palette to set
  8849.                firstcolr - index into palette where set will begin
  8850.                lastcolr - index into palette where set will end
  8851.  
  8852.                OUTPUT
  8853.  
  8854.                no value returned
  8855.  
  8856.                USAGE
  8857.  
  8858.                PALSET sets the specified range of colors in the current
  8859.                palette with the corresponding range in the palette pal.
  8860.  
  8861.                SEE ALSO
  8862.  
  8863.                PALGET
  8864.  
  8865.                EXAMPLE
  8866.  
  8867.                See PALCOPY
  8868.  
  8869.  
  8870.  
  8871.  
  8872.  
  8873.  
  8874.  
  8875.  
  8876.  
  8877.  
  8878.  
  8879.  
  8880.  
  8881.  
  8882.  
  8883.  
  8884.  
  8885.  
  8886.  
  8887.  
  8888.  
  8889.  
  8890.  
  8891.  
  8892.  
  8893.  
  8894.  
  8895.                                                                         142
  8896.  
  8897.  
  8898.  
  8899.  
  8900.  
  8901.             RES320
  8902.  
  8903.                PROTOTYPE
  8904.  
  8905.                extern int far res320 (void)
  8906.  
  8907.                INPUT
  8908.  
  8909.                no input parameters
  8910.  
  8911.                OUTPUT
  8912.  
  8913.                RES320 always returns a 1.
  8914.  
  8915.                USAGE
  8916.  
  8917.                RES320 sets video mode 0x13 which is the industry standard
  8918.                320x200 graphics mode with 256 colors.  This function can be
  8919.                called without calling WHICHVGA first as this function
  8920.                requires only that a VGA card is present, not a Super VGA
  8921.                card.  If a VGA is not present, the system may crash.
  8922.  
  8923.                SEE ALSO
  8924.  
  8925.                RES640, RES640L, RES800, RES1024, RES1280, WHICHVGA
  8926.  
  8927.                EXAMPLE
  8928.  
  8929.                /*
  8930.                 * set video mode to 320x200x256
  8931.                 */
  8932.  
  8933.                #include <stdlib.h>
  8934.                #include <conio.h>
  8935.                #include "svgacc.h"
  8936.  
  8937.                void main(void)
  8938.                {
  8939.                  int vmode;
  8940.  
  8941.                  vmode = videomodeget();
  8942.                  if ( !whichvga() )
  8943.                     exit();
  8944.                  res320();
  8945.                  drwstring(1,7,0,"this is the 320x200x256 video
  8946.                mode...",0,0);
  8947.                  getch();
  8948.                  videomodeset(vmode);
  8949.                  exit(0);
  8950.                }
  8951.  
  8952.  
  8953.  
  8954.  
  8955.  
  8956.  
  8957.                                                                         143
  8958.  
  8959.  
  8960.  
  8961.  
  8962.  
  8963.             RES640
  8964.  
  8965.                PROTOTYPE
  8966.  
  8967.                extern int far res640 (void)
  8968.  
  8969.                INPUT
  8970.  
  8971.                no input parameters
  8972.  
  8973.                OUTPUT
  8974.  
  8975.                RES640 returns 1 if successful, 0 otherwise.
  8976.  
  8977.                USAGE
  8978.  
  8979.                RES640 sets the video mode to 640x480 graphics mode with 256
  8980.                colors.  This function requires that a Super VGA card with
  8981.                at least 512K of video memory be present.  Also, WHICHVGA
  8982.                must be called first or the function will fail without
  8983.                changing the video mode.  If the video card does not have
  8984.                sufficient memory, RES640 will return without changing the
  8985.                video mode.
  8986.  
  8987.                SEE ALSO
  8988.  
  8989.                RES320, RES640L, RES800, RES1024, RES1280, WHICHVGA
  8990.  
  8991.                EXAMPLE
  8992.  
  8993.                /*
  8994.                 * set video mode to 640x480x256
  8995.                 */
  8996.  
  8997.                #include <stdlib.h>
  8998.                #include <conio.h>
  8999.                #include "svgacc.h"
  9000.  
  9001.                void main(void)
  9002.                {
  9003.                  int vmode;
  9004.  
  9005.                  vmode = videomodeget();
  9006.                  if ( !whichvga() )
  9007.                     exit(1);
  9008.                  if ( whichmem() < 512 )
  9009.                     exit(1);
  9010.                  res640();
  9011.                  drwstring(1,7,0,"this is the 640x480x256 video
  9012.                mode...",0,0);
  9013.                  getch();
  9014.                  videomodeset(vmode);
  9015.                  exit(0);
  9016.                }
  9017.  
  9018.  
  9019.                                                                         144
  9020.  
  9021.  
  9022.  
  9023.  
  9024.  
  9025.             RES640L
  9026.  
  9027.                PROTOTYPE
  9028.  
  9029.                extern int far res640l (void)
  9030.  
  9031.                INPUT
  9032.  
  9033.                no input parameters
  9034.  
  9035.                OUTPUT
  9036.  
  9037.                RES640L returns 1 if successful, 0 otherwise.
  9038.  
  9039.                USAGE
  9040.  
  9041.                RES640L sets the video mode to 640x400 graphics mode with
  9042.                256 colors.  This function requires that a Super VGA card
  9043.                with at least 256K of video memory be present.  Also,
  9044.                WHICHVGA must be called first or the function will fail
  9045.                without changing the video mode.  If the video card does not
  9046.                have sufficient memory, RES640L will return without changing
  9047.                the video mode.
  9048.  
  9049.                Note: The 640x400 is an uncommon resolution.  Many SVGA
  9050.                cards do not support this mode.
  9051.  
  9052.                SEE ALSO
  9053.  
  9054.                RES320, RES640, RES800, RES1024, RES1280, WHICHVGA
  9055.  
  9056.                EXAMPLE
  9057.  
  9058.                /*
  9059.                 * set video mode to 640x400x256
  9060.                 */
  9061.  
  9062.                #include <stdlib.h>
  9063.                #include <conio.h>
  9064.                #include "svgacc.h"
  9065.  
  9066.                void main(void)
  9067.                {
  9068.                  int vmode;
  9069.  
  9070.                  vmode = videomodeget();
  9071.                  if ( !whichvga() )
  9072.                     exit(1);
  9073.                  res640l();
  9074.                  drwstring(1,7,0,"this is the 640x400x256 video
  9075.                mode...",0,0);
  9076.                  getch();
  9077.                  videomodeset(vmode);
  9078.                  exit(0);
  9079.  
  9080.  
  9081.                                                                         145
  9082.  
  9083.  
  9084.  
  9085.  
  9086.  
  9087.                }
  9088.  
  9089.  
  9090.  
  9091.  
  9092.  
  9093.  
  9094.  
  9095.  
  9096.  
  9097.  
  9098.  
  9099.  
  9100.  
  9101.  
  9102.  
  9103.  
  9104.  
  9105.  
  9106.  
  9107.  
  9108.  
  9109.  
  9110.  
  9111.  
  9112.  
  9113.  
  9114.  
  9115.  
  9116.  
  9117.  
  9118.  
  9119.  
  9120.  
  9121.  
  9122.  
  9123.  
  9124.  
  9125.  
  9126.  
  9127.  
  9128.  
  9129.  
  9130.  
  9131.  
  9132.  
  9133.  
  9134.  
  9135.  
  9136.  
  9137.  
  9138.  
  9139.  
  9140.  
  9141.  
  9142.  
  9143.                                                                         146
  9144.  
  9145.  
  9146.  
  9147.  
  9148.  
  9149.             RES800
  9150.  
  9151.                PROTOTYPE
  9152.  
  9153.                extern int far res800 (void)
  9154.  
  9155.                INPUT
  9156.  
  9157.                no input parameters
  9158.  
  9159.                OUTPUT
  9160.  
  9161.                RES800 returns 1 if successful, 0 otherwise.
  9162.  
  9163.                USAGE
  9164.  
  9165.                RES800 sets the video mode to 800x600 graphics mode with 256
  9166.                colors.  This function requires that a Super VGA card with
  9167.                at least 512K of video memory be present.  Also, WHICHVGA
  9168.                must be called first or the function will fail without
  9169.                changing the video mode.  If the video card does not have
  9170.                sufficient memory, RES800 will return without changing the
  9171.                video mode.
  9172.  
  9173.                SEE ALSO
  9174.  
  9175.                RES320, RES640, RES640L, RES1024, RES1280, WHICHVGA
  9176.  
  9177.                EXAMPLE
  9178.  
  9179.                /*
  9180.                 * set video mode to 800x600x256
  9181.                 */
  9182.  
  9183.                #include <stdlib.h>
  9184.                #include <conio.h>
  9185.                #include "svgacc.h"
  9186.  
  9187.                void main(void)
  9188.                {
  9189.                  int vmode;
  9190.  
  9191.                  vmode = videomodeget();
  9192.                  if ( !whichvga() )
  9193.                     exit(1);
  9194.                  if ( whichmem() < 512 )
  9195.                     exit(1);
  9196.                  res800();
  9197.                  drwstring(1,7,0,"this is the 800x600x256 video
  9198.                mode...",0,0);
  9199.                  getch();
  9200.                  videomodeset(vmode);
  9201.                  exit(0);
  9202.                }
  9203.  
  9204.  
  9205.                                                                         147
  9206.  
  9207.  
  9208.  
  9209.  
  9210.  
  9211.             RES1024
  9212.  
  9213.                PROTOTYPE
  9214.  
  9215.                extern int far res1024 (void)
  9216.  
  9217.                INPUT
  9218.  
  9219.                no input parameters
  9220.  
  9221.                OUTPUT
  9222.  
  9223.                RES1024 returns 1 if successful, 0 otherwise.
  9224.  
  9225.                USAGE
  9226.  
  9227.                RES1024 sets the video mode to 1024x768 graphics mode with
  9228.                256 colors.  This function requires that a Super VGA card
  9229.                with at least 1 Megabyte of video memory be present.  Also,
  9230.                WHICHVGA must be called first or the function will fail
  9231.                without changing the video mode.  If the video card does not
  9232.                have sufficient memory, RES1024 will return without changing
  9233.                the video mode.
  9234.  
  9235.                SEE ALSO
  9236.  
  9237.                RES320, RES640, RES640L, RES800, RES1280, WHICHVGA
  9238.  
  9239.                EXAMPLE
  9240.  
  9241.                /*
  9242.                 * set video mode to 1024x768x256
  9243.                 */
  9244.  
  9245.                #include <stdlib.h>
  9246.                #include <conio.h>
  9247.                #include "svgacc.h"
  9248.  
  9249.                void main(void)
  9250.                {
  9251.                  int vmode;
  9252.  
  9253.                  vmode = videomodeget();
  9254.                  if ( !whichvga() )
  9255.                     exit(1);
  9256.                  if ( whichmem() < 1024 )
  9257.                     exit(1);
  9258.                  res1024();
  9259.                  drwstring(1,7,0,"this is the 1024x768x256 video
  9260.                mode...",0,0);
  9261.                  getch();
  9262.                  videomodeset(vmode);
  9263.                  exit(0);
  9264.                }
  9265.  
  9266.  
  9267.                                                                         148
  9268.  
  9269.  
  9270.  
  9271.  
  9272.  
  9273.             RES1280
  9274.  
  9275.                PROTOTYPE
  9276.  
  9277.                extern int far res1280 (void)
  9278.  
  9279.                INPUT
  9280.  
  9281.                no input parameters
  9282.  
  9283.                OUTPUT
  9284.  
  9285.                RES1280 returns 1 if successful, 0 otherwise.
  9286.  
  9287.                USAGE
  9288.  
  9289.                RES1280 sets the video mode to 1280x1024 graphics mode with
  9290.                256 colors.  This function requires that a Super VGA card
  9291.                with at least 2 Megabytes of video memory be present.  Also,
  9292.                WHICHVGA must be called first or the function will fail
  9293.                without changing the video mode.  If the video card does not
  9294.                have sufficient memory, RES1280 will return without changing
  9295.                the video mode.
  9296.  
  9297.                SEE ALSO
  9298.  
  9299.                RES320, RES640, RES640L, RES800, RES1024, WHICHVGA
  9300.  
  9301.                EXAMPLE
  9302.  
  9303.                /*
  9304.                 * set video mode to 1280x1024x256
  9305.                 */
  9306.  
  9307.                #include <stdlib.h>
  9308.                #include <conio.h>
  9309.                #include "svgacc.h"
  9310.  
  9311.                void main(void)
  9312.                {
  9313.                  int vmode;
  9314.  
  9315.                  vmode = videomodeget();
  9316.                  if ( !whichvga() )
  9317.                     exit(1);
  9318.                  if ( whichmem() < 2048 )
  9319.                     exit(1);
  9320.                  res1024();
  9321.                  drwstring(1,7,0,"this is the 1280x1024x256 video
  9322.                mode...",0,0);
  9323.                  getch();
  9324.                  videomodeset(vmode);
  9325.                  exit(0);
  9326.                }
  9327.  
  9328.  
  9329.                                                                         149
  9330.  
  9331.  
  9332.  
  9333.  
  9334.  
  9335.             RESTEXT
  9336.  
  9337.                PROTOTYPE
  9338.  
  9339.                extern int far restext (void)
  9340.  
  9341.                INPUT
  9342.  
  9343.                no input parameters
  9344.  
  9345.                OUTPUT
  9346.  
  9347.                RESTEXT always returns a 1.
  9348.  
  9349.                USAGE
  9350.  
  9351.                RESTEXT sets video mode three which is the industry standard
  9352.                80x25 text mode.
  9353.  
  9354.                SEE ALSO
  9355.  
  9356.                VIDEOMODEGET, VIDEOMODESET
  9357.  
  9358.                EXAMPLE
  9359.  
  9360.                /*
  9361.                 * set video mode to standard DOS text mode 3
  9362.                 */
  9363.  
  9364.                #include <stdlib.h>
  9365.                #include <conio.h>
  9366.                #include "svgacc.h"
  9367.  
  9368.                void main(void)
  9369.                {
  9370.                  int vmode;
  9371.  
  9372.                  vmode = videomodeget();
  9373.                  if ( !restext() )
  9374.                     exit(1);
  9375.                  printf("this is the text video mode (DOS video mode
  9376.                3)...");
  9377.                  getch();
  9378.                  videomodeset(vmode);
  9379.                  exit(0);
  9380.                }
  9381.  
  9382.  
  9383.  
  9384.  
  9385.  
  9386.  
  9387.  
  9388.  
  9389.  
  9390.  
  9391.                                                                         150
  9392.  
  9393.  
  9394.  
  9395.  
  9396.  
  9397.             SCROLLDN
  9398.  
  9399.                PROTOTYPE
  9400.  
  9401.                extern void far scrolldn (int x1, int y1, int x2, int y2,
  9402.                int num, int colr)
  9403.  
  9404.                INPUT
  9405.  
  9406.                x1, y1 - top left corner of block
  9407.                x2, y2 - bottom right corner of block
  9408.                num - number of pixels to shift
  9409.                colr - index to color in current palette
  9410.  
  9411.                OUTPUT
  9412.  
  9413.                no value returned
  9414.  
  9415.                USAGE
  9416.  
  9417.                SCROLLDN shifts the contents of the box described by (x1,
  9418.                y1) - (x2, y2) down by the number of pixels specified by
  9419.                num.  The empty pixels created at the top of the box are
  9420.                filled with colr.  The pixels that are shifted out of the
  9421.                box are lost.  SCROLLDN enforces x2x1 and y2 y1.  When
  9422.                placed within a loop, SCROLLDN will create a scrolling
  9423.                effect.
  9424.  
  9425.                SEE ALSO
  9426.  
  9427.                SCROLLLT, SCROLLRT, SCROLLUP
  9428.  
  9429.                EXAMPLE
  9430.  
  9431.                /*
  9432.                 * scroll some text down
  9433.                 */
  9434.  
  9435.                #include <stdlib.h>
  9436.                #include <conio.h>
  9437.                #include "svgacc.h"
  9438.  
  9439.                void main(void)
  9440.                {
  9441.                  int vmode, i;
  9442.  
  9443.                  vmode = videomodeget();
  9444.                  if ( !whichvga() || (whichmem() < 512))
  9445.                     exit(1);
  9446.                  res640();
  9447.                  drwbox (1,10,0,0,100,100);
  9448.                  drwstring(1,7,0,"text text",20,43);
  9449.                  for(i=0;i<40;i++)
  9450.                  {
  9451.  
  9452.  
  9453.                                                                         151
  9454.  
  9455.  
  9456.  
  9457.  
  9458.  
  9459.                     scrolldn(1,1,99,99,1,0);
  9460.                     sdelay(2);
  9461.                  }
  9462.                  getch();
  9463.                  videomodeset(vmode);
  9464.                }
  9465.  
  9466.  
  9467.  
  9468.  
  9469.  
  9470.  
  9471.  
  9472.  
  9473.  
  9474.  
  9475.  
  9476.  
  9477.  
  9478.  
  9479.  
  9480.  
  9481.  
  9482.  
  9483.  
  9484.  
  9485.  
  9486.  
  9487.  
  9488.  
  9489.  
  9490.  
  9491.  
  9492.  
  9493.  
  9494.  
  9495.  
  9496.  
  9497.  
  9498.  
  9499.  
  9500.  
  9501.  
  9502.  
  9503.  
  9504.  
  9505.  
  9506.  
  9507.  
  9508.  
  9509.  
  9510.  
  9511.  
  9512.  
  9513.  
  9514.  
  9515.                                                                         152
  9516.  
  9517.  
  9518.  
  9519.  
  9520.  
  9521.             SCROLLLT
  9522.  
  9523.                PROTOTYPE
  9524.  
  9525.                extern void far scrolllt (int x1, int y1, int x2, int y2,
  9526.                int num, int colr)
  9527.  
  9528.                INPUT
  9529.  
  9530.                x1, y1 - top left corner of block
  9531.                x2, y2 - bottom right corner of block
  9532.                num - number of pixels to shift
  9533.                colr - index to color in current palette
  9534.  
  9535.                OUTPUT
  9536.  
  9537.                no value returned
  9538.  
  9539.                USAGE
  9540.  
  9541.                SCROLLLT shifts the contents of the box described by (x1,
  9542.                y1) - (x2, y2) down by the number of pixels specified by
  9543.                num.  The empty pixels created at the right of the box are
  9544.                filled with colr.  The pixels that are shifted out of the
  9545.                box are lost.  SCROLLLT enforces x2x1 and y2 y1.  When
  9546.                placed within a loop, SCROLLRT will create a scrolling
  9547.                effect.
  9548.  
  9549.                SEE ALSO
  9550.  
  9551.                SCROLLDN, SCROLLRT, SCROLLUP
  9552.  
  9553.                EXAMPLE
  9554.  
  9555.                /*
  9556.                 * scroll some text left
  9557.                 */
  9558.  
  9559.                #include <stdlib.h>
  9560.                #include <conio.h>
  9561.                #include "svgacc.h"
  9562.  
  9563.                void main(void)
  9564.                {
  9565.                  int vmode, i;
  9566.  
  9567.                  vmode = videomodeget();
  9568.                  if ( !whichvga() || (whichmem() < 512))
  9569.                     exit(1);
  9570.                  res640();
  9571.                  drwbox (1,10,0,0,100,100);
  9572.                  drwstring(1,7,0,"text text",20,43);
  9573.                  for(i=0;i<40;i++)
  9574.                  {
  9575.  
  9576.  
  9577.                                                                         153
  9578.  
  9579.  
  9580.  
  9581.  
  9582.  
  9583.                     scrolllt(1,1,99,99,1,0);
  9584.                     sdelay(2);
  9585.                  }
  9586.                  getch();
  9587.                  videomodeset(vmode);
  9588.                }
  9589.  
  9590.  
  9591.  
  9592.  
  9593.  
  9594.  
  9595.  
  9596.  
  9597.  
  9598.  
  9599.  
  9600.  
  9601.  
  9602.  
  9603.  
  9604.  
  9605.  
  9606.  
  9607.  
  9608.  
  9609.  
  9610.  
  9611.  
  9612.  
  9613.  
  9614.  
  9615.  
  9616.  
  9617.  
  9618.  
  9619.  
  9620.  
  9621.  
  9622.  
  9623.  
  9624.  
  9625.  
  9626.  
  9627.  
  9628.  
  9629.  
  9630.  
  9631.  
  9632.  
  9633.  
  9634.  
  9635.  
  9636.  
  9637.  
  9638.  
  9639.                                                                         154
  9640.  
  9641.  
  9642.  
  9643.  
  9644.  
  9645.             SCROLLRT
  9646.  
  9647.                PROTOTYPE
  9648.  
  9649.                extern void far scrollrt (int x1, int y1, int x2, int y2,
  9650.                int num, int colr)
  9651.  
  9652.                INPUT
  9653.  
  9654.                x1, y1 - top left corner of block
  9655.                x2, y2 - bottom right corner of block
  9656.                num - number of pixels to shift
  9657.                colr - index to color in current palette
  9658.  
  9659.                OUTPUT
  9660.  
  9661.                no value returned
  9662.  
  9663.                USAGE
  9664.  
  9665.                SCROLLRT shifts the contents of the box described by (x1,
  9666.                y1) - (x2, y2) down by the number of pixels specified by
  9667.                num.  The empty pixels created at the left of the box are
  9668.                filled with colr.  The pixels that are shifted out of the
  9669.                box are lost.  SCROLLRT enforces x2x1 and y2 y1.  When
  9670.                placed within a loop, SCROLLRT will create a scrolling
  9671.                effect.
  9672.  
  9673.                SEE ALSO
  9674.  
  9675.                SCROLLDN, SCROLLLT, SCROLLUP
  9676.  
  9677.                EXAMPLE
  9678.  
  9679.                /*
  9680.                 * scroll some text right
  9681.                 */
  9682.  
  9683.                #include <stdlib.h>
  9684.                #include <conio.h>
  9685.                #include "svgacc.h"
  9686.  
  9687.                void main(void)
  9688.                {
  9689.                  int vmode, i;
  9690.  
  9691.                  vmode = videomodeget();
  9692.                  if ( !whichvga() || (whichmem() < 512))
  9693.                     exit(1);
  9694.                  res640();
  9695.                  drwbox (1,10,0,0,100,100);
  9696.                  drwstring(1,7,0,"text text",20,43);
  9697.                  for(i=0;i<40;i++)
  9698.                  {
  9699.  
  9700.  
  9701.                                                                         155
  9702.  
  9703.  
  9704.  
  9705.  
  9706.  
  9707.                     scrollrt(1,1,99,99,1,0);
  9708.                     sdelay(2);
  9709.                  }
  9710.                  getch();
  9711.                  videomodeset(vmode);
  9712.                }
  9713.  
  9714.  
  9715.  
  9716.  
  9717.  
  9718.  
  9719.  
  9720.  
  9721.  
  9722.  
  9723.  
  9724.  
  9725.  
  9726.  
  9727.  
  9728.  
  9729.  
  9730.  
  9731.  
  9732.  
  9733.  
  9734.  
  9735.  
  9736.  
  9737.  
  9738.  
  9739.  
  9740.  
  9741.  
  9742.  
  9743.  
  9744.  
  9745.  
  9746.  
  9747.  
  9748.  
  9749.  
  9750.  
  9751.  
  9752.  
  9753.  
  9754.  
  9755.  
  9756.  
  9757.  
  9758.  
  9759.  
  9760.  
  9761.  
  9762.  
  9763.                                                                         156
  9764.  
  9765.  
  9766.  
  9767.  
  9768.  
  9769.             SCROLLUP
  9770.  
  9771.                PROTOTYPE
  9772.  
  9773.                extern void far scrollup (int x1, int y1, int x2, int y2,
  9774.                int num, int colr)
  9775.  
  9776.                INPUT
  9777.  
  9778.                x1, y1 - top left corner of block
  9779.                x2, y2 - bottom right corner of block
  9780.                num - number of pixels to shift
  9781.                colr - index to color in current palette
  9782.  
  9783.                OUTPUT
  9784.  
  9785.                no value returned
  9786.  
  9787.                USAGE
  9788.  
  9789.                SCROLLUP shifts the contents of the box described by (x1,
  9790.                y1) - (x2, y2) down by the number of pixels specified by
  9791.                num.  The empty pixels created at the bottom of the box are
  9792.                filled with colr.  The pixels that are shifted out of the
  9793.                box are lost.  SCROLLUP enforces x2x1 and y2 y1.  When
  9794.                placed within a loop, SCROLLUP will create a scrolling
  9795.                effect.
  9796.  
  9797.                SEE ALSO
  9798.  
  9799.                SCROLLDN, SCROLLLT, SCROLLRT
  9800.  
  9801.                EXAMPLE
  9802.  
  9803.                /*
  9804.                 * scroll some text up
  9805.                 */
  9806.  
  9807.                #include <stdlib.h>
  9808.                #include <conio.h>
  9809.                #include "svgacc.h"
  9810.  
  9811.                void main(void)
  9812.                {
  9813.                  int vmode, i;
  9814.  
  9815.                  vmode = videomodeget();
  9816.                  if ( !whichvga() || (whichmem() < 512))
  9817.                     exit(1);
  9818.                  res640();
  9819.                  drwbox (1,10,0,0,100,100);
  9820.                  drwstring(1,7,0,"text text",20,43);
  9821.                  for(i=0;i<40;i++)
  9822.                  {
  9823.  
  9824.  
  9825.                                                                         157
  9826.  
  9827.  
  9828.  
  9829.  
  9830.  
  9831.                     scrollup(1,1,99,99,1,0);
  9832.                     sdelay(2);
  9833.                  }
  9834.                  getch();
  9835.                  videomodeset(vmode);
  9836.                }
  9837.  
  9838.  
  9839.  
  9840.  
  9841.  
  9842.  
  9843.  
  9844.  
  9845.  
  9846.  
  9847.  
  9848.  
  9849.  
  9850.  
  9851.  
  9852.  
  9853.  
  9854.  
  9855.  
  9856.  
  9857.  
  9858.  
  9859.  
  9860.  
  9861.  
  9862.  
  9863.  
  9864.  
  9865.  
  9866.  
  9867.  
  9868.  
  9869.  
  9870.  
  9871.  
  9872.  
  9873.  
  9874.  
  9875.  
  9876.  
  9877.  
  9878.  
  9879.  
  9880.  
  9881.  
  9882.  
  9883.  
  9884.  
  9885.  
  9886.  
  9887.                                                                         158
  9888.  
  9889.  
  9890.  
  9891.  
  9892.  
  9893.             SDELAY
  9894.  
  9895.                PROTOTYPE
  9896.  
  9897.                extern void far sdelay (int count)
  9898.  
  9899.                INPUT
  9900.  
  9901.                count - number of vertical syncs to wait
  9902.  
  9903.                OUTPUT
  9904.  
  9905.                no value returned
  9906.  
  9907.                USAGE
  9908.  
  9909.                SDELAY pauses execution of the program for a period of time
  9910.                specified by count.  This delay remains approximately
  9911.                constant on all machines by using the vertical sync timer of
  9912.                the VGA graphics card which is about 60 - 70 Hz.
  9913.  
  9914.                EXAMPLE
  9915.  
  9916.                /*
  9917.                 * make a delay of about 3 seconds long
  9918.                 */
  9919.  
  9920.                #include <stdlib.h>
  9921.                #include <conio.h>
  9922.                #include <time.h>
  9923.                #include "svgacc.h"
  9924.  
  9925.                void main(void)
  9926.                {
  9927.                  time_t starttime;
  9928.                  time_t endtime;
  9929.                  printf("ok...stating delay...should be about 3
  9930.                seconds...");
  9931.                  time( &starttime);
  9932.                  sdelay(195);
  9933.                  time( &endtime);
  9934.                  printf("total time was: %d seconds...", endtime-
  9935.                starttime);
  9936.                  exit(0);
  9937.                }
  9938.  
  9939.  
  9940.  
  9941.  
  9942.  
  9943.  
  9944.  
  9945.  
  9946.  
  9947.  
  9948.  
  9949.                                                                         159
  9950.  
  9951.  
  9952.  
  9953.  
  9954.  
  9955.             SETCARD
  9956.  
  9957.                PROTOTYPE
  9958.  
  9959.                extern void far setcard (VGAChipset chip, int mem)
  9960.  
  9961.                INPUT
  9962.  
  9963.                chip - code for SVGA chip type
  9964.                mem - amount of video memory installed
  9965.  
  9966.                OUTPUT
  9967.  
  9968.                no value returned
  9969.  
  9970.                USAGE
  9971.  
  9972.                WARNING:  USING SETCARD IMPROPERLY MAY CAUSE A SYSTEM
  9973.                FAILURE OR DAMAGE.
  9974.                SETCARD sets the card type and installed video memory.  It
  9975.                can be used instead of the WHICHVGA function.  However,
  9976.                specifying an incorrect chip type or installed video memory
  9977.                may cause unpredictable results not excluding damage to the
  9978.                SVGA card and/or monitor.  Extreme caution is advised when
  9979.                using this function.  It is recommended that this function
  9980.                only be used when it is suspected that the identification
  9981.                process in WHICHVGA failed.  Be absolutely certain that the
  9982.                chip type specified is the actual chip type installed in the
  9983.                computer.  Mem should be a value of 256, 512 or 1024
  9984.                representing the kilobytes of video memory installed.  Use
  9985.                the following table to identify chip types:
  9986.  
  9987.             1   Acumos AVGA2/3 SuperVGA
  9988.             2   ATI Technologies 18/28/38/68800
  9989.                 SuperVGA
  9990.             3   Ahead V5000 ver A SuperVGA
  9991.             4   Ahead V5000 ver B SuperVGA
  9992.             5   Chips and Technologies 82C45x SuperVGA
  9993.             6   Cirrus Logic CL-GD 5xx, 6xx, 28xx,
  9994.                 54xx, 62xx SuperVGA
  9995.             7   Everex Micro Enhancer Ev236/6xx
  9996.                 SuperVGA
  9997.             8   Genoa 61/62/63/64/6600 SuperVGA
  9998.             9   NCR 77C21/22/22E/22E+ SuperVGA
  9999.             10  Oak Technologies OTI-037C/067/077/087
  10000.                 SuperVGA
  10001.             11  Paradise/Western Digital PVGA1A,
  10002.                 WD90C00/1x/2x/3x SuperVGA
  10003.             12  Realtek RT3106 SuperVGA
  10004.             13  Trident 8800CS, 8900B/C/CL/CX, 90x0
  10005.                 SuperVGA
  10006.             14  Tseng Labs ET3000-AX/BX/BP SuperVGA
  10007.             15  Tseng Labs ET4000/W32/W32I SuperVGA
  10008.             16  VESA compatible SuperVGA
  10009.  
  10010.  
  10011.                                                                         160
  10012.  
  10013.  
  10014.  
  10015.  
  10016.  
  10017.             17  Video 7 HT-208/16 SuperVGA
  10018.             18  Avance Logic AL2101 SuperVGA
  10019.             19  MXIC MX68000/10 SuperVGA
  10020.             20  Primus P2000 SuperVGA
  10021.  
  10022.                SEE ALSO
  10023.  
  10024.                WHICHVGA
  10025.  
  10026.                EXAMPLE
  10027.  
  10028.                /*
  10029.                !WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WAR
  10030.                NING!  */
  10031.                /*                                                       */
  10032.                /* USE THE "SETCARD" FUNCTION CAREFULLY. IT WORKS AROUND
  10033.                "WHICHVGA". */
  10034.                /* IMPROPER USE (I.E. SETTING THE CARD ID AND MEMORY TO
  10035.                SOMETHING   */
  10036.                /* THAT IS NOT VALID) MIGHT DAMAGE YOUR VIDEO CARD/VIDEO
  10037.                MONITOR OR  */
  10038.                /* CAUSE UNPREDICTABLE RESULTS. IT IS PROVIDED AS A METHOD
  10039.                TO FIND*/
  10040.                /* FAULTS IN THE VIDEO CARD/CHIP ID PROCESS.
  10041.                     */
  10042.                /*                                                       */
  10043.                /*
  10044.                !WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WAR
  10045.                NING!  */
  10046.  
  10047.  
  10048.  
  10049.  
  10050.  
  10051.  
  10052.  
  10053.  
  10054.  
  10055.  
  10056.  
  10057.  
  10058.  
  10059.  
  10060.  
  10061.  
  10062.  
  10063.  
  10064.  
  10065.  
  10066.  
  10067.  
  10068.  
  10069.  
  10070.  
  10071.  
  10072.  
  10073.                                                                         161
  10074.  
  10075.  
  10076.  
  10077.  
  10078.  
  10079.             SETVIEW
  10080.  
  10081.                PROTOTYPE
  10082.  
  10083.                extern void far setview (int x1, int y1, int x2, int y2)
  10084.  
  10085.                INPUT
  10086.  
  10087.                x1, y1 - top, left corner of view port
  10088.                x2, y2 - bottom, right corner of view port
  10089.  
  10090.                OUTPUT
  10091.  
  10092.                no value returned
  10093.  
  10094.                USAGE
  10095.  
  10096.                SETVIEW defines a viewport for clipping output on the
  10097.                screen.  Nothing can be drawn outside of the currently
  10098.                defined viewport.  The RES### functions set the viewport to
  10099.                the full screen.  The restrictions on X1, Y1, X2 and Y2 are
  10100.                as follows:
  10101.  
  10102.                0  X1 < X2   (screen width)
  10103.                0  Y1 < Y2   (32767, effectively unbounded)
  10104.  
  10105.                SEE ALSO
  10106.  
  10107.                RES320, RES640, RES640L, RES800, RES1024, RES1280
  10108.  
  10109.                EXAMPLE
  10110.  
  10111.                /*
  10112.                 * draws a lines clipped to a view port
  10113.                 */
  10114.  
  10115.                #include <stdlib.h>
  10116.                #include <conio.h>
  10117.                #include "svgacc.h"
  10118.                #define randnum(size) (rand() % (int)(size))
  10119.  
  10120.                void main(void)
  10121.                {
  10122.                  int vmode, i, x1, y1, x2, y2;
  10123.  
  10124.                  vmode = videomodeget();
  10125.                  if ( !whichvga() || (whichmem() < 512))
  10126.                     exit(1);
  10127.                  res640();
  10128.                  drwbox(1,15,101,101,538,378);
  10129.                  setview(101,101,538,378);
  10130.                  for(i=0;i<300;i++) {
  10131.                     x1 = randnum(640);
  10132.                     y1 = randnum(480);
  10133.  
  10134.  
  10135.                                                                         162
  10136.  
  10137.  
  10138.  
  10139.  
  10140.  
  10141.                     x2 = randnum(640);
  10142.                     y2 = randnum(480);
  10143.                     drwline(1,10,x1,y1,x2,y2);
  10144.                  }
  10145.                  getch();
  10146.                  videomodeset(vmode);
  10147.                  exit(0);
  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.  
  10192.  
  10193.  
  10194.  
  10195.  
  10196.  
  10197.                                                                         163
  10198.  
  10199.  
  10200.  
  10201.  
  10202.  
  10203.             SPRITECOLLDETECT
  10204.  
  10205.                PROTOTYPE
  10206.  
  10207.                extern int far spritecolldetect (int transcolr, int x1, int
  10208.                y1, int x2, int y2, RasterBlock far *sprite1, RasterBlock
  10209.                far *sprite2)
  10210.  
  10211.                INPUT
  10212.  
  10213.                transcolr - index to color in current palette
  10214.                x1, y1 - location of top, left corner of sprite number 1
  10215.                x2, y2 - location of top, left corner of sprite number 2
  10216.                sprite1 - sprite number 1
  10217.                sprite2 - sprite number 2
  10218.  
  10219.                OUTPUT
  10220.  
  10221.                SPRITECOLLDETECT returns the collision status of the two
  10222.                sprites.
  10223.  
  10224.                USAGE
  10225.  
  10226.                SPRITECOLLDETECT is used in sprite graphics or animation to
  10227.                report the collision status between two sprites.  Sprite1
  10228.                contains the first sprite which should have been previously
  10229.                defined by BLKGET or similar function.  Sprite2, likewise,
  10230.                contains the second sprite.  The top, left corner of the
  10231.                first and second sprites' locations are specified by x1, y1
  10232.                and x2, y2, respectively.
  10233.  
  10234.                SPRITECOLLDETECT will return a zero if the sprites are not
  10235.                colliding and the blocks are not overlapping.  The return
  10236.                will be one if the blocks overlap, but the sprites are not
  10237.                colliding.  A return value of two indicates that the sprites
  10238.                have at least one overlapping pixel and are, therefore,
  10239.                colliding.
  10240.  
  10241.                SEE ALSO
  10242.  
  10243.                BLKGET, BLKPUT, GETLASTSTRING, SPRITEGAP, SPRITEGET,
  10244.                SPRITEPUT
  10245.  
  10246.                EXAMPLE
  10247.  
  10248.                /*
  10249.                 * shows how spritecolldetect works
  10250.                 */
  10251.  
  10252.                #include <stdlib.h>
  10253.                #include <conio.h>
  10254.                #include "svgacc.h"
  10255.  
  10256.                void main(void)
  10257.  
  10258.  
  10259.                                                                         164
  10260.  
  10261.  
  10262.  
  10263.  
  10264.  
  10265.                {
  10266.                  int vmode, ret, i, x1, y1, x2, y2;
  10267.                  char text[70];
  10268.  
  10269.                  RasterBlock *sprite1data, *sprite2data;
  10270.  
  10271.                  vmode = videomodeget();
  10272.                  if ( !whichvga() )
  10273.                     exit(1);
  10274.                  res320();
  10275.                  x1 = 0;
  10276.                  y1 = 0;
  10277.                  x2 = 48;
  10278.                  y2 = 48;
  10279.                  drwline(1,8,x1,y1,x2,y1);
  10280.                  drwline(1,8,x2,y1,x2,y2);
  10281.                  drwline(1,8,x2,y2,x1,y2);
  10282.                  drwline(1,8,x1,y2,x1,y1);
  10283.                  fillarea(x1+1,y1+1,8,8);
  10284.                  drwellipse(1,10,((x2-x1)/2+x1),((y2-y1)/2+y1),(x2-
  10285.                x1)/2,(y2-y1)/2);
  10286.                  sprite1data = (RasterBlock *)malloc((x2-x1+1)*(y2-
  10287.                y1+1)+4);
  10288.                  blkget(x1,y1,x2,y2,sprite1data);
  10289.                  blkput(2,x1,y1,sprite1data);
  10290.                  x1 = 0;
  10291.                  y1 = 0;
  10292.                  x2 = 24;
  10293.                  y2 = 24;
  10294.                  drwline(1,8,x1,y1,x2,y1);
  10295.                  drwline(1,8,x2,y1,x2,y2);
  10296.                  drwline(1,8,x2,y2,x1,y2);
  10297.                  drwline(1,8,x1,y2,x1,y1);
  10298.                  fillarea(x1+1,y1+1,8,8);
  10299.                  drwline(1,10,x1,y1,x2,y2);
  10300.                  drwline(1,10,x2,y1,x1,y2);
  10301.                  sprite2data = (RasterBlock *)malloc((x2-x1+1)*(y2-
  10302.                y1+1)+4);
  10303.                  blkget(x1,y1,x2,y2,sprite2data);
  10304.                  blkput(2,x1,y1,sprite2data);
  10305.                  x1=90;
  10306.                  y1=90;
  10307.                  blkput(2,x1,y1,sprite1data);
  10308.                  for(i=30;i<150;i++)
  10309.                  {
  10310.                     blkput(2,i,i,sprite2data);
  10311.                     ret =
  10312.                spritecolldetect(8,x1,y1,i,i,sprite1data,sprite2data);
  10313.                     sprintf(text,"the return value is: %d",ret);
  10314.                     drwstring(1,7,0,text,0,0);
  10315.                     getch();
  10316.                     blkput(2,i,i,sprite2data);
  10317.                  }
  10318.                  videomodeset(vmode);
  10319.  
  10320.  
  10321.                                                                         165
  10322.  
  10323.  
  10324.  
  10325.  
  10326.  
  10327.                  exit(0);
  10328.                }
  10329.  
  10330.  
  10331.  
  10332.  
  10333.  
  10334.  
  10335.  
  10336.  
  10337.  
  10338.  
  10339.  
  10340.  
  10341.  
  10342.  
  10343.  
  10344.  
  10345.  
  10346.  
  10347.  
  10348.  
  10349.  
  10350.  
  10351.  
  10352.  
  10353.  
  10354.  
  10355.  
  10356.  
  10357.  
  10358.  
  10359.  
  10360.  
  10361.  
  10362.  
  10363.  
  10364.  
  10365.  
  10366.  
  10367.  
  10368.  
  10369.  
  10370.  
  10371.  
  10372.  
  10373.  
  10374.  
  10375.  
  10376.  
  10377.  
  10378.  
  10379.  
  10380.  
  10381.  
  10382.  
  10383.                                                                         166
  10384.  
  10385.  
  10386.  
  10387.  
  10388.  
  10389.             SPRITEGAP
  10390.  
  10391.                PROTOTYPE
  10392.  
  10393.                extern void far spritegap (int transcolr, int x, int y,
  10394.                RasterBlock far *sprite, RasterBlock far *spritebkgnd)
  10395.  
  10396.                INPUT
  10397.  
  10398.                transcolr - index to color in current palette
  10399.                x, y - top, left corner of block
  10400.                sprite- the sprite to place on screen
  10401.  
  10402.                OUTPUT
  10403.  
  10404.                no value returned
  10405.                spritebkgnd - sprite background
  10406.  
  10407.                USAGE
  10408.  
  10409.                SPRITEGAP ("Sprite-Get-And-Put") is used in sprite graphics
  10410.                or animation to retrieve a sprite's background and then
  10411.                display the sprite.  Sprite contains the sprite which should
  10412.                have been previously defined by BLKGET or similar function
  10413.                such as GETLASTSTRING.  Transcolr is the transparent colr
  10414.                assumed in sprite.  Spritebkgnd, a pointer to a RasterBlock
  10415.                structure the same size as the sprite, will receive the
  10416.                sprite's background.  The top, left corner of the sprite's
  10417.                location is specified by x, y.
  10418.  
  10419.                SEE ALSO
  10420.  
  10421.                BLKGET, BLKPUT, GETLASTSTRING, SPRITECOLLDETECT, SPRITEGET,
  10422.                SPRITEPUT
  10423.  
  10424.                EXAMPLE
  10425.  
  10426.                /*
  10427.                 * Show spritegap
  10428.                 */
  10429.  
  10430.                #include <stdlib.h>
  10431.                #include <math.h>
  10432.                #include <conio.h>
  10433.                #include "svgacc.h"
  10434.  
  10435.                void main(void)
  10436.                {
  10437.                  int vmode;
  10438.                  int i, j, colr, xinc, yinc, x1, y1, x2, y2, cnt, cntx,
  10439.                cnty, rot;
  10440.                  RasterBlock *gfxblk, *gfxblk2, *spritebkgnd;
  10441.  
  10442.                  vmode = videomodeget();
  10443.  
  10444.  
  10445.                                                                         167
  10446.  
  10447.  
  10448.  
  10449.  
  10450.  
  10451.                  if ( !whichvga() )
  10452.                     exit(1);
  10453.                  if ( whichmem() < 512)
  10454.                     exit(1);
  10455.                  if ( !res640() )
  10456.                     exit(1);
  10457.                  xinc = maxx/20;
  10458.                  yinc = maxy/20;
  10459.                  x1 = maxx/2-xinc;
  10460.                  y1 = maxy/2-yinc;
  10461.                  x2 = maxx/2+xinc;
  10462.                  y2 = maxy/2+yinc;
  10463.                  i = (x2-x1+1)*(y2-y1+1)+4;
  10464.                  gfxblk = (RasterBlock *)malloc(i);
  10465.                  if (!gfxblk) {
  10466.                     restext();
  10467.                     printf("ERROR: Allocating memory for gfxblk: %d
  10468.                bytes\n",i);
  10469.                     exit(1);
  10470.                  }
  10471.                  colr = 1;
  10472.                  for(i=0;i<=maxx/2;i++) {
  10473.                     drwcircle(1,colr,maxx/4+i,maxy/2,maxy/5);
  10474.                     colr+=1;
  10475.                     if(colr>15)
  10476.                       colr = 1;
  10477.                  }
  10478.                  drwbox(1,0,x1,y1,x2,y2);
  10479.                  blkget(x1,y1,x2,y2,gfxblk);
  10480.                  cntx = (x2-x1) / 2 + x1;
  10481.                  cnty = (y2-y1) / 2 + y1;
  10482.                  fillarea(x1+2,y1+2,0,0);
  10483.                  i = blkrotatesize(45,gfxblk);
  10484.                  spritebkgnd = (RasterBlock *)malloc(i);
  10485.                  if (!spritebkgnd) {
  10486.                     restext();
  10487.                     printf("ERROR: Allocating memory for spritebkgnd: %d
  10488.                bytes\n",i);
  10489.                     exit(1);
  10490.                  }
  10491.                  gfxblk2 = (RasterBlock *)malloc(i);
  10492.                  if (!gfxblk2) {
  10493.                     restext();
  10494.                     printf("ERROR: Allocating memory for gfxblk2: %d
  10495.                bytes\n",i);
  10496.                     exit(1);
  10497.                  }
  10498.                  blkget(x1,y1,x2,y2,spritebkgnd);
  10499.                  setview(0,64,maxx,maxy);
  10500.                  for(i=0;i<=360;i+=3) {
  10501.                     rot = blkrotate(i,1,gfxblk,gfxblk2);
  10502.                     spriteput(SET,1,cntx-(spritebkgnd->width)/2,cnty-
  10503.                (spritebkgnd->height)/2,spritebkgnd);
  10504.  
  10505.  
  10506.  
  10507.                                                                         168
  10508.  
  10509.  
  10510.  
  10511.  
  10512.  
  10513.                     spritegap(1,cntx-(gfxblk2->width)/2,cnty-(gfxblk2-
  10514.                >height)/2,gfxblk2,spritebkgnd);
  10515.                     sdelay(3);
  10516.                  }
  10517.                  spriteput(SET,1,cntx-(spritebkgnd->width)/2,cnty-
  10518.                (spritebkgnd->height)/2,spritebkgnd);
  10519.                  blkput(SET,x1,y1,(RasterBlock *)gfxblk);
  10520.                  getch();
  10521.                  videomodeset(vmode);
  10522.                  exit(0);
  10523.                }
  10524.  
  10525.  
  10526.  
  10527.  
  10528.  
  10529.  
  10530.  
  10531.  
  10532.  
  10533.  
  10534.  
  10535.  
  10536.  
  10537.  
  10538.  
  10539.  
  10540.  
  10541.  
  10542.  
  10543.  
  10544.  
  10545.  
  10546.  
  10547.  
  10548.  
  10549.  
  10550.  
  10551.  
  10552.  
  10553.  
  10554.  
  10555.  
  10556.  
  10557.  
  10558.  
  10559.  
  10560.  
  10561.  
  10562.  
  10563.  
  10564.  
  10565.  
  10566.  
  10567.  
  10568.  
  10569.                                                                         169
  10570.  
  10571.  
  10572.  
  10573.  
  10574.  
  10575.             SPRITEGET
  10576.  
  10577.                PROTOTYPE
  10578.  
  10579.                extern void far spriteget (int transcolr, int x, int y,
  10580.                RasterBlock far *sprite, RasterBlock far *spritebkgnd)
  10581.  
  10582.                INPUT
  10583.  
  10584.                transcolr - index to color in current palette
  10585.                x, y - top, left corner of block
  10586.                sprite - sprite to use as pattern
  10587.  
  10588.                OUTPUT
  10589.  
  10590.                no value returned
  10591.                spritebkgnd - sprite background
  10592.  
  10593.                USAGE
  10594.  
  10595.                SPRITEGET is used in sprite graphics or animation to
  10596.                retrieve the background for a sprite, normally just before
  10597.                using SPRITEPUT.  Sprite contains the sprite which should
  10598.                have been previously defined by BLKGET or similar function.
  10599.                Transcolr is the transparent color assumed in the sprite.
  10600.                Spritebkgnd, a pointer to a RasterBlock structure the same
  10601.                size as the sprite, will receive the sprite's background.
  10602.                The top, left corner of the sprite's location is specified
  10603.                by x, y.
  10604.  
  10605.                SEE ALSO
  10606.  
  10607.                BLKGET, BLKPUT, GETLASTSTRING, SPRITECOLLDETECT, SPRITEGAP,
  10608.                SPRITEPUT
  10609.  
  10610.                EXAMPLE
  10611.  
  10612.                /*
  10613.                 * Show spriteget
  10614.                 */
  10615.  
  10616.                #include <stdlib.h>
  10617.                #include <math.h>
  10618.                #include <conio.h>
  10619.                #include "svgacc.h"
  10620.  
  10621.                void main(void)
  10622.                {
  10623.                  int vmode, i, j, colr, xinc, yinc, x1, y1, x2, y2, cntx,
  10624.                cnty, rot;
  10625.                  RasterBlock *gfxblk, *gfxblk2, *spritebkgnd;
  10626.                  vmode = videomodeget();
  10627.                  if ( !whichvga() )
  10628.                     exit(1);
  10629.  
  10630.  
  10631.                                                                         170
  10632.  
  10633.  
  10634.  
  10635.  
  10636.  
  10637.                  if ( whichmem() < 512)
  10638.                     exit(1);
  10639.                  if ( !res640() )
  10640.                     exit(1);
  10641.                  xinc = maxx/20;
  10642.                  yinc = maxy/20;
  10643.                  x1 = maxx/2-xinc;
  10644.                  y1 = maxy/2-yinc;
  10645.                  x2 = maxx/2+xinc;
  10646.                  y2 = maxy/2+yinc;
  10647.                  i = (x2-x1+1)*(y2-y1+1)+4;
  10648.                  gfxblk = (RasterBlock *)malloc(i);
  10649.                  if (!gfxblk) {
  10650.                     restext();
  10651.                     printf("ERROR: Allocating memory for gfxblk: %d
  10652.                bytes\n",i);
  10653.                     exit(1);
  10654.                  }
  10655.                  colr = 1;
  10656.                  for(i=0;i<=maxx/2;i++) {
  10657.                     drwcircle(1,colr,maxx/4+i,maxy/2,maxy/5);
  10658.                     colr+=1;
  10659.                     if(colr>15)
  10660.                       colr = 1;
  10661.                  }
  10662.                  drwbox(1,0,x1,y1,x2,y2);
  10663.                  blkget(x1,y1,x2,y2,gfxblk);
  10664.                  cntx = (x2-x1) / 2 + x1;
  10665.                  cnty = (y2-y1) / 2 + y1;
  10666.                  fillarea(x1+2,y1+2,0,0);
  10667.                  i = blkrotatesize(45,gfxblk);
  10668.                  spritebkgnd = (RasterBlock *)malloc(i);
  10669.                  if (!spritebkgnd) {
  10670.                     restext();
  10671.                     printf("ERROR: Allocating memory for spritebkgnd: %d
  10672.                bytes\n",i);
  10673.                     exit(1);
  10674.                  }
  10675.                  gfxblk2 = (RasterBlock *)malloc(i);
  10676.                  if (!gfxblk2) {
  10677.                     restext();
  10678.                     printf("ERROR: Allocating memory for gfxblk2: %d
  10679.                bytes\n",i);
  10680.                     exit(1);
  10681.                  }
  10682.                  blkget(x1,y1,x2,y2,spritebkgnd);
  10683.                  setview(0,64,maxx,maxy);
  10684.                  for(i=0;i<=360;i+=3) {
  10685.                     rot = blkrotate(i,1,gfxblk,gfxblk2);
  10686.                     spriteput(SET,1,cntx-(spritebkgnd->width)/2,cnty-
  10687.                (spritebkgnd->height)/2,spritebkgnd);
  10688.                     spriteget(1,cntx-(gfxblk2->width)/2,cnty-(gfxblk2-
  10689.                >height)/2,gfxblk2,spritebkgnd);
  10690.  
  10691.  
  10692.  
  10693.                                                                         171
  10694.  
  10695.  
  10696.  
  10697.  
  10698.  
  10699.                     spriteput(SET,1,cntx-(gfxblk2->width)/2,cnty-(gfxblk2-
  10700.                >height)/2,gfxblk2);
  10701.                     sdelay(3);
  10702.                  }
  10703.                  spriteput(SET,1,cntx-(spritebkgnd->width)/2,cnty-
  10704.                (spritebkgnd->height)/2,spritebkgnd);
  10705.                  blkput(SET,x1,y1,(RasterBlock *)gfxblk);
  10706.                  getch();
  10707.                  videomodeset(vmode);
  10708.                  exit(0);
  10709.                }
  10710.  
  10711.  
  10712.  
  10713.  
  10714.  
  10715.  
  10716.  
  10717.  
  10718.  
  10719.  
  10720.  
  10721.  
  10722.  
  10723.  
  10724.  
  10725.  
  10726.  
  10727.  
  10728.  
  10729.  
  10730.  
  10731.  
  10732.  
  10733.  
  10734.  
  10735.  
  10736.  
  10737.  
  10738.  
  10739.  
  10740.  
  10741.  
  10742.  
  10743.  
  10744.  
  10745.  
  10746.  
  10747.  
  10748.  
  10749.  
  10750.  
  10751.  
  10752.  
  10753.  
  10754.  
  10755.                                                                         172
  10756.  
  10757.  
  10758.  
  10759.  
  10760.  
  10761.             SPRITEPUT
  10762.  
  10763.                PROTOTYPE
  10764.  
  10765.                extern void far spriteput (PixelMode mode, int transcolr,
  10766.                int x, int y, RasterBlock far *sprite)
  10767.  
  10768.                INPUT
  10769.  
  10770.                mode - pixel write mode
  10771.                transcolr - index to color in current palette
  10772.                x, y - top, left corner of block
  10773.                sprite- sprite to place on screen
  10774.  
  10775.                OUTPUT
  10776.  
  10777.                no value returned
  10778.  
  10779.                USAGE
  10780.  
  10781.                SPRITEPUT is used in sprite graphics or animation to display
  10782.                a sprite or, more commonly, its background.  Sprite contains
  10783.                the sprite which should have been previously defined by
  10784.                BLKGET,  SPRITEGAP or SPRITEGET.  Transcolr is the
  10785.                transparent color assumed in sprite.  The top, left corner
  10786.                of the sprite's location is specified by x, y.
  10787.  
  10788.                SEE ALSO
  10789.  
  10790.                BLKGET, BLKPUT, GETLASTSTRING, SPRITECOLLDETECT, SPRITEGAP,
  10791.                SPRITEGET
  10792.  
  10793.                EXAMPLE
  10794.  
  10795.                See SPRITEGET
  10796.  
  10797.  
  10798.  
  10799.  
  10800.  
  10801.  
  10802.  
  10803.  
  10804.  
  10805.  
  10806.  
  10807.  
  10808.  
  10809.  
  10810.  
  10811.  
  10812.  
  10813.  
  10814.  
  10815.  
  10816.  
  10817.                                                                         173
  10818.  
  10819.  
  10820.  
  10821.  
  10822.  
  10823.             VIDEOMODEGET
  10824.  
  10825.                PROTOTYPE
  10826.  
  10827.                extern int far videomodeget (void)
  10828.  
  10829.                INPUT
  10830.  
  10831.                no input parameters
  10832.  
  10833.                OUTPUT
  10834.  
  10835.                the current video mode
  10836.  
  10837.                USAGE
  10838.  
  10839.                VIDEOMODEGET returns the current video mode.  This function
  10840.                is best used to retrieve the video mode being used when a
  10841.                program begins.  When the program ends, this video mode can
  10842.                then be restored using VIDEOMODESET.
  10843.  
  10844.                SEE ALSO
  10845.  
  10846.                RES320, RES640, RES640L, RES800, RES1024, RES1280, RESTEXT,
  10847.                VIDEOMODESET
  10848.  
  10849.                EXAMPLE
  10850.  
  10851.                /*
  10852.                 * save the current video mode, enable 640x480x256, and
  10853.                reset the video mode
  10854.                 */
  10855.  
  10856.                #include <stdlib.h>
  10857.                #include <conio.h>
  10858.                #include "svgacc.h"
  10859.  
  10860.                void main(void)
  10861.                {
  10862.                  int vmode;
  10863.  
  10864.                  vmode = videomodeget();
  10865.                  if ( !whichvga() )
  10866.                     exit(1);
  10867.                  if ( whichmem() < 512)
  10868.                     exit(1);
  10869.                  res640();
  10870.                  videomodeset(vmode);
  10871.                  printf("we are back!");
  10872.                  getch();
  10873.                  exit(0);
  10874.                }
  10875.  
  10876.  
  10877.  
  10878.  
  10879.                                                                         174
  10880.  
  10881.  
  10882.  
  10883.  
  10884.  
  10885.             VIDEOMODESET
  10886.  
  10887.                PROTOTYPE
  10888.  
  10889.                extern void far videomodeset (int videomode)
  10890.  
  10891.                INPUT
  10892.  
  10893.                mode - number of video mode
  10894.  
  10895.                OUTPUT
  10896.  
  10897.                no value returned
  10898.  
  10899.                USAGE
  10900.  
  10901.                VIDEOMODESET sets the video mode specified by mode.  This
  10902.                function is best used at the end of a program to restore the
  10903.                video mode to the mode in use when the program began.  The
  10904.                program should retrieve the video mode at the beginning by
  10905.                using VIDEOMODEGET.
  10906.  
  10907.                SEE ALSO
  10908.  
  10909.                RES320, RES640, RES640L, RES800, RES1024, RES1280, RESTEXT,
  10910.                VIDEOMODEGET
  10911.  
  10912.                EXAMPLE
  10913.  
  10914.                See VIDEMODEGET
  10915.  
  10916.  
  10917.  
  10918.  
  10919.  
  10920.  
  10921.  
  10922.  
  10923.  
  10924.  
  10925.  
  10926.  
  10927.  
  10928.  
  10929.  
  10930.  
  10931.  
  10932.  
  10933.  
  10934.  
  10935.  
  10936.  
  10937.  
  10938.  
  10939.  
  10940.  
  10941.                                                                         175
  10942.  
  10943.  
  10944.  
  10945.  
  10946.  
  10947.             VIDEOOFF
  10948.  
  10949.                PROTOTYPE
  10950.  
  10951.                extern void far videooff (void)
  10952.  
  10953.                INPUT
  10954.  
  10955.                no input parameters
  10956.  
  10957.                OUTPUT
  10958.  
  10959.                no value returned
  10960.  
  10961.                USAGE
  10962.  
  10963.                VIDEOOFF turns the output display off.  Graphics may still
  10964.                be drawn to the screen.  However, the computer's monitor
  10965.                will display nothing and appear black.  This function can be
  10966.                used to hide graphics being drawn by initially using
  10967.                VIDEOOFF and then later calling VIDEOON.
  10968.  
  10969.                SEE ALSO
  10970.  
  10971.                VIDEOON
  10972.  
  10973.                EXAMPLE
  10974.  
  10975.                /*
  10976.                 * disable the video for about 3 seconds, then enable it
  10977.                 */
  10978.  
  10979.                #include <stdlib.h>
  10980.                #include <conio.h>
  10981.                #include "svgacc.h"
  10982.  
  10983.                void main(void)
  10984.                {
  10985.                  int vmode;
  10986.  
  10987.                  printf("press a key to disable video for 3 seconds...");
  10988.                  getch();
  10989.                  videooff();
  10990.                  sdelay(195);
  10991.                  videoon();
  10992.                  videomodeset(vmode);
  10993.                  printf("we are back!");
  10994.                  getch();
  10995.                  exit(0);
  10996.                }
  10997.  
  10998.  
  10999.  
  11000.  
  11001.  
  11002.  
  11003.                                                                         176
  11004.  
  11005.  
  11006.  
  11007.  
  11008.  
  11009.             VIDEOON
  11010.  
  11011.                PROTOTYPE
  11012.  
  11013.                extern void far videoon (void)
  11014.  
  11015.                INPUT
  11016.  
  11017.                no input parameters
  11018.  
  11019.                OUTPUT
  11020.  
  11021.                no value returned
  11022.  
  11023.                USAGE
  11024.  
  11025.                VIDEOON turns the display on.  All graphics that were drawn
  11026.                while the display was off are now visible.  This function
  11027.                can be used to hide graphics being drawn by initially using
  11028.                VIDEOOFF and then later calling VIDEOON.
  11029.  
  11030.                SEE ALSO
  11031.  
  11032.                VIDEOOFF
  11033.  
  11034.                EXAMPLE
  11035.  
  11036.                See VIDEOOFF
  11037.  
  11038.  
  11039.  
  11040.  
  11041.  
  11042.  
  11043.  
  11044.  
  11045.  
  11046.  
  11047.  
  11048.  
  11049.  
  11050.  
  11051.  
  11052.  
  11053.  
  11054.  
  11055.  
  11056.  
  11057.  
  11058.  
  11059.  
  11060.  
  11061.  
  11062.  
  11063.  
  11064.  
  11065.                                                                         177
  11066.  
  11067.  
  11068.  
  11069.  
  11070.  
  11071.             WHICHCPU
  11072.  
  11073.                PROTOTYPE
  11074.  
  11075.                extern int far whichcpu (void)
  11076.  
  11077.                INPUT
  11078.  
  11079.                no input parameters
  11080.  
  11081.                OUTPUT
  11082.  
  11083.                processor type
  11084.  
  11085.                USAGE
  11086.  
  11087.                WHICHCPU returns the computer's processor type as 86, 286,
  11088.                386 or 486.  This function should be called by any program
  11089.                using this library's routines to insure that the computer is
  11090.                at least 386 compatible or better.
  11091.  
  11092.                SEE ALSO
  11093.  
  11094.                WHICHJOYSTICK, WHICHMOUSE, WHICHVGA
  11095.  
  11096.                EXAMPLE
  11097.  
  11098.                /*
  11099.                 * id the microprocessor
  11100.                 */
  11101.  
  11102.                #include <stdlib.h>
  11103.                #include <conio.h>
  11104.                #include "svgacc.h"
  11105.  
  11106.                void main(void)
  11107.                {
  11108.                  int vmode;
  11109.                  int cpu;
  11110.  
  11111.                  cpu = whichcpu();
  11112.                  printf("Microprocessor is identified as an 80%d.\n",
  11113.                cpu);
  11114.                  getch();
  11115.                  exit(0);
  11116.                }
  11117.  
  11118.  
  11119.  
  11120.  
  11121.  
  11122.  
  11123.  
  11124.  
  11125.  
  11126.  
  11127.                                                                         178
  11128.  
  11129.  
  11130.  
  11131.  
  11132.  
  11133.             WHICHJOYSTICK
  11134.  
  11135.                PROTOTYPE
  11136.  
  11137.                extern int far whichjoystick (void)
  11138.  
  11139.                INPUT
  11140.  
  11141.                no input parameters
  11142.  
  11143.                OUTPUT
  11144.  
  11145.                available joystick support
  11146.  
  11147.                USAGE
  11148.  
  11149.                WHICHJOYSTICK returns the joystick support available on the
  11150.                computer.  This function should be called prior to use of
  11151.                the joysticks to verify that joysticks are available.  If
  11152.                the function returns a -1, there is no joystick port present
  11153.                or no BIOS support for a joystick.  Joystick A is bit 1 and
  11154.                B is bit 2.  Therefore, a return value of 1 means joystick A
  11155.                is available, a value of 2 means B is available and a value
  11156.                of 3 means both are available.  If no bits are set, there
  11157.                are no joysticks present.
  11158.  
  11159.                SEE ALSO
  11160.  
  11161.                JOYSTICKINFO, WHICHCPU, WHICHMOUSE, WHICHVGA
  11162.  
  11163.                EXAMPLE
  11164.  
  11165.                /* id any joysticks */
  11166.                #include <stdlib.h>
  11167.                #include "svgacc.h"
  11168.  
  11169.                void main(void)
  11170.                {
  11171.                  int vmode, joystick;
  11172.  
  11173.                  joystick = whichjoystick();
  11174.                  switch (joystick) {
  11175.                     case -1:
  11176.                       printf("No joystick port detected or no joystick
  11177.                BIOS support present.\n\n");
  11178.                       break;
  11179.                     case 0:
  11180.                       printf("No joystick detected\n\n");
  11181.                       break;
  11182.                     case 1:
  11183.                       printf("Joystick A is present and available.\n\n");
  11184.                       break;
  11185.                     case 2:
  11186.                       printf("Joystick B is present and available.\n\n");
  11187.  
  11188.  
  11189.                                                                         179
  11190.  
  11191.  
  11192.  
  11193.  
  11194.  
  11195.                       break;
  11196.                     case 3:
  11197.                       printf("Both Joystick A and Joystick B are
  11198.                present.\n\n");
  11199.                       break;
  11200.                  }
  11201.                }
  11202.  
  11203.  
  11204.  
  11205.  
  11206.  
  11207.  
  11208.  
  11209.  
  11210.  
  11211.  
  11212.  
  11213.  
  11214.  
  11215.  
  11216.  
  11217.  
  11218.  
  11219.  
  11220.  
  11221.  
  11222.  
  11223.  
  11224.  
  11225.  
  11226.  
  11227.  
  11228.  
  11229.  
  11230.  
  11231.  
  11232.  
  11233.  
  11234.  
  11235.  
  11236.  
  11237.  
  11238.  
  11239.  
  11240.  
  11241.  
  11242.  
  11243.  
  11244.  
  11245.  
  11246.  
  11247.  
  11248.  
  11249.  
  11250.  
  11251.                                                                         180
  11252.  
  11253.  
  11254.  
  11255.  
  11256.  
  11257.             WHICHMEM
  11258.  
  11259.                PROTOTYPE
  11260.  
  11261.                extern int far whichmem (void)
  11262.  
  11263.                INPUT
  11264.  
  11265.                no input parameters
  11266.  
  11267.                OUTPUT
  11268.  
  11269.                installed video memory in kilobytes
  11270.  
  11271.                USAGE
  11272.  
  11273.                WHICHMEM returns the amount of installed video memory as
  11274.                previously determined by WHICHVGA.  WHICHVGA should be
  11275.                called prior to WHICHMEM.  This function should be called
  11276.                prior to any of the RES### functions to verify that there is
  11277.                enough memory to support the desired resolution.  If SETCARD
  11278.                was used to set the video card and memory, WHICHMEM will
  11279.                return the amount of memory as defined by SETCARD.
  11280.  
  11281.                SEE ALSO
  11282.  
  11283.                RES320, RES640, RES640L, RES800, RES1024, RES1280, SETCARD,
  11284.                WHICHVGA
  11285.  
  11286.                EXAMPLE
  11287.  
  11288.                /*
  11289.                 * id the video memory
  11290.                 */
  11291.  
  11292.                #include <stdlib.h>
  11293.                #include <conio.h>
  11294.                #include "svgacc.h"
  11295.  
  11296.                void main(void)
  11297.                {
  11298.                  int vmode, vga, mem;
  11299.  
  11300.                  vga = whichvga();
  11301.                  mem = whichmem();
  11302.                  printf("Installed video memory is %d k.\n", mem);
  11303.                  getch();
  11304.                  exit(0);
  11305.                }
  11306.  
  11307.  
  11308.  
  11309.  
  11310.  
  11311.  
  11312.  
  11313.                                                                         181
  11314.  
  11315.  
  11316.  
  11317.  
  11318.  
  11319.             WHICHMOUSE
  11320.  
  11321.                PROTOTYPE
  11322.  
  11323.                extern int far whichmouse (void)
  11324.  
  11325.                INPUT
  11326.  
  11327.                no input parameters
  11328.  
  11329.                OUTPUT
  11330.  
  11331.                number of buttons on mouse
  11332.  
  11333.                USAGE
  11334.  
  11335.                WHICHMOUSE returns a value indicating whether a Microsoft
  11336.                compatible mouse is available.  If the function returns a 0,
  11337.                no mouse is available.  A non zero value indicates a mouse
  11338.                and Microsoft compatible driver are installed and gives the
  11339.                number of buttons (2 or 3) available.
  11340.  
  11341.                SEE ALSO
  11342.  
  11343.                MOUSEINFO, WHICHCPU, WHICHJOYSTICK, WHICHVGA
  11344.  
  11345.                EXAMPLE
  11346.  
  11347.                See MOUSEINFO
  11348.  
  11349.  
  11350.  
  11351.  
  11352.  
  11353.  
  11354.  
  11355.  
  11356.  
  11357.  
  11358.  
  11359.  
  11360.  
  11361.  
  11362.  
  11363.  
  11364.  
  11365.  
  11366.  
  11367.  
  11368.  
  11369.  
  11370.  
  11371.  
  11372.  
  11373.  
  11374.  
  11375.                                                                         182
  11376.  
  11377.  
  11378.  
  11379.  
  11380.  
  11381.             WHICHVGA
  11382.  
  11383.                PROTOTYPE
  11384.  
  11385.                extern VGAChipset far whichvga (void)
  11386.  
  11387.                INPUT
  11388.  
  11389.                no input parameters
  11390.  
  11391.                OUTPUT
  11392.  
  11393.                WHICHVGA returns a code identifying the video card.
  11394.  
  11395.                USAGE
  11396.  
  11397.                WHICHVGA identifies the video card installed and the amount
  11398.                of video memory.  In addition this function sets up the
  11399.                default font and mouse cursor.  This function must be called
  11400.                before any other graphics function.  The code returned
  11401.                identifies the video card according to the following table:
  11402.  
  11403.             1   Acumos AVGA2/3 SuperVGA
  11404.             2   ATI Technologies 18/28/38/68800
  11405.                 SuperVGA
  11406.             3   Ahead V5000 ver A SuperVGA
  11407.             4   Ahead V5000 ver B SuperVGA
  11408.             5   Chips and Technologies 82C45x SuperVGA
  11409.             6   Cirrus Logic CL-GD 5xx, 6xx, 28xx,
  11410.                 54xx, 62xx SuperVGA
  11411.             7   Everex Micro Enhancer Ev236/6xx
  11412.                 SuperVGA
  11413.             8   Genoa 61/62/63/64/6600 SuperVGA
  11414.             9   NCR 77C21/22/22E/22E+ SuperVGA
  11415.             10  Oak Technologies OTI-037C/067/077/087
  11416.                 SuperVGA
  11417.             11  Paradise/Western Digital PVGA1A,
  11418.                 WD90C00/1x/2x/3x SuperVGA
  11419.             12  Realtek RT3106 SuperVGA
  11420.             13  Trident 8800CS, 8900B/C/CL/CX, 90x0
  11421.                 SuperVGA
  11422.             14  Tseng Labs ET3000-AX/BX/BP SuperVGA
  11423.             15  Tseng Labs ET4000/W32/W32I SuperVGA
  11424.             16  VESA compatible SuperVGA
  11425.             17  Video 7 HT-208/16 SuperVGA
  11426.             18  Avance Logic AL2101 SuperVGA
  11427.             19  MXIC MX68000/10 SuperVGA
  11428.             20  Primus P2000 SuperVGA
  11429.  
  11430.                Any value returned not found on this table represents an
  11431.                unidentified video card.
  11432.  
  11433.                No graphics functions should be called unless the video card
  11434.                is properly identified.
  11435.  
  11436.  
  11437.                                                                         183
  11438.  
  11439.  
  11440.  
  11441.  
  11442.  
  11443.  
  11444.                SEE ALSO
  11445.  
  11446.                SETCARD, WHICHCPU, WHICHJOYSTICK, WHICHMOUSE, WHICHMEM
  11447.  
  11448.                EXAMPLE
  11449.  
  11450.                /*
  11451.                 * id the svga
  11452.                 */
  11453.  
  11454.                #include <stdlib.h>
  11455.                #include <conio.h>
  11456.                #include "svgacc.h"
  11457.  
  11458.                void main(void)
  11459.                {
  11460.  
  11461.                char buf[40];
  11462.  
  11463.                switch(whichvga()) {
  11464.                  case ACUMOS:
  11465.                     sprintf(buf,"Acumos AVGA2/3 SuperVGA");
  11466.                     break;
  11467.                  case ATI:
  11468.                     sprintf(buf,"ATI Technologies 18/28/38/68800
  11469.             SuperVGA");
  11470.                     break;
  11471.                  case AHEADA:
  11472.                     sprintf(buf,"Ahead V5000 Ver A SuperVGA");
  11473.                     break;
  11474.                  case AHEADB:
  11475.                     sprintf(buf,"Ahead V5000 Ver B SuperVGA");
  11476.                     break;
  11477.                  case CHIPSTECH:
  11478.                     sprintf(buf,"Chips and Technologies 82C450/1/2/3/5/6/7
  11479.             SuperVGA");
  11480.                     break;
  11481.                  case CIRRUS:
  11482.                     sprintf(buf,"Cirrus Logic CL-GD 5xx,6xx,28xx,54xx,62xx
  11483.             SuperVGA");
  11484.                     break;
  11485.                  case EVEREX:
  11486.                     sprintf(buf,"Everex EV236/6xx Micro Enhancer
  11487.             SuperVGA");
  11488.                     break;
  11489.                  case GENOA:
  11490.                     sprintf(buf,"Genoa 61/62/63/64/6600 SuperVGA");
  11491.                     break;
  11492.                  case NCR:
  11493.                     sprintf(buf,"NCR 77C21/22/22E/22E+ SuperVGA");
  11494.                     break;
  11495.                  case OAKTECH:
  11496.  
  11497.  
  11498.  
  11499.                                                                         184
  11500.  
  11501.  
  11502.  
  11503.  
  11504.  
  11505.                     sprintf(buf,"Oak Technologies OTI-037/67/77/87C
  11506.             SuperVGA");
  11507.                     break;
  11508.                  case PARADISE:
  11509.                     sprintf(buf,"Paradise/Western Digital
  11510.             PVGA1A,WD90C00/1x/2x/3x SuperVGA");
  11511.                     break;
  11512.                  case REALTEK:
  11513.                     sprintf(buf,"Realtek RT3106 SuperVGA");
  11514.                     break;
  11515.                  case TRIDENT:
  11516.                     sprintf(buf,"Trident 8800CS,8900B/C/CL/CX,90x0
  11517.             SuperVGA");
  11518.                     break;
  11519.                  case TSENG3:
  11520.                     sprintf(buf,"Tseng Labs ET3000-AX/BX/BP SuperVGA");
  11521.                     break;
  11522.                  case TSENG4:
  11523.                     sprintf(buf,"Tseng Labs ET4000/W32/W32I SuperVGA");
  11524.                     break;
  11525.                  case VESA:
  11526.                     sprintf(buf,"VESA compatible SuperVGA");
  11527.                     break;
  11528.                  case VIDEO7:
  11529.                     sprintf(buf,"Video 7 HT-208/16 SuperVGA");
  11530.                     break;
  11531.                  case AVANCE:
  11532.                     sprintf(buf,"Avance Logic AL2101 SuperVGA");
  11533.                     break;
  11534.                  case MXIC:
  11535.                     sprintf(buf,"MXIC MX68000/10 SuperVGA");
  11536.                     break;
  11537.                  case PRIMUS:
  11538.                     sprintf(buf,"Primus P2000 SuperVGA");
  11539.                     break;
  11540.                  default:
  11541.                     printf("Sorry, unable to identify video card or it is
  11542.             not a SuperVGA video adapter.\n");
  11543.                     exit(0);
  11544.                }
  11545.                printf("Video card/chip is identified as %s.\n",&buf);
  11546.                exit(0);
  11547.             }
  11548.  
  11549.  
  11550.  
  11551.  
  11552.  
  11553.  
  11554.  
  11555.  
  11556.  
  11557.  
  11558.  
  11559.  
  11560.  
  11561.                                                                         185
  11562.  
  11563.  
  11564.  
  11565.  
  11566.  
  11567.             WHICHXMS
  11568.  
  11569.                PROTOTYPE
  11570.  
  11571.                extern int far whichxms (unsigned int far *xmskbytesavail,
  11572.                unsigned int far *xmshandlesavail)
  11573.  
  11574.                INPUT
  11575.  
  11576.                no input parameters
  11577.  
  11578.                OUTPUT
  11579.  
  11580.                WHICHXMS returns a 1 if extended memory support is detected,
  11581.                0 otherwise.
  11582.                xmskbytesavail - number of free kilobytes in extended memory
  11583.                xmshandlesavail - number of available free handles
  11584.  
  11585.                USAGE
  11586.  
  11587.                WHICHXMS detects the existence of extended memory support
  11588.                and sets up the library function calls.  This function must
  11589.                be called before any other extended memory functions.
  11590.                WHICHXMS also returns the number of free kilobytes of
  11591.                extended memory and the number of available handles.  The
  11592.                number of available handles is limited, normally to 32.
  11593.                This limit can be modified by changing the extended memory
  11594.                driver (Microsoft's HIMEM.SYS is the most common) command
  11595.                line in the CONFIG.SYS file.
  11596.  
  11597.                SEE ALSO
  11598.  
  11599.                XMSALLOCATE, XMSCOPY, XMSERROR, XMSFREE, XMSGET, XMSPUT
  11600.  
  11601.                EXAMPLE
  11602.  
  11603.                /*
  11604.                 * show what xms memory is available
  11605.                 */
  11606.  
  11607.                #include <stdlib.h>
  11608.                #include <conio.h>
  11609.                #include "svgacc.h"
  11610.  
  11611.                void main(void)
  11612.                {
  11613.                  int er, mem, handles;
  11614.  
  11615.                  if ( whichxms(&mem,&handles) ) {
  11616.                     printf("an active xms memory manager was found!\n");
  11617.                     printf("a total of %d kb of xms memory
  11618.                available...\n",mem);
  11619.                     printf("a total of %d xms memory handles
  11620.                available...\n",handles);
  11621.  
  11622.  
  11623.                                                                         186
  11624.  
  11625.  
  11626.  
  11627.  
  11628.  
  11629.                     printf(" \n");
  11630.                     if ((mem < 1) || (handles < 1)) {
  11631.                       printf("sorry...there is either no free xms or\n");
  11632.                       printf("no free handles\n");
  11633.                       printf(" \n");
  11634.                       printf("xms support not available...\n");
  11635.                       exit(1);
  11636.                     }
  11637.                     else {
  11638.                     printf(" \n");
  11639.                     printf("xms support is ready and available!\n");
  11640.                     exit(1);
  11641.                     }
  11642.                  }
  11643.                  else {
  11644.                     printf("sorry...no active xms memory manager
  11645.                found...\n");
  11646.                     printf("make sure you have an xms memory manager\n");
  11647.                     printf("(such as HIMEM.SYS) loaded\n");
  11648.                     printf(" \n");
  11649.                     printf("xms support not available...\n");
  11650.                     exit(1);
  11651.                  }
  11652.  
  11653.                  exit(0);
  11654.                }
  11655.  
  11656.  
  11657.  
  11658.  
  11659.  
  11660.  
  11661.  
  11662.  
  11663.  
  11664.  
  11665.  
  11666.  
  11667.  
  11668.  
  11669.  
  11670.  
  11671.  
  11672.  
  11673.  
  11674.  
  11675.  
  11676.  
  11677.  
  11678.  
  11679.  
  11680.  
  11681.  
  11682.  
  11683.  
  11684.  
  11685.                                                                         187
  11686.  
  11687.  
  11688.  
  11689.  
  11690.  
  11691.             XMSALLOCATE
  11692.  
  11693.                PROTOTYPE
  11694.  
  11695.                extern int far xmsallocate (unsigned int reqkbytes)
  11696.  
  11697.                INPUT
  11698.  
  11699.                reqkbytes - requested number of kilobytes of extended memory
  11700.  
  11701.                OUTPUT
  11702.  
  11703.                XMSALLOCATE returns the assigned memory handle if the
  11704.                allocation is successful, 0 otherwise.
  11705.  
  11706.                USAGE
  11707.  
  11708.                XMSALLOCATE attempts to allocate the requested number of
  11709.                kilobytes in extended memory.  If successful, the function
  11710.                returns the handle of the new memory block.  If the function
  11711.                returns zero, then the allocation was unsuccessful; check
  11712.                XMSERROR for error codes.
  11713.  
  11714.                All allocated blocks must be freed using XMSFREE before a
  11715.                program terminates or the memory is lost until the machine
  11716.                is rebooted.  Simply exiting a program will not free
  11717.                allocated extended memory blocks.
  11718.  
  11719.                SEE ALSO
  11720.  
  11721.                WHICHXMS, XMSCOPY, XMSERROR, XMSFREE, XMSGET, XMSPUT
  11722.  
  11723.                EXAMPLE
  11724.  
  11725.                See XMSCOPY
  11726.  
  11727.  
  11728.  
  11729.  
  11730.  
  11731.  
  11732.  
  11733.  
  11734.  
  11735.  
  11736.  
  11737.  
  11738.  
  11739.  
  11740.  
  11741.  
  11742.  
  11743.  
  11744.  
  11745.  
  11746.  
  11747.                                                                         188
  11748.  
  11749.  
  11750.  
  11751.  
  11752.  
  11753.             XMSCOPY
  11754.  
  11755.                PROTOTYPE
  11756.  
  11757.                extern int far xmscopy (int xmssrchandle, long srcoffset,
  11758.                int xmsdesthandle, long destoffset, unsigned long count)
  11759.  
  11760.                INPUT
  11761.  
  11762.                xmssrchandle - handle of source extended memory block
  11763.                srcoffset - number of bytes from beginning of source memory
  11764.                block
  11765.                xmsdesthandle - handle of destination extended memory block
  11766.                destoffset - number of bytes from beginning of destination
  11767.                memory block
  11768.                count - number of bytes to copy from source to destination
  11769.                (must be even)
  11770.  
  11771.                OUTPUT
  11772.  
  11773.                XMSCOPY returns a 1 if copy was successful, 0 otherwise.
  11774.  
  11775.                USAGE
  11776.  
  11777.                XMSCOPY copies the number of bytes specified in count from
  11778.                the source extended memory block to the destination extended
  11779.                memory block.  Count must be an even number.  The copy may
  11780.                begin and/or end offset from the beginning of the source and
  11781.                destination blocks by passing non zero values in srcoffset
  11782.                and/or destoffset.  The copy will occur faster if both
  11783.                offsets are divisible by four.  If the copy was
  11784.                unsuccessful, check XMSERROR for error codes.
  11785.  
  11786.                SEE ALSO
  11787.  
  11788.                WHICHXMS, XMSALLOCATE, XMSERROR, XMSFREE, XMSGET, XMSPUT
  11789.  
  11790.                EXAMPLE
  11791.  
  11792.                /*
  11793.                 * show xms functions: this will copy one array into one
  11794.                 * xms block, copy that xms block to a second xms block,
  11795.                 * and then copy that second xms block to another array
  11796.                 */
  11797.  
  11798.                #include <stdlib.h>
  11799.                #include <conio.h>
  11800.                #include "svgacc.h"
  11801.  
  11802.                void main(void)
  11803.                {
  11804.                  int i, handle1, handle2, er, mem, handles;
  11805.                  int test1[10], test2[10];
  11806.  
  11807.  
  11808.  
  11809.                                                                         189
  11810.  
  11811.  
  11812.  
  11813.  
  11814.  
  11815.                  /* make sure xms is ready and available */
  11816.                  if ( whichxms(&mem,&handles) ) {
  11817.                     if ((mem < 1) || (handles < 1)) {
  11818.                       printf("sorry...there is either no free xms or\n");
  11819.                       printf("no free handles\n");
  11820.                       exit(1);
  11821.                     }
  11822.                  }
  11823.                  else {
  11824.                     printf("sorry...no active xms memory manager
  11825.                found...\n");
  11826.                     printf("make sure you have an xms memory manager\n");
  11827.                     printf("(such as HIMEM.SYS) loaded\n");
  11828.                     exit(1);
  11829.                  }
  11830.  
  11831.                  /* generate some data */
  11832.                  for(i=0;i<10;i++)
  11833.                  {
  11834.                     test1[i] = i;
  11835.                  }
  11836.  
  11837.                  /* allocate the first xms block */
  11838.                  handle1 = xmsallocate(1);
  11839.                  if ( !handle1 ) {
  11840.                     printf("opps there is some error...unable to allocate
  11841.                xms...\n");
  11842.                     printf("error # %d\n",xmserror());
  11843.                     er = xmsfree(handle1);
  11844.                     exit(1);
  11845.                  }
  11846.  
  11847.                  /* allocate the second xms block */
  11848.                  handle2 = xmsallocate(1);
  11849.                  if ( !handle2 ) {
  11850.                     printf("opps there is some error...unable to allocate
  11851.                xms...\n");
  11852.                     printf("error # %d\n",xmserror());
  11853.                     er = xmsfree(handle1);
  11854.                     er = xmsfree(handle2);
  11855.                     exit(1);
  11856.                  }
  11857.  
  11858.                  /* copy our source array into first xms block */
  11859.                  er = xmsput (test1, handle1, 0, sizeof(test1));
  11860.                  if ( !er ) {
  11861.                     printf("opps there is some error...see error code
  11862.                list...\n");
  11863.                     printf("error # %d\n",xmserror());
  11864.                     er = xmsfree(handle1);
  11865.                     er = xmsfree(handle2);
  11866.                     exit(1);
  11867.                  }
  11868.  
  11869.  
  11870.  
  11871.                                                                         190
  11872.  
  11873.  
  11874.  
  11875.  
  11876.  
  11877.                  /* copy first xms block into second xms block */
  11878.                  er = xmscopy (handle1, 0, handle2, 0, sizeof(test1));
  11879.                  if ( !er ) {
  11880.                     printf("opps there is some error...see error code
  11881.                list...\n");
  11882.                     printf("error # %d\n",xmserror());
  11883.                     er = xmsfree(handle1);
  11884.                     er = xmsfree(handle2);
  11885.                     exit(1);
  11886.                  }
  11887.  
  11888.                  /* copy second xms block to out destination array */
  11889.                  er = xmsget (handle2, 0, test2, sizeof(test1));
  11890.                  if ( !er ) {
  11891.                     printf("opps there is some error...see error code
  11892.                list...\n");
  11893.                     printf("error # %d\n",xmserror());
  11894.                     er = xmsfree(handle1);
  11895.                     er = xmsfree(handle2);
  11896.                     exit(1);
  11897.                  }
  11898.  
  11899.                  /* free up all the xms memory we have allocated */
  11900.                  er = xmsfree(handle1);
  11901.                  er = xmsfree(handle2);
  11902.  
  11903.                  /* show the results */
  11904.                  printf("ok...we initialized one array with data, copied
  11905.                that\n");
  11906.                  printf("array to an xms block, copied that xms block to
  11907.                a\n");
  11908.                  printf("second xms block, and finally copied the second
  11909.                xms\n");
  11910.                  printf("block into a new array...here are the
  11911.                results:\n");
  11912.                  printf(" \n");
  11913.                  printf("source array         destination array\n");
  11914.                  for(i=0;i<10;i++)
  11915.                  {
  11916.                  printf(" %d                    %d\n",test1[i],test2[i]);
  11917.                  }
  11918.                  exit(0);
  11919.                }
  11920.  
  11921.  
  11922.  
  11923.  
  11924.  
  11925.  
  11926.  
  11927.  
  11928.  
  11929.  
  11930.  
  11931.  
  11932.  
  11933.                                                                         191
  11934.  
  11935.  
  11936.  
  11937.  
  11938.  
  11939.             XMSERROR
  11940.  
  11941.                PROTOTYPE
  11942.  
  11943.                extern int far xmserror (void)
  11944.  
  11945.                INPUT
  11946.  
  11947.                no input parameters
  11948.  
  11949.                OUTPUT
  11950.  
  11951.                XMSERROR returns the error code from the most recent XMS
  11952.                function call.
  11953.  
  11954.                USAGE
  11955.  
  11956.                XMSERROR returns the error code from the most recent XMS
  11957.                function call.  Each XMS function resets the error code to
  11958.                zero.  Therefore, if there has been an error, the error code
  11959.                should be checked immediately.  The error code will be one
  11960.                of the following:
  11961.  
  11962.                0   no error
  11963.                1   WHICHXMS has not been
  11964.                    called
  11965.                2   number of bytes to
  11966.                    copy is zero
  11967.                3   number of bytes to
  11968.                    copy is odd
  11969.                4   offset into XMS block
  11970.                    is zero
  11971.                128 Function not
  11972.                    implemented
  11973.                129 VDISK device driver
  11974.                    was detected
  11975.                142 General driver error
  11976.                143 Unrecoverable driver
  11977.                    error
  11978.                146 DX is less than
  11979.                    /HMAMIN= parameter
  11980.                160 All extended memory is
  11981.                    allocated
  11982.                161 XMM handles are
  11983.                    exhausted
  11984.                162 Handle is invalid
  11985.                163 Source handle is
  11986.                    invalid
  11987.                164 Source offset is
  11988.                    invalid
  11989.                165 Destination handle is
  11990.                    invalid
  11991.                166 Destination offset is
  11992.                    invalid
  11993.  
  11994.  
  11995.                                                                         192
  11996.  
  11997.  
  11998.  
  11999.  
  12000.  
  12001.                167 Length is invalid
  12002.                168 Overlap in move
  12003.                    request is invalid
  12004.                169 Parity error detected
  12005.                171 Block locked
  12006.  
  12007.                SEE ALSO
  12008.  
  12009.                WHICHXMS, XMSALLOCATE, XMSCOPY, XMSFREE, XMSGET, XMSPUT
  12010.  
  12011.                EXAMPLE
  12012.  
  12013.                See XMSCOPY
  12014.  
  12015.  
  12016.  
  12017.  
  12018.  
  12019.  
  12020.  
  12021.  
  12022.  
  12023.  
  12024.  
  12025.  
  12026.  
  12027.  
  12028.  
  12029.  
  12030.  
  12031.  
  12032.  
  12033.  
  12034.  
  12035.  
  12036.  
  12037.  
  12038.  
  12039.  
  12040.  
  12041.  
  12042.  
  12043.  
  12044.  
  12045.  
  12046.  
  12047.  
  12048.  
  12049.  
  12050.  
  12051.  
  12052.  
  12053.  
  12054.  
  12055.  
  12056.  
  12057.                                                                         193
  12058.  
  12059.  
  12060.  
  12061.  
  12062.  
  12063.             XMSFREE
  12064.  
  12065.                PROTOTYPE
  12066.  
  12067.                extern int far xmsfree (int xmshandle)
  12068.  
  12069.                INPUT
  12070.  
  12071.                xmshandle - handle of extended memory block to free
  12072.  
  12073.                OUTPUT
  12074.  
  12075.                XMSFREE returns 1 if extended memory block was deallocated,
  12076.                0 otherwise.
  12077.  
  12078.                USAGE
  12079.  
  12080.                XMSFREE deallocates the specified extended memory block.
  12081.                All allocated blocks must be freed before a program
  12082.                terminates or the memory is lost until the machine is
  12083.                rebooted.  Simply exiting a program will not free allocated
  12084.                extended memory blocks.  If the function was unsuccessful,
  12085.                check XMSERROR for error codes.
  12086.  
  12087.                SEE ALSO
  12088.  
  12089.                WHICHXMS, XMSALLOCATE, XMSCOPY, XMSERROR, XMSGET, XMSPUT
  12090.  
  12091.                EXAMPLE
  12092.  
  12093.                See XMSCOPY
  12094.  
  12095.  
  12096.  
  12097.  
  12098.  
  12099.  
  12100.  
  12101.  
  12102.  
  12103.  
  12104.  
  12105.  
  12106.  
  12107.  
  12108.  
  12109.  
  12110.  
  12111.  
  12112.  
  12113.  
  12114.  
  12115.  
  12116.  
  12117.  
  12118.  
  12119.                                                                         194
  12120.  
  12121.  
  12122.  
  12123.  
  12124.  
  12125.             XMSGET
  12126.  
  12127.                PROTOTYPE
  12128.  
  12129.                extern int far xmsget (int xmshandle, long offset, void far
  12130.                *destmem, unsigned long count)
  12131.  
  12132.                INPUT
  12133.  
  12134.                xmshandle - handle of source extended memory block
  12135.                offset - number of bytes from beginning of source memory
  12136.                block
  12137.                count - number of bytes to copy from extended memory to
  12138.                conventional memory (must be even)
  12139.  
  12140.                OUTPUT
  12141.  
  12142.                XMSGET returns 1 if the copy was successful, 0 otherwise.
  12143.                destmem - copy of data in conventional memory
  12144.  
  12145.                USAGE
  12146.  
  12147.                XMSGET retrieves data from extended memory and places it in
  12148.                conventional memory.  The number of bytes copied must be an
  12149.                even number and cannot be larger than 65536.  The copy may
  12150.                begin off the beginning of the source extended memory block
  12151.                by specifying an non zero offset.  If the function was
  12152.                unsuccessful, check XMSERROR for error codes.
  12153.  
  12154.                SEE ALSO
  12155.  
  12156.                WHICHXMS, XMSALLOCATE, XMSCOPY, XMSERROR, XMSFREE, XMSPUT
  12157.  
  12158.                EXAMPLE
  12159.  
  12160.                See XMSCOPY
  12161.  
  12162.  
  12163.  
  12164.  
  12165.  
  12166.  
  12167.  
  12168.  
  12169.  
  12170.  
  12171.  
  12172.  
  12173.  
  12174.  
  12175.  
  12176.  
  12177.  
  12178.  
  12179.  
  12180.  
  12181.                                                                         195
  12182.  
  12183.  
  12184.  
  12185.  
  12186.  
  12187.             XMSPUT
  12188.  
  12189.                PROTOTYPE
  12190.  
  12191.                extern int far xmsput (void far *sourcemem, int xmshandle,
  12192.                long offset, unsigned long count)
  12193.  
  12194.                INPUT
  12195.  
  12196.                sourcemem - source data in conventional memory
  12197.                xmshandle - handle of destination extended memory block
  12198.                offset - number of bytes from beginning of destination
  12199.                memory block
  12200.                count - number of bytes to copy from conventional memory to
  12201.                extended memory (must be even)
  12202.  
  12203.                OUTPUT
  12204.  
  12205.                XMSPUT returns 1 if the copy was successful, 0 otherwise.
  12206.  
  12207.                USAGE
  12208.  
  12209.                XMSPUT copies data from conventional memory to extended
  12210.                memory.  The number of bytes copied must be an even number
  12211.                and cannot be larger than 65536.  The destination may begin
  12212.                off the beginning of the extended memory block by specifying
  12213.                an non zero offset.  If the function was unsuccessful, check
  12214.                XMSERROR for error codes.
  12215.  
  12216.                SEE ALSO
  12217.  
  12218.                WHICHXMS, XMSALLOCATE, XMSCOPY, XMSERROR, XMSFREE, XMSGET
  12219.  
  12220.                EXAMPLE
  12221.  
  12222.                See XMSCOPY
  12223.  
  12224.  
  12225.  
  12226.  
  12227.  
  12228.  
  12229.  
  12230.  
  12231.  
  12232.  
  12233.  
  12234.  
  12235.  
  12236.  
  12237.  
  12238.  
  12239.  
  12240.  
  12241.  
  12242.  
  12243.                                                                         196
  12244.  
  12245.  
  12246.  
  12247.  
  12248.  
  12249.             APPENDIX A.  SVGACC.H
  12250.  
  12251.             This is the header file containing function prototypes and
  12252.             structure definitions for SVGACC.LIB.  This file should be
  12253.             included in every program module that uses this library.  To
  12254.             properly include the header file, place the following line at
  12255.             the top of the every code module:
  12256.  
  12257.                                   #include "svgacc.h"
  12258.  
  12259.             Without these prototypes and definitions, the C/C++ compiler
  12260.             will be unable to compile any code module using the commands
  12261.             found in this library.
  12262.  
  12263.                /* SVGACC Include File for MS C/C++/QuickC and Borland C/C++
  12264.                 * Copyright 1994 by Stephen L. Balkum and Daniel A. Sill
  12265.                 * Zephyr Software P.O. Box 7704, Austin, Texas  78713-7704
  12266.                 */
  12267.  
  12268.                #ifndef SVGACC_H
  12269.                #define SVGACC_H
  12270.  
  12271.                typedef unsigned char byte;
  12272.  
  12273.                typedef struct {
  12274.                  char r;
  12275.                  char g;
  12276.                  char b;
  12277.                } RGB;
  12278.  
  12279.                typedef RGB PaletteData[256];
  12280.  
  12281.                typedef struct {
  12282.                  byte hotspotx;
  12283.                  byte hotspoty;
  12284.                  byte data[384];
  12285.                } MouseCursor;
  12286.  
  12287.                typedef struct {
  12288.                  byte width;
  12289.                  byte height;
  12290.                  byte data[4096];
  12291.                } Font;
  12292.  
  12293.                typedef enum {
  12294.                  NO_ACTION = 0,
  12295.                  SET,
  12296.                  XOR,
  12297.                  OR,
  12298.                  AND
  12299.                } PixelMode;
  12300.  
  12301.                typedef enum {
  12302.                  UNKNOWN = 0,
  12303.  
  12304.  
  12305.                                                                         197
  12306.  
  12307.  
  12308.  
  12309.  
  12310.  
  12311.                  ACUMOS,
  12312.                  ATI,
  12313.                  AHEADA,
  12314.                  AHEADB,
  12315.                  CHIPSTECH,
  12316.                  CIRRUS,
  12317.                  EVEREX,
  12318.                  GENOA,
  12319.                  NCR,
  12320.                  OAKTECH,
  12321.                  PARADISE,
  12322.                  REALTEK,
  12323.                  TRIDENT,
  12324.                  TSENG3,
  12325.                  TSENG4,
  12326.                  VESA,
  12327.                  VIDEO7,
  12328.                  AVANCE,
  12329.                  MXIC,
  12330.                  PRIMUS
  12331.                } VGAChipset;
  12332.  
  12333.                typedef struct {
  12334.                  unsigned int width;
  12335.                  unsigned int height;
  12336.                  byte data[1];
  12337.                } RasterBlock;
  12338.  
  12339.                typedef struct {
  12340.                  int x;
  12341.                  int y;
  12342.                } D2Point;
  12343.  
  12344.                typedef struct {
  12345.                  int x;
  12346.                  int y;
  12347.                  int z;
  12348.                } D3Point;
  12349.  
  12350.                typedef struct {
  12351.                  int eyex;
  12352.                  int eyey;
  12353.                  int eyez;
  12354.                  int scrd;
  12355.                  int theta;
  12356.                  int phi;
  12357.                } ProjParameters;
  12358.  
  12359.                #ifdef __cplusplus
  12360.                extern "C" {
  12361.                #endif
  12362.  
  12363.                /* Global variables */
  12364.                extern const int far maxx;
  12365.  
  12366.  
  12367.                                                                         198
  12368.  
  12369.  
  12370.  
  12371.  
  12372.  
  12373.                extern const int far maxy;
  12374.                extern const int far viewx1;
  12375.                extern const int far viewy1;
  12376.                extern const int far viewx2;
  12377.                extern const int far viewy2;
  12378.  
  12379.                /* 'BLocK' methods to manipulate RasterBlocks on and off the
  12380.                  screen */
  12381.  
  12382.                extern int  far blkget (int x1, int y1, int x2, int y2,
  12383.                  RasterBlock far *gfxblk);
  12384.                extern void far blkput (PixelMode mode, int x, int y,
  12385.                  RasterBlock far *gfxblk);
  12386.                extern void far blkresize (unsigned newxsize, unsigned
  12387.                  newysize, RasterBlock far *sourcegfxblk, RasterBlock far
  12388.                  *destgfxblk);
  12389.                extern int  far blkrotate (int ang, int backfill,
  12390.                  RasterBlock far *sourcegfxblk, RasterBlock far
  12391.                  *destgfxblk);
  12392.                extern int  far blkrotatesize (int ang, RasterBlock far
  12393.                  *sourcegfxblk);
  12394.  
  12395.                /* 'BYTECOPY' method for fast memory copy */
  12396.  
  12397.                extern void far bytecopy (void far *src, void far *dst,
  12398.                  unsigned long numbytes);
  12399.  
  12400.                /* '2D' methods to transform D2Points */
  12401.  
  12402.                extern void far d2rotate (int points, int xorigin, int
  12403.                  yorigin, int ang, D2Point far *inary, D2Point far
  12404.                  *outary);
  12405.                extern void far d2scale (int points, int xscale, int yscale,
  12406.                  D2Point far *inary, D2Point far *outary);
  12407.                extern void far d2translate (int points, int xtrans, int
  12408.                  ytrans, D2Point far *inary, D2Point far *outary);
  12409.  
  12410.                /* '3D' methods to transform D3Points */
  12411.  
  12412.                extern int  far d3project (int points, ProjParameters far
  12413.                  *params, D3Point far *inary, D2Point far *outary);
  12414.                extern void far d3rotate (int points, int xorigin, int
  12415.                  yorigin, int zorigin, int zrang, int yrang, int xrang,
  12416.                  D3Point far *inary, D3Point far *outary);
  12417.                extern void far d3scale (int points, int xscale, int yscale,
  12418.                  int zscale, D3Point far *inary, D3Point far *outary);
  12419.                extern void far d3translate (int points, int xtrans, int
  12420.                  ytrans, int ztrans, D3Point far *inary, D3Point far
  12421.                  *outary);
  12422.  
  12423.                /* 'DRaW' methods for placing text and graphics primitives
  12424.                  on screen */
  12425.  
  12426.  
  12427.  
  12428.  
  12429.                                                                         199
  12430.  
  12431.  
  12432.  
  12433.  
  12434.  
  12435.                extern void far drwbox (PixelMode mode, int colr, int x1,
  12436.                  int y1, int x2, int y2);
  12437.                extern void far drwcircle (PixelMode mode, int colr, int
  12438.                  centerx, int centery, int radius);
  12439.                extern void far drwellipse (PixelMode mode, int colr, int
  12440.                  centerx, int centery, int radiusx, int radiusy);
  12441.                extern void far drwfillbox (PixelMode mode, int colr, int
  12442.                  x1, int y1, int x2, int y2);
  12443.                extern void far drwfillcircle (PixelMode mode, int colr, int
  12444.                  centerx, int centery, int radius);
  12445.                extern void far drwfillellipse (PixelMode mode, int colr,
  12446.                  int centerx, int centery, int radiusx, int radiusy);
  12447.                extern void far drwline (PixelMode mode, int colr, int x1,
  12448.                  int y1, int x2, int y2);
  12449.                extern void far drwpoint (PixelMode mode, int colr, int x,
  12450.                  int y);
  12451.                extern void far drwstring (PixelMode mode, int fcolr, int
  12452.                  bcolr, const char far *strng, int x, int y);
  12453.                extern void far drwstringdn (PixelMode mode, int fcolr, int
  12454.                  bcolr, const char far *strng, int x, int y);
  12455.                extern void far drwstringlt (PixelMode mode, int fcolr, int
  12456.                  bcolr, const char far *strng, int x, int y);
  12457.                extern void far drwstringrt (PixelMode mode, int fcolr, int
  12458.                  bcolr, const char far *strng, int x, int y);
  12459.  
  12460.                /* 'FILL' methods for filling various regions on screen with
  12461.                  a color */
  12462.  
  12463.                extern void far fillarea (int xseed, int yseed, int
  12464.                  bordercolr, int fillcolr);
  12465.                extern void far fillconvexpoly (int colr, int points,
  12466.                  D2Point far *inary);
  12467.                extern void far fillcolor (int xseed, int yseed, int
  12468.                  oldcolr, int newcolr);
  12469.                extern void far fillpage (int colr);
  12470.                extern void far fillscreen (int colr);
  12471.                extern void far fillview (int colr);
  12472.  
  12473.                /* 'FONT' methods for setting the current font */
  12474.  
  12475.                extern void far fontgetinfo (int far *wdth, int far *hght);
  12476.                extern void far fontset (Font far *font);
  12477.                extern void far fontsystem (void);
  12478.  
  12479.                /* 'GET' methods to return information held by library */
  12480.  
  12481.                extern void far getlaststring (RasterBlock far
  12482.                  *strnggfxblk);
  12483.                extern long far getarccos (long cosvalue);
  12484.                extern long far getarcsin (long sinvalue);
  12485.                extern long far getarctan (long tanvalue);
  12486.                extern long far getcos (long angle);
  12487.                extern int  far getpoint (int x, int y);
  12488.                extern long far getsin (long angle);
  12489.  
  12490.  
  12491.                                                                         200
  12492.  
  12493.  
  12494.  
  12495.  
  12496.  
  12497.                extern long far gettan (long angle);
  12498.  
  12499.                /* 'GIF' methods to read / write GIF files and place images
  12500.                  on screen */
  12501.  
  12502.                extern int  far gifgetinfo (const char far *name, int far
  12503.                  *gifxsize, int far *gifysize, int far *numcolors, RGB far
  12504.                  *pal);
  12505.                extern int  far gifmake (int x1, int y1, int x2, int y2,
  12506.                  const char far *name);
  12507.                extern int  far gifput (PixelMode mode, int xloc, int yloc,
  12508.                  const char far *name);
  12509.  
  12510.                /* 'JOYSTICK' method to read joysticks' status */
  12511.  
  12512.                extern void far joystickinfo (int far *jax, int far *jay,
  12513.                  int far *jabuts, int far *jbx, int far *jby, int far
  12514.                  *jbbuts);
  12515.  
  12516.                /* 'MOUSE' methods to interact with mouse driver */
  12517.  
  12518.                extern void far mousebutpress (int reqbut, int far *xloc,
  12519.                  int far *yloc, int far *num, int far *mbuts);
  12520.                extern void far mousebutrelease (int reqbut, int far *xloc,
  12521.                  int far *yloc, int far *num, int far *mbuts);
  12522.                extern void far mousecursordefault (void);
  12523.                extern void far mousecursorset (MouseCursor far
  12524.                  *mousecursor);
  12525.                extern void far mouseenter (void);
  12526.                extern void far mouseexit (void);
  12527.                extern void far mousehide (void);
  12528.                extern void far mouseinfo (int far *drvmajorver, int far
  12529.                  *drvminorver, int far *mousetype, int far *irqnumber);
  12530.                extern void far mouselocset (int xloc, int yloc);
  12531.                extern void far mouserangeset (int x1, int y1, int x2, int
  12532.                  y2);
  12533.                extern void far mouserestorestate (byte far *mousebuf);
  12534.                extern void far mousesavestate (byte far *mousebuf);
  12535.                extern void far mousesensset (int xsens, int ysens, int
  12536.                  dblspdthresh);
  12537.                extern void far mouseshow (void);
  12538.                extern void far mousestatus (int far *x, int far *y, int far
  12539.                  *mbuts);
  12540.                extern int  far mousestoragesize (void);
  12541.  
  12542.                extern void far overscanset (int colr);
  12543.  
  12544.                /* 'PAGE' methods to control paging abilities */
  12545.  
  12546.                extern int  far pageactive (int page);
  12547.                extern int  far pagedisplay (int x, int y, int page);
  12548.  
  12549.                /* 'PALette' methods to manipulate and activate palettes */
  12550.  
  12551.  
  12552.  
  12553.                                                                         201
  12554.  
  12555.  
  12556.  
  12557.  
  12558.  
  12559.                extern void far palchgauto (RGB far *pal, RGB far *newpal,
  12560.                  int firstcolr, int lastcolr, int speed);
  12561.                extern void far palchgstep (RGB far *pal, RGB far *newpal,
  12562.                  int firstcolr, int lastcolr, int percent);
  12563.                extern void far palcopy (RGB far *srcpal, RGB far *destpal,
  12564.                  int firstcolr, int lastcolr);
  12565.                extern void far paldimstep (RGB far *pal, int firstcolr, int
  12566.                  lastcolr, int percent);
  12567.                extern void far palget (RGB far *pal, int firstcolr, int
  12568.                  lastcolr);
  12569.                extern void far palioauto (RGB far *pal, int firstcolr, int
  12570.                  lastcolr, int speed);
  12571.                extern void far palrotate (RGB far *pal, int firstcolr, int
  12572.                  lastcolr, int shift);
  12573.                extern void far palset (RGB far *pal, int firstcolr, int
  12574.                  lastcolr);
  12575.  
  12576.                /* 'RESolution' methods to set various video modes */
  12577.  
  12578.                extern int  far res320 (void);
  12579.                extern int  far res640 (void);
  12580.                extern int  far res640l (void);
  12581.                extern int  far res800 (void);
  12582.                extern int  far res1024 (void);
  12583.                extern int  far res1280 (void);
  12584.                extern int  far restext (void);
  12585.  
  12586.                /* 'SCROLL' methods for scrolling various sections of the
  12587.                  screen */
  12588.  
  12589.                extern void far scrolldn (int x1, int y1, int x2, int y2,
  12590.                  int num, int colr);
  12591.                extern void far scrolllt (int x1, int y1, int x2, int y2,
  12592.                  int num, int colr);
  12593.                extern void far scrollrt (int x1, int y1, int x2, int y2,
  12594.                  int num, int colr);
  12595.                extern void far scrollup (int x1, int y1, int x2, int y2,
  12596.                  int num, int colr);
  12597.  
  12598.                /* 'Sync' DELAY method */
  12599.  
  12600.                extern void far sdelay (int count);
  12601.  
  12602.                /* 'SET' methods to adjust library internal variables */
  12603.  
  12604.                extern void far setcard (VGAChipset chip, int mem);
  12605.                extern void far setview (int x1, int y1, int x2, int y2);
  12606.  
  12607.                /* 'SPRITE' methods for manipulating sprites on and off
  12608.                  screen */
  12609.  
  12610.                extern int  far spritecolldetect (int transcolr, int x1, int
  12611.                  y1, int x2, int y2, RasterBlock far *sprite1, RasterBlock
  12612.                  far *sprite2);
  12613.  
  12614.  
  12615.                                                                         202
  12616.  
  12617.  
  12618.  
  12619.  
  12620.  
  12621.                extern void far spritegap (int transcolr, int x, int y,
  12622.                  RasterBlock far *sprite, RasterBlock far *spritebkgnd);
  12623.                extern void far spriteget (int transcolr, int x, int y,
  12624.                  RasterBlock far *sprite, RasterBlock far *spritebkgnd);
  12625.                extern void far spriteput (PixelMode mode, int transcolr,
  12626.                  int x, int y, RasterBlock far *sprite);
  12627.  
  12628.                /* 'VIDEO' methods to interact with video mode and display
  12629.                  */
  12630.  
  12631.                extern int  far videomodeget (void);
  12632.                extern void far videomodeset (int videomode);
  12633.                extern void far videooff (void);
  12634.                extern void far videoon (void);
  12635.  
  12636.                /* 'Identification' methods to discover WHICH hardware is
  12637.                  available */
  12638.  
  12639.                extern int  far whichcpu (void);
  12640.                extern int  far whichjoystick (void);
  12641.                extern int  far whichmem (void);
  12642.                extern int  far whichmouse (void);
  12643.                extern VGAChipset far whichvga (void);
  12644.                extern int  far whichxms (unsigned int far *xmskbytesavail,
  12645.                  unsigned int far *xmshandlesavail);
  12646.  
  12647.                /* 'XMS' methods to store and retrieve extended memory */
  12648.  
  12649.                extern int  far xmsallocate (unsigned int reqkbytes);
  12650.                extern int  far xmscopy (int xmssrchandle, long srcoffset,
  12651.                  int xmsdesthandle, long destoffset, unsigned long count);
  12652.                extern int  far xmserror (void);
  12653.                extern int  far xmsfree (int xmshandle);
  12654.                extern int  far xmsget (int xmshandle, long offset, void far
  12655.                  *destmem, unsigned long count);
  12656.                extern int  far xmsput (void far *sourcemem, int xmshandle,
  12657.                  long offset, unsigned long count);
  12658.  
  12659.                #ifdef __cplusplus
  12660.                }
  12661.                #endif
  12662.  
  12663.                #endif
  12664.                /* SVGACC_H */
  12665.  
  12666.  
  12667.  
  12668.  
  12669.  
  12670.  
  12671.  
  12672.  
  12673.  
  12674.  
  12675.  
  12676.  
  12677.                                                                         203
  12678.  
  12679.  
  12680.  
  12681.  
  12682.  
  12683.             APPENDIX B.  JOYSTICK PORTS AND Y-CABLES
  12684.  
  12685.             SCHEMATIC WIRING DIAGRAM FOR A STANDARD JOYSTICK PORT
  12686.  
  12687.                                       DB15 male
  12688.                                       connector
  12689.                      Joystick B            ___       Joystick A
  12690.                                         __/   |
  12691.                                        /    o | 1 -------------------+
  12692.                +------------------  9 | o     |     ___Button A      |
  12693.                |     Button A___      |     o | 2 --o o-+            |
  12694.                |           +-o o-- 10 | o     |         |    X Axis  |
  12695.                |  X Axis   |          |     o | 3 -------------+     |
  12696.                |     +------------ 11 | o     |         |      |     |
  12697.                |     |     |          |     o | 4 ------+      |     |
  12698.                +--/\/\/\   +------ 12 | o     |         |    /\/\/\--+
  12699.                |           |          |     o | 5       |            |
  12700.                |     +------------ 13 | o     |         |            |
  12701.                |     |     | ___      |     o | 6 -------------+     |
  12702.                |     |     +-o o-- 14 | o     |     ___ |      |     |
  12703.                |     |    Button B    |     o | 7 --o o-+      |     |
  12704.                |     |             15 | o     |   Button B   /\/\/\--+
  12705.                +--/\/\/\               \__  o | 8            Y Axis
  12706.                  Y Axis                   \___|
  12707.  
  12708.             Notes:
  12709.  
  12710.             1) This diagram comes with NO warranties expressed or implied.
  12711.                It is provided for information only.  In no event shall
  12712.                Stephen L. Balkum, Daniel A. Sill or Zephyr Software be held
  12713.                liable for damages resulting from use, misuse, or inability
  12714.                to use this information.
  12715.  
  12716.             2) The x and y axis potentiometers have a typical range of 0 to
  12717.                100k ohms.  Buttons are normally open and close when
  12718.                pressed.
  12719.  
  12720.             3) This diagram is correct for joystick ports that conform to
  12721.                the standard set forth by IBM. Some specialty joystick cards
  12722.                provide separate A and B joystick connectors.  For these
  12723.                cards, both connectors are wired to pins 1 through 8 as
  12724.                shown in the diagram.
  12725.  
  12726.             4) Many 'Super I/O' boards (2H/2F/2S/1P/1G) equipped with a
  12727.                joystick port will support only one joystick.  On these
  12728.                cards, pins 9 through 15 are not used.
  12729.  
  12730.             5) Commercially available joysticks are wired to use pins 1
  12731.                through 8 and, therefore, will always be 'Joystick A' if
  12732.                plugged directly into a dual joystick port connector.
  12733.  
  12734.             6) Many sound cards provide joystick ports; however, their
  12735.                connector wiring does not always conform to the standard
  12736.                shown above.  Some of these connectors may be used for other
  12737.  
  12738.  
  12739.                                                                         204
  12740.  
  12741.  
  12742.  
  12743.  
  12744.  
  12745.                purposes such as a MIDI port.  See the documentation that
  12746.                comes with the sound card.
  12747.  
  12748.             7) If there is more than one joystick port on a computer
  12749.                configured to operate the same joystick, only ONE port
  12750.                should be enabled at any given time for proper operation.
  12751.                Disable all but one joystick port.  For example, if the
  12752.                computer has both a Super I/O card and a sound card, the
  12753.                joystick port on the Super I/O card should be disabled since
  12754.                the sound card's port probably supports two joysticks and
  12755.                the I/O card supports only one.
  12756.  
  12757.  
  12758.  
  12759.  
  12760.  
  12761.  
  12762.  
  12763.  
  12764.  
  12765.  
  12766.  
  12767.  
  12768.  
  12769.  
  12770.  
  12771.  
  12772.  
  12773.  
  12774.  
  12775.  
  12776.  
  12777.  
  12778.  
  12779.  
  12780.  
  12781.  
  12782.  
  12783.  
  12784.  
  12785.  
  12786.  
  12787.  
  12788.  
  12789.  
  12790.  
  12791.  
  12792.  
  12793.  
  12794.  
  12795.  
  12796.  
  12797.  
  12798.  
  12799.  
  12800.  
  12801.                                                                         205
  12802.  
  12803.  
  12804.  
  12805.  
  12806.  
  12807.             SCHEMATIC WIRING DIAGRAM FOR A JOYSTICK Y-CABLE
  12808.                                                 ___
  12809.                            DB15 male         __/   |
  12810.                          connector to       /    o | 1 --------+
  12811.                          Joystick Port   9 | o     |           |
  12812.                           on computer      |     o | 2 --------|-+
  12813.                               +-------- 10 | o     |           | |
  12814.                               |            |     o | 3 --------|-|-+
  12815.                               | +------ 11 | o     |           | | |
  12816.                               | |          |     o | 4 --------|-|-|-+
  12817.                               | |       12 | o     |           | | | |
  12818.                               | |          |     o | 5         | | | |
  12819.                               | | +---- 13 | o     |           | | | |
  12820.                               | | |        |     o | 6 --------|-|-|-|-+
  12821.                               | | | +-- 14 | o     |           | | | | |
  12822.                               | | | |      |     o | 7 --------|-|-|-|-|-+
  12823.                               | | | |   15 | o     |           | | | | | |
  12824.                               | | | |       \__  o | 8         | | | | | |
  12825.                               | | | |          \___|           | | | | | |
  12826.                               | | | |                          | | | | | |
  12827.                               | | | |                          | | | | | |
  12828.                               | | | |  +-----------------------+ | | | | |
  12829.                               | | | |  |                       | | | | | |
  12830.                               | | | |  | +---------------------|-|-|-+ | |
  12831.                               | | | |  | |                     | | | | | |
  12832.                               | | | |  | |                     | | | | | |
  12833.              DB15 female      | | | |  | |     DB15 female     | | | | | |
  12834.              connector to     | | | |  | |     connector to    | | | | | |
  12835.               Joystick B      | | | |  | |      Joystick A     | | | | | |
  12836.                     ___       | | | |  | |            ___      | | | | | |
  12837.                  __/   |      | | | |  | |         __/   |     | | | | | |
  12838.                 /    o | 1 ---|-|-|-|--+ |        /    o | 1 --+ | | | | |
  12839.              9 | o     |      | | | |    |     9 | o     |       | | | | |
  12840.                |     o | 2 ---+ | | |    |       |     o | 2 ----+ | | | |
  12841.             10 | o     |        | | |    |    10 | o     |         | | | |
  12842.                |     o | 3 -----+ | |    |       |     o | 3 ------+ | | |
  12843.             11 | o     |          | |    |    11 | o     |           | | |
  12844.                |     o | 4 -------|-|----+       |     o | 4 --------+ | |
  12845.             12 | o     |          | |         12 | o     |             | |
  12846.                |     o | 5        | |            |     o | 5           | |
  12847.             13 | o     |          | |         13 | o     |             | |
  12848.                |     o | 6 -------+ |            |     o | 6 ----------+ |
  12849.             14 | o     |            |         14 | o     |               |
  12850.                |     o | 7 ---------+            |     o | 7 ------------+
  12851.             15 | o     |                      15 | o     |
  12852.                 \__  o | 8                        \__  o | 8
  12853.                    \___|                             \___|
  12854.  
  12855.             Notes:
  12856.  
  12857.             1) This diagram comes with NO warranties expressed or implied.
  12858.                It is provided for information only.  In no event shall
  12859.                Stephen L. Balkum, Daniel A. Sill or Zephyr Software be held
  12860.  
  12861.  
  12862.  
  12863.                                                                         206
  12864.  
  12865.  
  12866.  
  12867.  
  12868.  
  12869.                liable for damages resulting from use, misuse, or inability
  12870.                to use this information.
  12871.  
  12872.             2) This cable has worked with a standard joystick port
  12873.                connector, a Sound Blaster port connector, and a Sound
  12874.                Blaster Pro joystick port connector.
  12875.  
  12876.  
  12877.  
  12878.  
  12879.  
  12880.  
  12881.  
  12882.  
  12883.  
  12884.  
  12885.  
  12886.  
  12887.  
  12888.  
  12889.  
  12890.  
  12891.  
  12892.  
  12893.  
  12894.  
  12895.  
  12896.  
  12897.  
  12898.  
  12899.  
  12900.  
  12901.  
  12902.  
  12903.  
  12904.  
  12905.  
  12906.  
  12907.  
  12908.  
  12909.  
  12910.  
  12911.  
  12912.  
  12913.  
  12914.  
  12915.  
  12916.  
  12917.  
  12918.  
  12919.  
  12920.  
  12921.  
  12922.  
  12923.  
  12924.  
  12925.                                                                         207
  12926.