home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_C / SVGACC20.ZIP / SVGACC20.TXT < prev    next >
Text File  |  1994-03-11  |  271KB  |  12,429 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.  
  50.           1993-1994 by Zephyr Software - Stephen L. Balkum and Daniel A.
  51.           Sill
  52.  
  53.           All rights reserved.  No part of this book shall be reproduced or
  54.           transmitted by any means, electronic, mechanical, photocopying,
  55.           recording or otherwise, without written permission from Zephyr
  56.           Software - Stephen L. Balkum and Daniel A. Sill.
  57.  
  58.           Although every effort has been made to insure the accuracy of the
  59.           material in this book, Zephyr Software, Stephen L. Balkum and
  60.           Daniel A. Sill assume no responsibility for errors or omissions.
  61.           In addition no liability is assumed for damages resulting from
  62.           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 of
  69.           CompuServe Incorporated.
  70.           GIF (sm) is a Service Mark property of CompuServe Incorporated.
  71.           Sound Blaster and Sound Blaster Pro are trademarks of Creative
  72.           Labs, Inc.
  73.           All others are trademarks of their respective owners.
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.                                                                          ii
  92.  
  93.  
  94.  
  95.  
  96.  
  97.                              SOFTWARE LICENSE AGREEMENT
  98.  
  99.                By using this software, you agree to the terms of this
  100.                                      agreement.
  101.  
  102.                No warranties are expressed or implied.  In no event
  103.                shall Zephyr Software, Stephen L. Balkum or Daniel A.
  104.                Sill be held liable for damages resulting from the use
  105.                or misuse of this product, including but not limited to
  106.                implied warranties of fitness for a particular purpose.
  107.  
  108.                The shareware version may be freely distributed as long
  109.                as all files stay together and are not modified in any
  110.                way.  No cost may be charged for the shareware version
  111.                beyond normal and reasonable copying and distribution
  112.                expenses.
  113.  
  114.                No products developed with this software shall be sold
  115.                unless this software has been registered with Zephyr
  116.                Software, Stephen L. Balkum or Daniel A. Sill.
  117.  
  118.                At no time for any reason shall this software be
  119.                reverse engineered, decompiled or disassembled.
  120.  
  121.                This software may not be rented or leased.
  122.  
  123.                This software may be used only on one terminal or one
  124.                computer at any one given moment in time.  This
  125.                software may not be installed on a network of any type.
  126.                Contact Zephyr Software, Stephen L. Balkum or Daniel A.
  127.                Sill for networking options.
  128.  
  129.                United States Government Restricted Rights:
  130.                Use, duplication or disclosure of this software and
  131.                documentation by the U.S. Government is subject to the
  132.                restrictions as set forth in subparagraph (c)(1)(ii) of
  133.                the Rights in Technical Data and Computer Software
  134.                clause at DFARS 252.227-7013.  Contractor/manufacturer
  135.                is Stephen L. Balkum and Daniel A. Sill, P.O. Box 7704,
  136.                Austin, Texas 78713-7704.
  137.  
  138.                The ownership of this software may be transferred as
  139.                long as Zephyr Software, Stephen L. Balkum or Daniel A.
  140.                Sill is notified in writing of the transfer date and
  141.                new owner.  The new owner must agree to this contract.
  142.                The transfer must include all registered updates and
  143.                previously registered versions.  The original owner may
  144.                not retain any copies in any form of the registered
  145.                software or its documents.
  146.  
  147.  
  148.  
  149.  
  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 for
  162.           a library that would allow the programmer full access to the
  163.           abilities of Super VGA.  We wanted the colors VGA could provide
  164.           and better resolution than EGA could provide.  Professionally
  165.           developed libraries with this ability were definitely out of our
  166.           price range.  After our searches continuously returned nothing,
  167.           we decided to fill the apparent void in the shareware market.
  168.  
  169.           Our searches did give two useful packages:  John Bridges' VGAKIT
  170.           and Finn Thoegersen's VGADOC.  We began with these two works and
  171.           developed a graphics library intended to allow the programmer
  172.           access to the huge world of high resolution programming.
  173.  
  174.           On the surface the task appeared quite simple.  However, it
  175.           quickly became obvious that the routines in this library would be
  176.           required to affect extremely large amounts of data.  Operations
  177.           must be quick to be successful.  Therefore, every effort was made
  178.           to create the fastest code possible - even at the expense of
  179.           size.  For this reason we opted to write code with the 32 bit
  180.           instructions of the 80386 and 80486 chips.  It is our opinion
  181.           that anyone with a hi-res card in a lesser machine may have some
  182.           priorities out of order. All routines are written in assembly and
  183.           use absolutely no floating point values.  Anytime a real number
  184.           was required, fixed point notation was used.  In addition we
  185.           attempted to write the routines such that any reasonable argument
  186.           passed can be interpreted intelligently by the library.
  187.  
  188.           With the numerous Super VGA cards available and no well
  189.           established standard we chose John Bridges' identification and
  190.           bank switching routines as a beginning.  These two routines have
  191.           undergone some modification, but not enough to justify
  192.           copyrighting this portion of the library's code by Zephyr
  193.           Software.  We have no intentions of releasing our changes to
  194.           these routines into the public domain.  From that point onward
  195.           all code is original.  In some instances common algorithms were
  196.           researched and original code written according to that algorithm.
  197.  
  198.           This Super VGA library gives the programmer transparent access to
  199.           twenty different Super VGA cards.  These cards include Acumos,
  200.           Ahead, ATI Technologies, Avance, Chips and Technologies, Cirrus
  201.           Logic, Everex, Genoa, MXIC, NCR, Oak Technologies,
  202.           Paradise/Western Digital, Primus, Realtek, Trident, Tseng Labs,
  203.           Video 7 and the VESA standard.  Please see the WHICHVGA function
  204.           for the specific chipsets.  The programmer only needs to verify
  205.           that the end user's card has been identified, but not which card
  206.           was recognized.  After proper identification, all functions react
  207.           in exactly the same fashion.  The library contains functions to
  208.           draw all of the major primitives.  In addition there are
  209.           functions that modify the screen palette, write text on the
  210.           screen with a choice of fonts and modify the reaction of the
  211.           primitives.  Identification routines include not only the video
  212.           card, but also the amount of video memory, type of processor and
  213.  
  214.  
  215.                                                                           2
  216.  
  217.  
  218.  
  219.  
  220.  
  221.           installed pointing devices.  Advanced functions provide full
  222.           mouse support (when used with a Microsoft compatible driver) and
  223.           joystick support.  Finally, support for two dimensional and three
  224.           dimensional coordinate systems is provided including rotation,
  225.           translation, scaling and projection.
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  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 by
  289.           calling the WHICHCPU function.  Many of the library's functions
  290.           use 386 exclusive code which may cause a computer with a lesser
  291.           processor to crash.  In addition WHICHMOUSE must be called before
  292.           calling any of the mouse functions.  Lastly, it is recommended
  293.           that WHICHJOYSTICK be called before a program uses the joystick
  294.           routines.
  295.  
  296.           It is required that a program call WHICHVGA prior to any function
  297.           that communicates with the video card.  If WHICHVGA returns a
  298.           zero for unknown card type, the program should not call any
  299.           graphics function.  Without proper identification of the video
  300.           card any graphics function will likely cause a system failure.
  301.           It is recommended, although not necessary, that a program call
  302.           WHICHMEM prior to calling any RES function.  Although the video
  303.           card was properly identified, it may not have sufficient onboard
  304.           memory to support the desired resolution.  As a second check the
  305.           RES functions will do nothing if the video card has not been
  306.           identified or if the video card does not support the specified
  307.           resolution for memory or hardware reasons.
  308.  
  309.           THE 256 COLOR PALETTE
  310.  
  311.           The 256 color palette of the Super VGA cards is a six bit
  312.           palette.  Each of the 256 colors of the palette are described by
  313.           three values representing the intensity of the colors red, blue
  314.           and green.  These values can range from 0 to 63.  Anytime a value
  315.           outside of this range is used, the video card simply ignores the
  316.           upper two bits.  Therefore, 64 is the same as 0.  This should be
  317.           taken into consideration when manipulating the palette or when
  318.           importing a palette from an external source such as a GIF image.
  319.  
  320.           USE OF 2-D AND 3-D FUNCTIONS
  321.  
  322.           In the interest of speed, the 2-D and 3-D functions were written
  323.           to best work on multiple points at once.  We refer to these
  324.           functions as object-oriented.  This means that the points
  325.           defining an object (a box, a house, etc.) should be contained
  326.           within one array or part of an array and calls to the functions
  327.           should act on all of the points in the array.  Calls to functions
  328.           have a high speed overhead, therefore, placing more than one
  329.           object in the same array and passing the entire array to the
  330.           functions can be beneficial.  However, these functions will work
  331.           on a single point as well.
  332.  
  333.           A consequence of our object-oriented 2-D and 3-D functions is the
  334.           use of the scaling functions.  When scaling objects, we recommend
  335.           the object be defined about the origin.  D2SCALE and D3SCALE both
  336.           work with respect to the origin.  This eliminates a significant
  337.  
  338.  
  339.                                                                           4
  340.  
  341.  
  342.  
  343.  
  344.  
  345.           number of translations that would otherwise be required by having
  346.           a definable scale origin.  For example, to draw two boxes, one
  347.           scaled by one-half of the other, each rotated by 45 degrees at
  348.           the center of the screen, the recommended procedure is as
  349.           follows:
  350.  
  351.             define an array BOX containing the 2-D points: (100, 100), (-
  352.                100, 100), (-100, -100), (100, -100), (note: the box is
  353.                centered about the origin.)
  354.             rotate BOX by 45 degrees about (0, 0) and place the output in
  355.                RBOX,
  356.             scale RBOX by 50% (scaling factor would be 128, or 80 hex) and
  357.                place output in SRBOX,
  358.             translate RBOX to the center of the screen - a translation of
  359.                320, 240 in 640x480 resolution - and place output in TRBOX,
  360.             translate SRBOX to the center of the screen - same translation
  361.                as for RBOX - and place output in TSRBOX,
  362.             draw TRBOX and TSRBOX on the screen.
  363.  
  364.           Notice that by defining the box centered about the origin the
  365.           translation values were extremely intuitive.  Also notice that if
  366.           we had scaled the second box after the translation, it would have
  367.           been draw in the upper left quadrant of the screen instead of the
  368.           center.
  369.  
  370.           In mathematics and many sciences it is customary that in a 2-D
  371.           coordinate system the Y axis increases upward and the X axis
  372.           increases to the right.  The computer industry has decided the Y
  373.           axis should increase downward.  The 2-D functions are not
  374.           affected by the choice in coordinate systems.  However, it is
  375.           important to remember that a positive rotation in D2ROTATE
  376.           rotates from the positive X axis to the positive Y axis.
  377.           Therefore, when using mathematical conventions, a positive
  378.           rotation moves counter-clockwise.  On the computer screen a
  379.           positive rotation moves clockwise.
  380.  
  381.           The 3-D coordinate system follows mathematical conventions by
  382.           using a right-handed coordinate system.  The easiest way to
  383.           visualize this coordinate system is by using your right hand.
  384.           Place your index finger and thumb at a right angle to one another
  385.           as if to form an imaginary pistol.  Now place your second finger
  386.           at a right angle to your index finger.  It should be at a right
  387.           angle to your thumb as well.  This represents the three axes.
  388.           The index finger is the X axis, the second finger is the Y axis
  389.           and the thumb is the Z axis.  The easiest way to remember
  390.           rotation directions in this system is cyclically.  A positive
  391.           rotation about the X axis rotates the Y axis into the Z axis.  A
  392.           positive rotation about the Y axis rotates the Z axis into the X
  393.           axis.  A positive rotation about the Z axis rotates the X axis
  394.           into the Y axis.
  395.  
  396.           After doing all necessary 3-D transformations, projection onto
  397.           the 2-D computer screen is required.  Although the computer
  398.           screen's coordinate system does not follow mathematical
  399.  
  400.  
  401.                                                                           5
  402.  
  403.  
  404.  
  405.  
  406.  
  407.           conventions, the D3PROJECT function automatically takes care of
  408.           all conversions.  The programmer only needs to draw the resulting
  409.           lines on the screen.
  410.  
  411.           THE CONCEPT OF SPRITE GRAPHICS
  412.  
  413.           The key to sprite graphics is the assumption that only a small
  414.           percentage of the pixels in a graphics block are used by the
  415.           animation and the remaining pixels should be treated as
  416.           transparent, revealing the background behind the sprite.  The
  417.           sprite routines in this library only act on non-transparent
  418.           colors, thus, saving time by ignoring a large number of pixels.
  419.           When retrieving the background for a sprite, prior knowledge of
  420.           the sprite itself permits obtaining background only where it is
  421.           necessary.
  422.  
  423.           The following steps outline an example of the recommended
  424.           procedure for using the sprite functions:
  425.  
  426.             1. draw the sprite on the screen - a white stick figure on a
  427.                black background, for example
  428.             2. use BLKGET to place the sprite in an array STICK
  429.             3. use SPRITEGAP to simultaneously retrieve the background into
  430.                BACKSTICK and place STICK on the screen, declaring black as
  431.                the transparent color
  432.             4. use SPRITEPUT to replace the background BACKSTICK in the
  433.                same location as step 3
  434.             5. repeat steps 3 and 4 as many times and in as many locations
  435.                as desired
  436.  
  437.           GLOBAL VARIABLES
  438.  
  439.           Access to several global variables provided to the programmer.
  440.           The most important two variables are MAXX and MAXY.  These two
  441.           values give the current resolution and are set by the RES###
  442.           functions.  They should not be changed directly at any time by
  443.           the programmer.  Doing so may cause erratic results from many of
  444.           the graphics functions in this library.  These variables
  445.           initially contain 0.
  446.  
  447.           Four other variables, VIEWX1, VIEWY1, VIEWX2, VIEWY2, can be
  448.           accessed by the programmer.  They define the current viewport
  449.           used for clipping purposes.  These values, also, should not be
  450.           changed directly by the programmer.  The SETVIEW function should
  451.           be used to change these values as it performs important error
  452.           checking.  The viewport is defined as the whole screen by the
  453.           RES### functions.  If drawing on more or less than the entire
  454.           screen is desired, call SETVIEW as necessary.
  455.  
  456.           EXTENDED MEMORY SUPPORT
  457.  
  458.           With the higher screen resolutions, more memory may be needed for
  459.           data storage.  For this reason extended memory support is
  460.           provided.  Accessing extended memory requires the computer to
  461.  
  462.  
  463.                                                                           6
  464.  
  465.  
  466.  
  467.  
  468.  
  469.           switch into protected mode.  The process of switching into
  470.           protected mode and returning is handled by the extended memory
  471.           manager, usually HIMEM.SYS.  The switch is relatively slow.
  472.           Therefore, it should be used as fast storage access since it is
  473.           much faster than disk access.
  474.  
  475.           Extended memory access is also limited by the number of available
  476.           handles.  The limit is controlled by a switch on the extended
  477.           memory manager's command line and normally defaults to 32.  Also,
  478.           it is imperative that all allocated extended memory blocks be
  479.           freed before the program terminates.  Unfreed memory blocks will
  480.           be unavailable until the computer is rebooted.
  481.  
  482.           CONVENTIONS USED IN THIS MANUAL
  483.  
  484.           All parameters, other than pointers, passed to and from functions
  485.           and procedures in this graphics library are short (two byte)
  486.           integers  A byte variable type is assumed to be an unsigned
  487.           character.  No floating point values are used.  By not using real
  488.           numbers round-off error can be a concern.  Under most
  489.           circumstances this error will not be a problem and will not be
  490.           noticed.  The use of large numbers in rotations is recommended.
  491.  
  492.           No functions in this library allocate memory for the programmer,
  493.           except, of course, XMSALLOCATE.  It is the programmer's
  494.           responsibility to be sure all pointers reference properly
  495.           allocated memory of the appropriate size.
  496.  
  497.           Whenever a pixel is written on the screen, a mode is required.
  498.           Unless otherwise noted, there are five possible modes:
  499.           NO_ACTION, SET, XOR, OR and AND.  These modes are represented by
  500.           the numbers zero through four respectively.  NO_ACTION is self-
  501.           explanatory.  Technically, SET is the fastest mode.  However, XOR
  502.           maybe the most useful.  XOR'ing a point twice with the same color
  503.           returns the original color.  This can be used to cover and
  504.           uncover graphics.  In addition when a reference to a color index
  505.           is made, only values between and including 0 and 255 are valid.
  506.           Any integer will work, but only the lowest eight bits are
  507.           recognized.
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  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 RasterBlock
  553.             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 of
  561.             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 X2 X1 and Y2Y1.  Also, the
  564.             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 or
  738.             down according the to values passed in newxsize and newysize.
  739.             The resulting bitmap is returned in destgfxblk which should
  740.             already be declared with a size calculated according to the
  741.             equation in BLKGET.  Neither newxsize nor newysize should be
  742.             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, RasterBlock
  908.             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 the
  925.             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 space
  928.             around the newly rotated block is filled with the color given
  929.             by backfill.  The resulting bitmap is stored in destgfxblk.
  930.             The size of destgfxblk should be at least as big as given by
  931.             BLKROTATESIZE.
  932.  
  933.             The function will fail if it calculates that the internal
  934.             buffers would be overflowed or if the destination array would
  935.             be larger than 65536 bytes.  BLKROTATESIZE should be called
  936.             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 calculates
  1109.             the required size of the output buffer needed when BLKROTATE
  1110.             is called.  It also insures that the internal library buffers
  1111.             are not overflowed.  The function will fail if it calculates
  1112.             that the internal buffers would be overflowed or if the
  1113.             destination buffer would be larger than 65536 bytes.
  1114.             BLKROTATESIZE should be called prior to BLKROTATE to insure
  1115.             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 dst.
  1171.             It assumes that space for dst has been properly allocated.  It
  1172.             is much faster than using a FOR loop or MEMCPY.
  1173.  
  1174.             SEE ALSO
  1175.  
  1176.             PALCOPY
  1177.  
  1178.             EXAMPLE
  1179.  
  1180.             /*
  1181.              * show byte copy
  1182.              */
  1183.             #include <stdlib.h>
  1184.             #include <conio.h>
  1185.             #include "svgacc.h"
  1186.  
  1187.             void main(void)
  1188.             {
  1189.                int i;
  1190.                int test1[10], test2[10];
  1191.  
  1192.                for(i=0;i<10;i++)
  1193.                {
  1194.                  test1[i] = i;
  1195.                }
  1196.                bytecopy(test1,test2,sizeof(test1));
  1197.                printf("ok...we initialized one array with data, copied
  1198.             that\n");
  1199.                printf("array to an a new array...here are the results:\n");
  1200.                printf(" \n");
  1201.                printf("source array         destination array\n");
  1202.                for(i=0;i<10;i++)
  1203.                {
  1204.                  printf(" %d                    %d\n",test1[i],test2[i]);
  1205.  
  1206.  
  1207.                                                                          18
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.                }
  1214.                exit(0);
  1215.             }
  1216.  
  1217.  
  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.  The
  1301.             function assumes space for outary has been properly allocated.
  1302.  
  1303.             SEE ALSO
  1304.  
  1305.             D2SCALE, D2TRANSLATE
  1306.  
  1307.             EXAMPLE
  1308.  
  1309.             /*
  1310.              * shows d2rotate works
  1311.              */
  1312.  
  1313.             #include <stdlib.h>
  1314.             #include <conio.h>
  1315.             #include "svgacc.h"
  1316.  
  1317.             D2Point tri[3];
  1318.             D2Point trio[3];
  1319.             D2Point tri2[3];
  1320.  
  1321.             void drwtri(void);
  1322.             void ertri(void);
  1323.  
  1324.             void main(void)
  1325.             {
  1326.                int vmode,i;
  1327.  
  1328.                vmode = videomodeget();
  1329.  
  1330.  
  1331.                                                                          20
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.                if (!whichvga())
  1338.                  exit(1);
  1339.                if (whichmem()<512)
  1340.                  exit(1);
  1341.                res640();
  1342.                trio[0].x = 0;
  1343.                trio[0].y = 0;
  1344.                trio[1].x = -80;
  1345.                trio[1].y = 60;
  1346.                trio[2].x = 80;
  1347.                trio[2].y = 60;
  1348.                drwtri();
  1349.                for(i=0;i<=360;i+=2)
  1350.                {
  1351.                  d2rotate(3,0,0,i,trio,tri);
  1352.                  drwtri();
  1353.                  sdelay(2);
  1354.                  ertri();
  1355.                }
  1356.                drwtri();
  1357.                getch();
  1358.                videomodeset(vmode);
  1359.                exit(0);
  1360.             }
  1361.  
  1362.             void drwtri(void)
  1363.             {
  1364.                d2translate(3,320,240,tri,tri2);
  1365.                drwline(1,10,tri2[0].x,tri2[0].y,tri2[1].x,tri2[1].y);
  1366.                drwline(1,10,tri2[1].x,tri2[1].y,tri2[2].x,tri2[2].y);
  1367.                drwline(1,10,tri2[2].x,tri2[2].y,tri2[0].x,tri2[0].y);
  1368.                return;
  1369.             }
  1370.  
  1371.             void ertri(void)
  1372.             {
  1373.                d2translate(3,320,240,tri,tri2);
  1374.                drwline(1,0,tri2[0].x,tri2[0].y,tri2[1].x,tri2[1].y);
  1375.                drwline(1,0,tri2[1].x,tri2[1].y,tri2[2].x,tri2[2].y);
  1376.                drwline(1,0,tri2[2].x,tri2[2].y,tri2[0].x,tri2[0].y);
  1377.                return;
  1378.             }
  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 considered
  1424.             100 percent and results in no change.  Therefore, 128 (80 hex)
  1425.             reduces values by one half and 512 (200 hex) doubles values.
  1426.             The function assumes space for outary has been properly
  1427.             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 outary
  1611.             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 direction
  1724.                phi - angle from positive 3D Z axis to viewing direction
  1725.             inary - D3Point pointer to array containing points to project
  1726.  
  1727.             OUTPUT
  1728.  
  1729.             Returns 1 if successful, 0 if any one point failed.
  1730.             outary - D2Point array of projected values
  1731.  
  1732.             USAGE
  1733.                                 +Z axis
  1734.                                    |                   /\
  1735.                                    |                  /  \
  1736.                                    |            !     \ * \
  1737.                                    |            !......X: /
  1738.                                    |            ! Phi / \/
  1739.                                    |            !    /  :
  1740.                                    |            !   /   :
  1741.                                    |            !  /    :
  1742.                                    |       EyeX ! /ScrD :
  1743.                                    |       EyeY !/      :
  1744.                                    |       EyeZ *- - - -:- - - - -
  1745.                                    |           / `      :
  1746.                                    |          /   `     :
  1747.                                    |         /      `   :
  1748.                                    |        /      ---` :
  1749.                                    |       /___----
  1750.                                    |      /     Theta
  1751.                                    |
  1752.                                    |________________________________+Y axis
  1753.                                   /
  1754.                                  /
  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, eyey,
  1778.             eyez in the ProjParameters structure.  The direction the
  1779.             viewer is facing is specified with scrd, theta, phi in the
  1780.             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 angle
  1785.             in the virtual X-Y plane from the virtual X axis to the
  1786.             projection screen.  Positive angles rotate clockwise in the X-
  1787.             Y plane.  Lastly, the angle of elevation above or below the
  1788.             virtual X-Y plane is given by phi.  Positive angles direct
  1789.             viewing above the plane; negative below.
  1790.  
  1791.             If a point is projected to a location behind the viewer, i.e.
  1792.             on the side of the viewer opposite the projection screen,
  1793.             D3PROJECT returns a zero indicating one or more failed points.
  1794.             The returned values of the X and Y for failed points will be -
  1795.             32768 to make them easily identified.
  1796.  
  1797.             SEE ALSO
  1798.  
  1799.             D3ROTATE, D3TRANSLATE, D3SCALE, SETVIEW
  1800.  
  1801.             EXAMPLE
  1802.  
  1803.             /* shows d3project works */
  1804.             #include <stdlib.h>
  1805.             #include <conio.h>
  1806.             #include "svgacc.h"
  1807.  
  1808.             D2Point plot[8];
  1809.             void drwcube(void);
  1810.  
  1811.             void main(void)
  1812.             {
  1813.                int vmode,i,dummy;
  1814.                ProjParameters proj;
  1815.                D3Point cube[8] = { { 100,-100, 100},
  1816.                                 { 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.  
  1824.                vmode = videomodeget();
  1825.  
  1826.  
  1827.                                                                          28
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.                if (!whichvga())
  1834.                  exit(1);
  1835.                if (whichmem()<512)
  1836.                  exit(1);
  1837.                res640();
  1838.                proj.eyex = -1040;
  1839.                proj.eyey = -600;
  1840.                proj.eyez = -1200;
  1841.                proj.scrd = 1700;
  1842.                proj.theta = 30;
  1843.                proj.phi = 45;
  1844.                dummy = d3project(8,&proj,cube,plot);
  1845.                drwcube();
  1846.                getch();
  1847.                videomodeset(vmode);
  1848.             }
  1849.  
  1850.             void drwcube(void)
  1851.             {
  1852.                int i;
  1853.  
  1854.                for(i=0;i<=2;i++)
  1855.  
  1856.                drwline(1,10,plot[i].x,plot[i].y,plot[i+1].x,plot[i+1].y);
  1857.                drwline(1,10,plot[3].x,plot[3].y,plot[0].x,plot[0].y);
  1858.                for(i=4;i<=6;i++)
  1859.  
  1860.                drwline(1,10,plot[i].x,plot[i].y,plot[i+1].x,plot[i+1].y);
  1861.                drwline(1,10,plot[7].x,plot[7].y,plot[4].x,plot[4].y);
  1862.                for(i=0;i<=3;i++)
  1863.  
  1864.                drwline(1,10,plot[i].x,plot[i].y,plot[i+4].x,plot[i+4].y);
  1865.                return;
  1866.             }
  1867.  
  1868.  
  1869.  
  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 and
  1920.             rotates them by the specified angles about xorigin, yorigin,
  1921.             zorigin.  The results are returned in outary which can be the
  1922.             same as inary.  A virtual set of axes are placed at the origin
  1923.             of rotation and rotation takes place about these axes.  A
  1924.             positive angle causes a counter-clockwise rotation from the
  1925.             positive X axis to the positive Y axis.  The function assumes
  1926.             space for outary has been properly allocated.
  1927.  
  1928.             SEE ALSO
  1929.  
  1930.             D3PROJECT, D3SCALE, D3TRANSLATE
  1931.  
  1932.             EXAMPLE
  1933.  
  1934.             /*
  1935.              * shows d3rotate works
  1936.              */
  1937.  
  1938.             #include <stdlib.h>
  1939.             #include <conio.h>
  1940.             #include "svgacc.h"
  1941.  
  1942.             D2Point plot[8];
  1943.  
  1944.             void drwcube(void);
  1945.  
  1946.             void main(void)
  1947.             {
  1948.                int vmode,i,dummy;
  1949.  
  1950.  
  1951.                                                                          30
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.                ProjParameters proj;
  1958.                D3Point rcube[8];
  1959.                D3Point cube[8] = { { 100,-100, 100},
  1960.                                 { 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.  
  1968.                vmode = videomodeget();
  1969.                if (!whichvga() || (whichmem() < 512))
  1970.                  exit(1);
  1971.                res640();
  1972.  
  1973.                proj.eyex = -1040;
  1974.                proj.eyey = -600;
  1975.                proj.eyez = -1200;
  1976.                proj.scrd = 1700;
  1977.                proj.theta = 30;
  1978.                proj.phi = 45;
  1979.  
  1980.                for(i=0;i<=360;i+=2)
  1981.                {
  1982.                  d3rotate(8,0,0,0,i,i,i,cube,rcube);
  1983.                  dummy = d3project(8,&proj,rcube,plot);
  1984.                  drwcube();
  1985.                  sdelay(2);
  1986.                  drwcube();
  1987.                }
  1988.  
  1989.                drwcube();
  1990.  
  1991.                getch();
  1992.  
  1993.                videomodeset(vmode);
  1994.             }
  1995.  
  1996.             void drwcube(void)
  1997.             {
  1998.                int j;
  1999.  
  2000.                for(j=0;j<=2;j++)
  2001.  
  2002.                drwline(2,10,plot[j].x,plot[j].y,plot[j+1].x,plot[j+1].y);
  2003.                drwline(2,10,plot[3].x,plot[3].y,plot[0].x,plot[0].y);
  2004.  
  2005.                for(j=4;j<=6;j++)
  2006.  
  2007.                drwline(2,10,plot[j].x,plot[j].y,plot[j+1].x,plot[j+1].y);
  2008.                drwline(2,10,plot[7].x,plot[7].y,plot[4].x,plot[4].y);
  2009.  
  2010.                for(j=0;j<=3;j++)
  2011.  
  2012.  
  2013.                                                                          31
  2014.  
  2015.  
  2016.  
  2017.  
  2018.  
  2019.  
  2020.                drwline(2,10,plot[j].x,plot[j].y,plot[j+4].x,plot[j+4].y);
  2021.  
  2022.                return;
  2023.             }
  2024.  
  2025.  
  2026.  
  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 the
  2106.             same as inary.  A scale factor of 256 (100 hex) is considered
  2107.             100 percent and results in no change.  Therefore, 128 (80 hex)
  2108.             reduces values by one half and 512 (200 hex) doubles values.
  2109.             The function assumes space for outary has been properly
  2110.             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.                drwline(2,10,plot[3].x,plot[3].y,plot[0].x,plot[0].y);
  2193.  
  2194.                for(j=4;j<=6;j++)
  2195.  
  2196.                drwline(2,10,plot[j].x,plot[j].y,plot[j+1].x,plot[j+1].y);
  2197.  
  2198.  
  2199.                                                                          34
  2200.  
  2201.  
  2202.  
  2203.  
  2204.  
  2205.                drwline(2,10,plot[7].x,plot[7].y,plot[4].x,plot[4].y);
  2206.  
  2207.                for(j=0;j<=3;j++)
  2208.  
  2209.                drwline(2,10,plot[j].x,plot[j].y,plot[j+4].x,plot[j+4].y);
  2210.  
  2211.                return;
  2212.             }
  2213.  
  2214.  
  2215.  
  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 *outary)
  2273.  
  2274.             INPUT
  2275.  
  2276.             numpoints - number of points to translate
  2277.             xtrans - distance to translate along X axis
  2278.             ytrans - distance to translate along Y axis
  2279.             ztrans - distance to translate along Z axis
  2280.             inary - D3Point pointer to array containing points to
  2281.             translate
  2282.  
  2283.             OUTPUT
  2284.  
  2285.             no value returned
  2286.             outary - D3Point array of translated points
  2287.  
  2288.             USAGE
  2289.  
  2290.             D3TRANSLATE takes the three dimensional points given in inary
  2291.             and translates them by the specified number of pixels along
  2292.             each axis.  The results are returned in outary which can be
  2293.             the same as inary.  The function assumes space for outary has
  2294.             been properly allocated.
  2295.  
  2296.             SEE ALSO
  2297.  
  2298.             D3PROJECT, D3ROTATE, D3SCALE
  2299.  
  2300.             EXAMPLE
  2301.  
  2302.             /*
  2303.              * shows d3translate works
  2304.              */
  2305.  
  2306.             #include <stdlib.h>
  2307.             #include <conio.h>
  2308.             #include "svgacc.h"
  2309.  
  2310.             D2Point plot[8];
  2311.  
  2312.             void drwcube(void);
  2313.  
  2314.             void main(void)
  2315.             {
  2316.                int vmode,i,dummy;
  2317.                ProjParameters proj;
  2318.                D3Point tcube[8];
  2319.                D3Point cube[8] = { { 100,-100, 100},
  2320.                                 { 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.  
  2336.                vmode = videomodeget();
  2337.                if (!whichvga() || (whichmem() < 512))
  2338.                  exit(1);
  2339.                res640();
  2340.  
  2341.                proj.eyex = -1040;
  2342.                proj.eyey = -600;
  2343.                proj.eyez = -1200;
  2344.                proj.scrd = 1700;
  2345.                proj.theta = 30;
  2346.                proj.phi = 45;
  2347.  
  2348.                for(i=0;i<=400;i+=8)
  2349.                {
  2350.                  d3translate(8,i,i,i,cube,tcube);
  2351.                  dummy = d3project(8,&proj,tcube,plot);
  2352.                  drwcube();
  2353.                  sdelay(2);
  2354.                  drwcube();
  2355.                }
  2356.                for(i=400;i>=0;i-=8)
  2357.                {
  2358.                  d3translate(8,i,i,i,cube,tcube);
  2359.                  dummy = d3project(8,&proj,tcube,plot);
  2360.                  drwcube();
  2361.                  sdelay(2);
  2362.                  drwcube();
  2363.                }
  2364.                drwcube();
  2365.                getch();
  2366.                videomodeset(vmode);
  2367.             }
  2368.  
  2369.             void drwcube(void)
  2370.             {
  2371.                int j;
  2372.  
  2373.                for(j=0;j<=2;j++)
  2374.  
  2375.                drwline(2,10,plot[j].x,plot[j].y,plot[j+1].x,plot[j+1].y);
  2376.                drwline(2,10,plot[3].x,plot[3].y,plot[0].x,plot[0].y);
  2377.  
  2378.                for(j=4;j<=6;j++)
  2379.  
  2380.                drwline(2,10,plot[j].x,plot[j].y,plot[j+1].x,plot[j+1].y);
  2381.                drwline(2,10,plot[7].x,plot[7].y,plot[4].x,plot[4].y);
  2382.  
  2383.  
  2384.  
  2385.                                                                          37
  2386.  
  2387.  
  2388.  
  2389.  
  2390.  
  2391.                for(j=0;j<=3;j++)
  2392.  
  2393.                drwline(2,10,plot[j].x,plot[j].y,plot[j+4].x,plot[j+4].y);
  2394.  
  2395.                return;
  2396.             }
  2397.  
  2398.  
  2399.  
  2400.  
  2401.  
  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, int
  2458.             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).  The
  2475.             vertices given do not need to be exactly the top left and
  2476.             bottom right.  They only have to reference opposite vertices
  2477.             of the rectangle.  Any portion of the rectangle that lies
  2478.             outside of the currently defined viewport will not be drawn.
  2479.  
  2480.             SEE ALSO
  2481.  
  2482.             DRWFILLBOX, DRWLINE, SETVIEW
  2483.  
  2484.             EXAMPLE
  2485.  
  2486.             /*
  2487.              * Places a box around the whole screen
  2488.              */
  2489.  
  2490.             #include <stdlib.h>
  2491.             #include <conio.h>
  2492.             #include "svgacc.h"
  2493.  
  2494.             void main(void)
  2495.             {
  2496.                int vmode;
  2497.  
  2498.                vmode = videomodeget();
  2499.                if ( !whichvga() )
  2500.                  exit(1);
  2501.                if ( whichmem() < 512)
  2502.                  exit(1);
  2503.                res640();
  2504.                drwbox (1,10,0,0,639,479);
  2505.                getch();
  2506.                videomodeset(vmode);
  2507.  
  2508.  
  2509.                                                                          39
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.                exit(0);
  2516.             }
  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 of
  2599.             radius.  All values of xcenter, ycenter and radius are valid.
  2600.             Any portion of the circle that lies outside of the currently
  2601.             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 mode
  2723.             with the center defined by (xcenter, ycenter).  The radius in
  2724.             the horizontal direction is raduisx and the radius in the
  2725.             vertical direction is radiusy.  All values of xcenter,
  2726.             ycenter, radiusx and radiusy are valid.  Any portion of the
  2727.             ellipse that lies outside of the currently defined viewport
  2728.             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 x1,
  2830.             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 (x2,
  2847.             y2).  The vertices given do not need to be exactly the top
  2848.             left and bottom right.  They only have to reference opposite
  2849.             vertices of the rectangle.  Any portion of the rectangle that
  2850.             lies outside of the currently defined viewport will not be
  2851.             drawn.
  2852.  
  2853.             SEE ALSO
  2854.  
  2855.             DRWBOX, DRWLINE, 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 a
  2971.             radius of radius.  All values of xcenter, ycenter and radius
  2972.             are valid.  Any portion of the circle that lies outside of the
  2973.             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, int
  3078.             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 xcenter,
  3098.             ycenter, radiusx and radiusy are valid.  Any portion of the
  3099.             ellipse that lies outside of the currently defined viewport
  3100.             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, int
  3202.             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 x1,
  3219.             y1, x2 and y2 are valid.  Any portion of the line that lies
  3220.             outside of the currently defined viewport will not be drawn.
  3221.  
  3222.             SEE ALSO
  3223.  
  3224.             DRWBOX, SETVIEW
  3225.  
  3226.             EXAMPLE
  3227.  
  3228.             /*
  3229.              * Draws a line from 0,0 to the center of the screen
  3230.              */
  3231.  
  3232.             #include <stdlib.h>
  3233.             #include <conio.h>
  3234.             #include "svgacc.h"
  3235.  
  3236.             void main(void)
  3237.             {
  3238.                int vmode;
  3239.                vmode = videomodeget();
  3240.                if ( !whichvga() )
  3241.                  exit(1);
  3242.                if ( whichmem() < 512)
  3243.                  exit(1);
  3244.                res640();
  3245.                drwline (1,10,0,0,320,240);
  3246.                getch();
  3247.                videomodeset(vmode);
  3248.                exit(0);
  3249.             }
  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, int
  3264.             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 drawn
  3334.             x, y - location of upper, left corner of block
  3335.  
  3336.             OUTPUT
  3337.  
  3338.             no value returned
  3339.  
  3340.             USAGE
  3341.  
  3342.             DRWSTRING takes the null terminated ASCII characters beginning
  3343.             at strng and creates a graphics block similar to the blocks
  3344.             used by blkget and blkput and places this block on the screen
  3345.             at the specified coordinates.  The characters are drawn with
  3346.             color fcolr using the current font and the background is color
  3347.             bcolr.  When mode 0, NO_ACTION, is used, the graphics block is
  3348.             created in memory, retrievable by GETLASTSTRING, but no text
  3349.             is actually drawn on the screen.  (Note: the system font is
  3350.             automatically installed when WHICHVGA is called.)
  3351.  
  3352.             SEE ALSO
  3353.  
  3354.             FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRINGDN, DRWSTRINGLT,
  3355.             DRWSTRINGRT, GETLASTSTRING
  3356.  
  3357.             EXAMPLE
  3358.  
  3359.             /*
  3360.              * Draws some normal text at the center of the screen
  3361.              */
  3362.             #include <stdlib.h>
  3363.             #include <conio.h>
  3364.             #include "svgacc.h"
  3365.  
  3366.             void main(void)
  3367.             {
  3368.                int vmode;
  3369.                char text[]="hello world";
  3370.  
  3371.                vmode = videomodeget();
  3372.                if ( !whichvga() || (whichmem() < 512))
  3373.                  exit(1);
  3374.                res640();
  3375.  
  3376.  
  3377.                                                                          53
  3378.  
  3379.  
  3380.  
  3381.  
  3382.  
  3383.                drwstring(1,10,0,text,320,240);
  3384.                getch();
  3385.                videomodeset(vmode);
  3386.                exit(0);
  3387.             }
  3388.  
  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 drawn
  3458.             x, y - location of lower, right corner of block
  3459.  
  3460.             OUTPUT
  3461.  
  3462.             no value returned
  3463.  
  3464.             USAGE
  3465.  
  3466.             DRWSTRINGDN takes the null terminated ASCII characters
  3467.             beginning at strng and creates a graphics block similar to the
  3468.             blocks used by BLKGET and BLKPUT.  The characters are drawn
  3469.             with color fcolr using the current font and the background is
  3470.             color bcolr.  When mode 0, NO_ACTION, is used, the graphics
  3471.             block is created in memory retrievable by GETLASTSTRING, but
  3472.             no text is actually drawn on the screen.  (Note: the system
  3473.             font is automatically installed when WHICHVGA is called.)  The
  3474.             text is drawn upside down with x, y specifying the lower,
  3475.             right corner.  This corner corresponds to the upper, left
  3476.             corner when the text is oriented upright.
  3477.  
  3478.             SEE ALSO
  3479.  
  3480.             FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRING, DRWSTRINGLT,
  3481.             DRWSTRINGRT, GETLASTSTRING
  3482.  
  3483.             EXAMPLE
  3484.  
  3485.             /* Draws some text rotated by 180 degrees at the center of the
  3486.             screen */
  3487.             #include <stdlib.h>
  3488.             #include <conio.h>
  3489.             #include "svgacc.h"
  3490.  
  3491.             void main(void)
  3492.             {
  3493.                int vmode;
  3494.                char text[]="hello world";
  3495.  
  3496.                vmode = videomodeget();
  3497.                if ( !whichvga() || (whichmem() < 512))
  3498.                  exit(1);
  3499.  
  3500.  
  3501.                                                                          55
  3502.  
  3503.  
  3504.  
  3505.  
  3506.  
  3507.                res640();
  3508.                drwstringdn(1,10,0,text,320,240);
  3509.                getch();
  3510.                videomodeset(vmode);
  3511.                exit(0);
  3512.             }
  3513.  
  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 drawn
  3582.             x, y - location of lower, left corner of block
  3583.  
  3584.             OUTPUT
  3585.  
  3586.             no value returned
  3587.  
  3588.             USAGE
  3589.  
  3590.             DRWSTRINGLT takes the null terminated ASCII characters
  3591.             beginning at strng and creates a graphics block similar to the
  3592.             blocks used by BLKGET and BLKPUT.  The characters are drawn
  3593.             with color fcolr using the current font and the background is
  3594.             color bcolr.  When mode 0, NO_ACTION, is used, the graphics
  3595.             block is created in memory retrievable by GETLASTSTRING, but
  3596.             no text is actually drawn on the screen.  (Note: the system
  3597.             font is automatically installed when WHICHVGA is called.)  The
  3598.             text block is rotated 90 to the left with x, y specifying the
  3599.             lower, left corner.  This corner corresponds to the upper,
  3600.             left corner when the text is oriented upright.
  3601.  
  3602.             SEE ALSO
  3603.  
  3604.             FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRING, DRWSTRINGDN,
  3605.             DRWSTRINGRT, GETLASTSTRING
  3606.  
  3607.             EXAMPLE
  3608.  
  3609.             /* Draws some text rotated 90 degrees to the left at center of
  3610.             screen */
  3611.             #include <stdlib.h>
  3612.             #include <conio.h>
  3613.             #include "svgacc.h"
  3614.  
  3615.             void main(void)
  3616.             {
  3617.                int vmode;
  3618.                char text[]="hello world";
  3619.  
  3620.                vmode = videomodeget();
  3621.                if ( !whichvga() || (whichmem() < 512))
  3622.                  exit(1);
  3623.  
  3624.  
  3625.                                                                          57
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.                res640();
  3632.                drwstringlt(1,10,0,text,320,240);
  3633.                getch();
  3634.                videomodeset(vmode);
  3635.                exit(0);
  3636.             }
  3637.  
  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 drawn
  3706.             x, y - location of upper, right corner of block
  3707.  
  3708.             OUTPUT
  3709.  
  3710.             no value returned
  3711.  
  3712.             USAGE
  3713.  
  3714.             DRWSTRINGRT takes the null terminated ASCII characters
  3715.             beginning at strng and creates a graphics block similar to the
  3716.             blocks used by BLKGET and BLKPUT.  The characters are drawn
  3717.             with color fcolr using the current font and the background is
  3718.             color bcolr.  When mode 0, NO_ACTION, is used, the graphics
  3719.             block is created in memory retrievable by GETLASTSTRING, but
  3720.             no text is actually drawn on the screen.  (Note: the system
  3721.             font is automatically installed when WHICHVGA is called.)  The
  3722.             text block is rotated 90 to the right with x, y specifying the
  3723.             upper, right corner.  This corner corresponds to the upper,
  3724.             left corner if the text is oriented upright.
  3725.  
  3726.             SEE ALSO
  3727.  
  3728.             FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRING, DRWSTRINGDN,
  3729.             DRWSTRINGLT, GETLASTSTRING
  3730.  
  3731.             EXAMPLE
  3732.  
  3733.             /* Draws text rotated 90 degrees to the right at center of
  3734.             screen */
  3735.             #include <stdlib.h>
  3736.             #include <conio.h>
  3737.             #include "svgacc.h"
  3738.  
  3739.             void main(void)
  3740.             {
  3741.                int vmode;
  3742.                char text[]="hello world";
  3743.  
  3744.                vmode = videomodeget();
  3745.                if ( !whichvga() || (whichmem() < 512))
  3746.                  exit(1);
  3747.  
  3748.  
  3749.                                                                          59
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.                res640();
  3756.                drwstringrt(1,10,0,text,320,240);
  3757.                getch();
  3758.                videomodeset(vmode);
  3759.                exit(0);
  3760.             }
  3761.  
  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.             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 oldcolr,
  3946.             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 oldcolr
  3953.  
  3954.             OUTPUT
  3955.  
  3956.             no value returned
  3957.  
  3958.             USAGE
  3959.  
  3960.             FILLCOLOR replaces every existence of oldcolr with newcolr
  3961.             within a region.  The region is defined as any pixel of
  3962.             oldcolr which has a path of pixels of oldcolr or newcolr with
  3963.             sides touching back to the seed point, (xseed, yseed).
  3964.             Therefore, only pixels of oldcolr are modified and no other
  3965.             information is changed.
  3966.  
  3967.             SEE ALSO
  3968.  
  3969.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA, FILLPAGE,
  3970.             FILLSCREEN, FILLVIEW, SETVIEW
  3971.  
  3972.             EXAMPLE
  3973.  
  3974.             /*
  3975.              * replaces the black color with a new color
  3976.              */
  3977.  
  3978.             #include <stdlib.h>
  3979.             #include <conio.h>
  3980.             #include "svgacc.h"
  3981.  
  3982.             void main(void)
  3983.             {
  3984.                int vmode;
  3985.  
  3986.                vmode = videomodeget();
  3987.                if ( !whichvga() )
  3988.                  exit(1);
  3989.                if ( whichmem() < 512)
  3990.                  exit(1);
  3991.                res640();
  3992.                drwbox(1,10,0,0,100,100);
  3993.                drwbox(1,12,20,20,80,80);
  3994.                fillcolor(1,1,0,7);
  3995.  
  3996.  
  3997.                                                                          63
  3998.  
  3999.  
  4000.  
  4001.  
  4002.  
  4003.                getch();
  4004.                videomodeset(vmode);
  4005.                exit(0);
  4006.             }
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.  
  4031.  
  4032.  
  4033.  
  4034.  
  4035.  
  4036.  
  4037.  
  4038.  
  4039.  
  4040.  
  4041.  
  4042.  
  4043.  
  4044.  
  4045.  
  4046.  
  4047.  
  4048.  
  4049.  
  4050.  
  4051.  
  4052.  
  4053.  
  4054.  
  4055.  
  4056.  
  4057.  
  4058.  
  4059.                                                                          64
  4060.  
  4061.  
  4062.  
  4063.  
  4064.  
  4065.           FILLPAGE
  4066.  
  4067.             PROTOTYPE
  4068.  
  4069.             extern void far fillpage (int colr)
  4070.  
  4071.             INPUT
  4072.  
  4073.             colr - index to color in current palette
  4074.  
  4075.             OUTPUT
  4076.  
  4077.             no value is returned
  4078.  
  4079.             USAGE
  4080.  
  4081.             FILLPAGE clears the currently active page with the specified
  4082.             color.  All information on the page is lost.  (Note, a faster
  4083.             method to clear the page is to call any of the RES###
  4084.             functions.  These reset the graphics screen and automatically
  4085.             clear it to color index zero as well as reset the default
  4086.             palette.)
  4087.  
  4088.             SEE ALSO
  4089.  
  4090.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  4091.             FILLCOLOR, FILLSCREEN, FILLVIEW
  4092.  
  4093.             EXAMPLE
  4094.  
  4095.             /*
  4096.              * fill the page with a color
  4097.              */
  4098.  
  4099.             #include <stdlib.h>
  4100.             #include <conio.h>
  4101.             #include "svgacc.h"
  4102.  
  4103.             void main(void)
  4104.             {
  4105.                int vmode;
  4106.  
  4107.                vmode = videomodeget();
  4108.                if ( !whichvga() )
  4109.                  exit(1);
  4110.                if ( whichmem() < 512)
  4111.                  exit(1);
  4112.                res640();
  4113.                fillpage(10);
  4114.                getch();
  4115.                videomodeset(vmode);
  4116.                exit(0);
  4117.             }
  4118.  
  4119.  
  4120.  
  4121.                                                                          65
  4122.  
  4123.  
  4124.  
  4125.  
  4126.  
  4127.           FILLSCREEN
  4128.  
  4129.             PROTOTYPE
  4130.  
  4131.             extern void far fillscreen (int colr)
  4132.  
  4133.             INPUT
  4134.  
  4135.             colr - index to color in current palette
  4136.  
  4137.             OUTPUT
  4138.  
  4139.             no value is returned
  4140.  
  4141.             USAGE
  4142.  
  4143.             FILLSCREEN clears the entire screen with the specified color.
  4144.             All information on the screen is lost.  (Note, a faster method
  4145.             to clear the screen is to call any of the RES### functions.
  4146.             These reset the graphics screen and automatically clear it to
  4147.             color index zero as well as reset the default palette.)
  4148.  
  4149.             SEE ALSO
  4150.  
  4151.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  4152.             FILLCOLOR, FILLPAGE, FILLVIEW
  4153.  
  4154.             EXAMPLE
  4155.  
  4156.             /*
  4157.              * fill the screen with a color
  4158.              */
  4159.  
  4160.             #include <stdlib.h>
  4161.             #include <conio.h>
  4162.             #include "svgacc.h"
  4163.  
  4164.             void main(void)
  4165.             {
  4166.                int vmode;
  4167.  
  4168.                vmode = videomodeget();
  4169.                if ( !whichvga() )
  4170.                  exit(1);
  4171.                if ( whichmem() < 512)
  4172.                  exit(1);
  4173.                res640();
  4174.                fillscreen(10);
  4175.                getch();
  4176.                videomodeset(vmode);
  4177.                exit(0);
  4178.             }
  4179.  
  4180.  
  4181.  
  4182.  
  4183.                                                                          66
  4184.  
  4185.  
  4186.  
  4187.  
  4188.  
  4189.           FILLVIEW
  4190.  
  4191.             PROTOTYPE
  4192.  
  4193.             extern void far fillview (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.             FILLVIEW fills the currently defined viewport with the
  4206.             specified color.  All information in the viewport is lost.
  4207.  
  4208.             SEE ALSO
  4209.  
  4210.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  4211.             FILLCOLOR, FILLPAGE, FILLSCREEN, SETVIEW
  4212.  
  4213.             EXAMPLE
  4214.  
  4215.             /*
  4216.              * fill the viewport with a color
  4217.              */
  4218.  
  4219.             #include <stdlib.h>
  4220.             #include <conio.h>
  4221.             #include "svgacc.h"
  4222.  
  4223.             void main(void)
  4224.             {
  4225.                int vmode;
  4226.  
  4227.                vmode = videomodeget();
  4228.                if ( !whichvga() )
  4229.                  exit(1);
  4230.                if ( whichmem() < 512)
  4231.                  exit(1);
  4232.                res640();
  4233.                setview(100,100,539,379);
  4234.                fillview(10);
  4235.                getch();
  4236.                videomodeset(vmode);
  4237.                exit(0);
  4238.             }
  4239.  
  4240.  
  4241.  
  4242.  
  4243.  
  4244.  
  4245.                                                                          67
  4246.  
  4247.  
  4248.  
  4249.  
  4250.  
  4251.           FONTGETINFO
  4252.  
  4253.             PROTOTYPE
  4254.  
  4255.             extern void far fontgetinfo (int far *wdth, int far *hght)
  4256.  
  4257.             INPUT
  4258.  
  4259.             no input parameters
  4260.  
  4261.             OUTPUT
  4262.  
  4263.             wdth - integer pointer to width in pixels of current font
  4264.             hght - integer pointer to height in pixels of current font
  4265.  
  4266.             USAGE
  4267.  
  4268.             FONTGETINFO returns in wdth and hght the dimensions of the
  4269.             currently loaded font.
  4270.  
  4271.             SEE ALSO
  4272.  
  4273.             FONTSET, FONTSYSTEM
  4274.  
  4275.             EXAMPLE
  4276.  
  4277.             /*
  4278.              * display system font width and height
  4279.              */
  4280.  
  4281.             #include <stdlib.h>
  4282.             #include <conio.h>
  4283.             #include "svgacc.h"
  4284.  
  4285.             void main(void)
  4286.             {
  4287.                int vmode;
  4288.                int fontwidth;
  4289.                int fontheight;
  4290.                char text[50];
  4291.  
  4292.                vmode = videomodeget();
  4293.                if ( !whichvga() )
  4294.                  exit(1);
  4295.                if ( whichmem() < 512)
  4296.                  exit(1);
  4297.                res640();
  4298.                fontgetinfo(&fontwidth,&fontheight);
  4299.                sprintf(text,"the system font width is: %d",fontwidth);
  4300.                drwstring(1,7,0,text,0,0);
  4301.                sprintf(text,"the system font height is: %d",fontheight);
  4302.                drwstring(1,7,0,text,0,20);
  4303.                getch();
  4304.                videomodeset(vmode);
  4305.  
  4306.  
  4307.                                                                          68
  4308.  
  4309.  
  4310.  
  4311.  
  4312.  
  4313.                exit(0);
  4314.             }
  4315.  
  4316.  
  4317.  
  4318.  
  4319.  
  4320.  
  4321.  
  4322.  
  4323.  
  4324.  
  4325.  
  4326.  
  4327.  
  4328.  
  4329.  
  4330.  
  4331.  
  4332.  
  4333.  
  4334.  
  4335.  
  4336.  
  4337.  
  4338.  
  4339.  
  4340.  
  4341.  
  4342.  
  4343.  
  4344.  
  4345.  
  4346.  
  4347.  
  4348.  
  4349.  
  4350.  
  4351.  
  4352.  
  4353.  
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360.  
  4361.  
  4362.  
  4363.  
  4364.  
  4365.  
  4366.  
  4367.  
  4368.  
  4369.                                                                          69
  4370.  
  4371.  
  4372.  
  4373.  
  4374.  
  4375.           FONTSET
  4376.  
  4377.             PROTOTYPE
  4378.  
  4379.             extern void far fontset (Font far *font)
  4380.  
  4381.             INPUT
  4382.  
  4383.             font - pointer to Font structure
  4384.  
  4385.             OUTPUT
  4386.  
  4387.             no value returned
  4388.  
  4389.             USAGE
  4390.  
  4391.             FONTSET loads the current font with the data found at font.
  4392.             The Font structure is 4098 bytes long with the first two bytes
  4393.             being the width and height of the font respectively.
  4394.  
  4395.             SEE ALSO
  4396.  
  4397.             FONTGETINFO, FONTSYSTEM
  4398.  
  4399.             EXAMPLE
  4400.  
  4401.             /*
  4402.              * Load a font from disk and enable it
  4403.              */
  4404.  
  4405.             #include <stdlib.h>
  4406.             #include <conio.h>
  4407.             #include <stdio.h>
  4408.             #include "svgacc.h"
  4409.  
  4410.             Font newfont;
  4411.  
  4412.             void main(void)
  4413.             {
  4414.                int vmode;
  4415.                char text[]="The Dragon Font!";
  4416.                FILE *fontfile;
  4417.                vmode = videomodeget();
  4418.                if ( !whichvga() )
  4419.                  exit(1);
  4420.                if ( whichmem() < 512)
  4421.                  exit(1);
  4422.                if ( !res640() )
  4423.                  exit(1);
  4424.                if( (fontfile = fopen("dragon.fnt","rb")) == NULL )
  4425.                  exit (1);
  4426.                fread(&newfont,4098,1,fontfile);
  4427.                fclose(fontfile);
  4428.                fontset(&newfont);
  4429.  
  4430.  
  4431.                                                                          70
  4432.  
  4433.  
  4434.  
  4435.  
  4436.  
  4437.                drwstring(1,10,0,text,0,0);
  4438.                getch();
  4439.                videomodeset(vmode);
  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.           FONTSYSTEM
  4500.  
  4501.             PROTOTYPE
  4502.  
  4503.             extern void far fontsystem (void)
  4504.  
  4505.             INPUT
  4506.  
  4507.             no input parameters
  4508.  
  4509.             OUTPUT
  4510.  
  4511.             no value returned
  4512.  
  4513.             USAGE
  4514.  
  4515.             FONTSYSTEM sets the current font to the standard system font.
  4516.             This font is automatically set when WHICHVGA is called.
  4517.  
  4518.             SEE ALSO
  4519.  
  4520.             WHICHVGA, FONTGETINFO, FONTSET
  4521.  
  4522.             EXAMPLE
  4523.  
  4524.             /* Load font from disk, enable it, and switch back to system
  4525.             font */
  4526.  
  4527.             #include <stdlib.h>
  4528.             #include <conio.h>
  4529.             #include <stdio.h>
  4530.             #include "svgacc.h"
  4531.  
  4532.             Font newfont;
  4533.  
  4534.             void main(void)
  4535.             {
  4536.                int vmode;
  4537.                char text1[]="The Dragon Font!";
  4538.                char text2[]="The System Font!";
  4539.                FILE *fontfile;
  4540.                vmode = videomodeget();
  4541.                if ( !whichvga() || (whichmem() < 512))
  4542.                  exit(1);
  4543.                if ( !res640() )
  4544.                  exit(1);
  4545.                if( (fontfile = fopen("dragon.fnt","rb")) == NULL )
  4546.                  exit(1);
  4547.                fread(&newfont,4098,1,fontfile);
  4548.                fclose(fontfile);
  4549.                fontset(&newfont);
  4550.                drwstring(1,10,0,text1,0,0);
  4551.                fontsystem();
  4552.                drwstring(1,10,0,text2,0,20);
  4553.  
  4554.  
  4555.                                                                          72
  4556.  
  4557.  
  4558.  
  4559.  
  4560.  
  4561.                getch();
  4562.                videomodeset(vmode);
  4563.             }
  4564.  
  4565.  
  4566.  
  4567.  
  4568.  
  4569.  
  4570.  
  4571.  
  4572.  
  4573.  
  4574.  
  4575.  
  4576.  
  4577.  
  4578.  
  4579.  
  4580.  
  4581.  
  4582.  
  4583.  
  4584.  
  4585.  
  4586.  
  4587.  
  4588.  
  4589.  
  4590.  
  4591.  
  4592.  
  4593.  
  4594.  
  4595.  
  4596.  
  4597.  
  4598.  
  4599.  
  4600.  
  4601.  
  4602.  
  4603.  
  4604.  
  4605.  
  4606.  
  4607.  
  4608.  
  4609.  
  4610.  
  4611.  
  4612.  
  4613.  
  4614.  
  4615.  
  4616.  
  4617.                                                                          73
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.           GETARCCOS
  4624.  
  4625.             PROTOTYPE
  4626.  
  4627.             extern long far getarccos (long cosvalue)
  4628.  
  4629.             INPUT
  4630.  
  4631.             cosvalue - number between -1 and +1 scaled up by 13 bits
  4632.             (8192)
  4633.  
  4634.             OUTPUT
  4635.  
  4636.             GETARCCOS returns the arc cosine of cosvalue in degrees.
  4637.  
  4638.             USAGE
  4639.  
  4640.             GETARCCOS returns the arc cosine in degrees for the given
  4641.             value.  The return will be between 0 and 180 degrees.
  4642.             Cosvalue should be between -8192 and +8192 representing the
  4643.             range -1 to +1.  Input values outside this range are invalid
  4644.             and GETARCCOS will return -32768.  This function uses an
  4645.             integer lookup table stored within the library in order to
  4646.             produce the fastest possible results.  No floating point
  4647.             arithmetic is used.  The scale factor of 13 bits (8192) was
  4648.             chosen because this is the number of bits at which every
  4649.             change of one degree gives a change in the value of the sine
  4650.             (or cosine) function.
  4651.  
  4652.             SEE ALSO
  4653.  
  4654.             GETARCSIN, GETARCTAN, GETCOS, GETSIN, GETTAN
  4655.  
  4656.             EXAMPLE
  4657.  
  4658.             /*
  4659.              * show getarccos
  4660.              */
  4661.  
  4662.             #include <stdlib.h>
  4663.             #include <conio.h>
  4664.             #include "svgacc.h"
  4665.  
  4666.             void main(void)
  4667.             {
  4668.                int ang;
  4669.                long valueX8192;
  4670.                float value;
  4671.  
  4672.                for(value=0;value<1;value+=.05)
  4673.                {
  4674.                  valueX8192 = 8192 * value;
  4675.                  ang = getarccos(valueX8192);
  4676.                  printf("arccos of %f = %d degrees\n",value,ang);
  4677.  
  4678.  
  4679.                                                                          74
  4680.  
  4681.  
  4682.  
  4683.  
  4684.  
  4685.                }
  4686.                exit(0);
  4687.             }
  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.           GETARCSIN
  4748.  
  4749.             PROTOTYPE
  4750.  
  4751.             extern long far getarcsin (long sinvalue)
  4752.  
  4753.             INPUT
  4754.  
  4755.             sinvalue - number between -1 and +1 scaled up by 13 bits
  4756.             (8192)
  4757.  
  4758.             OUTPUT
  4759.  
  4760.             GETARCSIN returns the arc sine of sinvalue in degrees.
  4761.  
  4762.             USAGE
  4763.  
  4764.             GETARCSIN returns the arc sine in degrees for the given value.
  4765.             The return will be between -90 and +90 degrees.  Sinvalue
  4766.             should be between -8192 and +8192 representing the range -1 to
  4767.             +1.  Input values outside this range are invalid and GETARCSIN
  4768.             will return -32768.  This function uses an integer lookup
  4769.             table stored within the library in order to produce the
  4770.             fastest possible results.  No floating point arithmetic is
  4771.             used.  The scale factor of 13 bits (8192) was chosen because
  4772.             this is the number of bits at which every change of one degree
  4773.             gives a change in the value of the sine (or cosine) function.
  4774.  
  4775.             SEE ALSO
  4776.  
  4777.             GETARCCOS, GETARCTAN, GETCOS, GETSIN, GETTAN
  4778.  
  4779.             EXAMPLE
  4780.  
  4781.             /*
  4782.              * show getarcsin
  4783.              */
  4784.  
  4785.             #include <stdlib.h>
  4786.             #include <conio.h>
  4787.             #include "svgacc.h"
  4788.  
  4789.             void main(void)
  4790.             {
  4791.                int ang;
  4792.                long valueX8192;
  4793.                float value;
  4794.  
  4795.                for(value=0;value<1;value+=.05)
  4796.                {
  4797.                  valueX8192 = 8192 * value;
  4798.                  ang = getarcsin(valueX8192);
  4799.                  printf("arcsin of %f = %d degrees\n",value,ang);
  4800.                }
  4801.  
  4802.  
  4803.                                                                          76
  4804.  
  4805.  
  4806.  
  4807.  
  4808.  
  4809.                exit(0);
  4810.             }
  4811.  
  4812.  
  4813.  
  4814.  
  4815.  
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822.  
  4823.  
  4824.  
  4825.  
  4826.  
  4827.  
  4828.  
  4829.  
  4830.  
  4831.  
  4832.  
  4833.  
  4834.  
  4835.  
  4836.  
  4837.  
  4838.  
  4839.  
  4840.  
  4841.  
  4842.  
  4843.  
  4844.  
  4845.  
  4846.  
  4847.  
  4848.  
  4849.  
  4850.  
  4851.  
  4852.  
  4853.  
  4854.  
  4855.  
  4856.  
  4857.  
  4858.  
  4859.  
  4860.  
  4861.  
  4862.  
  4863.  
  4864.  
  4865.                                                                          77
  4866.  
  4867.  
  4868.  
  4869.  
  4870.  
  4871.           GETARCTAN
  4872.  
  4873.             PROTOTYPE
  4874.  
  4875.             extern long far getarctan (long tanvalue)
  4876.  
  4877.             INPUT
  4878.  
  4879.             tanvalue - long integer representing a decimal scaled up by 13
  4880.             bits (8192)
  4881.  
  4882.             OUTPUT
  4883.  
  4884.             GETARCTAN returns the arc tangent of tanvalue in degrees.
  4885.  
  4886.             USAGE
  4887.  
  4888.             GETARCTAN returns the arc tangent in degrees for the given
  4889.             value.  The return will be between -89 and +89 degrees.
  4890.             Tanvalue can be any long integer.  It is interpreted as a
  4891.             decimal scaled up by 8192 (13 bits).  This function uses an
  4892.             integer lookup table stored within the library in order to
  4893.             produce the fastest possible results.  No floating point
  4894.             arithmetic is used.  The scale factor of 13 bits (8192) was
  4895.             chosen because this is the number of bits at which every
  4896.             change of one degree gives a change in the value of the sine
  4897.             (or cosine) function.
  4898.  
  4899.             SEE ALSO
  4900.  
  4901.             GETARCCOS, GETARCSIN, GETCOS, GETSIN, GETTAN
  4902.  
  4903.             EXAMPLE
  4904.  
  4905.             /*
  4906.              * show getarctan
  4907.              */
  4908.  
  4909.             #include <stdlib.h>
  4910.             #include <conio.h>
  4911.             #include "svgacc.h"
  4912.  
  4913.             void main(void)
  4914.             {
  4915.                int tanang;
  4916.                int ang;
  4917.                long valueX8192;
  4918.                float value;
  4919.  
  4920.                for(value=0;value<2;value+=.1)
  4921.                {
  4922.                  valueX8192 = 8192 * value;
  4923.                  ang = getarctan(valueX8192);
  4924.                  printf("arctan 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.           GETCOS
  4996.  
  4997.             PROTOTYPE
  4998.  
  4999.             extern long far getcos (long angle)
  5000.  
  5001.             INPUT
  5002.  
  5003.             angle - angle in degrees
  5004.  
  5005.             OUTPUT
  5006.  
  5007.             GETCOS returns the cosine of angle scaled up by 13 bits
  5008.             (8192).
  5009.  
  5010.             USAGE
  5011.  
  5012.             GETCOS returns the cosine of the specified angle.  Angle can
  5013.             be any long value.  The return value has been multiplied by
  5014.             8192.  This function uses an integer lookup table stored
  5015.             within the library in order to produce the fastest possible
  5016.             results.  No floating point arithmetic is used.  The scale
  5017.             factor of 13 bits (8192) was chosen because this is the number
  5018.             of bits at which every change of one degree gives a change in
  5019.             the value of the sine (or cosine) function.
  5020.  
  5021.             SEE ALSO
  5022.  
  5023.             GETARCCOS, GETARCSIN, GETARCTAN, GETSIN, GETTAN
  5024.  
  5025.             EXAMPLE
  5026.  
  5027.             /*
  5028.              * show getcos
  5029.              */
  5030.  
  5031.             #include <stdlib.h>
  5032.             #include <conio.h>
  5033.             #include "svgacc.h"
  5034.  
  5035.             void main(void)
  5036.             {
  5037.                int ang;
  5038.                float value;
  5039.  
  5040.                for(ang=0;ang<90;ang+=5)
  5041.                {
  5042.                  value = (float)getcos(ang) / 8192;
  5043.                  printf("cos of %d degrees = %f\n",ang,value);
  5044.                }
  5045.                exit(0);
  5046.             }
  5047.  
  5048.  
  5049.  
  5050.  
  5051.                                                                          80
  5052.  
  5053.  
  5054.  
  5055.  
  5056.  
  5057.           GETLASTSTRING
  5058.  
  5059.             PROTOTYPE
  5060.  
  5061.             extern void far getlaststring (RasterBlock far *strnggfxblk)
  5062.  
  5063.             INPUT
  5064.  
  5065.             no input parameters
  5066.  
  5067.             OUTPUT
  5068.  
  5069.             no value returned
  5070.             strnggfxblk - RasterBlock pointer to destination array
  5071.  
  5072.             USAGE
  5073.  
  5074.             GETLASTSTRING returns the text drawn on the screen by the last
  5075.             called DRWSTRING function.  The text is returned in
  5076.             strnggfxblk which may be used with BLKPUT or the sprite
  5077.             functions.  The text in strnggfxblk is oriented in the same
  5078.             manner as the last called DRWSTRING function.  The suggested
  5079.             practice is to call the DRWSTRING function using mode
  5080.             NO_ACTION which does not actually draw text on the screen.
  5081.             GETLASTSTRING should be called immediately after the desired
  5082.             DRWSTRING function to prevent possible loss of data caused by
  5083.             other functions.
  5084.  
  5085.             The number of bytes of raster data needed by strnggfxblk is
  5086.             equal to
  5087.  
  5088.                          (fontwidth*stringlength)*(fontheight)
  5089.  
  5090.             plus four bytes for the width and height integers in the
  5091.             RasterBlock structure.
  5092.  
  5093.             The font's dimensions can be obtained by calling FONTGETINFO
  5094.             and the string's length can be obtained using the STRLEN
  5095.             function.  Note, however, that strnggfxblk can be quite large.
  5096.             If insufficient space is allocated for strnggfxblk,
  5097.             GETLASTSTRING will overwrite any data in memory contained
  5098.             beyond strnggfxblk and may possibly cause the system to crash.
  5099.  
  5100.             SEE ALSO
  5101.  
  5102.             BLKPUT, DRWSTRING, DRWSTRINGDN, DRWSTRINGLT, DRWSTRINGRT,
  5103.             FONTGETINFO
  5104.  
  5105.             EXAMPLE
  5106.  
  5107.             /*
  5108.              * Draws some text using the 'NO-ACTION' mode then
  5109.              * retrieve the raster data as a 'RasterBlock'
  5110.              */
  5111.  
  5112.  
  5113.                                                                          81
  5114.  
  5115.  
  5116.  
  5117.  
  5118.  
  5119.  
  5120.             #include <stdlib.h>
  5121.             #include <conio.h>
  5122.             #include "svgacc.h"
  5123.  
  5124.             void main(void)
  5125.             {
  5126.                int vmode,fontwidth,fontheight;
  5127.                char text[]="hello world";
  5128.                RasterBlock *blkdata;
  5129.                vmode = videomodeget();
  5130.                if ( !whichvga() || (whichmem() < 512))
  5131.                  exit(1);
  5132.                if ( !res640() )
  5133.                  exit(1);
  5134.                drwstringrt(NO_ACTION,10,0,text,320,240);
  5135.                fontgetinfo(&fontwidth,&fontheight);
  5136.                blkdata = (RasterBlock *)malloc(fontwidth*11*fontheight +
  5137.             4);
  5138.                getlaststring(blkdata);
  5139.                blkput(SET,0,0,blkdata);
  5140.                getch();
  5141.                videomodeset(vmode);
  5142.             }
  5143.  
  5144.  
  5145.  
  5146.  
  5147.  
  5148.  
  5149.  
  5150.  
  5151.  
  5152.  
  5153.  
  5154.  
  5155.  
  5156.  
  5157.  
  5158.  
  5159.  
  5160.  
  5161.  
  5162.  
  5163.  
  5164.  
  5165.  
  5166.  
  5167.  
  5168.  
  5169.  
  5170.  
  5171.  
  5172.  
  5173.  
  5174.  
  5175.                                                                          82
  5176.  
  5177.  
  5178.  
  5179.  
  5180.  
  5181.           GETPOINT
  5182.  
  5183.             PROTOTYPE
  5184.  
  5185.             extern int far getpoint (int x, int y)
  5186.  
  5187.             INPUT
  5188.  
  5189.             x, y - location of pixel to read
  5190.  
  5191.             OUTPUT
  5192.  
  5193.             GETPOINT returns the color index of the pixel at x, y.
  5194.  
  5195.             USAGE
  5196.  
  5197.             GETPOINT returns the value of the pixel at location x, y.
  5198.             This value is a color index into the current palette.
  5199.  
  5200.             SEE ALSO
  5201.  
  5202.             DRWPOINT
  5203.  
  5204.             EXAMPLE
  5205.  
  5206.             /*
  5207.              * draw a point and check that it is there
  5208.              */
  5209.  
  5210.             #include <stdlib.h>
  5211.             #include <conio.h>
  5212.             #include "svgacc.h"
  5213.  
  5214.             void main(void)
  5215.             {
  5216.                int vmode;
  5217.                int pointvalue;
  5218.                char text[50];
  5219.  
  5220.                vmode = videomodeget();
  5221.                if ( !whichvga() )
  5222.                  exit(1);
  5223.                if ( whichmem() < 512)
  5224.                  exit(1);
  5225.                res640();
  5226.                drwpoint(1,10,320,240);
  5227.                pointvalue = getpoint(320,240);
  5228.                sprintf(text,"the point value is: %d",pointvalue);
  5229.                drwstring(1,7,0,text,0,0);
  5230.                getch();
  5231.                videomodeset(vmode);
  5232.                exit(0);
  5233.             }
  5234.  
  5235.  
  5236.  
  5237.                                                                          83
  5238.  
  5239.  
  5240.  
  5241.  
  5242.  
  5243.           GETSIN
  5244.  
  5245.             PROTOTYPE
  5246.  
  5247.             extern long far getsin (long angle)
  5248.  
  5249.             INPUT
  5250.  
  5251.             angle - angle in degrees
  5252.  
  5253.             OUTPUT
  5254.  
  5255.             GETSIN returns the sine of angle scaled up by 13 bits (8192).
  5256.  
  5257.             USAGE
  5258.  
  5259.             GETSIN returns the sine of the specified angle.  Angle can be
  5260.             any long value.  The return value has been multiplied by 8192.
  5261.             This function uses an integer lookup table stored within the
  5262.             library in order to produce the fastest possible results.  No
  5263.             floating point arithmetic is used.  The scale factor of 13
  5264.             bits (8192) was chosen because this is the number of bits at
  5265.             which every change of one degree gives a change in the value
  5266.             of the sine (or cosine) function.
  5267.  
  5268.             SEE ALSO
  5269.  
  5270.             GETARCCOS, GETARCSIN, GETARCTAN, GETCOS, GETTAN
  5271.  
  5272.             EXAMPLE
  5273.  
  5274.             /*
  5275.              * show getsin
  5276.              */
  5277.  
  5278.             #include <stdlib.h>
  5279.             #include <conio.h>
  5280.             #include "svgacc.h"
  5281.  
  5282.             void main(void)
  5283.             {
  5284.                int sinang, ang;
  5285.                float value;
  5286.  
  5287.                for(ang=0;ang<90;ang+=5)
  5288.                {
  5289.                  value = (float)getsin(ang) / 8192;
  5290.                  printf("sin of %d degrees = %f\n",ang,value);
  5291.                }
  5292.                exit(0);
  5293.             }
  5294.  
  5295.  
  5296.  
  5297.  
  5298.  
  5299.                                                                          84
  5300.  
  5301.  
  5302.  
  5303.  
  5304.  
  5305.           GETTAN
  5306.  
  5307.             PROTOTYPE
  5308.  
  5309.             extern long far gettan (long angle)
  5310.  
  5311.             INPUT
  5312.  
  5313.             angle - angle in degrees
  5314.  
  5315.             OUTPUT
  5316.  
  5317.             GETTAN returns the tangent of angle scaled up by 13 bits
  5318.             (8192)
  5319.  
  5320.             USAGE
  5321.  
  5322.             GETTAN returns the tangent of the specified angle.  Angle can
  5323.             be any long value except +(90+n*180), where n is an integer.
  5324.             The return value has been multiplied by 8192.  If an invalid
  5325.             angle is given, the GETTAN will return &H80000000 (-
  5326.             2147483648).  This function uses an integer lookup table
  5327.             stored within the library in order to produce the fastest
  5328.             possible results.  No floating point arithmetic is used.  The
  5329.             scale factor of 13 bits (8192) was chosen because this is the
  5330.             number of bits at which every change of one degree gives a
  5331.             change in the value of the sine (or cosine) function.
  5332.  
  5333.             SEE ALSO
  5334.  
  5335.             GETARCCOS, GETARCSIN, GETARCTAN, GETCOS, GETSIN
  5336.  
  5337.             EXAMPLE
  5338.  
  5339.             /*
  5340.              * show gettan
  5341.              */
  5342.  
  5343.             #include <stdlib.h>
  5344.             #include <conio.h>
  5345.             #include "svgacc.h"
  5346.  
  5347.             void main(void)
  5348.             {
  5349.                int tanang, ang;
  5350.                float value;
  5351.  
  5352.                for(ang=0;ang<90;ang+=5)
  5353.                {
  5354.                  value = (float)gettan(ang) / 8192;
  5355.                  printf("tan of %d degrees = %f\n",ang,value);
  5356.                }
  5357.                exit(0);
  5358.             }
  5359.  
  5360.  
  5361.                                                                          85
  5362.  
  5363.  
  5364.  
  5365.  
  5366.  
  5367.           GIFGETINFO
  5368.  
  5369.             PROTOTYPE
  5370.  
  5371.             extern int far gifgetinfo (const char far *name, int far
  5372.                *gifxsize, int far *gifysize, int far *numcolors, RGB far
  5373.                *pal)
  5374.  
  5375.             INPUT
  5376.  
  5377.             name - char pointer to the filename of the GIF image to read
  5378.  
  5379.             OUTPUT
  5380.  
  5381.             GIFGETINFO returns 1 if successful, error code otherwise.
  5382.             gifxsize - width in pixels of the image
  5383.             gifysize - height in pixels of the image
  5384.             numcolors - number of colors in the image palette
  5385.             palette - copy of image palette
  5386.  
  5387.             USAGE
  5388.  
  5389.             GIFGETINFO reads name and returns the characteristics of the
  5390.             image.  The dimensions of the image are returned in gifxsize,
  5391.             gifysize.  The number of colors in the image's palette is
  5392.             returned in numcolors and the palette is returned in palette.
  5393.             Although the image's palette may contain less than 256 colors,
  5394.             palette must be 768 bytes in length.  The image's palette will
  5395.             begin with the first color in Palette.
  5396.  
  5397.             For ease of programming the GIF decoder requires that the
  5398.             image be non-interlaced, use only a global color map and be
  5399.             compressed according to GIF87A specifications.
  5400.  
  5401.             If GIFGETINFO determines that Filename is a satisfactory file,
  5402.             the function will return a one.  Otherwise, the function will
  5403.             return one of several error codes as listed below:
  5404.  
  5405.             0 =  does not exist or there is some disk I/O problem
  5406.             -1 = does not have the GIF87A signature
  5407.             -2 = image is interlaced
  5408.             -3 = does not use a global color map
  5409.             -4 = has some general error
  5410.  
  5411.             SEE ALSO
  5412.  
  5413.             GIFMAKE, GIFPUT
  5414.  
  5415.             EXAMPLE
  5416.  
  5417.             /*
  5418.              * show the info on the 'uttower.gif' GIF file
  5419.              */
  5420.  
  5421.  
  5422.  
  5423.                                                                          86
  5424.  
  5425.  
  5426.  
  5427.  
  5428.  
  5429.             #include <stdlib.h>
  5430.             #include <conio.h>
  5431.             #include "svgacc.h"
  5432.  
  5433.             void main(void)
  5434.             {
  5435.                int vmode, xsize, ysize, numcol, ok;
  5436.                int i, darkcolor, britecolor, currcolor;
  5437.                PaletteData gifpal;
  5438.                char buf[80];
  5439.                char fname[] = "uttower.gif";
  5440.  
  5441.                vmode = videomodeget();
  5442.                if ( !whichvga() || (whichmem() < 512))
  5443.                  exit(1);
  5444.  
  5445.                ok = gifgetinfo(fname,&xsize,&ysize,&numcol,gifpal);
  5446.  
  5447.                if (ok == 1) {
  5448.                  if ( !res640() )
  5449.                     exit(1);
  5450.  
  5451.                  /* we have an unknown 8 bit palette and we must cut it
  5452.             down to
  5453.                     6 bits and find the brightest and darkest colors */
  5454.                  darkcolor = 0 + 0 + 0;
  5455.                  britecolor = 63 + 63 + 63;
  5456.                  for(i=0;i<255;i++) {
  5457.                     gifpal[i].r >>= 2;
  5458.                     gifpal[i].g >>= 2;
  5459.                     gifpal[i].b >>= 2;
  5460.                     currcolor = gifpal[i].r + gifpal[i].g + gifpal[i].b;
  5461.                     if (currcolor > darkcolor)
  5462.                       darkcolor = currcolor;
  5463.                     if (currcolor < britecolor)
  5464.                       britecolor = currcolor;
  5465.                  }
  5466.                  palset(gifpal,0,255);
  5467.                  fillscreen(darkcolor);
  5468.                  sprintf(buf,"'%s' is identified as a 'Non-interlaced'
  5469.             type 'GIF87a' GIF image.",fname);
  5470.                  drwstring(1,britecolor,darkcolor,buf,0,0);
  5471.                  sprintf(buf,"Dimensions are: %d pixels wide and %d pixels
  5472.             high.",xsize,ysize);
  5473.                  drwstring(1,britecolor,darkcolor,buf,0,16);
  5474.                  sprintf(buf,"Number of colors: %d.",numcol);
  5475.                  drwstring(1,britecolor,darkcolor,buf,0,32);
  5476.                  gifput(SET,100,100,fname);
  5477.                } else {
  5478.                  printf("error in GIF file, error code: %d\n",ok);
  5479.                }
  5480.                getch();
  5481.                videomodeset(vmode);
  5482.             }
  5483.  
  5484.  
  5485.                                                                          87
  5486.  
  5487.  
  5488.  
  5489.  
  5490.  
  5491.           GIFMAKE
  5492.  
  5493.             PROTOTYPE
  5494.  
  5495.             extern int far gifmake (int x1, int y1, int x2, int y2, const
  5496.             char far *name)
  5497.  
  5498.             INPUT
  5499.  
  5500.             x1, y1 - the location of the top, left corner of the image
  5501.             x2, y2 - the bottom, right corner of the image
  5502.             name - filename to store the GIF image
  5503.  
  5504.             OUTPUT
  5505.  
  5506.             GIFMAKE returns a 1 if successful, 0 if unsuccessful.
  5507.  
  5508.             USAGE
  5509.  
  5510.             GIFMAKE takes the bitmap enclosed in the box defined by (x1,
  5511.             y1) - (x2, y2) and writes a GIF with the filename specified by
  5512.             name.  The resulting file uses the GIF87a compression
  5513.             specifications.  The values x1, y1, x2 and y2 must be valid
  5514.             coordinates on the currently active page.  Name may specify a
  5515.             full path and drive letter, if necessary.
  5516.  
  5517.             SEE ALSO
  5518.  
  5519.             GIFGETINFO, GIFPUT
  5520.  
  5521.             EXAMPLE
  5522.  
  5523.             /*
  5524.              * Make a simple GIF file
  5525.              */
  5526.  
  5527.             #include <stdlib.h>
  5528.             #include <conio.h>
  5529.             #include "svgacc.h"
  5530.             #define randnum(size) (rand() % (int)(size))
  5531.  
  5532.             void main(void)
  5533.             {
  5534.                int vmode,colr,num,i;
  5535.                int x1,y1,x2,y2,er;
  5536.                char text[]="This GIF was made using Zephyr Software's
  5537.             GIFMAKE function!";
  5538.                char fname[]="test.gif";
  5539.  
  5540.                vmode = videomodeget();
  5541.                if ( !whichvga() || (whichmem() < 512))
  5542.                  exit(1);
  5543.                if ( !res640() )
  5544.                  exit(1);
  5545.  
  5546.  
  5547.                                                                          88
  5548.  
  5549.  
  5550.  
  5551.  
  5552.  
  5553.                fillscreen(10);
  5554.                colr = 1;
  5555.                for(i=0;i<200;i++) {
  5556.                  x1 = randnum(maxx);
  5557.                  y1 = randnum(maxy);
  5558.                  x2 = randnum(maxx);
  5559.                  y2 = randnum(maxy);
  5560.                  drwline(1,colr++,x1,y1,x2,y2);
  5561.                  if (colr>15)
  5562.                     colr = 1;
  5563.                }
  5564.                drwbox(SET,15,0,0,maxx,maxy);
  5565.                drwstring(1,15,0,text,60,10);
  5566.                er = gifmake(0,0,maxx,maxy,fname);
  5567.                if (er != 1 ) {
  5568.                  videomodeset(vmode);
  5569.                  exit(1);
  5570.                }
  5571.  
  5572.                videomodeset(vmode);
  5573.                exit(0);
  5574.             } 
  5575.  
  5576.  
  5577.  
  5578.  
  5579.  
  5580.  
  5581.  
  5582.  
  5583.  
  5584.  
  5585.  
  5586.  
  5587.  
  5588.  
  5589.  
  5590.  
  5591.  
  5592.  
  5593.  
  5594.  
  5595.  
  5596.  
  5597.  
  5598.  
  5599.  
  5600.  
  5601.  
  5602.  
  5603.  
  5604.  
  5605.  
  5606.  
  5607.  
  5608.  
  5609.                                                                          89
  5610.  
  5611.  
  5612.  
  5613.  
  5614.  
  5615.           GIFPUT
  5616.  
  5617.             PROTOTYPE
  5618.  
  5619.             extern int far gifput (PixelMode mode, int xloc, int yloc,
  5620.             const char far *name)
  5621.  
  5622.             INPUT
  5623.  
  5624.             mode - pixel write mode
  5625.             xloc, yloc - the location of the top, left corner of the GIF
  5626.             image
  5627.             name - char pointer to filename of the GIF image to read
  5628.  
  5629.             OUTPUT
  5630.  
  5631.             GIFPUT returns 1 if successful, error code otherwise.
  5632.  
  5633.             USAGE
  5634.  
  5635.             GIFPUT reads the GIF image from name and places it on the
  5636.             screen with the top, left corner at xloc, yloc.  The image is
  5637.             automatically clipped to the currently defined viewport.  The
  5638.             image's palette should be previously obtained by using
  5639.             GIFGETINFO.
  5640.  
  5641.             For ease of programming the GIF decoder requires that the
  5642.             image be non-interlaced, use only a global color map and be
  5643.             compressed according to the GIF87A specifications.
  5644.  
  5645.             If GIFPUT encounters no problems, the function will return a
  5646.             one.  Otherwise, the function will return one of several error
  5647.             codes as listed below:
  5648.  
  5649.             0 =  does not exist or there is some disk I/O problem
  5650.             -1 = does not have the GIF87A signature
  5651.             -2 = image is interlaced
  5652.             -3 = does not use a global color map
  5653.             -4 = has some general error
  5654.  
  5655.             SEE ALSO
  5656.  
  5657.             GIFGETINFO, GIFMAKE, SETVIEW
  5658.  
  5659.             EXAMPLE
  5660.  
  5661.             See GIFGETINFO
  5662.  
  5663.  
  5664.  
  5665.  
  5666.  
  5667.  
  5668.  
  5669.  
  5670.  
  5671.                                                                          90
  5672.  
  5673.  
  5674.  
  5675.  
  5676.  
  5677.           JOYSTICKINFO
  5678.  
  5679.             PROTOTYPE
  5680.  
  5681.             extern void far joystickinfo (int far *jax, int far *jay, int
  5682.             far *jabuts, int far *jbx, int far *jby, int far *jbbuts)
  5683.  
  5684.             INPUT
  5685.  
  5686.             no input parameters
  5687.  
  5688.             OUTPUT
  5689.  
  5690.             jax, jay - horizontal and vertical values of joystick A
  5691.             jabuts - button status of joystick A
  5692.             jbx, jby - horizontal and vertical values of joystick B
  5693.             jbbuts - button status of joystick B
  5694.  
  5695.             USAGE
  5696.  
  5697.             JOYSTICKINFO returns the current status of the two joysticks'
  5698.             position and buttons.  The position is returned in jax, jay
  5699.             for joystick A and jbx, jby for joystick B.  The buttons'
  5700.             status is held in jabuts and jbbuts.  For each joystick,
  5701.             button A - usually the fire button - is held in bit zero and
  5702.             button B is in bit one.  Button status is most easily checked
  5703.             with a bitwise AND of jabuts (or jbbuts) and the desired bit.
  5704.  
  5705.             Not all joysticks are constructed with the same components.
  5706.             In addition, joysticks are not linear devices.  The value of a
  5707.             joystick's center will not necessarily be the mean of its
  5708.             extreme values.  Therefore, it is recommended that any program
  5709.             using the joystick for more than just directional control
  5710.             complete a calibration of the joystick prior to usage.  For an
  5711.             example of joystick calibration, see the SVGADEMO.EXE source
  5712.             code.
  5713.  
  5714.             It is recommended, though not required, to call WHICHJOYSTICK,
  5715.             prior to using the joysticks in order to verify the existence
  5716.             of the hardware.
  5717.  
  5718.             SEE ALSO
  5719.  
  5720.             WHICHJOYSTICK
  5721.  
  5722.             EXAMPLE
  5723.  
  5724.             /*
  5725.              * show joysticks port readings
  5726.              */
  5727.  
  5728.             #include <stdlib.h>
  5729.             #include <conio.h>
  5730.             #include "svgacc.h"
  5731.  
  5732.  
  5733.                                                                          91
  5734.  
  5735.  
  5736.  
  5737.  
  5738.  
  5739.  
  5740.             void main(void)
  5741.             {
  5742.                int vmode;
  5743.                int jax, jay, jabuts, jbx, jby, jbbuts;
  5744.  
  5745.                printf("A:  X    Y  btn | B:  X    Y  btn\n  ");
  5746.                while(!kbhit()) {
  5747.                  joystickinfo(&jax,&jay,&jabuts,&jbx,&jby,&jbbuts);
  5748.                  printf("%04d %04d  %1d  |   ",jax,jay,jabuts);
  5749.                  printf("%04d %04d  %1d",jbx,jby,jbbuts);
  5750.                  printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
  5751.                  printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
  5752.                }
  5753.                getch();
  5754.             }
  5755.  
  5756.  
  5757.  
  5758.  
  5759.  
  5760.  
  5761.  
  5762.  
  5763.  
  5764.  
  5765.  
  5766.  
  5767.  
  5768.  
  5769.  
  5770.  
  5771.  
  5772.  
  5773.  
  5774.  
  5775.  
  5776.  
  5777.  
  5778.  
  5779.  
  5780.  
  5781.  
  5782.  
  5783.  
  5784.  
  5785.  
  5786.  
  5787.  
  5788.  
  5789.  
  5790.  
  5791.  
  5792.  
  5793.  
  5794.  
  5795.                                                                          92
  5796.  
  5797.  
  5798.  
  5799.  
  5800.  
  5801.           MOUSEBUTPRESS
  5802.  
  5803.             PROTOTYPE
  5804.  
  5805.             extern void far mousebutpress (int reqbut, int far *xloc, int
  5806.             far *yloc, int far *num, int far *mbuts)
  5807.  
  5808.             INPUT
  5809.  
  5810.             reqbut - button for which information is requested
  5811.  
  5812.             OUTPUT
  5813.  
  5814.             x, y - current location of mouse cursor
  5815.             num - number of times requested button has been pressed since
  5816.             last request
  5817.             mbuts - current status of mouse buttons
  5818.  
  5819.             USAGE
  5820.  
  5821.             MOUSEBUTPRESS returns in Num the number of times a mouse
  5822.             button has been pressed since the last call to MOUSEBUTPRESS.
  5823.             In addition the current status of the mouse cursor and buttons
  5824.             is returned.  The position is returned in X, Y.  The buttons'
  5825.             status is held in mbuts.  The left button is held in bit zero,
  5826.             right button in bit one and center button - for three button
  5827.             mice - in bit two.  Button status is most easily checked with
  5828.             a bitwise AND of mbuts and the desired bit.  The button for
  5829.             which a history is desired is identified by the bits in
  5830.             reqbut.  However, only one bit in reqbut may be set.
  5831.             Therefore, only the values of 1, 2 and 4 are permitted.  If
  5832.             more than one bit in reqbut is set, the function will exit and
  5833.             no information will be returned.
  5834.  
  5835.             SEE ALSO
  5836.  
  5837.             MOUSEBUTRELEASE, MOUSESTATUS
  5838.  
  5839.             EXAMPLE
  5840.  
  5841.             /* enable,show mouse / display left button press history for
  5842.             the last 2
  5843.              * seconds
  5844.              */
  5845.  
  5846.             #include <stdlib.h>
  5847.             #include <conio.h>
  5848.             #include "svgacc.h"
  5849.  
  5850.             void main(void)
  5851.             {
  5852.                int vmode, x, y, n, mbuts;
  5853.                char text[50];
  5854.  
  5855.  
  5856.  
  5857.                                                                          93
  5858.  
  5859.  
  5860.  
  5861.  
  5862.  
  5863.                char textclr[]="
  5864.             ";
  5865.  
  5866.                vmode = videomodeget();
  5867.                if ( !whichvga() )
  5868.                  exit(1);
  5869.                if ( whichmem() < 512)
  5870.                  exit(1);
  5871.                if ( !whichmouse())
  5872.                  exit(1);
  5873.                res640();
  5874.                mousecursordefault();
  5875.                mouseenter();
  5876.                mouseshow();
  5877.                while(!kbhit())
  5878.                {
  5879.                  mousebutpress(1,&x,&y,&n,&mbuts);
  5880.                  sprintf(text,"mouse x loc: %3d, y loc: %3d, number of
  5881.             times: %2d",x,y,n);
  5882.                  mousehide();
  5883.                  drwstring(1,15,8,text,0,0);
  5884.                  mouseshow();
  5885.                  sdelay(80);
  5886.                  mousehide();
  5887.                  drwstring(1,15,8,textclr,0,0);
  5888.                  mouseshow();
  5889.                }
  5890.                mousehide();
  5891.                mouseexit();
  5892.                videomodeset(vmode);
  5893.                exit(0);
  5894.             }
  5895.  
  5896.  
  5897.  
  5898.  
  5899.  
  5900.  
  5901.  
  5902.  
  5903.  
  5904.  
  5905.  
  5906.  
  5907.  
  5908.  
  5909.  
  5910.  
  5911.  
  5912.  
  5913.  
  5914.  
  5915.  
  5916.  
  5917.  
  5918.  
  5919.                                                                          94
  5920.  
  5921.  
  5922.  
  5923.  
  5924.  
  5925.           MOUSEBUTRELEASE
  5926.  
  5927.             PROTOTYPE
  5928.  
  5929.             extern void far mousebutrelease (int reqbut, int far *xloc,
  5930.             int far *yloc, int far *num, int far *mbuts)
  5931.  
  5932.             INPUT
  5933.  
  5934.             reqbut - button for which information is requested
  5935.  
  5936.             OUTPUT
  5937.  
  5938.             x, y - current location of mouse cursor
  5939.             num - number of times requested button has been released since
  5940.             last request
  5941.             mbuts - current status of mouse buttons
  5942.  
  5943.             USAGE
  5944.  
  5945.             MOUSEBUTRELEASE returns in Num the number of times a mouse
  5946.             button has been released since the last call to
  5947.             MOUSEBUTRELEASE.  In addition the current status of the mouse
  5948.             cursor and buttons is returned.  The position is returned in
  5949.             x, y.  The buttons' status is held in mbuts.  The left button
  5950.             is held in bit zero, right button in bit one and center button
  5951.             - for three button mice - in bit two.  Button status is most
  5952.             easily checked with a bitwise AND of mbuts and the desired
  5953.             bit.  The button for which a history is desired is identified
  5954.             by the bits in reqbut.  However, only one bit in reqbut may be
  5955.             set.  Therefore, only the values of 1, 2 and 4 are permitted.
  5956.             If more than one bit in reqbut is set, the function will exit
  5957.             and no information will be returned.
  5958.  
  5959.             SEE ALSO
  5960.  
  5961.             MOUSEBUTPRESS, MOUSESTATUS
  5962.  
  5963.             EXAMPLE
  5964.  
  5965.             /* enable,show mouse / display left button release history for
  5966.             the last
  5967.              * 2 seconds
  5968.              */
  5969.  
  5970.             #include <stdlib.h>
  5971.             #include <conio.h>
  5972.             #include "svgacc.h"
  5973.  
  5974.             void main(void)
  5975.             {
  5976.                int vmode, x, y, n, mbuts;
  5977.                char text[50];
  5978.  
  5979.  
  5980.  
  5981.                                                                          95
  5982.  
  5983.  
  5984.  
  5985.  
  5986.  
  5987.                char textclr[]="
  5988.             ";
  5989.  
  5990.                vmode = videomodeget();
  5991.                if ( !whichvga() )
  5992.                  exit(1);
  5993.                if ( whichmem() < 512)
  5994.                  exit(1);
  5995.                if ( !whichmouse())
  5996.                  exit(1);
  5997.                res640();
  5998.                mousecursordefault();
  5999.                mouseenter();
  6000.                mouseshow();
  6001.                while(!kbhit())
  6002.                {
  6003.                  mousebutrelease(1,&x,&y,&n,&mbuts);
  6004.                  sprintf(text,"mouse x loc: %3d, y loc: %3d, number of
  6005.             times: %2d",x,y,n);
  6006.                  mousehide();
  6007.                  drwstring(1,15,8,text,0,0);
  6008.                  mouseshow();
  6009.                  sdelay(80);
  6010.                  mousehide();
  6011.                  drwstring(1,15,8,textclr,0,0);
  6012.                  mouseshow();
  6013.                }
  6014.                mousehide();
  6015.                mouseexit();
  6016.                videomodeset(vmode);
  6017.                exit(0);
  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.           MOUSECURSORSET
  6050.  
  6051.             PROTOTYPE
  6052.  
  6053.             extern void far mousecursorset (MouseCursor far *mousecursor)
  6054.  
  6055.             INPUT
  6056.  
  6057.             mousecursor - MouseCursor pointer to mouse cursor data
  6058.  
  6059.             OUTPUT
  6060.  
  6061.             no value returned
  6062.  
  6063.             USAGE
  6064.  
  6065.             MOUSECURSORSET defines the cursor according to the data in the
  6066.             MouseCursor structure.  The hot spot for the cursor is set by
  6067.             mousecursor.hotspotx, mousecursor.hotspoty.  The values for
  6068.             mousecursor.hotspotx and mousecursor.hotspoty must be within
  6069.             the cursor.  Valid mousecursor.hotspotx values are from 0 to
  6070.             15 and mousecursor.hotspoty ranges from 0 to 23.
  6071.  
  6072.             SEE ALSO
  6073.  
  6074.             MOUSECURSORDEFAULT, MOUSEENTER, MOUSESHOW
  6075.  
  6076.             EXAMPLE
  6077.  
  6078.             /*
  6079.              * enable,show mouse, and switch to a different mouse cursor
  6080.              */
  6081.  
  6082.             #include <stdlib.h>
  6083.             #include <conio.h>
  6084.             #include "svgacc.h"
  6085.  
  6086.             void main(void)
  6087.             {
  6088.                int vmode;
  6089.  
  6090.                MouseCursor bigmousecursor = {
  6091.                  1,1,
  6092.  
  6093.                0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,
  6094.                  0,15,15,0,0,255,255,255,255,255,255,255,255,255,255,255,
  6095.                  0,15,15,15,15,0,0,0,255,255,255,255,255,255,255,255,
  6096.                  0,15,15,15,15,15,15,15,0,0,255,255,255,255,255,255,
  6097.                  0,15,15,15,15,15,15,15,15,15,0,0,0,255,255,255,
  6098.                  0,15,15,15,15,15,15,15,15,15,15,15,15,0,0,255,
  6099.                  0,15,15,15,15,15,15,15,15,15,15,15,15,15,0,255,
  6100.                  0,15,15,15,15,15,15,15,15,15,15,15,0,0,255,255,
  6101.                  0,15,15,15,15,15,15,15,15,15,15,0,255,255,255,255,
  6102.                  0,15,15,15,15,15,15,15,15,0,0,255,255,255,255,255,
  6103.  
  6104.  
  6105.                                                                          97
  6106.  
  6107.  
  6108.  
  6109.  
  6110.  
  6111.                  0,15,15,15,15,15,15,15,15,0,255,255,255,255,255,255,
  6112.                  0,15,15,15,15,15,0,15,15,15,0,255,255,255,255,255,
  6113.                  0,15,15,15,15,0,0,15,15,15,0,255,255,255,255,255,
  6114.                  0,15,15,0,0,255,255,0,15,15,15,0,255,255,255,255,
  6115.                  0,15,0,255,255,255,255,0,15,15,15,0,255,255,255,255,
  6116.                  0,0,255,255,255,255,255,255,0,15,15,15,0,255,255,255,
  6117.                  255,255,255,255,255,255,255,255,255,0,15,15,15,0,255,255,
  6118.                  255,255,255,255,255,255,255,255,255,0,15,15,15,0,255,255,
  6119.                  255,255,255,255,255,255,255,255,255,255,0,15,15,15,0,255,
  6120.                  255,255,255,255,255,255,255,255,255,255,255,0,15,15,15,0,
  6121.                  255,255,255,255,255,255,255,255,255,255,255,0,15,15,15,0,
  6122.  
  6123.                255,255,255,255,255,255,255,255,255,255,255,255,0,15,15,0,
  6124.  
  6125.                255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,
  6126.  
  6127.                255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
  6128.             255
  6129.                };
  6130.  
  6131.                vmode = videomodeget();
  6132.                if ( !whichvga() )
  6133.                  exit(1);
  6134.                if ( whichmem() < 512)
  6135.                  exit(1);
  6136.                if ( !whichmouse())
  6137.                  exit(1);
  6138.                res640();
  6139.                mouseenter();
  6140.                drwstring(1,7,0,"press a key to return to default
  6141.             cursor",0,0);
  6142.                mousecursorset(bigmousecursor);
  6143.                mouseshow();
  6144.                getch();
  6145.                mousecursordefault();
  6146.                drwstring(1,7,0,"press a key to end
  6147.             ",0,0);
  6148.                getch();
  6149.                mousehide();
  6150.                mouseexit();
  6151.                videomodeset(vmode);
  6152.                exit(0);
  6153.             }
  6154.  
  6155.  
  6156.  
  6157.  
  6158.  
  6159.  
  6160.  
  6161.  
  6162.  
  6163.  
  6164.  
  6165.  
  6166.  
  6167.                                                                          98
  6168.  
  6169.  
  6170.  
  6171.  
  6172.  
  6173.           MOUSECURSORDEFAULT
  6174.  
  6175.             PROTOTYPE
  6176.  
  6177.             extern void far mousecursordefault (void)
  6178.  
  6179.             INPUT
  6180.  
  6181.             no input parameters
  6182.  
  6183.             OUTPUT
  6184.  
  6185.             no value returned
  6186.  
  6187.             USAGE
  6188.  
  6189.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  6190.             arrow with the hot spot in the upper, left corner.  This is
  6191.             the cursor set when MOUSEENTER is called.
  6192.  
  6193.             SEE ALSO
  6194.  
  6195.             MOUSECURSORSET, MOUSEENTER
  6196.  
  6197.             EXAMPLE
  6198.  
  6199.             See MOUSECURSORSET
  6200.  
  6201.  
  6202.  
  6203.  
  6204.  
  6205.  
  6206.  
  6207.  
  6208.  
  6209.  
  6210.  
  6211.  
  6212.  
  6213.  
  6214.  
  6215.  
  6216.  
  6217.  
  6218.  
  6219.  
  6220.  
  6221.  
  6222.  
  6223.  
  6224.  
  6225.  
  6226.  
  6227.  
  6228.  
  6229.                                                                          99
  6230.  
  6231.  
  6232.  
  6233.  
  6234.  
  6235.           MOUSEENTER
  6236.  
  6237.             PROTOTYPE
  6238.  
  6239.             extern void far mouseenter (void)
  6240.  
  6241.             INPUT
  6242.  
  6243.             no input parameters
  6244.  
  6245.             OUTPUT
  6246.  
  6247.             no value returned
  6248.  
  6249.             USAGE
  6250.  
  6251.             MOUSEENTER must be called before any other mouse functions.
  6252.             It initializes all of the mouse abilities including installing
  6253.             the Zephyr mouse display driver.  MOUSEENTER initializes the
  6254.             default mouse cursor, the default sensitivity and sets the
  6255.             range to the current screen resolution.  The mouse cursor
  6256.             location is set to the middle of the screen.
  6257.  
  6258.             SEE ALSO
  6259.  
  6260.             MOUSEEXIT, MOUSEHIDE, MOUSESHOW
  6261.  
  6262.             EXAMPLE
  6263.  
  6264.             /*
  6265.              * enable,show mouse
  6266.              */
  6267.             #include <stdlib.h>
  6268.             #include <conio.h>
  6269.             #include "svgacc.h"
  6270.  
  6271.             void main(void)
  6272.             {
  6273.                int vmode;
  6274.  
  6275.                vmode = videomodeget();
  6276.                if ( !whichvga() )
  6277.                  exit(1);
  6278.                if ( whichmem() < 512)
  6279.                  exit(1);
  6280.                if ( !whichmouse())
  6281.                  exit(1);
  6282.                res640();
  6283.                mouseenter();
  6284.                mouseshow();
  6285.                getch();
  6286.                mousehide();
  6287.                mouseexit();
  6288.                videomodeset(vmode);
  6289.  
  6290.  
  6291.                                                                         100
  6292.  
  6293.  
  6294.  
  6295.  
  6296.  
  6297.                exit(0);
  6298.             }
  6299.  
  6300.  
  6301.  
  6302.  
  6303.  
  6304.  
  6305.  
  6306.  
  6307.  
  6308.  
  6309.  
  6310.  
  6311.  
  6312.  
  6313.  
  6314.  
  6315.  
  6316.  
  6317.  
  6318.  
  6319.  
  6320.  
  6321.  
  6322.  
  6323.  
  6324.  
  6325.  
  6326.  
  6327.  
  6328.  
  6329.  
  6330.  
  6331.  
  6332.  
  6333.  
  6334.  
  6335.  
  6336.  
  6337.  
  6338.  
  6339.  
  6340.  
  6341.  
  6342.  
  6343.  
  6344.  
  6345.  
  6346.  
  6347.  
  6348.  
  6349.  
  6350.  
  6351.  
  6352.  
  6353.                                                                         101
  6354.  
  6355.  
  6356.  
  6357.  
  6358.  
  6359.           MOUSEEXIT
  6360.  
  6361.             PROTOTYPE
  6362.  
  6363.             extern void far mouseexit (void)
  6364.  
  6365.             INPUT
  6366.  
  6367.             no input parameters
  6368.  
  6369.             OUTPUT
  6370.  
  6371.             no value returned
  6372.  
  6373.             USAGE
  6374.  
  6375.             MOUSEEXIT properly disables all of the mouse abilities.  This
  6376.             function also removes the Zephyr mouse display driver.  This
  6377.             function should be called prior to exiting any program that
  6378.             previously called MOUSEENTER.
  6379.  
  6380.             SEE ALSO
  6381.  
  6382.             MOUSEENTER, MOUSEHIDE, MOUSESHOW
  6383.  
  6384.             EXAMPLE
  6385.  
  6386.             /*
  6387.              * enable,show mouse, then disable it
  6388.              */
  6389.             #include <stdlib.h>
  6390.             #include <conio.h>
  6391.             #include "svgacc.h"
  6392.  
  6393.             void main(void)
  6394.             {
  6395.                int vmode;
  6396.  
  6397.                vmode = videomodeget();
  6398.                if ( !whichvga() )
  6399.                  exit(1);
  6400.                if ( whichmem() < 512)
  6401.                  exit(1);
  6402.                if ( !whichmouse())
  6403.                  exit(1);
  6404.                res640();
  6405.                mousecursordefault();
  6406.                mouseenter();
  6407.                mouseshow();
  6408.                getch();
  6409.                mousehide();
  6410.                mouseexit();
  6411.                videomodeset(vmode);
  6412.                exit(0);
  6413.  
  6414.  
  6415.                                                                         102
  6416.  
  6417.  
  6418.  
  6419.  
  6420.  
  6421.             }
  6422.  
  6423.  
  6424.  
  6425.  
  6426.  
  6427.  
  6428.  
  6429.  
  6430.  
  6431.  
  6432.  
  6433.  
  6434.  
  6435.  
  6436.  
  6437.  
  6438.  
  6439.  
  6440.  
  6441.  
  6442.  
  6443.  
  6444.  
  6445.  
  6446.  
  6447.  
  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.           MOUSEHIDE
  6484.  
  6485.             PROTOTYPE
  6486.  
  6487.             extern void far mousehide (void)
  6488.  
  6489.             INPUT
  6490.  
  6491.             no input parameters
  6492.  
  6493.             OUTPUT
  6494.  
  6495.             no value returned
  6496.  
  6497.             USAGE
  6498.  
  6499.             MOUSEHIDE turns off the mouse display driver and removes the
  6500.             cursor from the display.  It is recommended to hide the mouse
  6501.             any time something will be drawn in its general vicinity.
  6502.             Note, however, that although the cursor is not visible, all
  6503.             other mouse abilities remain active.
  6504.  
  6505.             SEE ALSO
  6506.  
  6507.             MOUSEENTER, MOUSEEXIT, MOUSESHOW
  6508.  
  6509.             EXAMPLE
  6510.  
  6511.             /*
  6512.              * enable,show mouse,hide mouse
  6513.              */
  6514.             #include <stdlib.h>
  6515.             #include <conio.h>
  6516.             #include "svgacc.h"
  6517.             void main(void)
  6518.             {
  6519.                int vmode;
  6520.  
  6521.                vmode = videomodeget();
  6522.                if ( !whichvga() )
  6523.                  exit(1);
  6524.                if ( whichmem() < 512)
  6525.                  exit(1);
  6526.                if ( !whichmouse())
  6527.                  exit(1);
  6528.                res640();
  6529.                mousecursordefault();
  6530.                mouseenter();
  6531.                mouseshow();
  6532.                getch();
  6533.                mousehide();
  6534.                getch();
  6535.                mouseexit();
  6536.                videomodeset(vmode);
  6537.  
  6538.  
  6539.                                                                         104
  6540.  
  6541.  
  6542.  
  6543.  
  6544.  
  6545.                exit(0);
  6546.             }
  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.           MOUSEINFO
  6608.  
  6609.             PROTOTYPE
  6610.  
  6611.             extern void far mouseinfo (int far *drvmajorver, int far
  6612.             *drvminorver, int far *mousetype, int far *irqnumber)
  6613.  
  6614.             INPUT
  6615.  
  6616.             no input parameters
  6617.  
  6618.             OUTPUT
  6619.  
  6620.             drvmajorver - Microsoft compatible mouse driver major version
  6621.             number
  6622.             drvminorver - Microsoft compatible mouse driver minor version
  6623.             number
  6624.             mousetype - type of mouse installed
  6625.             irqnumber - interrupt used by the mouse
  6626.  
  6627.             USAGE
  6628.  
  6629.             MOUSEINFO returns information about the mouse and its
  6630.             installed driver.  The driver must be Microsoft compatible.
  6631.             This information can be used to determine whether the mouse
  6632.             functions in this library will operate correctly.  For proper
  6633.             operation the driver version number must be greater than 1.00.
  6634.             Irqnumber gives the interrupt number of the mouse.  Mousetype
  6635.             returns information about the type of hardware installed
  6636.             according to the following table:
  6637.  
  6638.             0 =  unknown type
  6639.             1 =  bus mouse
  6640.             2 =  serial mouse
  6641.             3 =  Inport mouse
  6642.             4 =  PS/2 mouse
  6643.             5 =  HP mouse
  6644.  
  6645.             SEE ALSO
  6646.  
  6647.             WHICHMOUSE
  6648.  
  6649.             EXAMPLE
  6650.  
  6651.             /*
  6652.              * id any installed mouse
  6653.              */
  6654.  
  6655.             #include <stdlib.h>
  6656.             #include <conio.h>
  6657.             #include "svgacc.h"
  6658.  
  6659.             void main(void)
  6660.             {
  6661.  
  6662.  
  6663.                                                                         106
  6664.  
  6665.  
  6666.  
  6667.  
  6668.  
  6669.                int mjv, mnv, tp, i, mouse;
  6670.                char buf[100];
  6671.  
  6672.                mouse = whichmouse();
  6673.                if (mouse > 0) {
  6674.                  mouseinfo(&mjv, &mnv, &tp, &i);
  6675.                  switch (tp) {
  6676.                     case 1:
  6677.                       sprintf(buf,"bus mouse");
  6678.                       break;
  6679.                     case 2:
  6680.                       sprintf(buf,"serial mouse");
  6681.                       break;
  6682.                     case 3:
  6683.                       sprintf(buf,"Inport mouse");
  6684.                       break;
  6685.                     case 4:
  6686.                       sprintf(buf,"PS/2 mouse");
  6687.                       break;
  6688.                     case 5:
  6689.                       sprintf(buf,"HP mouse");
  6690.                       break;
  6691.                     default:
  6692.                       sprintf(buf,"unknown type");
  6693.                  }
  6694.                  printf("Microsoft compatible %s detected with %d buttons
  6695.             on IRQ %d.\n", &buf, mouse, i);
  6696.                  printf("Software driver version is %d.%d (Microsoft
  6697.             equivalent version).\n\n", mjv, mnv);
  6698.  
  6699.                } else
  6700.                  printf("No Microsoft compatible mouse detected.\n\n");
  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.           MOUSELOCSET
  6732.  
  6733.             PROTOTYPE
  6734.  
  6735.             extern void far mouselocset (int xloc, int yloc)
  6736.  
  6737.             INPUT
  6738.  
  6739.             x, y - location on screen
  6740.  
  6741.             OUTPUT
  6742.  
  6743.             no value returned
  6744.  
  6745.             USAGE
  6746.  
  6747.             MOUSELOCSET moves the mouse cursor the location on the screen
  6748.             specified by x, y.  If either x or y is outside of the
  6749.             currently permitted mouse range, it is set to the closest
  6750.             border.  The currently permitted mouse range is the current
  6751.             screen resolution or the last called MOUSERANGESET.
  6752.  
  6753.             SEE ALSO
  6754.  
  6755.             MOUSEENTER, MOUSERANGESET
  6756.  
  6757.             EXAMPLE
  6758.  
  6759.             /*
  6760.              * enable,show mouse then move it to the origin
  6761.              */
  6762.             #include <stdlib.h>
  6763.             #include <conio.h>
  6764.             #include "svgacc.h"
  6765.             void main(void)
  6766.             {
  6767.                int vmode;
  6768.                vmode = videomodeget();
  6769.                if ( !whichvga() )
  6770.                  exit(1);
  6771.                if ( whichmem() < 512)
  6772.                  exit(1);
  6773.                if ( !whichmouse())
  6774.                  exit(1);
  6775.                res640();
  6776.                mousecursordefault();
  6777.                mouseenter();
  6778.                mouseshow();
  6779.                getch();
  6780.                mouselocset(0,0);
  6781.                getch();
  6782.                mousehide();
  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.           MOUSERANGESET
  6856.  
  6857.             PROTOTYPE
  6858.  
  6859.             extern void far mouserangeset (int x1, int y1, int x2, int y2)
  6860.  
  6861.             INPUT
  6862.  
  6863.             x1, y1 - location on screen of top, left corner of range
  6864.             x2, y2 - location on screen of bottom, right corner of range
  6865.  
  6866.             OUTPUT
  6867.  
  6868.             no value returned
  6869.  
  6870.             USAGE
  6871.  
  6872.             MOUSERANGESET defines a permissible range on the screen for
  6873.             mouse movement.  The mouse is automatically positioned in the
  6874.             center of this range.
  6875.  
  6876.             SEE ALSO
  6877.  
  6878.             MOUSELOCSET, MOUSESTATUS
  6879.  
  6880.             EXAMPLE
  6881.  
  6882.             /*
  6883.              * enable,show and set a range for the mouse
  6884.              */
  6885.  
  6886.             #include <stdlib.h>
  6887.             #include <conio.h>
  6888.             #include "svgacc.h"
  6889.  
  6890.             void main(void)
  6891.             {
  6892.                int vmode;
  6893.                vmode = videomodeget();
  6894.                if ( !whichvga() )
  6895.                  exit(1);
  6896.                if ( whichmem() < 512)
  6897.                  exit(1);
  6898.                if ( !whichmouse())
  6899.                  exit(1);
  6900.                if ( !res640() )
  6901.                  exit(1);
  6902.                mouseenter();
  6903.                drwbox(1,10,100,100,539,379);
  6904.                mouserangeset(100,100,539,379);
  6905.                mouseshow();
  6906.                getch();
  6907.                mousehide();
  6908.                mouseexit();
  6909.  
  6910.  
  6911.                                                                         110
  6912.  
  6913.  
  6914.  
  6915.  
  6916.  
  6917.                videomodeset(vmode);
  6918.                exit(0);
  6919.             }
  6920.  
  6921.  
  6922.  
  6923.  
  6924.  
  6925.  
  6926.  
  6927.  
  6928.  
  6929.  
  6930.  
  6931.  
  6932.  
  6933.  
  6934.  
  6935.  
  6936.  
  6937.  
  6938.  
  6939.  
  6940.  
  6941.  
  6942.  
  6943.  
  6944.  
  6945.  
  6946.  
  6947.  
  6948.  
  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.           MOUSERESTORESTATE
  6980.  
  6981.             PROTOTYPE
  6982.  
  6983.             extern void far mouserestorestate (byte far *mousebuf)
  6984.  
  6985.             INPUT
  6986.  
  6987.             mousebuf - byte pointer to buffer holding complete mouse
  6988.             status information
  6989.  
  6990.             OUTPUT
  6991.  
  6992.             no value returned
  6993.  
  6994.             USAGE
  6995.  
  6996.             MOUSERESTORESTATE completely restores a previously saved mouse
  6997.             status as contained in mousebuf.  The mouse status must have
  6998.             been already stored in mousebuf by MOUSESAVESTATE.
  6999.  
  7000.             SEE ALSO
  7001.  
  7002.             MOUSESAVESTATE, MOUSESTORAGESIZE
  7003.  
  7004.             EXAMPLE
  7005.  
  7006.             /*
  7007.              * save the mouse driver state,shell out to DOS, restore the
  7008.             driver state
  7009.              */
  7010.  
  7011.             #include <stdlib.h>
  7012.             #include <conio.h>
  7013.             #include <process.h>
  7014.             #include "svgacc.h"
  7015.  
  7016.             void main(void)
  7017.             {
  7018.                int rt, bufsiz;
  7019.                byte *mousedriverdata;
  7020.                char cmdcom[]="C:\COMMAND.COM";
  7021.                char *args[1];
  7022.  
  7023.                if ( !whichmouse())
  7024.                  exit(1);
  7025.                bufsiz=mousestoragesize();
  7026.                mousedriverdata = (byte *)malloc(bufsiz);
  7027.                mousesavestate(mousedriverdata);
  7028.                printf("* Type Exit To Return To Program *");
  7029.                args[0]=NULL;
  7030.                rt=spawnv(P_WAIT,cmdcom,args);
  7031.                mouserestorestate(mousedriverdata);
  7032.                printf("mouse driver data restored...");
  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.           MOUSESAVESTATE
  7104.  
  7105.             PROTOTYPE
  7106.  
  7107.             extern void far mousesavestate (byte far *mousebuf)
  7108.  
  7109.             INPUT
  7110.  
  7111.             no input parameters
  7112.  
  7113.             OUTPUT
  7114.  
  7115.             no value returned
  7116.             mousebuf - buffer holding complete mouse status information
  7117.  
  7118.             USAGE
  7119.  
  7120.             MOUSESAVESTATE saves the complete mouse status in mousebuf.
  7121.             The size of mousebuf in bytes is defined by MOUSESTORAGESIZE
  7122.             which should called first.
  7123.  
  7124.             SEE ALSO
  7125.  
  7126.             MOUSERESTORESTATE, MOUSESTORAGESIZE
  7127.  
  7128.             EXAMPLE
  7129.  
  7130.             See MOUSERESTORESTATE
  7131.  
  7132.  
  7133.  
  7134.  
  7135.  
  7136.  
  7137.  
  7138.  
  7139.  
  7140.  
  7141.  
  7142.  
  7143.  
  7144.  
  7145.  
  7146.  
  7147.  
  7148.  
  7149.  
  7150.  
  7151.  
  7152.  
  7153.  
  7154.  
  7155.  
  7156.  
  7157.  
  7158.  
  7159.                                                                         114
  7160.  
  7161.  
  7162.  
  7163.  
  7164.  
  7165.           MOUSESENSSET
  7166.  
  7167.             PROTOTYPE
  7168.  
  7169.             extern void far mousesensset (int xsens, int ysens, int
  7170.             dblspdthresh)
  7171.  
  7172.             INPUT
  7173.  
  7174.             xsens = number of mickeys per 8 pixels horizontally (default =
  7175.             8 mickeys per 8 pixels)
  7176.             ysens = number of mickeys per 8 pixels vertically (default =
  7177.             16 mickeys per 8 pixels)
  7178.             dblspdthresh=number of mickeys per second at which speed is
  7179.             doubled (default = 64)
  7180.  
  7181.             OUTPUT
  7182.  
  7183.             no value returned
  7184.  
  7185.             USAGE
  7186.  
  7187.             MOUSESENSSET defines the relationship between mouse movement
  7188.             and cursor movement on the screen.  A mickey is defined as
  7189.             1/200th of an inch.  The ratio between mickeys and pixels is
  7190.             specified by xsens and ysens in the horizontal and vertical
  7191.             directions respectively.  When the mouse movement is faster
  7192.             than DblSpdThresh in mickeys per second, the speed is doubled.
  7193.             The default values are assigned whenever MOUSEENTER or
  7194.             MOUSEEXIT are called.
  7195.  
  7196.             SEE ALSO
  7197.  
  7198.             MOUSEENTER, MOUSEEXIT, MOUSESTATUS
  7199.  
  7200.             EXAMPLE
  7201.  
  7202.             /*
  7203.              * enable,show the mouse and make it very sensitive
  7204.              */
  7205.  
  7206.             #include <stdlib.h>
  7207.             #include <conio.h>
  7208.             #include "svgacc.h"
  7209.             void main(void)
  7210.             {
  7211.                int vmode;
  7212.                vmode = videomodeget();
  7213.                if ( !whichvga() )
  7214.                  exit(1);
  7215.                if ( whichmem() < 512)
  7216.                  exit(1);
  7217.                if ( !whichmouse())
  7218.                  exit(1);
  7219.  
  7220.  
  7221.                                                                         115
  7222.  
  7223.  
  7224.  
  7225.  
  7226.  
  7227.                res640();
  7228.                mousecursordefault();
  7229.                mouseenter();
  7230.                mouseshow();
  7231.                mousesensset(100,100);
  7232.                getch();
  7233.                mousehide();
  7234.                mouseexit();
  7235.                videomodeset(vmode);
  7236.                exit(0);
  7237.             }
  7238.  
  7239.  
  7240.  
  7241.  
  7242.  
  7243.  
  7244.  
  7245.  
  7246.  
  7247.  
  7248.  
  7249.  
  7250.  
  7251.  
  7252.  
  7253.  
  7254.  
  7255.  
  7256.  
  7257.  
  7258.  
  7259.  
  7260.  
  7261.  
  7262.  
  7263.  
  7264.  
  7265.  
  7266.  
  7267.  
  7268.  
  7269.  
  7270.  
  7271.  
  7272.  
  7273.  
  7274.  
  7275.  
  7276.  
  7277.  
  7278.  
  7279.  
  7280.  
  7281.  
  7282.  
  7283.                                                                         116
  7284.  
  7285.  
  7286.  
  7287.  
  7288.  
  7289.           MOUSESHOW
  7290.  
  7291.             PROTOTYPE
  7292.  
  7293.             extern void far mouseshow (void)
  7294.  
  7295.             INPUT
  7296.  
  7297.             no input parameters
  7298.  
  7299.             OUTPUT
  7300.  
  7301.             no value returned
  7302.  
  7303.             USAGE
  7304.  
  7305.             MOUSESHOW enables the mouse display driver and places the
  7306.             cursor on the screen.  The cursor is only updated when the
  7307.             mouse is moved.  Therefore, it is recommended to hide the
  7308.             cursor when drawing on the screen to avoid unexpected results.
  7309.  
  7310.             SEE ALSO
  7311.  
  7312.             MOUSEENTER, MOUSEEXIT, MOUSEHIDE
  7313.  
  7314.             EXAMPLE
  7315.  
  7316.             See MOUSEHIDE
  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.           MOUSESTATUS
  7352.  
  7353.             PROTOTYPE
  7354.  
  7355.             extern void far mousestatus (int far *x, int far *y, int far
  7356.             *mbuts)
  7357.  
  7358.             INPUT
  7359.  
  7360.             no input parameters
  7361.  
  7362.             OUTPUT
  7363.  
  7364.             x, y - mouse position on screen
  7365.             mbuts - status of mouse buttons
  7366.  
  7367.             USAGE
  7368.  
  7369.             MOUSESTATUS returns the current status of the mouse position
  7370.             and buttons.  The position is returned in x, y.  The buttons'
  7371.             status is held in mbuts.  The left button is held in bit zero,
  7372.             right button in bit one and center button - for three button
  7373.             mice - in bit two.  Button status is most easily checked with
  7374.             a bitwise AND of mbuts and the desired bit.
  7375.  
  7376.             SEE ALSO
  7377.  
  7378.             MOUSERANGESET, MOUSESENSSET
  7379.  
  7380.             EXAMPLE
  7381.  
  7382.             /* enable,show mouse & display status */
  7383.             #include <stdlib.h>
  7384.             #include <conio.h>
  7385.             #include "svgacc.h"
  7386.  
  7387.             void main(void)
  7388.             {
  7389.                int vmode, x, y, mbuts;
  7390.                char buf[100];
  7391.  
  7392.                vmode = videomodeget();
  7393.                if ( !whichvga() || (whichmem() < 512))
  7394.                  exit(1);
  7395.                if ( !whichmouse())
  7396.                  exit(1);
  7397.                res640();
  7398.                mouseenter();
  7399.                mouseshow();
  7400.                while(!kbhit()) {
  7401.                  mousestatus(&x,&y,&mbuts);
  7402.                  sprintf(buf,"X= %4d  Y= %4d  LB= %1d  CB= %1d  RB=
  7403.             %1d\0",x,y,(mbuts & 1),(mbuts & 2),(mbuts & 4));
  7404.                  drwstring(1,15,8,buf,10,32);
  7405.  
  7406.  
  7407.                                                                         118
  7408.  
  7409.  
  7410.  
  7411.  
  7412.  
  7413.                }
  7414.                mousehide();
  7415.                mouseexit();
  7416.                videomodeset(vmode);
  7417.             }
  7418.  
  7419.  
  7420.  
  7421.  
  7422.  
  7423.  
  7424.  
  7425.  
  7426.  
  7427.  
  7428.  
  7429.  
  7430.  
  7431.  
  7432.  
  7433.  
  7434.  
  7435.  
  7436.  
  7437.  
  7438.  
  7439.  
  7440.  
  7441.  
  7442.  
  7443.  
  7444.  
  7445.  
  7446.  
  7447.  
  7448.  
  7449.  
  7450.  
  7451.  
  7452.  
  7453.  
  7454.  
  7455.  
  7456.  
  7457.  
  7458.  
  7459.  
  7460.  
  7461.  
  7462.  
  7463.  
  7464.  
  7465.  
  7466.  
  7467.  
  7468.  
  7469.                                                                         119
  7470.  
  7471.  
  7472.  
  7473.  
  7474.  
  7475.           MOUSESTORAGESIZE
  7476.  
  7477.             PROTOTYPE
  7478.  
  7479.             extern int far mousestoragesize (void)
  7480.  
  7481.             INPUT
  7482.  
  7483.             no input parameters
  7484.  
  7485.             OUTPUT
  7486.  
  7487.             MOUSESTORAGESIZE returns the size of buffer in bytes to store
  7488.             complete mouse status
  7489.  
  7490.             USAGE
  7491.  
  7492.             MOUSESTORAGESIZE determines the proper size buffer to hold the
  7493.             complete mouse status information.  This buffer should be
  7494.             allocated before calling MOUSESAVESTATE.
  7495.  
  7496.             SEE ALSO
  7497.  
  7498.             MOUSERESTORESTATE, MOUSESAVESTATE
  7499.  
  7500.             EXAMPLE
  7501.  
  7502.             /*
  7503.              * return the size in bytes need to save the mouse driver
  7504.             status
  7505.              */
  7506.  
  7507.             #include <stdlib.h>
  7508.             #include <conio.h>
  7509.             #include "svgacc.h"
  7510.  
  7511.             void main(void)
  7512.             {
  7513.                int bufsiz;
  7514.                char buf[50];
  7515.  
  7516.                if ( !whichmouse())
  7517.                  exit(1);
  7518.  
  7519.                bufsiz=mousestoragesize();
  7520.                sprintf(buf,"%d bytes are required to save mouse driver
  7521.             status...",bufsiz);
  7522.                printf("%s", &buf);
  7523.                exit(0);
  7524.             }
  7525.  
  7526.  
  7527.  
  7528.  
  7529.  
  7530.  
  7531.                                                                         120
  7532.  
  7533.  
  7534.  
  7535.  
  7536.  
  7537.           OVERSCANSET
  7538.  
  7539.             PROTOTYPE
  7540.  
  7541.             extern void far overscanset (int colr)
  7542.  
  7543.             INPUT
  7544.  
  7545.             colr - index to color in current palette
  7546.  
  7547.             OUTPUT
  7548.  
  7549.             no value returned
  7550.  
  7551.             USAGE
  7552.  
  7553.             OVERSCANSET sets the overscan region to the specified color.
  7554.             The overscan region is the area between the usable pixel area
  7555.             and the region not scanned by the monitor.  Normally, the
  7556.             overscan is color zero which is defined as black the majority
  7557.             of the time.  The overscan color is reset to zero anytime a
  7558.             RES### function is called.
  7559.  
  7560.             Note: OVERSCANSET always works in the 320x200 resolution.  In
  7561.             the higher resolutions on many common SVGA cards this function
  7562.             is ignored.  Instead, the card always assigns the overscan
  7563.             region to color zero.  Therefore, it is recommended to not use
  7564.             OVERSCANSET, but assign color zero as needed.
  7565.  
  7566.             EXAMPLE
  7567.  
  7568.             /*
  7569.              * set the overscan color to green
  7570.              */
  7571.  
  7572.             #include <stdlib.h>
  7573.             #include <conio.h>
  7574.             #include "svgacc.h"
  7575.  
  7576.             void main(void)
  7577.             {
  7578.                int vmode;
  7579.                vmode = videomodeget();
  7580.                if ( !whichvga() )
  7581.                  exit(1);
  7582.                res320();
  7583.                overscanset(10);
  7584.                getch();
  7585.                videomodeset(vmode);
  7586.                exit(0);
  7587.             }
  7588.  
  7589.  
  7590.  
  7591.  
  7592.  
  7593.                                                                         121
  7594.  
  7595.  
  7596.  
  7597.  
  7598.  
  7599.           PAGEACTIVE
  7600.  
  7601.             PROTOTYPE
  7602.  
  7603.             extern int far pageactive (int page)
  7604.  
  7605.             INPUT
  7606.  
  7607.             page - number of page to make active
  7608.  
  7609.             OUTPUT
  7610.  
  7611.             PAGEACTIVE returns a 1 if successful, 0 if unsuccessful.
  7612.  
  7613.             USAGE
  7614.  
  7615.             PAGEACTIVE sets the active page as specified by page.  It
  7616.             works by creating an offset to be added when any bank
  7617.             switching is performed.  This function does not affect the
  7618.             actual display.  A page is defined as the number of 64K blocks
  7619.             necessary to contain the current screen resolution.  For
  7620.             example, 640x480 requires 307,200 bytes which is a little more
  7621.             than 4.5 64K blocks.  One page in this resolution will be 5
  7622.             banks.
  7623.  
  7624.             PAGEACTIVE does not work in 320x200 mode since this mode uses
  7625.             no bank switching.
  7626.  
  7627.             SEE ALSO
  7628.  
  7629.             FILLPAGE, PAGEDISPLAY
  7630.  
  7631.             EXAMPLE
  7632.  
  7633.             /*
  7634.             * Show pageactive (video card needs 1meg to show pages in
  7635.             640x480x256)
  7636.             */
  7637.  
  7638.             #include <stdlib.h>
  7639.             #include <math.h>
  7640.             #include <conio.h>
  7641.             #include "svgacc.h"
  7642.  
  7643.             void main(void)
  7644.             {
  7645.                int vmode,er;
  7646.                char text[]="press a key...";
  7647.                char buf[20];
  7648.                vmode = videomodeget();
  7649.                if ( !whichvga() )
  7650.                  exit(1);
  7651.                if ( whichmem() < 1024)
  7652.                  exit(1);
  7653.  
  7654.  
  7655.                                                                         122
  7656.  
  7657.  
  7658.  
  7659.  
  7660.  
  7661.                if ( !res640() )
  7662.                  exit(1);
  7663.                /* make sure video card supports page flipping */
  7664.                if ( !pagedisplay(0,0,0) ) {
  7665.                  videomodeset(vmode);
  7666.                  exit(1);
  7667.                }
  7668.                er = pageactive(0);
  7669.                fillpage(0);
  7670.                drwstring(1,10,0,text,0,300);
  7671.                sprintf(buf,"Page 0");
  7672.                drwstring(1,10,0,buf,0,0);
  7673.                er = pageactive(1);
  7674.                fillpage(0);
  7675.                drwstring(1,12,0,text,0,300);
  7676.                sprintf(buf,"Page 1");
  7677.                drwstring(1,12,0,buf,0,20);
  7678.                er = pageactive(2);
  7679.                fillpage(0);
  7680.                drwstring(1,13,0,text,0,300);
  7681.                sprintf(buf,"Page 2");
  7682.                drwstring(1,13,0,buf,0,40);
  7683.                er = pageactive(0);
  7684.                er = pagedisplay(0,0,0);
  7685.                getch();
  7686.                er = pagedisplay(0,0,1);
  7687.                getch();
  7688.                er = pagedisplay(0,0,2);
  7689.                getch();
  7690.                videomodeset(vmode);
  7691.                exit(0);
  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.           PAGEDISPLAY
  7724.  
  7725.             PROTOTYPE
  7726.  
  7727.             extern int far pagedisplay (int x, int y, int page)
  7728.  
  7729.             INPUT
  7730.  
  7731.             x, y - coordinate to place at top, left of display
  7732.             page - number of page to make active
  7733.  
  7734.             OUTPUT
  7735.  
  7736.             PAGEDISPLAY returns a 1 if successful, 0 if unsuccessful.
  7737.  
  7738.             USAGE
  7739.  
  7740.             PAGEDISPLAY tells the video card where in video memory to
  7741.             begin the display.  This display offset is calculated from the
  7742.             specified page, x and y.  This is done by multiplying y times
  7743.             the width of the current resolution, adding x and then adding
  7744.             the appropriate number of 64K blocks for page.  X, y and page
  7745.             must all be positive numbers, but are otherwise not
  7746.             restricted.  The display will wrap if the values are
  7747.             abnormally large.  Wrapping will happen from side to side as
  7748.             well as from top of memory to bottom of memory.
  7749.  
  7750.             PAGEDISPLAY does not work in 320x200 mode since this mode uses
  7751.             no bank switching.  In addition, older models of some SVGA
  7752.             cards operating in native mode do not support paging.  In this
  7753.             library these cards are: Acumos, Ahead version A, Everex and
  7754.             Genoa.  To ensure compatibility, a program should make a call
  7755.             similar to:
  7756.  
  7757.                if ( !pagedisplay(0,0,0) )
  7758.                  printf("PAGING NOT SUPPORTED\n");
  7759.  
  7760.             Note: SVGA cards by ATI Technologies appear to ignore bit 4
  7761.             (counting from 0 to 19) in its linear addressing mode and
  7762.             assume it is zero.  Therefore, bit 4 of the x parameter will
  7763.             be ignored by ATI chipsets.
  7764.  
  7765.             SEE ALSO
  7766.  
  7767.             FILLPAGE, PAGEACTIVE
  7768.  
  7769.             EXAMPLE
  7770.  
  7771.             See PAGEACTIVE
  7772.  
  7773.  
  7774.  
  7775.  
  7776.  
  7777.  
  7778.  
  7779.                                                                         124
  7780.  
  7781.  
  7782.  
  7783.  
  7784.  
  7785.           PALCHGAUTO
  7786.  
  7787.             PROTOTYPE
  7788.  
  7789.             extern void far palchgauto (RGB far *pal, RGB far *newpal, int
  7790.             firstcolr, int lastcolr, int speed)
  7791.  
  7792.             INPUT
  7793.  
  7794.             pal - initial palette
  7795.             newpal - new palette
  7796.             firstcolr - index into palette where change will begin
  7797.             lastcolr - index into palette where change will end
  7798.             speed - speed of change
  7799.  
  7800.             OUTPUT
  7801.  
  7802.             no value returned
  7803.  
  7804.             USAGE
  7805.  
  7806.             PALCHGAUTO smoothly fades the colors between firstcolr and
  7807.             lastcolr from the palette pal to newpal.  The speed of the
  7808.             fade is set by speed which is percentage change between each
  7809.             step of the fade.  Only values between 1 and 128 are valid
  7810.             where 1 represents a one percent change between steps and 128
  7811.             (80 hex) represents fifty percent change between steps.  A
  7812.             speed of 128 would then have only two steps.  A speed outside
  7813.             of the valid range causes the function to immediately return
  7814.             without making any changes.  The time required to accomplish
  7815.             the entire fade is approximately equal to 0.033 seconds times
  7816.             256 divided by speed.  PALCHGAUTO does not modify either pal
  7817.             or newpal.
  7818.  
  7819.             SEE ALSO
  7820.  
  7821.             PALCHGSTEP, PALDIMSTEP, PALIOAUTO
  7822.  
  7823.             EXAMPLE
  7824.  
  7825.             /*
  7826.              * autofade from one palette to another and back again
  7827.              */
  7828.  
  7829.             #include <stdlib.h>
  7830.             #include <conio.h>
  7831.             #include "svgacc.h"
  7832.  
  7833.             void main(void)
  7834.             {
  7835.                int vmode, colr, y, i, index;
  7836.                PaletteData orgpal, newpal;
  7837.  
  7838.                vmode = videomodeget();
  7839.  
  7840.  
  7841.                                                                         125
  7842.  
  7843.  
  7844.  
  7845.  
  7846.  
  7847.                if ( !whichvga() )
  7848.                  exit(1);
  7849.                if ( whichmem() < 512)
  7850.                  exit(1);
  7851.                res640();
  7852.                palget(orgpal,0,255);
  7853.                for (index=0;index<256;index++) {
  7854.                  newpal[index].r = index / 4;
  7855.                  newpal[index].g = index / 4;
  7856.                  newpal[index].b = index / 4;
  7857.                }
  7858.                colr = 0;
  7859.                for (y=0;y<480;y++) {
  7860.                  drwline(1,colr++,0,y,639,y);
  7861.                  if (colr>255)
  7862.                     colr = 0;
  7863.                }
  7864.                palchgauto(orgpal,newpal,0,255,2);
  7865.                palchgauto(newpal,orgpal,0,255,2);
  7866.                getch();
  7867.                videomodeset(vmode);
  7868.                exit(0);
  7869.             }
  7870.  
  7871.  
  7872.  
  7873.  
  7874.  
  7875.  
  7876.  
  7877.  
  7878.  
  7879.  
  7880.  
  7881.  
  7882.  
  7883.  
  7884.  
  7885.  
  7886.  
  7887.  
  7888.  
  7889.  
  7890.  
  7891.  
  7892.  
  7893.  
  7894.  
  7895.  
  7896.  
  7897.  
  7898.  
  7899.  
  7900.  
  7901.  
  7902.  
  7903.                                                                         126
  7904.  
  7905.  
  7906.  
  7907.  
  7908.  
  7909.           PALCHGSTEP
  7910.  
  7911.             PROTOTYPE
  7912.  
  7913.             extern void far palchgstep (RGB far *pal, RGB far *newpal, int
  7914.             firstcolr, int lastcolr, int percent)
  7915.  
  7916.             INPUT
  7917.  
  7918.             pal - initial palette
  7919.             newpal - new palette
  7920.             firstcolr - index into palette where change will begin
  7921.             lastcolr - index into palette where change will end
  7922.             percent - percent step from current palette to new palette
  7923.  
  7924.             OUTPUT
  7925.  
  7926.             no value returned
  7927.  
  7928.             USAGE
  7929.  
  7930.             PALCHGSTEP changes the palette colors between firstcolr and
  7931.             lastcolr by percent from pal to newpal.  This function works
  7932.             very much like PALCHGAUTO except it only takes a single step
  7933.             and returns.  The step taken is a percentage specified by
  7934.             Percent where 256 (100 hex) is a 100 percent change.  The
  7935.             valid range for Percent is 0 to 256.  Values beyond this range
  7936.             cause the function to immediately return without making any
  7937.             changes.  A loop from 4 to 256 by fours using PALCHGSTEP would
  7938.             have similar results as PALCHGAUTO with a speed of 4.  Neither
  7939.             pal, nor newpal are modified.
  7940.  
  7941.             SEE ALSO
  7942.  
  7943.             PALCHGAUTO, PALDIMSTEP, PALIOAUTO
  7944.  
  7945.             EXAMPLE
  7946.  
  7947.             /*
  7948.              * step fade from one palette to another and back again
  7949.              */
  7950.  
  7951.             #include <stdlib.h>
  7952.             #include <conio.h>
  7953.             #include "svgacc.h"
  7954.  
  7955.             void main(void)
  7956.             {
  7957.                int vmode, colr, y, i, index;
  7958.                PaletteData orgpal, newpal;
  7959.  
  7960.                vmode = videomodeget();
  7961.                if ( !whichvga() )
  7962.                  exit(1);
  7963.  
  7964.  
  7965.                                                                         127
  7966.  
  7967.  
  7968.  
  7969.  
  7970.  
  7971.                if ( whichmem() < 512)
  7972.                  exit(1);
  7973.                res640();
  7974.  
  7975.                palget(orgpal,0,255);
  7976.                for (index=0;index<256;index++)
  7977.                {
  7978.                  newpal[index].r = index / 4;
  7979.                  newpal[index].g = index / 4;
  7980.                  newpal[index].b = index / 4;
  7981.                }
  7982.                colr = 0;
  7983.                for (y=0;y<480;y++)
  7984.                {
  7985.                  drwline(1,colr++,0,y,639,y);
  7986.                  if (colr>255)
  7987.                     colr = 0;
  7988.                }
  7989.                for (index=0;index<256;index++)
  7990.                {
  7991.                  palchgstep(orgpal,newpal,0,255,index);
  7992.                }
  7993.                for (index=256;index>=-1;index--)
  7994.                {
  7995.                  palchgstep(orgpal,newpal,0,255,index);
  7996.                }
  7997.                getch();
  7998.                videomodeset(vmode);
  7999.                exit(0);
  8000.             }
  8001.  
  8002.  
  8003.  
  8004.  
  8005.  
  8006.  
  8007.  
  8008.  
  8009.  
  8010.  
  8011.  
  8012.  
  8013.  
  8014.  
  8015.  
  8016.  
  8017.  
  8018.  
  8019.  
  8020.  
  8021.  
  8022.  
  8023.  
  8024.  
  8025.  
  8026.  
  8027.                                                                         128
  8028.  
  8029.  
  8030.  
  8031.  
  8032.  
  8033.           PALCOPY
  8034.  
  8035.             PROTOTYPE
  8036.  
  8037.             extern void far palcopy (RGB far *srcpal, RGB far *destpal,
  8038.             int firstcolr, int lastcolr)
  8039.  
  8040.             INPUT
  8041.  
  8042.             srcpal - source palette
  8043.             firstcolr - index into palette where copy will begin
  8044.             lastcolr - index into palette where copy will end
  8045.  
  8046.             OUTPUT
  8047.  
  8048.             no value returned
  8049.             destpal - copy of srcpal
  8050.  
  8051.             USAGE
  8052.  
  8053.             PALCOPY quickly copies a source palette into a second palette
  8054.             array.  Destpal must be previously allocated.  A portion of a
  8055.             palette may be copied by specifying first and last colors.  If
  8056.             firstcolr is greater than lastcolr, no copy will occur.
  8057.  
  8058.             SEE ALSO
  8059.  
  8060.             BYTECOPY
  8061.  
  8062.             EXAMPLE
  8063.  
  8064.             /*
  8065.              * create a color palette(grayscale) and copy it to a palette
  8066.              * of a different name
  8067.              */
  8068.  
  8069.             #include <stdlib.h>
  8070.             #include <conio.h>
  8071.             #include "svgacc.h"
  8072.  
  8073.             void main(void)
  8074.             {
  8075.                int vmode,colr,y,i,index;
  8076.                PaletteData pal, newpal;
  8077.  
  8078.                vmode = videomodeget();
  8079.                if ( !whichvga() )
  8080.                  exit(1);
  8081.                if ( whichmem() < 512)
  8082.                  exit(1);
  8083.                if ( !res640() )
  8084.                  exit(1);
  8085.                for (index=0;index<256;index++) {
  8086.                  pal[index].r = index / 4;
  8087.  
  8088.  
  8089.                                                                         129
  8090.  
  8091.  
  8092.  
  8093.  
  8094.  
  8095.                  pal[index].g = index / 4;
  8096.                  pal[index].b = index / 4;
  8097.                }
  8098.                colr = 0;
  8099.                palcopy(pal,newpal,0,255);
  8100.                for (y=0;y<480;y++) {
  8101.                  drwline(1,colr++,0,y,639,y);
  8102.                  if (colr>255)
  8103.                     colr = 0;
  8104.                }
  8105.                palset(newpal,0,255);
  8106.                getch();
  8107.                videomodeset(vmode);
  8108.                exit(0);
  8109.             }
  8110.  
  8111.  
  8112.  
  8113.  
  8114.  
  8115.  
  8116.  
  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.           PALDIMSTEP
  8158.  
  8159.             PROTOTYPE
  8160.  
  8161.             extern void far paldimstep (RGB far *pal, int firstcolr, int
  8162.             lastcolr, int percent)
  8163.  
  8164.             INPUT
  8165.  
  8166.             pal - initial palette
  8167.             firstcolr - index into palette where dim will begin
  8168.             lastcolr - index into palette where dim will end
  8169.             percent - percent step from current palette to black
  8170.  
  8171.             OUTPUT
  8172.  
  8173.             no value returned
  8174.  
  8175.             USAGE
  8176.  
  8177.             PALDIMSTEP fades the specified palette to black by the given
  8178.             percentage between firstcolr and lastcolr.  The percentage
  8179.             step from pal to black is specified by percent where 256 (100
  8180.             hex) is full black.  The valid range for Percent is 0 to 256.
  8181.             Values beyond this range cause the function to immediately
  8182.             return without making any changes.  pal is not modified.
  8183.  
  8184.             SEE ALSO
  8185.  
  8186.             PALCHGAUTO, PALCHGSTEP, PALIOAUTO
  8187.  
  8188.             EXAMPLE
  8189.  
  8190.             /*
  8191.              * step dim from a palette to black and back again
  8192.              */
  8193.  
  8194.             #include <stdlib.h>
  8195.             #include <conio.h>
  8196.             #include "svgacc.h"
  8197.  
  8198.             void main(void)
  8199.             {
  8200.                int vmode;
  8201.                int colr;
  8202.                int y;
  8203.                int i;
  8204.                int index;
  8205.                PaletteData orgpal;
  8206.  
  8207.                vmode = videomodeget();
  8208.                if ( !whichvga() )
  8209.                  exit(1);
  8210.                if ( whichmem() < 512)
  8211.  
  8212.  
  8213.                                                                         131
  8214.  
  8215.  
  8216.  
  8217.  
  8218.  
  8219.                  exit(1);
  8220.                res640();
  8221.                palget(orgpal,0,255);
  8222.                colr = 0;
  8223.                for (y=0;y<480;y++)
  8224.                {
  8225.                  drwline(1,colr++,0,y,639,y);
  8226.                  if (colr>255)
  8227.                     colr = 0;
  8228.                }
  8229.                for (index=0;index<256;index++)
  8230.                {
  8231.                  paldimstep(orgpal,0,255,index);
  8232.                }
  8233.                for (index=256;index>=-1;index--)
  8234.                {
  8235.                  paldimstep(orgpal,0,255,index);
  8236.                }
  8237.                getch();
  8238.                videomodeset(vmode);
  8239.                exit(0);
  8240.             }
  8241.  
  8242.  
  8243.  
  8244.  
  8245.  
  8246.  
  8247.  
  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.           PALGET
  8282.  
  8283.             PROTOTYPE
  8284.  
  8285.             extern void far palget (RGB far *pal, int firstcolr, int
  8286.             lastcolr)
  8287.  
  8288.             INPUT
  8289.  
  8290.             firstcolr - index into palette where get will begin
  8291.             lastcolr - index into palette where get will end
  8292.  
  8293.             OUTPUT
  8294.  
  8295.             pal - copy of the current palette in the specified range
  8296.  
  8297.             USAGE
  8298.  
  8299.             PALGET returns in pal the colors from the current palette
  8300.             between firstcolr and lastcolr.  Only colors in the specified
  8301.             range are returned and all others in pal are unchanged.  Pal
  8302.             must be 768 bytes in length despite the number of colors
  8303.             retrieved.
  8304.  
  8305.             SEE ALSO
  8306.  
  8307.             PALROTATE, PALSET
  8308.  
  8309.             EXAMPLE
  8310.  
  8311.             See PALCHGAUTO
  8312.  
  8313.  
  8314.  
  8315.  
  8316.  
  8317.  
  8318.  
  8319.  
  8320.  
  8321.  
  8322.  
  8323.  
  8324.  
  8325.  
  8326.  
  8327.  
  8328.  
  8329.  
  8330.  
  8331.  
  8332.  
  8333.  
  8334.  
  8335.  
  8336.  
  8337.                                                                         133
  8338.  
  8339.  
  8340.  
  8341.  
  8342.  
  8343.           PALIOAUTO
  8344.  
  8345.             PROTOTYPE
  8346.  
  8347.             extern void far palioauto (RGB far *pal, int firstcolr, int
  8348.             lastcolr, int speed)
  8349.  
  8350.             INPUT
  8351.  
  8352.             pal - initial palette
  8353.             firstcolr - index into palette where fade will begin
  8354.             lastcolr - index into palette where fade will end
  8355.             speed - speed of fade
  8356.  
  8357.             OUTPUT
  8358.  
  8359.             no value returned
  8360.  
  8361.             USAGE
  8362.  
  8363.             PALIOAUTO smoothly fades the colors between firstcolr and
  8364.             lastcolr of pal to or from solid black.  The speed of the fade
  8365.             is set by speed which is the percentage change between each
  8366.             step of the fade.  A positive speed corresponds to fading from
  8367.             pal to black and a negative speed fades from black to Pal.
  8368.             Only values between -128 and +128 are valid where  1
  8369.             represents a one percent change between steps and  128 ( 80
  8370.             hex) represents fifty percent change between steps.  A speed
  8371.             of 128 would then have only two steps.  A speed outside of the
  8372.             valid range causes the function to immediately return without
  8373.             making any changes.  The time required to accomplish the
  8374.             entire fade is approximately equal to 0.033 seconds times 256
  8375.             divided by speed.  PALIOAUTO does not modify pal.
  8376.  
  8377.             SEE ALSO
  8378.  
  8379.             PALCHGAUTO, PALCHGSTEP, PALDIMSTEP
  8380.  
  8381.             EXAMPLE
  8382.  
  8383.             /*
  8384.              * autofade a palette to black and back again
  8385.              */
  8386.  
  8387.             #include <stdlib.h>
  8388.             #include <conio.h>
  8389.             #include "svgacc.h"
  8390.  
  8391.             void main(void)
  8392.             {
  8393.                int vmode, colr, y;
  8394.                PaletteData orgpal;
  8395.  
  8396.                vmode = videomodeget();
  8397.  
  8398.  
  8399.                                                                         134
  8400.  
  8401.  
  8402.  
  8403.  
  8404.  
  8405.                if ( !whichvga() )
  8406.                  exit(1);
  8407.                if ( whichmem() < 512)
  8408.                  exit(1);
  8409.                res640();
  8410.                colr = 0;
  8411.                palget(orgpal,0,255);
  8412.                for (y=0;y<480;y++) {
  8413.                  drwline(1,colr++,0,y,639,y);
  8414.                  if (colr>255)
  8415.                     colr = 0;
  8416.                }
  8417.                palioauto(orgpal,0,255,-2);
  8418.                palioauto(orgpal,0,255,2);
  8419.                getch();
  8420.                videomodeset(vmode);
  8421.                exit(0);
  8422.             }
  8423.  
  8424.  
  8425.  
  8426.  
  8427.  
  8428.  
  8429.  
  8430.  
  8431.  
  8432.  
  8433.  
  8434.  
  8435.  
  8436.  
  8437.  
  8438.  
  8439.  
  8440.  
  8441.  
  8442.  
  8443.  
  8444.  
  8445.  
  8446.  
  8447.  
  8448.  
  8449.  
  8450.  
  8451.  
  8452.  
  8453.  
  8454.  
  8455.  
  8456.  
  8457.  
  8458.  
  8459.  
  8460.  
  8461.                                                                         135
  8462.  
  8463.  
  8464.  
  8465.  
  8466.  
  8467.           PALROTATE
  8468.  
  8469.             PROTOTYPE
  8470.  
  8471.             extern void far palrotate (RGB far *pal, int firstcolr, int
  8472.             lastcolr, int shift)
  8473.  
  8474.             INPUT
  8475.  
  8476.             pal - PaletteData pointer to current palette
  8477.             firstcolr - index into palette where shift will begin
  8478.             lastcolr - index into palette where shift will end
  8479.             shift - number of locations to shift colors
  8480.  
  8481.             OUTPUT
  8482.  
  8483.             no value returned
  8484.  
  8485.             USAGE
  8486.  
  8487.             PALROTATE shifts the colors in pal between firstcolr and
  8488.             lastcolr by a given number of locations and sets this new
  8489.             palette.  The number of locations the colors are moved is
  8490.             specified by shift which is between 1 and 256.  Pal is not
  8491.             modified by PALROTATE.
  8492.  
  8493.             SEE ALSO
  8494.  
  8495.             PALGET, PALSET
  8496.  
  8497.             EXAMPLE
  8498.  
  8499.             /*
  8500.              * rotate a few palette entries around
  8501.              */
  8502.  
  8503.             #include <stdlib.h>
  8504.             #include <conio.h>
  8505.             #include "svgacc.h"
  8506.  
  8507.             void main(void)
  8508.             {
  8509.                int vmode, colr, y, i, index;
  8510.                PaletteData orgpal;
  8511.  
  8512.                vmode = videomodeget();
  8513.                if ( !whichvga() )
  8514.                  exit(1);
  8515.                if ( whichmem() < 512)
  8516.                  exit(1);
  8517.                res640();
  8518.                colr = 0;
  8519.                palget(orgpal,0,255);
  8520.                for (y=0;y<480;y++) {
  8521.  
  8522.  
  8523.                                                                         136
  8524.  
  8525.  
  8526.  
  8527.  
  8528.  
  8529.                  drwline(1,colr++,0,y,639,y);
  8530.                  if (colr>255)
  8531.                     colr = 0;
  8532.                }
  8533.                for (i=0;i<200;i++) {
  8534.                  palrotate(orgpal,1,127,1);
  8535.                  palget(orgpal,0,255);
  8536.                }
  8537.                getch();
  8538.                videomodeset(vmode);
  8539.                exit(0);
  8540.             }
  8541.  
  8542.  
  8543.  
  8544.  
  8545.  
  8546.  
  8547.  
  8548.  
  8549.  
  8550.  
  8551.  
  8552.  
  8553.  
  8554.  
  8555.  
  8556.  
  8557.  
  8558.  
  8559.  
  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.           PALSET
  8592.  
  8593.             PROTOTYPE
  8594.  
  8595.             extern void far palset (RGB far *pal, int firstcolr, int
  8596.             lastcolr)
  8597.  
  8598.             INPUT
  8599.  
  8600.             pal - palette to set
  8601.             firstcolr - index into palette where set will begin
  8602.             lastcolr - index into palette where set will end
  8603.  
  8604.             OUTPUT
  8605.  
  8606.             no value returned
  8607.  
  8608.             USAGE
  8609.  
  8610.             PALSET sets the specified range of colors in the current
  8611.             palette with the corresponding range in the palette pal.
  8612.  
  8613.             SEE ALSO
  8614.  
  8615.             PALGET
  8616.  
  8617.             EXAMPLE
  8618.  
  8619.             See PALCOPY
  8620.  
  8621.  
  8622.  
  8623.  
  8624.  
  8625.  
  8626.  
  8627.  
  8628.  
  8629.  
  8630.  
  8631.  
  8632.  
  8633.  
  8634.  
  8635.  
  8636.  
  8637.  
  8638.  
  8639.  
  8640.  
  8641.  
  8642.  
  8643.  
  8644.  
  8645.  
  8646.  
  8647.                                                                         138
  8648.  
  8649.  
  8650.  
  8651.  
  8652.  
  8653.           RES320
  8654.  
  8655.             PROTOTYPE
  8656.  
  8657.             extern int far res320 (void)
  8658.  
  8659.             INPUT
  8660.  
  8661.             no input parameters
  8662.  
  8663.             OUTPUT
  8664.  
  8665.             RES320 always returns a 1.
  8666.  
  8667.             USAGE
  8668.  
  8669.             RES320 sets video mode 0x13 which is the industry standard
  8670.             320x200 graphics mode with 256 colors.  This function can be
  8671.             called without calling WHICHVGA first as this function
  8672.             requires only that a VGA card is present, not a Super VGA
  8673.             card.  If a VGA is not present, the system may crash.
  8674.  
  8675.             SEE ALSO
  8676.  
  8677.             RES640, RES640L, RES800, RES1024, WHICHVGA
  8678.  
  8679.             EXAMPLE
  8680.  
  8681.             /*
  8682.              * set video mode to 320x200x256
  8683.              */
  8684.  
  8685.             #include <stdlib.h>
  8686.             #include <conio.h>
  8687.             #include "svgacc.h"
  8688.  
  8689.             void main(void)
  8690.             {
  8691.                int vmode;
  8692.  
  8693.                vmode = videomodeget();
  8694.                if ( !whichvga() )
  8695.                  exit();
  8696.                res320();
  8697.                drwstring(1,7,0,"this is the 320x200x256 video
  8698.             mode...",0,0);
  8699.                getch();
  8700.                videomodeset(vmode);
  8701.                exit(0);
  8702.             }
  8703.  
  8704.  
  8705.  
  8706.  
  8707.  
  8708.  
  8709.                                                                         139
  8710.  
  8711.  
  8712.  
  8713.  
  8714.  
  8715.           RES640
  8716.  
  8717.             PROTOTYPE
  8718.  
  8719.             extern int far res640 (void)
  8720.  
  8721.             INPUT
  8722.  
  8723.             no input parameters
  8724.  
  8725.             OUTPUT
  8726.  
  8727.             RES640 returns 1 if successful, 0 otherwise.
  8728.  
  8729.             USAGE
  8730.  
  8731.             RES640 sets the video mode to 640x480 graphics mode with 256
  8732.             colors.  This function requires that a Super VGA card with at
  8733.             least 512K of video memory be present.  Also, WHICHVGA must be
  8734.             called first or the function will fail without changing the
  8735.             video mode.  If the video card does not have sufficient
  8736.             memory, RES640 will return without changing the video mode.
  8737.  
  8738.             SEE ALSO
  8739.  
  8740.             RES320, RES640L, RES800, RES1024, WHICHVGA
  8741.  
  8742.             EXAMPLE
  8743.  
  8744.             /*
  8745.              * set video mode to 640x480x256
  8746.              */
  8747.  
  8748.             #include <stdlib.h>
  8749.             #include <conio.h>
  8750.             #include "svgacc.h"
  8751.  
  8752.             void main(void)
  8753.             {
  8754.                int vmode;
  8755.  
  8756.                vmode = videomodeget();
  8757.                if ( !whichvga() )
  8758.                  exit(1);
  8759.                if ( !whichmem() < 512 )
  8760.                  exit(1);
  8761.                res640();
  8762.                drwstring(1,7,0,"this is the 640x480x256 video
  8763.             mode...",0,0);
  8764.                getch();
  8765.                videomodeset(vmode);
  8766.                exit(0);
  8767.             }
  8768.  
  8769.  
  8770.  
  8771.                                                                         140
  8772.  
  8773.  
  8774.  
  8775.  
  8776.  
  8777.           RES640L
  8778.  
  8779.             PROTOTYPE
  8780.  
  8781.             extern int far res640l (void)
  8782.  
  8783.             INPUT
  8784.  
  8785.             no input parameters
  8786.  
  8787.             OUTPUT
  8788.  
  8789.             RES640L returns 1 if successful, 0 otherwise.
  8790.  
  8791.             USAGE
  8792.  
  8793.             RES640L sets the video mode to 640x400 graphics mode with 256
  8794.             colors.  This function requires that a Super VGA card with at
  8795.             least 256K of video memory be present.  Also, WHICHVGA must be
  8796.             called first or the function will fail without changing the
  8797.             video mode.  If the video card does not have sufficient
  8798.             memory, RES640L will return without changing the video mode.
  8799.  
  8800.             Note: The 640x400 is an uncommon resolution.  Many SVGA cards
  8801.             do not support this mode.
  8802.  
  8803.             SEE ALSO
  8804.  
  8805.             RES320, RES640, RES800, RES1024, WHICHVGA
  8806.  
  8807.             EXAMPLE
  8808.  
  8809.             /*
  8810.              * set video mode to 640x400x256
  8811.              */
  8812.  
  8813.             #include <stdlib.h>
  8814.             #include <conio.h>
  8815.             #include "svgacc.h"
  8816.  
  8817.             void main(void)
  8818.             {
  8819.                int vmode;
  8820.  
  8821.                vmode = videomodeget();
  8822.                if ( !whichvga() )
  8823.                  exit(1);
  8824.                res640l();
  8825.                drwstring(1,7,0,"this is the 640x400x256 video
  8826.             mode...",0,0);
  8827.                getch();
  8828.                videomodeset(vmode);
  8829.                exit(0);
  8830.             }
  8831.  
  8832.  
  8833.                                                                         141
  8834.  
  8835.  
  8836.  
  8837.  
  8838.  
  8839.           RES800
  8840.  
  8841.             PROTOTYPE
  8842.  
  8843.             extern int far res800 (void)
  8844.  
  8845.             INPUT
  8846.  
  8847.             no input parameters
  8848.  
  8849.             OUTPUT
  8850.  
  8851.             RES800 returns 1 if successful, 0 otherwise.
  8852.  
  8853.             USAGE
  8854.  
  8855.             RES800 sets the video mode to 800x600 graphics mode with 256
  8856.             colors.  This function requires that a Super VGA card with at
  8857.             least 512K of video memory be present.  Also, WHICHVGA must be
  8858.             called first or the function will fail without changing the
  8859.             video mode.  If the video card does not have sufficient
  8860.             memory, RES800 will return without changing the video mode.
  8861.  
  8862.             SEE ALSO
  8863.  
  8864.             RES320, RES640, RES640L, RES1024, WHICHVGA
  8865.  
  8866.             EXAMPLE
  8867.  
  8868.             /*
  8869.              * set video mode to 800x600x256
  8870.              */
  8871.  
  8872.             #include <stdlib.h>
  8873.             #include <conio.h>
  8874.             #include "svgacc.h"
  8875.  
  8876.             void main(void)
  8877.             {
  8878.                int vmode;
  8879.  
  8880.                vmode = videomodeget();
  8881.                if ( !whichvga() )
  8882.                  exit(1);
  8883.                if ( !whichmem() < 512 )
  8884.                  exit(1);
  8885.                res800();
  8886.                drwstring(1,7,0,"this is the 800x600x256 video
  8887.             mode...",0,0);
  8888.                getch();
  8889.                videomodeset(vmode);
  8890.                exit(0);
  8891.             }
  8892.  
  8893.  
  8894.  
  8895.                                                                         142
  8896.  
  8897.  
  8898.  
  8899.  
  8900.  
  8901.           RES1024
  8902.  
  8903.             PROTOTYPE
  8904.  
  8905.             extern int far res1024 (void)
  8906.  
  8907.             INPUT
  8908.  
  8909.             no input parameters
  8910.  
  8911.             OUTPUT
  8912.  
  8913.             RES1024 returns 1 if successful, 0 otherwise.
  8914.  
  8915.             USAGE
  8916.  
  8917.             RES1024 sets the video mode to 1024x768 graphics mode with 256
  8918.             colors.  This function requires that a Super VGA card with at
  8919.             least 1 Megabyte of video memory be present.  Also, WHICHVGA
  8920.             must be called first or the function will fail without
  8921.             changing the video mode.  If the video card does not have
  8922.             sufficient memory, RES1024 will return without changing the
  8923.             video mode.
  8924.  
  8925.             SEE ALSO
  8926.  
  8927.             RES320, RES640, RES640L, RES800, WHICHVGA
  8928.  
  8929.             EXAMPLE
  8930.  
  8931.             /*
  8932.              * set video mode to 1024x768x256
  8933.              */
  8934.  
  8935.             #include <stdlib.h>
  8936.             #include <conio.h>
  8937.             #include "svgacc.h"
  8938.  
  8939.             void main(void)
  8940.             {
  8941.                int vmode;
  8942.  
  8943.                vmode = videomodeget();
  8944.                if ( !whichvga() )
  8945.                  exit(1);
  8946.                if ( !whichmem() < 1024 )
  8947.                  exit(1);
  8948.                res1024();
  8949.                drwstring(1,7,0,"this is the 1024x768x256 video
  8950.             mode...",0,0);
  8951.                getch();
  8952.                videomodeset(vmode);
  8953.                exit(0);
  8954.             }
  8955.  
  8956.  
  8957.                                                                         143
  8958.  
  8959.  
  8960.  
  8961.  
  8962.  
  8963.           RESTEXT
  8964.  
  8965.             PROTOTYPE
  8966.  
  8967.             extern int far restext (void)
  8968.  
  8969.             INPUT
  8970.  
  8971.             no input parameters
  8972.  
  8973.             OUTPUT
  8974.  
  8975.             RESTEXT always returns a 1.
  8976.  
  8977.             USAGE
  8978.  
  8979.             RESTEXT sets video mode three which is the industry standard
  8980.             80x25 text mode.
  8981.  
  8982.             SEE ALSO
  8983.  
  8984.             VIDEOMODEGET, VIDEOMODESET
  8985.  
  8986.             EXAMPLE
  8987.  
  8988.             /*
  8989.              * set video mode to standard DOS text mode 3
  8990.              */
  8991.  
  8992.             #include <stdlib.h>
  8993.             #include <conio.h>
  8994.             #include "svgacc.h"
  8995.  
  8996.             void main(void)
  8997.             {
  8998.                int vmode;
  8999.  
  9000.                vmode = videomodeget();
  9001.                if ( !restext() )
  9002.                  exit(1);
  9003.                printf("this is the text video mode (DOS video mode 3)...");
  9004.                getch();
  9005.                videomodeset(vmode);
  9006.                exit(0);
  9007.             }
  9008.  
  9009.  
  9010.  
  9011.  
  9012.  
  9013.  
  9014.  
  9015.  
  9016.  
  9017.  
  9018.  
  9019.                                                                         144
  9020.  
  9021.  
  9022.  
  9023.  
  9024.  
  9025.           SCROLLDN
  9026.  
  9027.             PROTOTYPE
  9028.  
  9029.             extern void far scrolldn (int x1, int y1, int x2, int y2, int
  9030.             num, int colr)
  9031.  
  9032.             INPUT
  9033.  
  9034.             x1, y1 - top left corner of block
  9035.             x2, y2 - bottom right corner of block
  9036.             num - number of pixels to shift
  9037.             colr - index to color in current palette
  9038.  
  9039.             OUTPUT
  9040.  
  9041.             no value returned
  9042.  
  9043.             USAGE
  9044.  
  9045.             SCROLLDN shifts the contents of the box described by (x1, y1)
  9046.             - (x2, y2) down by the number of pixels specified by num.  The
  9047.             empty pixels created at the top of the box are filled with
  9048.             colr.  The pixels that are shifted out of the box are lost.
  9049.             SCROLLDN enforces x2 x1 and y2y1.  When placed within a loop,
  9050.             SCROLLDN will create a scrolling effect.
  9051.  
  9052.             SEE ALSO
  9053.  
  9054.             SCROLLLT, SCROLLRT, SCROLLUP
  9055.  
  9056.             EXAMPLE
  9057.  
  9058.             /*
  9059.              * scroll some text down
  9060.              */
  9061.  
  9062.             #include <stdlib.h>
  9063.             #include <conio.h>
  9064.             #include "svgacc.h"
  9065.  
  9066.             void main(void)
  9067.             {
  9068.                int vmode, i;
  9069.  
  9070.                vmode = videomodeget();
  9071.                if ( !whichvga() || (whichmem() < 512))
  9072.                  exit(1);
  9073.                res640();
  9074.                drwbox (1,10,0,0,100,100);
  9075.                drwstring(1,7,0,"text text",20,43);
  9076.                for(i=0;i<40;i++)
  9077.                {
  9078.                  scrolldn(1,1,99,99,1,0);
  9079.  
  9080.  
  9081.                                                                         145
  9082.  
  9083.  
  9084.  
  9085.  
  9086.  
  9087.                  sdelay(2);
  9088.                }
  9089.                getch();
  9090.                videomodeset(vmode);
  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.           SCROLLLT
  9150.  
  9151.             PROTOTYPE
  9152.  
  9153.             extern void far scrolllt (int x1, int y1, int x2, int y2, int
  9154.             num, int colr)
  9155.  
  9156.             INPUT
  9157.  
  9158.             x1, y1 - top left corner of block
  9159.             x2, y2 - bottom right corner of block
  9160.             num - number of pixels to shift
  9161.             colr - index to color in current palette
  9162.  
  9163.             OUTPUT
  9164.  
  9165.             no value returned
  9166.  
  9167.             USAGE
  9168.  
  9169.             SCROLLLT shifts the contents of the box described by (x1, y1)
  9170.             - (x2, y2) down by the number of pixels specified by num.  The
  9171.             empty pixels created at the right of the box are filled with
  9172.             colr.  The pixels that are shifted out of the box are lost.
  9173.             SCROLLLT enforces x2 x1 and y2y1.  When placed within a loop,
  9174.             SCROLLRT will create a scrolling effect.
  9175.  
  9176.             SEE ALSO
  9177.  
  9178.             SCROLLDN, SCROLLRT, SCROLLUP
  9179.  
  9180.             EXAMPLE
  9181.  
  9182.             /*
  9183.              * scroll some text left
  9184.              */
  9185.  
  9186.             #include <stdlib.h>
  9187.             #include <conio.h>
  9188.             #include "svgacc.h"
  9189.  
  9190.             void main(void)
  9191.             {
  9192.                int vmode, i;
  9193.  
  9194.                vmode = videomodeget();
  9195.                if ( !whichvga() || (whichmem() < 512))
  9196.                  exit(1);
  9197.                res640();
  9198.                drwbox (1,10,0,0,100,100);
  9199.                drwstring(1,7,0,"text text",20,43);
  9200.                for(i=0;i<40;i++)
  9201.                {
  9202.                  scrolllt(1,1,99,99,1,0);
  9203.  
  9204.  
  9205.                                                                         147
  9206.  
  9207.  
  9208.  
  9209.  
  9210.  
  9211.                  sdelay(2);
  9212.                }
  9213.                getch();
  9214.                videomodeset(vmode);
  9215.             }
  9216.  
  9217.  
  9218.  
  9219.  
  9220.  
  9221.  
  9222.  
  9223.  
  9224.  
  9225.  
  9226.  
  9227.  
  9228.  
  9229.  
  9230.  
  9231.  
  9232.  
  9233.  
  9234.  
  9235.  
  9236.  
  9237.  
  9238.  
  9239.  
  9240.  
  9241.  
  9242.  
  9243.  
  9244.  
  9245.  
  9246.  
  9247.  
  9248.  
  9249.  
  9250.  
  9251.  
  9252.  
  9253.  
  9254.  
  9255.  
  9256.  
  9257.  
  9258.  
  9259.  
  9260.  
  9261.  
  9262.  
  9263.  
  9264.  
  9265.  
  9266.  
  9267.                                                                         148
  9268.  
  9269.  
  9270.  
  9271.  
  9272.  
  9273.           SCROLLRT
  9274.  
  9275.             PROTOTYPE
  9276.  
  9277.             extern void far scrollrt (int x1, int y1, int x2, int y2, int
  9278.             num, int colr)
  9279.  
  9280.             INPUT
  9281.  
  9282.             x1, y1 - top left corner of block
  9283.             x2, y2 - bottom right corner of block
  9284.             num - number of pixels to shift
  9285.             colr - index to color in current palette
  9286.  
  9287.             OUTPUT
  9288.  
  9289.             no value returned
  9290.  
  9291.             USAGE
  9292.  
  9293.             SCROLLRT shifts the contents of the box described by (x1, y1)
  9294.             - (x2, y2) down by the number of pixels specified by num.  The
  9295.             empty pixels created at the left of the box are filled with
  9296.             colr.  The pixels that are shifted out of the box are lost.
  9297.             SCROLLRT enforces x2 x1 and y2y1.  When placed within a loop,
  9298.             SCROLLRT will create a scrolling effect.
  9299.  
  9300.             SEE ALSO
  9301.  
  9302.             SCROLLDN, SCROLLLT, SCROLLUP
  9303.  
  9304.             EXAMPLE
  9305.  
  9306.             /*
  9307.              * scroll some text right
  9308.              */
  9309.  
  9310.             #include <stdlib.h>
  9311.             #include <conio.h>
  9312.             #include "svgacc.h"
  9313.  
  9314.             void main(void)
  9315.             {
  9316.                int vmode, i;
  9317.  
  9318.                vmode = videomodeget();
  9319.                if ( !whichvga() || (whichmem() < 512))
  9320.                  exit(1);
  9321.                res640();
  9322.                drwbox (1,10,0,0,100,100);
  9323.                drwstring(1,7,0,"text text",20,43);
  9324.                for(i=0;i<40;i++)
  9325.                {
  9326.                  scrollrt(1,1,99,99,1,0);
  9327.  
  9328.  
  9329.                                                                         149
  9330.  
  9331.  
  9332.  
  9333.  
  9334.  
  9335.                  sdelay(2);
  9336.                }
  9337.                getch();
  9338.                videomodeset(vmode);
  9339.             }
  9340.  
  9341.  
  9342.  
  9343.  
  9344.  
  9345.  
  9346.  
  9347.  
  9348.  
  9349.  
  9350.  
  9351.  
  9352.  
  9353.  
  9354.  
  9355.  
  9356.  
  9357.  
  9358.  
  9359.  
  9360.  
  9361.  
  9362.  
  9363.  
  9364.  
  9365.  
  9366.  
  9367.  
  9368.  
  9369.  
  9370.  
  9371.  
  9372.  
  9373.  
  9374.  
  9375.  
  9376.  
  9377.  
  9378.  
  9379.  
  9380.  
  9381.  
  9382.  
  9383.  
  9384.  
  9385.  
  9386.  
  9387.  
  9388.  
  9389.  
  9390.  
  9391.                                                                         150
  9392.  
  9393.  
  9394.  
  9395.  
  9396.  
  9397.           SCROLLUP
  9398.  
  9399.             PROTOTYPE
  9400.  
  9401.             extern void far scrollup (int x1, int y1, int x2, int y2, int
  9402.             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.             SCROLLUP shifts the contents of the box described by (x1, y1)
  9418.             - (x2, y2) down by the number of pixels specified by num.  The
  9419.             empty pixels created at the bottom of the box are filled with
  9420.             colr.  The pixels that are shifted out of the box are lost.
  9421.             SCROLLUP enforces x2 x1 and y2y1.  When placed within a loop,
  9422.             SCROLLUP will create a scrolling effect.
  9423.  
  9424.             SEE ALSO
  9425.  
  9426.             SCROLLDN, SCROLLLT, SCROLLRT
  9427.  
  9428.             EXAMPLE
  9429.  
  9430.             /*
  9431.              * scroll some text up
  9432.              */
  9433.  
  9434.             #include <stdlib.h>
  9435.             #include <conio.h>
  9436.             #include "svgacc.h"
  9437.  
  9438.             void main(void)
  9439.             {
  9440.                int vmode, i;
  9441.  
  9442.                vmode = videomodeget();
  9443.                if ( !whichvga() || (whichmem() < 512))
  9444.                  exit(1);
  9445.                res640();
  9446.                drwbox (1,10,0,0,100,100);
  9447.                drwstring(1,7,0,"text text",20,43);
  9448.                for(i=0;i<40;i++)
  9449.                {
  9450.                  scrollup(1,1,99,99,1,0);
  9451.  
  9452.  
  9453.                                                                         151
  9454.  
  9455.  
  9456.  
  9457.  
  9458.  
  9459.                  sdelay(2);
  9460.                }
  9461.                getch();
  9462.                videomodeset(vmode);
  9463.             }
  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.           SDELAY
  9522.  
  9523.             PROTOTYPE
  9524.  
  9525.             extern void far sdelay (int count)
  9526.  
  9527.             INPUT
  9528.  
  9529.             count - number of vertical syncs to wait
  9530.  
  9531.             OUTPUT
  9532.  
  9533.             no value returned
  9534.  
  9535.             USAGE
  9536.  
  9537.             SDELAY pauses execution of the program for a period of time
  9538.             specified by count.  This delay remains approximately constant
  9539.             on all machines by using the vertical sync timer of the VGA
  9540.             graphics card which is about 60 - 70 Hz.
  9541.  
  9542.             EXAMPLE
  9543.  
  9544.             /*
  9545.              * make a delay of about 3 seconds long
  9546.              */
  9547.  
  9548.             #include <stdlib.h>
  9549.             #include <conio.h>
  9550.             #include <time.h>
  9551.             #include "svgacc.h"
  9552.  
  9553.             void main(void)
  9554.             {
  9555.                time_t starttime;
  9556.                time_t endtime;
  9557.                printf("ok...stating delay...should be about 3 seconds...");
  9558.                time( &starttime);
  9559.                sdelay(195);
  9560.                time( &endtime);
  9561.                printf("total time was: %d seconds...", endtime-starttime);
  9562.                exit(0);
  9563.             }
  9564.  
  9565.  
  9566.  
  9567.  
  9568.  
  9569.  
  9570.  
  9571.  
  9572.  
  9573.  
  9574.  
  9575.  
  9576.  
  9577.                                                                         153
  9578.  
  9579.  
  9580.  
  9581.  
  9582.  
  9583.           SETCARD
  9584.  
  9585.             PROTOTYPE
  9586.  
  9587.             extern void far setcard (VGAChipset chip, int mem)
  9588.  
  9589.             INPUT
  9590.  
  9591.             chip - code for SVGA chip type
  9592.             mem - amount of video memory installed
  9593.  
  9594.             OUTPUT
  9595.  
  9596.             no value returned
  9597.  
  9598.             USAGE
  9599.  
  9600.             WARNING:  USING SETCARD IMPROPERLY MAY CAUSE A SYSTEM FAILURE
  9601.             OR DAMAGE.
  9602.             SETCARD sets the card type and installed video memory.  It can
  9603.             be used instead of the WHICHVGA function.  However, specifying
  9604.             an incorrect chip type or installed video memory may cause
  9605.             unpredictable results not excluding damage to the SVGA card
  9606.             and/or monitor.  Extreme caution is advised when using this
  9607.             function.  It is recommended that this function only be used
  9608.             when it is suspected that the identification process in
  9609.             WHICHVGA failed.  Be absolutely certain that the chip type
  9610.             specified is the actual chip type installed in the computer.
  9611.             Mem should be a value of 256, 512 or 1024 representing the
  9612.             kilobytes of video memory installed.  Use the following table
  9613.             to identify chip types:
  9614.  
  9615.           1  Acumos AVGA2/3 SuperVGA
  9616.           2  ATI Technologies 18/28/38/68800 SuperVGA
  9617.           3  Ahead V5000 ver A SuperVGA
  9618.           4  Ahead V5000 ver B SuperVGA
  9619.           5  Chips and Technologies 82C45x SuperVGA
  9620.           6  Cirrus Logic CL-GD 5xx, 6xx, 28xx, 54xx, 62xx SuperVGA
  9621.           7  Everex Micro Enhancer Ev236/6xx SuperVGA
  9622.           8  Genoa 61/62/63/64/6600 SuperVGA
  9623.           9  NCR 77C21/22/22E/22E+ SuperVGA
  9624.           10 Oak Technologies OTI-037C/067/077/087 SuperVGA
  9625.           11 Paradise/Western Digital PVGA1A, WD90C00/1x/2x/3x SuperVGA
  9626.           12 Realtek RT3106 SuperVGA
  9627.           13 Trident 8800CS, 8900B/C/CL/CX, 90x0 SuperVGA
  9628.           14 Tseng Labs ET3000-AX/BX/BP SuperVGA
  9629.           15 Tseng Labs ET4000/W32/W32I SuperVGA
  9630.           16 VESA compatible SuperVGA
  9631.           17 Video 7 HT-208/16 SuperVGA
  9632.           18 Avance Logic AL2101 SuperVGA
  9633.           19 MXIC MX68000/10 SuperVGA
  9634.           20 Primus P2000 SuperVGA
  9635.  
  9636.  
  9637.  
  9638.  
  9639.                                                                         154
  9640.  
  9641.  
  9642.  
  9643.  
  9644.  
  9645.             SEE ALSO
  9646.  
  9647.             WHICHVGA
  9648.  
  9649.             EXAMPLE
  9650.  
  9651.             /*
  9652.             !WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNI
  9653.             NG!  */
  9654.             /*                                                        */
  9655.             /* USE THE "SETCARD" FUNCTION CAREFULLY. IT WORKS AROUND
  9656.             "WHICHVGA".  */
  9657.             /* IMPROPER USE (I.E. SETTING THE CARD ID AND MEMORY TO
  9658.             SOMETHING    */
  9659.             /* THAT IS NOT VALID) MIGHT DAMAGE YOUR VIDEO CARD/VIDEO
  9660.             MONITOR OR   */
  9661.             /* CAUSE UNPREDICTABLE RESULTS. IT IS PROVIDED AS A METHOD TO
  9662.             FIND */
  9663.             /* FAULTS IN THE VIDEO CARD/CHIP ID PROCESS.
  9664.                */
  9665.             /*                                                        */
  9666.             /*
  9667.             !WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNI
  9668.             NG!  */
  9669.  
  9670.  
  9671.  
  9672.  
  9673.  
  9674.  
  9675.  
  9676.  
  9677.  
  9678.  
  9679.  
  9680.  
  9681.  
  9682.  
  9683.  
  9684.  
  9685.  
  9686.  
  9687.  
  9688.  
  9689.  
  9690.  
  9691.  
  9692.  
  9693.  
  9694.  
  9695.  
  9696.  
  9697.  
  9698.  
  9699.  
  9700.  
  9701.                                                                         155
  9702.  
  9703.  
  9704.  
  9705.  
  9706.  
  9707.           SETVIEW
  9708.  
  9709.             PROTOTYPE
  9710.  
  9711.             extern void far setview (int x1, int y1, int x2, int y2)
  9712.  
  9713.             INPUT
  9714.  
  9715.             x1, y1 - top, left corner of view port
  9716.             x2, y2 - bottom, right corner of view port
  9717.  
  9718.             OUTPUT
  9719.  
  9720.             no value returned
  9721.  
  9722.             USAGE
  9723.  
  9724.             SETVIEW defines a viewport for clipping output on the screen.
  9725.             Nothing can be drawn outside of the currently defined
  9726.             viewport.  The RES### functions set the viewport to the full
  9727.             screen.  The restrictions on X1, Y1, X2 and Y2 are as follows:
  9728.  
  9729.             0   X1 < X2  (screen width)
  9730.             0   Y1 < Y2  (32767, effectively unbounded)
  9731.  
  9732.             SEE ALSO
  9733.  
  9734.             RES320, RES640, RES640L, RES800, RES1024
  9735.  
  9736.             EXAMPLE
  9737.  
  9738.             /*
  9739.              * draws a lines clipped to a view port
  9740.              */
  9741.  
  9742.             #include <stdlib.h>
  9743.             #include <conio.h>
  9744.             #include "svgacc.h"
  9745.             #define randnum(size) (rand() % (int)(size))
  9746.  
  9747.             void main(void)
  9748.             {
  9749.                int vmode, i, x1, y1, x2, y2;
  9750.  
  9751.                vmode = videomodeget();
  9752.                if ( !whichvga() || (whichmem() < 512))
  9753.                  exit(1);
  9754.                res640();
  9755.                drwbox(1,15,101,101,538,378);
  9756.                setview(101,101,538,378);
  9757.                for(i=0;i<300;i++) {
  9758.                  x1 = randnum(640);
  9759.                  y1 = randnum(480);
  9760.                  x2 = randnum(640);
  9761.  
  9762.  
  9763.                                                                         156
  9764.  
  9765.  
  9766.  
  9767.  
  9768.  
  9769.                  y2 = randnum(480);
  9770.                  drwline(1,10,x1,y1,x2,y2);
  9771.                }
  9772.                getch();
  9773.                videomodeset(vmode);
  9774.                exit(0);
  9775.             }
  9776.  
  9777.  
  9778.  
  9779.  
  9780.  
  9781.  
  9782.  
  9783.  
  9784.  
  9785.  
  9786.  
  9787.  
  9788.  
  9789.  
  9790.  
  9791.  
  9792.  
  9793.  
  9794.  
  9795.  
  9796.  
  9797.  
  9798.  
  9799.  
  9800.  
  9801.  
  9802.  
  9803.  
  9804.  
  9805.  
  9806.  
  9807.  
  9808.  
  9809.  
  9810.  
  9811.  
  9812.  
  9813.  
  9814.  
  9815.  
  9816.  
  9817.  
  9818.  
  9819.  
  9820.  
  9821.  
  9822.  
  9823.  
  9824.  
  9825.                                                                         157
  9826.  
  9827.  
  9828.  
  9829.  
  9830.  
  9831.           SPRITECOLLDETECT
  9832.  
  9833.             PROTOTYPE
  9834.  
  9835.             extern int far spritecolldetect (int transcolr, int x1, int
  9836.             y1, int x2, int y2, RasterBlock far *sprite1, RasterBlock far
  9837.             *sprite2)
  9838.  
  9839.             INPUT
  9840.  
  9841.             transcolr - index to color in current palette
  9842.             x1, y1 - location of top, left corner of sprite number 1
  9843.             x2, y2 - location of top, left corner of sprite number 2
  9844.             sprite1 - sprite number 1
  9845.             sprite2 - sprite number 2
  9846.  
  9847.             OUTPUT
  9848.  
  9849.             SPRITECOLLDETECT returns the collision status of the two
  9850.             sprites.
  9851.  
  9852.             USAGE
  9853.  
  9854.             SPRITECOLLDETECT is used in sprite graphics or animation to
  9855.             report the collision status between two sprites.  Sprite1
  9856.             contains the first sprite which should have been previously
  9857.             defined by BLKGET or similar function.  Sprite2, likewise,
  9858.             contains the second sprite.  The top, left corner of the first
  9859.             and second sprites' locations are specified by x1, y1 and x2,
  9860.             y2, respectively.
  9861.  
  9862.             SPRITECOLLDETECT will return a zero if the sprites are not
  9863.             colliding and the blocks are not overlapping.  The return will
  9864.             be one if the blocks overlap, but the sprites are not
  9865.             colliding.  A return value of two indicates that the sprites
  9866.             have at least one overlapping pixel and are, therefore,
  9867.             colliding.
  9868.  
  9869.             SEE ALSO
  9870.  
  9871.             BLKGET, BLKPUT, GETLASTSTRING, SPRITEGAP, SPRITEGET, SPRITEPUT
  9872.  
  9873.             EXAMPLE
  9874.  
  9875.             /*
  9876.              * shows how spritecolldetect works
  9877.              */
  9878.  
  9879.             #include <stdlib.h>
  9880.             #include <conio.h>
  9881.             #include "svgacc.h"
  9882.  
  9883.             void main(void)
  9884.             {
  9885.  
  9886.  
  9887.                                                                         158
  9888.  
  9889.  
  9890.  
  9891.  
  9892.  
  9893.                int vmode, ret, i, x1, y1, x2, y2;
  9894.                char text[70];
  9895.  
  9896.                RasterBlock *sprite1data, *sprite2data;
  9897.  
  9898.                vmode = videomodeget();
  9899.                if ( !whichvga() )
  9900.                  exit(1);
  9901.                res320();
  9902.                x1 = 0;
  9903.                y1 = 0;
  9904.                x2 = 48;
  9905.                y2 = 48;
  9906.                drwline(1,8,x1,y1,x2,y1);
  9907.                drwline(1,8,x2,y1,x2,y2);
  9908.                drwline(1,8,x2,y2,x1,y2);
  9909.                drwline(1,8,x1,y2,x1,y1);
  9910.                fillarea(x1+1,y1+1,8,8);
  9911.                drwellipse(1,10,((x2-x1)/2+x1),((y2-y1)/2+y1),(x2-x1)/2,(y2-
  9912.             y1)/2);
  9913.                sprite1data = (RasterBlock *)malloc((x2-x1+1)*(y2-y1+1)+4);
  9914.                blkget(x1,y1,x2,y2,sprite1data);
  9915.                blkput(2,x1,y1,sprite1data);
  9916.                x1 = 0;
  9917.                y1 = 0;
  9918.                x2 = 24;
  9919.                y2 = 24;
  9920.                drwline(1,8,x1,y1,x2,y1);
  9921.                drwline(1,8,x2,y1,x2,y2);
  9922.                drwline(1,8,x2,y2,x1,y2);
  9923.                drwline(1,8,x1,y2,x1,y1);
  9924.                fillarea(x1+1,y1+1,8,8);
  9925.                drwline(1,10,x1,y1,x2,y2);
  9926.                drwline(1,10,x2,y1,x1,y2);
  9927.                sprite2data = (RasterBlock *)malloc((x2-x1+1)*(y2-y1+1)+4);
  9928.                blkget(x1,y1,x2,y2,sprite2data);
  9929.                blkput(2,x1,y1,sprite2data);
  9930.                x1=90;
  9931.                y1=90;
  9932.                blkput(2,x1,y1,sprite1data);
  9933.                for(i=30;i<150;i++)
  9934.                {
  9935.                  blkput(2,i,i,sprite2data);
  9936.                  ret =
  9937.             spritecolldetect(8,x1,y1,i,i,sprite1data,sprite2data);
  9938.                  sprintf(text,"the return value is: %d",ret);
  9939.                  drwstring(1,7,0,text,0,0);
  9940.                  getch();
  9941.                  blkput(2,i,i,sprite2data);
  9942.                }
  9943.                videomodeset(vmode);
  9944.                exit(0);
  9945.             }
  9946.  
  9947.  
  9948.  
  9949.                                                                         159
  9950.  
  9951.  
  9952.  
  9953.  
  9954.  
  9955.           SPRITEGAP
  9956.  
  9957.             PROTOTYPE
  9958.  
  9959.             extern void far spritegap (int transcolr, int x, int y,
  9960.             RasterBlock far *sprite, RasterBlock far *spritebkgnd)
  9961.  
  9962.             INPUT
  9963.  
  9964.             transcolr - index to color in current palette
  9965.             x, y - top, left corner of block
  9966.             sprite- the sprite to place on screen
  9967.  
  9968.             OUTPUT
  9969.  
  9970.             no value returned
  9971.             spritebkgnd - sprite background
  9972.  
  9973.             USAGE
  9974.  
  9975.             SPRITEGAP ("Sprite-Get-And-Put") is used in sprite graphics or
  9976.             animation to retrieve a sprite's background and then display
  9977.             the sprite.  Sprite contains the sprite which should have been
  9978.             previously defined by BLKGET or similar function such as
  9979.             GETLASTSTRING.  Transcolr is the transparent colr assumed in
  9980.             sprite.  Spritebkgnd, a pointer to a RasterBlock structure the
  9981.             same size as the sprite, will receive the sprite's background.
  9982.             The top, left corner of the sprite's location is specified by
  9983.             x, y.
  9984.  
  9985.             SEE ALSO
  9986.  
  9987.             BLKGET, BLKPUT, GETLASTSTRING, SPRITECOLLDETECT, SPRITEGET,
  9988.             SPRITEPUT
  9989.  
  9990.             EXAMPLE
  9991.  
  9992.             /*
  9993.              * Show spritegap
  9994.              */
  9995.  
  9996.             #include <stdlib.h>
  9997.             #include <math.h>
  9998.             #include <conio.h>
  9999.             #include "svgacc.h"
  10000.  
  10001.             void main(void)
  10002.             {
  10003.                int vmode;
  10004.                int i, j, colr, xinc, yinc, x1, y1, x2, y2, cnt, cntx, cnty,
  10005.             rot;
  10006.                RasterBlock *gfxblk, *gfxblk2, *spritebkgnd;
  10007.  
  10008.                vmode = videomodeget();
  10009.  
  10010.  
  10011.                                                                         160
  10012.  
  10013.  
  10014.  
  10015.  
  10016.  
  10017.                if ( !whichvga() )
  10018.                  exit(1);
  10019.                if ( whichmem() < 512)
  10020.                  exit(1);
  10021.                if ( !res640() )
  10022.                  exit(1);
  10023.                xinc = maxx/20;
  10024.                yinc = maxy/20;
  10025.                x1 = maxx/2-xinc;
  10026.                y1 = maxy/2-yinc;
  10027.                x2 = maxx/2+xinc;
  10028.                y2 = maxy/2+yinc;
  10029.                i = (x2-x1+1)*(y2-y1+1)+4;
  10030.                gfxblk = (RasterBlock *)malloc(i);
  10031.                if (!gfxblk) {
  10032.                  restext();
  10033.                  printf("ERROR: Allocating memory for gfxblk: %d
  10034.             bytes\n",i);
  10035.                  exit(1);
  10036.                }
  10037.                colr = 1;
  10038.                for(i=0;i<=maxx/2;i++) {
  10039.                  drwcircle(1,colr,maxx/4+i,maxy/2,maxy/5);
  10040.                  colr+=1;
  10041.                  if(colr>15)
  10042.                     colr = 1;
  10043.                }
  10044.                drwbox(1,0,x1,y1,x2,y2);
  10045.                blkget(x1,y1,x2,y2,gfxblk);
  10046.                cntx = (x2-x1) / 2 + x1;
  10047.                cnty = (y2-y1) / 2 + y1;
  10048.                fillarea(x1+2,y1+2,0,0);
  10049.                i = blkrotatesize(45,gfxblk);
  10050.                spritebkgnd = (RasterBlock *)malloc(i);
  10051.                if (!spritebkgnd) {
  10052.                  restext();
  10053.                  printf("ERROR: Allocating memory for spritebkgnd: %d
  10054.             bytes\n",i);
  10055.                  exit(1);
  10056.                }
  10057.                gfxblk2 = (RasterBlock *)malloc(i);
  10058.                if (!gfxblk2) {
  10059.                  restext();
  10060.                  printf("ERROR: Allocating memory for gfxblk2: %d
  10061.             bytes\n",i);
  10062.                  exit(1);
  10063.                }
  10064.                blkget(x1,y1,x2,y2,spritebkgnd);
  10065.                setview(0,64,maxx,maxy);
  10066.                for(i=0;i<=360;i+=3) {
  10067.                  rot = blkrotate(i,1,gfxblk,gfxblk2);
  10068.                  spriteput(SET,1,cntx-(spritebkgnd->width)/2,cnty-
  10069.             (spritebkgnd->height)/2,spritebkgnd);
  10070.  
  10071.  
  10072.  
  10073.                                                                         161
  10074.  
  10075.  
  10076.  
  10077.  
  10078.  
  10079.                  spritegap(1,cntx-(gfxblk2->width)/2,cnty-(gfxblk2-
  10080.             >height)/2,gfxblk2,spritebkgnd);
  10081.                  sdelay(3);
  10082.                }
  10083.                spriteput(SET,1,cntx-(spritebkgnd->width)/2,cnty-
  10084.             (spritebkgnd->height)/2,spritebkgnd);
  10085.                blkput(SET,x1,y1,(RasterBlock *)gfxblk);
  10086.                getch();
  10087.                videomodeset(vmode);
  10088.                exit(0);
  10089.             }
  10090.  
  10091.  
  10092.  
  10093.  
  10094.  
  10095.  
  10096.  
  10097.  
  10098.  
  10099.  
  10100.  
  10101.  
  10102.  
  10103.  
  10104.  
  10105.  
  10106.  
  10107.  
  10108.  
  10109.  
  10110.  
  10111.  
  10112.  
  10113.  
  10114.  
  10115.  
  10116.  
  10117.  
  10118.  
  10119.  
  10120.  
  10121.  
  10122.  
  10123.  
  10124.  
  10125.  
  10126.  
  10127.  
  10128.  
  10129.  
  10130.  
  10131.  
  10132.  
  10133.  
  10134.  
  10135.                                                                         162
  10136.  
  10137.  
  10138.  
  10139.  
  10140.  
  10141.           SPRITEGET
  10142.  
  10143.             PROTOTYPE
  10144.  
  10145.             extern void far spriteget (int transcolr, int x, int y,
  10146.             RasterBlock far *sprite, RasterBlock far *spritebkgnd)
  10147.  
  10148.             INPUT
  10149.  
  10150.             transcolr - index to color in current palette
  10151.             x, y - top, left corner of block
  10152.             sprite - sprite to use as pattern
  10153.  
  10154.             OUTPUT
  10155.  
  10156.             no value returned
  10157.             spritebkgnd - sprite background
  10158.  
  10159.             USAGE
  10160.  
  10161.             SPRITEGET is used in sprite graphics or animation to retrieve
  10162.             the background for a sprite, normally just before using
  10163.             SPRITEPUT.  Sprite contains the sprite which should have been
  10164.             previously defined by BLKGET or similar function.  Transcolr
  10165.             is the transparent color assumed in the sprite.  Spritebkgnd,
  10166.             a pointer to a RasterBlock structure the same size as the
  10167.             sprite, will receive the sprite's background.  The top, left
  10168.             corner of the sprite's location is specified by x, y.
  10169.  
  10170.             SEE ALSO
  10171.  
  10172.             BLKGET, BLKPUT, GETLASTSTRING, SPRITECOLLDETECT, SPRITEGAP,
  10173.             SPRITEPUT
  10174.  
  10175.             EXAMPLE
  10176.  
  10177.             /*
  10178.              * Show spriteget
  10179.              */
  10180.  
  10181.             #include <stdlib.h>
  10182.             #include <math.h>
  10183.             #include <conio.h>
  10184.             #include "svgacc.h"
  10185.  
  10186.             void main(void)
  10187.             {
  10188.                int vmode, i, j, colr, xinc, yinc, x1, y1, x2, y2, cntx,
  10189.             cnty, rot;
  10190.                RasterBlock *gfxblk, *gfxblk2, *spritebkgnd;
  10191.                vmode = videomodeget();
  10192.                if ( !whichvga() )
  10193.                  exit(1);
  10194.                if ( whichmem() < 512)
  10195.  
  10196.  
  10197.                                                                         163
  10198.  
  10199.  
  10200.  
  10201.  
  10202.  
  10203.                  exit(1);
  10204.                if ( !res640() )
  10205.                  exit(1);
  10206.                xinc = maxx/20;
  10207.                yinc = maxy/20;
  10208.                x1 = maxx/2-xinc;
  10209.                y1 = maxy/2-yinc;
  10210.                x2 = maxx/2+xinc;
  10211.                y2 = maxy/2+yinc;
  10212.                i = (x2-x1+1)*(y2-y1+1)+4;
  10213.                gfxblk = (RasterBlock *)malloc(i);
  10214.                if (!gfxblk) {
  10215.                  restext();
  10216.                  printf("ERROR: Allocating memory for gfxblk: %d
  10217.             bytes\n",i);
  10218.                  exit(1);
  10219.                }
  10220.                colr = 1;
  10221.                for(i=0;i<=maxx/2;i++) {
  10222.                  drwcircle(1,colr,maxx/4+i,maxy/2,maxy/5);
  10223.                  colr+=1;
  10224.                  if(colr>15)
  10225.                     colr = 1;
  10226.                }
  10227.                drwbox(1,0,x1,y1,x2,y2);
  10228.                blkget(x1,y1,x2,y2,gfxblk);
  10229.                cntx = (x2-x1) / 2 + x1;
  10230.                cnty = (y2-y1) / 2 + y1;
  10231.                fillarea(x1+2,y1+2,0,0);
  10232.                i = blkrotatesize(45,gfxblk);
  10233.                spritebkgnd = (RasterBlock *)malloc(i);
  10234.                if (!spritebkgnd) {
  10235.                  restext();
  10236.                  printf("ERROR: Allocating memory for spritebkgnd: %d
  10237.             bytes\n",i);
  10238.                  exit(1);
  10239.                }
  10240.                gfxblk2 = (RasterBlock *)malloc(i);
  10241.                if (!gfxblk2) {
  10242.                  restext();
  10243.                  printf("ERROR: Allocating memory for gfxblk2: %d
  10244.             bytes\n",i);
  10245.                  exit(1);
  10246.                }
  10247.                blkget(x1,y1,x2,y2,spritebkgnd);
  10248.                setview(0,64,maxx,maxy);
  10249.                for(i=0;i<=360;i+=3) {
  10250.                  rot = blkrotate(i,1,gfxblk,gfxblk2);
  10251.                  spriteput(SET,1,cntx-(spritebkgnd->width)/2,cnty-
  10252.             (spritebkgnd->height)/2,spritebkgnd);
  10253.                  spriteget(1,cntx-(gfxblk2->width)/2,cnty-(gfxblk2-
  10254.             >height)/2,gfxblk2,spritebkgnd);
  10255.                  spriteput(SET,1,cntx-(gfxblk2->width)/2,cnty-(gfxblk2-
  10256.             >height)/2,gfxblk2);
  10257.  
  10258.  
  10259.                                                                         164
  10260.  
  10261.  
  10262.  
  10263.  
  10264.  
  10265.                  sdelay(3);
  10266.                }
  10267.                spriteput(SET,1,cntx-(spritebkgnd->width)/2,cnty-
  10268.             (spritebkgnd->height)/2,spritebkgnd);
  10269.                blkput(SET,x1,y1,(RasterBlock *)gfxblk);
  10270.                getch();
  10271.                videomodeset(vmode);
  10272.                exit(0);
  10273.             }
  10274.  
  10275.  
  10276.  
  10277.  
  10278.  
  10279.  
  10280.  
  10281.  
  10282.  
  10283.  
  10284.  
  10285.  
  10286.  
  10287.  
  10288.  
  10289.  
  10290.  
  10291.  
  10292.  
  10293.  
  10294.  
  10295.  
  10296.  
  10297.  
  10298.  
  10299.  
  10300.  
  10301.  
  10302.  
  10303.  
  10304.  
  10305.  
  10306.  
  10307.  
  10308.  
  10309.  
  10310.  
  10311.  
  10312.  
  10313.  
  10314.  
  10315.  
  10316.  
  10317.  
  10318.  
  10319.  
  10320.  
  10321.                                                                         165
  10322.  
  10323.  
  10324.  
  10325.  
  10326.  
  10327.           SPRITEPUT
  10328.  
  10329.             PROTOTYPE
  10330.  
  10331.             extern void far spriteput (PixelMode mode, int transcolr, int
  10332.             x, int y, RasterBlock far *sprite)
  10333.  
  10334.             INPUT
  10335.  
  10336.             mode - pixel write mode
  10337.             transcolr - index to color in current palette
  10338.             x, y - top, left corner of block
  10339.             sprite- sprite to place on screen
  10340.  
  10341.             OUTPUT
  10342.  
  10343.             no value returned
  10344.  
  10345.             USAGE
  10346.  
  10347.             SPRITEPUT is used in sprite graphics or animation to display a
  10348.             sprite or, more commonly, its background.  Sprite contains the
  10349.             sprite which should have been previously defined by BLKGET,
  10350.             SPRITEGAP or SPRITEGET.  Transcolr is the transparent color
  10351.             assumed in sprite.  The top, left corner of the sprite's
  10352.             location is specified by x, y.
  10353.  
  10354.             SEE ALSO
  10355.  
  10356.             BLKGET, BLKPUT, GETLASTSTRING, SPRITECOLLDETECT, SPRITEGAP,
  10357.             SPRITEGET
  10358.  
  10359.             EXAMPLE
  10360.  
  10361.             See SPRITEGET
  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.           VIDEOMODEGET
  10390.  
  10391.             PROTOTYPE
  10392.  
  10393.             extern int far videomodeget (void)
  10394.  
  10395.             INPUT
  10396.  
  10397.             no input parameters
  10398.  
  10399.             OUTPUT
  10400.  
  10401.             the current video mode
  10402.  
  10403.             USAGE
  10404.  
  10405.             VIDEOMODEGET returns the current video mode.  This function is
  10406.             best used to retrieve the video mode being used when a program
  10407.             begins.  When the program ends, this video mode can then be
  10408.             restored using VIDEOMODESET.
  10409.  
  10410.             SEE ALSO
  10411.  
  10412.             RES320, RES640, RES640L, RES800, RES1024, RESTEXT,
  10413.             VIDEOMODESET
  10414.  
  10415.             EXAMPLE
  10416.  
  10417.             /*
  10418.              * save the current video mode, enable 640x480x256, and reset
  10419.             the video mode
  10420.              */
  10421.  
  10422.             #include <stdlib.h>
  10423.             #include <conio.h>
  10424.             #include "svgacc.h"
  10425.  
  10426.             void main(void)
  10427.             {
  10428.                int vmode;
  10429.  
  10430.                vmode = videomodeget();
  10431.                if ( !whichvga() )
  10432.                  exit(1);
  10433.                if ( whichmem() < 512)
  10434.                  exit(1);
  10435.                res640();
  10436.                videomodeset(vmode);
  10437.                printf("we are back!");
  10438.                getch();
  10439.                exit(0);
  10440.             }
  10441.  
  10442.  
  10443.  
  10444.  
  10445.                                                                         167
  10446.  
  10447.  
  10448.  
  10449.  
  10450.  
  10451.           VIDEOMODESET
  10452.  
  10453.             PROTOTYPE
  10454.  
  10455.             extern void far videomodeset (int videomode)
  10456.  
  10457.             INPUT
  10458.  
  10459.             mode - number of video mode
  10460.  
  10461.             OUTPUT
  10462.  
  10463.             no value returned
  10464.  
  10465.             USAGE
  10466.  
  10467.             VIDEOMODESET sets the video mode specified by mode.  This
  10468.             function is best used at the end of a program to restore the
  10469.             video mode to the mode in use when the program began.  The
  10470.             program should retrieve the video mode at the beginning by
  10471.             using VIDEOMODEGET.
  10472.  
  10473.             SEE ALSO
  10474.  
  10475.             RES320, RES640, RES640L, RES800, RES1024, RESTEXT,
  10476.             VIDEOMODEGET
  10477.  
  10478.             EXAMPLE
  10479.  
  10480.             See VIDEMODEGET
  10481.  
  10482.  
  10483.  
  10484.  
  10485.  
  10486.  
  10487.  
  10488.  
  10489.  
  10490.  
  10491.  
  10492.  
  10493.  
  10494.  
  10495.  
  10496.  
  10497.  
  10498.  
  10499.  
  10500.  
  10501.  
  10502.  
  10503.  
  10504.  
  10505.  
  10506.  
  10507.                                                                         168
  10508.  
  10509.  
  10510.  
  10511.  
  10512.  
  10513.           VIDEOOFF
  10514.  
  10515.             PROTOTYPE
  10516.  
  10517.             extern void far videooff (void)
  10518.  
  10519.             INPUT
  10520.  
  10521.             no input parameters
  10522.  
  10523.             OUTPUT
  10524.  
  10525.             no value returned
  10526.  
  10527.             USAGE
  10528.  
  10529.             VIDEOOFF turns the output display off.  Graphics may still be
  10530.             drawn to the screen.  However, the computer's monitor will
  10531.             display nothing and appear black.  This function can be used
  10532.             to hide graphics being drawn by initially using VIDEOOFF and
  10533.             then later calling VIDEOON.
  10534.  
  10535.             SEE ALSO
  10536.  
  10537.             VIDEOON
  10538.  
  10539.             EXAMPLE
  10540.  
  10541.             /*
  10542.              * disable the video for about 3 seconds, then enable it
  10543.              */
  10544.  
  10545.             #include <stdlib.h>
  10546.             #include <conio.h>
  10547.             #include "svgacc.h"
  10548.  
  10549.             void main(void)
  10550.             {
  10551.                int vmode;
  10552.  
  10553.                printf("press a key to disable video for 3 seconds...");
  10554.                getch();
  10555.                videooff();
  10556.                sdelay(195);
  10557.                videoon();
  10558.                videomodeset(vmode);
  10559.                printf("we are back!");
  10560.                getch();
  10561.                exit(0);
  10562.             }
  10563.  
  10564.  
  10565.  
  10566.  
  10567.  
  10568.  
  10569.                                                                         169
  10570.  
  10571.  
  10572.  
  10573.  
  10574.  
  10575.           VIDEOON
  10576.  
  10577.             PROTOTYPE
  10578.  
  10579.             extern void far videoon (void)
  10580.  
  10581.             INPUT
  10582.  
  10583.             no input parameters
  10584.  
  10585.             OUTPUT
  10586.  
  10587.             no value returned
  10588.  
  10589.             USAGE
  10590.  
  10591.             VIDEOON turns the display on.  All graphics that were drawn
  10592.             while the display was off are now visible.  This function can
  10593.             be used to hide graphics being drawn by initially using
  10594.             VIDEOOFF and then later calling VIDEOON.
  10595.  
  10596.             SEE ALSO
  10597.  
  10598.             VIDEOOFF
  10599.  
  10600.             EXAMPLE
  10601.  
  10602.             See VIDEOOFF
  10603.  
  10604.  
  10605.  
  10606.  
  10607.  
  10608.  
  10609.  
  10610.  
  10611.  
  10612.  
  10613.  
  10614.  
  10615.  
  10616.  
  10617.  
  10618.  
  10619.  
  10620.  
  10621.  
  10622.  
  10623.  
  10624.  
  10625.  
  10626.  
  10627.  
  10628.  
  10629.  
  10630.  
  10631.                                                                         170
  10632.  
  10633.  
  10634.  
  10635.  
  10636.  
  10637.           WHICHCPU
  10638.  
  10639.             PROTOTYPE
  10640.  
  10641.             extern int far whichcpu (void)
  10642.  
  10643.             INPUT
  10644.  
  10645.             no input parameters
  10646.  
  10647.             OUTPUT
  10648.  
  10649.             processor type
  10650.  
  10651.             USAGE
  10652.  
  10653.             WHICHCPU returns the computer's processor type as 86, 286, 386
  10654.             or 486.  This function should be called by any program using
  10655.             this library's routines to insure that the computer is at
  10656.             least 386 compatible or better.
  10657.  
  10658.             SEE ALSO
  10659.  
  10660.             WHICHJOYSTICK, WHICHMOUSE, WHICHVGA
  10661.  
  10662.             EXAMPLE
  10663.  
  10664.             /*
  10665.              * id the microprocessor
  10666.              */
  10667.  
  10668.             #include <stdlib.h>
  10669.             #include <conio.h>
  10670.             #include "svgacc.h"
  10671.  
  10672.             void main(void)
  10673.             {
  10674.                int vmode;
  10675.                int cpu;
  10676.  
  10677.                cpu = whichcpu();
  10678.                printf("Microprocessor is identified as an 80%d.\n", cpu);
  10679.                getch();
  10680.                exit(0);
  10681.             }
  10682.  
  10683.  
  10684.  
  10685.  
  10686.  
  10687.  
  10688.  
  10689.  
  10690.  
  10691.  
  10692.  
  10693.                                                                         171
  10694.  
  10695.  
  10696.  
  10697.  
  10698.  
  10699.           WHICHJOYSTICK
  10700.  
  10701.             PROTOTYPE
  10702.  
  10703.             extern int far whichjoystick (void)
  10704.  
  10705.             INPUT
  10706.  
  10707.             no input parameters
  10708.  
  10709.             OUTPUT
  10710.  
  10711.             available joystick support
  10712.  
  10713.             USAGE
  10714.  
  10715.             WHICHJOYSTICK returns the joystick support available on the
  10716.             computer.  This function should be called prior to use of the
  10717.             joysticks to verify that joysticks are available.  If the
  10718.             function returns a -1, there is no joystick port present or no
  10719.             BIOS support for a joystick.  Joystick A is bit 1 and B is bit
  10720.             2.  Therefore, a return value of 1 means joystick A is
  10721.             available, a value of 2 means B is available and a value of 3
  10722.             means both are available.  If no bits are set, there are no
  10723.             joysticks present.
  10724.  
  10725.             SEE ALSO
  10726.  
  10727.             JOYSTICKINFO, WHICHCPU, WHICHMOUSE, WHICHVGA
  10728.  
  10729.             EXAMPLE
  10730.  
  10731.             /* id any joysticks */
  10732.             #include <stdlib.h>
  10733.             #include "svgacc.h"
  10734.  
  10735.             void main(void)
  10736.             {
  10737.                int vmode, joystick;
  10738.  
  10739.                joystick = whichjoystick();
  10740.                switch (joystick) {
  10741.                  case -1:
  10742.                     printf("No joystick port detected or no joystick BIOS
  10743.             support present.\n\n");
  10744.                     break;
  10745.                  case 0:
  10746.                     printf("No joystick detected\n\n");
  10747.                     break;
  10748.                  case 1:
  10749.                     printf("Joystick A is present and available.\n\n");
  10750.                     break;
  10751.                  case 2:
  10752.                     printf("Joystick B is present and available.\n\n");
  10753.  
  10754.  
  10755.                                                                         172
  10756.  
  10757.  
  10758.  
  10759.  
  10760.  
  10761.                     break;
  10762.                  case 3:
  10763.                     printf("Both Joystick A and Joystick B are
  10764.             present.\n\n");
  10765.                     break;
  10766.                }
  10767.             }
  10768.  
  10769.  
  10770.  
  10771.  
  10772.  
  10773.  
  10774.  
  10775.  
  10776.  
  10777.  
  10778.  
  10779.  
  10780.  
  10781.  
  10782.  
  10783.  
  10784.  
  10785.  
  10786.  
  10787.  
  10788.  
  10789.  
  10790.  
  10791.  
  10792.  
  10793.  
  10794.  
  10795.  
  10796.  
  10797.  
  10798.  
  10799.  
  10800.  
  10801.  
  10802.  
  10803.  
  10804.  
  10805.  
  10806.  
  10807.  
  10808.  
  10809.  
  10810.  
  10811.  
  10812.  
  10813.  
  10814.  
  10815.  
  10816.  
  10817.                                                                         173
  10818.  
  10819.  
  10820.  
  10821.  
  10822.  
  10823.           WHICHMEM
  10824.  
  10825.             PROTOTYPE
  10826.  
  10827.             extern int far whichmem (void)
  10828.  
  10829.             INPUT
  10830.  
  10831.             no input parameters
  10832.  
  10833.             OUTPUT
  10834.  
  10835.             installed video memory in kilobytes
  10836.  
  10837.             USAGE
  10838.  
  10839.             WHICHMEM returns the amount of installed video memory as
  10840.             previously determined by WHICHVGA.  WHICHVGA should be called
  10841.             prior to WHICHMEM.  This function should be called prior to
  10842.             any of the RES### functions to verify that there is enough
  10843.             memory to support the desired resolution.  If SETCARD was used
  10844.             to set the video card and memory, WHICHMEM will return the
  10845.             amount of memory as defined by SETCARD.
  10846.  
  10847.             SEE ALSO
  10848.  
  10849.             RES320, RES640, RES640L, RES800, RES1024, SETCARD, WHICHVGA
  10850.  
  10851.             EXAMPLE
  10852.  
  10853.             /*
  10854.              * id the video memory
  10855.              */
  10856.  
  10857.             #include <stdlib.h>
  10858.             #include <conio.h>
  10859.             #include "svgacc.h"
  10860.  
  10861.             void main(void)
  10862.             {
  10863.                int vmode, vga, mem;
  10864.  
  10865.                vga = whichvga();
  10866.                mem = whichmem();
  10867.                printf("Installed video memory is %d k.\n", mem);
  10868.                getch();
  10869.                exit(0);
  10870.             }
  10871.  
  10872.  
  10873.  
  10874.  
  10875.  
  10876.  
  10877.  
  10878.  
  10879.                                                                         174
  10880.  
  10881.  
  10882.  
  10883.  
  10884.  
  10885.           WHICHMOUSE
  10886.  
  10887.             PROTOTYPE
  10888.  
  10889.             extern int far whichmouse (void)
  10890.  
  10891.             INPUT
  10892.  
  10893.             no input parameters
  10894.  
  10895.             OUTPUT
  10896.  
  10897.             number of buttons on mouse
  10898.  
  10899.             USAGE
  10900.  
  10901.             WHICHMOUSE returns a value indicating whether a Microsoft
  10902.             compatible mouse is available.  If the function returns a 0,
  10903.             no mouse is available.  A non zero value indicates a mouse and
  10904.             Microsoft compatible driver are installed and gives the number
  10905.             of buttons (2 or 3) available.
  10906.  
  10907.             SEE ALSO
  10908.  
  10909.             MOUSEINFO, WHICHCPU, WHICHJOYSTICK, WHICHVGA
  10910.  
  10911.             EXAMPLE
  10912.  
  10913.             See MOUSEINFO
  10914.  
  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.           WHICHVGA
  10948.  
  10949.             PROTOTYPE
  10950.  
  10951.             extern VGAChipset far whichvga (void)
  10952.  
  10953.             INPUT
  10954.  
  10955.             no input parameters
  10956.  
  10957.             OUTPUT
  10958.  
  10959.             WHICHVGA returns a code identifying the video card.
  10960.  
  10961.             USAGE
  10962.  
  10963.             WHICHVGA identifies the video card installed and the amount of
  10964.             video memory.  In addition this function sets up the default
  10965.             font and mouse cursor.  This function must be called before
  10966.             any other graphics function.  The code returned identifies the
  10967.             video card according to the following table:
  10968.  
  10969.           1  Acumos AVGA2/3 SuperVGA
  10970.           2  ATI Technologies 18/28/38/68800 SuperVGA
  10971.           3  Ahead V5000 ver A SuperVGA
  10972.           4  Ahead V5000 ver B SuperVGA
  10973.           5  Chips and Technologies 82C45x SuperVGA
  10974.           6  Cirrus Logic CL-GD 5xx, 6xx, 28xx, 54xx, 62xx SuperVGA
  10975.           7  Everex Micro Enhancer Ev236/6xx SuperVGA
  10976.           8  Genoa 61/62/63/64/6600 SuperVGA
  10977.           9  NCR 77C21/22/22E/22E+ SuperVGA
  10978.           10 Oak Technologies OTI-037C/067/077/087 SuperVGA
  10979.           11 Paradise/Western Digital PVGA1A, WD90C00/1x/2x/3x SuperVGA
  10980.           12 Realtek RT3106 SuperVGA
  10981.           13 Trident 8800CS, 8900B/C/CL/CX, 90x0 SuperVGA
  10982.           14 Tseng Labs ET3000-AX/BX/BP SuperVGA
  10983.           15 Tseng Labs ET4000/W32/W32I SuperVGA
  10984.           16 VESA compatible SuperVGA
  10985.           17 Video 7 HT-208/16 SuperVGA
  10986.           18 Avance Logic AL2101 SuperVGA
  10987.           19 MXIC MX68000/10 SuperVGA
  10988.           20 Primus P2000 SuperVGA
  10989.  
  10990.             Any value returned not found on this table represents an
  10991.             unidentified video card.
  10992.  
  10993.             No graphics functions should be called unless the video card
  10994.             is properly identified.
  10995.  
  10996.             SEE ALSO
  10997.  
  10998.             SETCARD, WHICHCPU, WHICHJOYSTICK, WHICHMOUSE, WHICHMEM
  10999.  
  11000.             EXAMPLE
  11001.  
  11002.  
  11003.                                                                         176
  11004.  
  11005.  
  11006.  
  11007.  
  11008.  
  11009.  
  11010.             /*
  11011.              * id the svga
  11012.              */
  11013.  
  11014.             #include <stdlib.h>
  11015.             #include <conio.h>
  11016.             #include "svgacc.h"
  11017.  
  11018.             void main(void)
  11019.             {
  11020.  
  11021.             char buf[40];
  11022.  
  11023.             switch(whichvga()) {
  11024.                case ACUMOS:
  11025.                  sprintf(buf,"Acumos AVGA2/3 SuperVGA");
  11026.                  break;
  11027.                case ATI:
  11028.                  sprintf(buf,"ATI Technologies 18/28/38/68800 SuperVGA");
  11029.                  break;
  11030.                case AHEADA:
  11031.                  sprintf(buf,"Ahead V5000 Ver A SuperVGA");
  11032.                  break;
  11033.                case AHEADB:
  11034.                  sprintf(buf,"Ahead V5000 Ver B SuperVGA");
  11035.                  break;
  11036.                case CHIPSTECH:
  11037.                  sprintf(buf,"Chips and Technologies 82C450/1/2/3/5/6/7
  11038.           SuperVGA");
  11039.                  break;
  11040.                case CIRRUS:
  11041.                  sprintf(buf,"Cirrus Logic CL-GD 5xx,6xx,28xx,54xx,62xx
  11042.           SuperVGA");
  11043.                  break;
  11044.                case EVEREX:
  11045.                  sprintf(buf,"Everex EV236/6xx Micro Enhancer SuperVGA");
  11046.                  break;
  11047.                case GENOA:
  11048.                  sprintf(buf,"Genoa 61/62/63/64/6600 SuperVGA");
  11049.                  break;
  11050.                case NCR:
  11051.                  sprintf(buf,"NCR 77C21/22/22E/22E+ SuperVGA");
  11052.                  break;
  11053.                case OAKTECH:
  11054.                  sprintf(buf,"Oak Technologies OTI-037/67/77/87C
  11055.           SuperVGA");
  11056.                  break;
  11057.                case PARADISE:
  11058.                  sprintf(buf,"Paradise/Western Digital
  11059.           PVGA1A,WD90C00/1x/2x/3x SuperVGA");
  11060.                  break;
  11061.                case REALTEK:
  11062.                  sprintf(buf,"Realtek RT3106 SuperVGA");
  11063.  
  11064.  
  11065.                                                                         177
  11066.  
  11067.  
  11068.  
  11069.  
  11070.  
  11071.                  break;
  11072.                case TRIDENT:
  11073.                  sprintf(buf,"Trident 8800CS,8900B/C/CL/CX,90x0
  11074.           SuperVGA");
  11075.                  break;
  11076.                case TSENG3:
  11077.                  sprintf(buf,"Tseng Labs ET3000-AX/BX/BP SuperVGA");
  11078.                  break;
  11079.                case TSENG4:
  11080.                  sprintf(buf,"Tseng Labs ET4000/W32/W32I SuperVGA");
  11081.                  break;
  11082.                case VESA:
  11083.                  sprintf(buf,"VESA compatible SuperVGA");
  11084.                  break;
  11085.                case VIDEO7:
  11086.                  sprintf(buf,"Video 7 HT-208/16 SuperVGA");
  11087.                  break;
  11088.                case AVANCE:
  11089.                  sprintf(buf,"Avance Logic AL2101 SuperVGA");
  11090.                  break;
  11091.                case MXIC:
  11092.                  sprintf(buf,"MXIC MX68000/10 SuperVGA");
  11093.                  break;
  11094.                case PRIMUS:
  11095.                  sprintf(buf,"Primus P2000 SuperVGA");
  11096.                  break;
  11097.                default:
  11098.                  printf("Sorry, unable to identify video card or it is not
  11099.           a SuperVGA video adapter.\n");
  11100.                  exit(0);
  11101.             }
  11102.             printf("Video card/chip is identified as %s.\n",&buf);
  11103.             exit(0);
  11104.           }
  11105.  
  11106.  
  11107.  
  11108.  
  11109.  
  11110.  
  11111.  
  11112.  
  11113.  
  11114.  
  11115.  
  11116.  
  11117.  
  11118.  
  11119.  
  11120.  
  11121.  
  11122.  
  11123.  
  11124.  
  11125.  
  11126.  
  11127.                                                                         178
  11128.  
  11129.  
  11130.  
  11131.  
  11132.  
  11133.           WHICHXMS
  11134.  
  11135.             PROTOTYPE
  11136.  
  11137.             extern int far whichxms (unsigned int far *xmskbytesavail,
  11138.             unsigned int far *xmshandlesavail)
  11139.  
  11140.             INPUT
  11141.  
  11142.             no input parameters
  11143.  
  11144.             OUTPUT
  11145.  
  11146.             WHICHXMS returns a 1 if extended memory support is detected, 0
  11147.             otherwise.
  11148.             xmskbytesavail - number of free kilobytes in extended memory
  11149.             xmshandlesavail - number of available free handles
  11150.  
  11151.             USAGE
  11152.  
  11153.             WHICHXMS detects the existence of extended memory support and
  11154.             sets up the library function calls.  This function must be
  11155.             called before any other extended memory functions.  WHICHXMS
  11156.             also returns the number of free kilobytes of extended memory
  11157.             and the number of available handles.  The number of available
  11158.             handles is limited, normally to 32.  This limit can be
  11159.             modified by changing the extended memory driver (Microsoft's
  11160.             HIMEM.SYS is the most common) command line in the CONFIG.SYS
  11161.             file.
  11162.  
  11163.             SEE ALSO
  11164.  
  11165.             XMSALLOCATE, XMSCOPY, XMSERROR, XMSFREE, XMSGET, XMSPUT
  11166.  
  11167.             EXAMPLE
  11168.  
  11169.             /*
  11170.              * show what xms memory is available
  11171.              */
  11172.  
  11173.             #include <stdlib.h>
  11174.             #include <conio.h>
  11175.             #include "svgacc.h"
  11176.  
  11177.             void main(void)
  11178.             {
  11179.                int er, mem, handles;
  11180.  
  11181.                if ( whichxms(&mem,&handles) ) {
  11182.                  printf("an active xms memory manager was found!\n");
  11183.                  printf("a total of %d kb of xms memory
  11184.             available...\n",mem);
  11185.                  printf("a total of %d xms memory handles
  11186.             available...\n",handles);
  11187.  
  11188.  
  11189.                                                                         179
  11190.  
  11191.  
  11192.  
  11193.  
  11194.  
  11195.                  printf(" \n");
  11196.                  if ((mem < 1) || (handles < 1)) {
  11197.                     printf("sorry...there is either no free xms or\n");
  11198.                     printf("no free handles\n");
  11199.                     printf(" \n");
  11200.                     printf("xms support not available...\n");
  11201.                     exit(1);
  11202.                  }
  11203.                  else {
  11204.                  printf(" \n");
  11205.                  printf("xms support is ready and available!\n");
  11206.                  exit(1);
  11207.                  }
  11208.                }
  11209.                else {
  11210.                  printf("sorry...no active xms memory manager
  11211.             found...\n");
  11212.                  printf("make sure you have an xms memory manager\n");
  11213.                  printf("(such as HIMEM.SYS) loaded\n");
  11214.                  printf(" \n");
  11215.                  printf("xms support not available...\n");
  11216.                  exit(1);
  11217.                }
  11218.  
  11219.                exit(0);
  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.           XMSALLOCATE
  11258.  
  11259.             PROTOTYPE
  11260.  
  11261.             extern int far xmsallocate (unsigned int reqkbytes)
  11262.  
  11263.             INPUT
  11264.  
  11265.             reqkbytes - requested number of kilobytes of extended memory
  11266.  
  11267.             OUTPUT
  11268.  
  11269.             XMSALLOCATE returns the assigned memory handle if the
  11270.             allocation is successful, 0 otherwise.
  11271.  
  11272.             USAGE
  11273.  
  11274.             XMSALLOCATE attempts to allocate the requested number of
  11275.             kilobytes in extended memory.  If successful, the function
  11276.             returns the handle of the new memory block.  If the function
  11277.             returns zero, then the allocation was unsuccessful; check
  11278.             XMSERROR for error codes.
  11279.  
  11280.             All allocated blocks must be freed using XMSFREE before a
  11281.             program terminates or the memory is lost until the machine is
  11282.             rebooted.  Simply exiting a program will not free allocated
  11283.             extended memory blocks.
  11284.  
  11285.             SEE ALSO
  11286.  
  11287.             WHICHXMS, XMSCOPY, XMSERROR, XMSFREE, XMSGET, XMSPUT
  11288.  
  11289.             EXAMPLE
  11290.  
  11291.             See XMSCOPY
  11292.  
  11293.  
  11294.  
  11295.  
  11296.  
  11297.  
  11298.  
  11299.  
  11300.  
  11301.  
  11302.  
  11303.  
  11304.  
  11305.  
  11306.  
  11307.  
  11308.  
  11309.  
  11310.  
  11311.  
  11312.  
  11313.                                                                         181
  11314.  
  11315.  
  11316.  
  11317.  
  11318.  
  11319.           XMSCOPY
  11320.  
  11321.             PROTOTYPE
  11322.  
  11323.             extern int far xmscopy (int xmssrchandle, long srcoffset, int
  11324.             xmsdesthandle, long destoffset, unsigned long count)
  11325.  
  11326.             INPUT
  11327.  
  11328.             xmssrchandle - handle of source extended memory block
  11329.             srcoffset - number of bytes from beginning of source memory
  11330.             block
  11331.             xmsdesthandle - handle of destination extended memory block
  11332.             destoffset - number of bytes from beginning of destination
  11333.             memory block
  11334.             count - number of bytes to copy from source to destination
  11335.             (must be even)
  11336.  
  11337.             OUTPUT
  11338.  
  11339.             XMSCOPY returns a 1 if copy was successful, 0 otherwise.
  11340.  
  11341.             USAGE
  11342.  
  11343.             XMSCOPY copies the number of bytes specified in count from the
  11344.             source extended memory block to the destination extended
  11345.             memory block.  Count must be an even number.  The copy may
  11346.             begin and/or end offset from the beginning of the source and
  11347.             destination blocks by passing non zero values in srcoffset
  11348.             and/or destoffset.  The copy will occur faster if both offsets
  11349.             are divisible by four.  If the copy was unsuccessful, check
  11350.             XMSERROR for error codes.
  11351.  
  11352.             SEE ALSO
  11353.  
  11354.             WHICHXMS, XMSALLOCATE, XMSERROR, XMSFREE, XMSGET, XMSPUT
  11355.  
  11356.             EXAMPLE
  11357.  
  11358.             /*
  11359.              * show xms functions: this will copy one array into one
  11360.              * xms block, copy that xms block to a second xms block,
  11361.              * and then copy that second xms block to another array
  11362.              */
  11363.  
  11364.             #include <stdlib.h>
  11365.             #include <conio.h>
  11366.             #include "svgacc.h"
  11367.  
  11368.             void main(void)
  11369.             {
  11370.                int i, handle1, handle2, er, mem, handles;
  11371.                int test1[10], test2[10];
  11372.  
  11373.  
  11374.  
  11375.                                                                         182
  11376.  
  11377.  
  11378.  
  11379.  
  11380.  
  11381.                /* make sure xms is ready and available */
  11382.                if ( whichxms(&mem,&handles) ) {
  11383.                  if ((mem < 1) || (handles < 1)) {
  11384.                     printf("sorry...there is either no free xms or\n");
  11385.                     printf("no free handles\n");
  11386.                     exit(1);
  11387.                  }
  11388.                }
  11389.                else {
  11390.                  printf("sorry...no active xms memory manager
  11391.             found...\n");
  11392.                  printf("make sure you have an xms memory manager\n");
  11393.                  printf("(such as HIMEM.SYS) loaded\n");
  11394.                  exit(1);
  11395.                }
  11396.  
  11397.                /* generate some data */
  11398.                for(i=0;i<10;i++)
  11399.                {
  11400.                  test1[i] = i;
  11401.                }
  11402.  
  11403.                /* allocate the first xms block */
  11404.                handle1 = xmsallocate(1);
  11405.                if ( !handle1 ) {
  11406.                  printf("opps there is some error...unable to allocate
  11407.             xms...\n");
  11408.                  printf("error # %d\n",xmserror());
  11409.                  er = xmsfree(handle1);
  11410.                  exit(1);
  11411.                }
  11412.  
  11413.                /* allocate the second xms block */
  11414.                handle2 = xmsallocate(1);
  11415.                if ( !handle2 ) {
  11416.                  printf("opps there is some error...unable to allocate
  11417.             xms...\n");
  11418.                  printf("error # %d\n",xmserror());
  11419.                  er = xmsfree(handle1);
  11420.                  er = xmsfree(handle2);
  11421.                  exit(1);
  11422.                }
  11423.  
  11424.                /* copy our source array into first xms block */
  11425.                er = xmsput (test1, handle1, 0, sizeof(test1));
  11426.                if ( !er ) {
  11427.                  printf("opps there is some error...see error code
  11428.             list...\n");
  11429.                  printf("error # %d\n",xmserror());
  11430.                  er = xmsfree(handle1);
  11431.                  er = xmsfree(handle2);
  11432.                  exit(1);
  11433.                }
  11434.  
  11435.  
  11436.  
  11437.                                                                         183
  11438.  
  11439.  
  11440.  
  11441.  
  11442.  
  11443.                /* copy first xms block into second xms block */
  11444.                er = xmscopy (handle1, 0, handle2, 0, sizeof(test1));
  11445.                if ( !er ) {
  11446.                  printf("opps there is some error...see error code
  11447.             list...\n");
  11448.                  printf("error # %d\n",xmserror());
  11449.                  er = xmsfree(handle1);
  11450.                  er = xmsfree(handle2);
  11451.                  exit(1);
  11452.                }
  11453.  
  11454.                /* copy second xms block to out destination array */
  11455.                er = xmsget (handle2, 0, test2, sizeof(test1));
  11456.                if ( !er ) {
  11457.                  printf("opps there is some error...see error code
  11458.             list...\n");
  11459.                  printf("error # %d\n",xmserror());
  11460.                  er = xmsfree(handle1);
  11461.                  er = xmsfree(handle2);
  11462.                  exit(1);
  11463.                }
  11464.  
  11465.                /* free up all the xms memory we have allocated */
  11466.                er = xmsfree(handle1);
  11467.                er = xmsfree(handle2);
  11468.  
  11469.                /* show the results */
  11470.                printf("ok...we initialized one array with data, copied
  11471.             that\n");
  11472.                printf("array to an xms block, copied that xms block to
  11473.             a\n");
  11474.                printf("second xms block, and finally copied the second
  11475.             xms\n");
  11476.                printf("block into a new array...here are the results:\n");
  11477.                printf(" \n");
  11478.                printf("source array         destination array\n");
  11479.                for(i=0;i<10;i++)
  11480.                {
  11481.                printf(" %d                    %d\n",test1[i],test2[i]);
  11482.                }
  11483.                exit(0);
  11484.             }
  11485.  
  11486.  
  11487.  
  11488.  
  11489.  
  11490.  
  11491.  
  11492.  
  11493.  
  11494.  
  11495.  
  11496.  
  11497.  
  11498.  
  11499.                                                                         184
  11500.  
  11501.  
  11502.  
  11503.  
  11504.  
  11505.           XMSERROR
  11506.  
  11507.             PROTOTYPE
  11508.  
  11509.             extern int far xmserror (void)
  11510.  
  11511.             INPUT
  11512.  
  11513.             no input parameters
  11514.  
  11515.             OUTPUT
  11516.  
  11517.             XMSERROR returns the error code from the most recent XMS
  11518.             function call.
  11519.  
  11520.             USAGE
  11521.  
  11522.             XMSERROR returns the error code from the most recent XMS
  11523.             function call.  Each XMS function resets the error code to
  11524.             zero.  Therefore, if there has been an error, the error code
  11525.             should be checked immediately.  The error code will be one of
  11526.             the following:
  11527.  
  11528.             0    no error
  11529.             1    WHICHXMS has not been called
  11530.             2    number of bytes to copy is zero
  11531.             3    number of bytes to copy is odd
  11532.             4    offset into XMS block is zero
  11533.             128  Function not implemented
  11534.             129  VDISK device driver was detected
  11535.             142  General driver error
  11536.             143  Unrecoverable driver error
  11537.             146  DX is less than /HMAMIN= parameter
  11538.             160  All extended memory is allocated
  11539.             161  XMM handles are exhausted
  11540.             162  Handle is invalid
  11541.             163  Source handle is invalid
  11542.             164  Source offset is invalid
  11543.             165  Destination handle is invalid
  11544.             166  Destination offset is invalid
  11545.             167  Length is invalid
  11546.             168  Overlap in move request is invalid
  11547.             169  Parity error detected
  11548.             171  Block locked
  11549.  
  11550.             SEE ALSO
  11551.  
  11552.             WHICHXMS, XMSALLOCATE, XMSCOPY, XMSFREE, XMSGET, XMSPUT
  11553.  
  11554.             EXAMPLE
  11555.  
  11556.             See XMSCOPY
  11557.  
  11558.  
  11559.  
  11560.  
  11561.                                                                         185
  11562.  
  11563.  
  11564.  
  11565.  
  11566.  
  11567.           XMSFREE
  11568.  
  11569.             PROTOTYPE
  11570.  
  11571.             extern int far xmsfree (int xmshandle)
  11572.  
  11573.             INPUT
  11574.  
  11575.             xmshandle - handle of extended memory block to free
  11576.  
  11577.             OUTPUT
  11578.  
  11579.             XMSFREE returns 1 if extended memory block was deallocated, 0
  11580.             otherwise.
  11581.  
  11582.             USAGE
  11583.  
  11584.             XMSFREE deallocates the specified extended memory block.  All
  11585.             allocated blocks must be freed before a program terminates or
  11586.             the memory is lost until the machine is rebooted.  Simply
  11587.             exiting a program will not free allocated extended memory
  11588.             blocks.  If the function was unsuccessful, check XMSERROR for
  11589.             error codes.
  11590.  
  11591.             SEE ALSO
  11592.  
  11593.             WHICHXMS, XMSALLOCATE, XMSCOPY, XMSERROR, XMSGET, XMSPUT
  11594.  
  11595.             EXAMPLE
  11596.  
  11597.             See XMSCOPY
  11598.  
  11599.  
  11600.  
  11601.  
  11602.  
  11603.  
  11604.  
  11605.  
  11606.  
  11607.  
  11608.  
  11609.  
  11610.  
  11611.  
  11612.  
  11613.  
  11614.  
  11615.  
  11616.  
  11617.  
  11618.  
  11619.  
  11620.  
  11621.  
  11622.  
  11623.                                                                         186
  11624.  
  11625.  
  11626.  
  11627.  
  11628.  
  11629.           XMSGET
  11630.  
  11631.             PROTOTYPE
  11632.  
  11633.             extern int far xmsget (int xmshandle, long offset, void far
  11634.             *destmem, unsigned long count)
  11635.  
  11636.             INPUT
  11637.  
  11638.             xmshandle - handle of source extended memory block
  11639.             offset - number of bytes from beginning of source memory block
  11640.             count - number of bytes to copy from extended memory to
  11641.             conventional memory (must be even)
  11642.  
  11643.             OUTPUT
  11644.  
  11645.             XMSGET returns 1 if the copy was successful, 0 otherwise.
  11646.             destmem - copy of data in conventional memory
  11647.  
  11648.             USAGE
  11649.  
  11650.             XMSGET retrieves data from extended memory and places it in
  11651.             conventional memory.  The number of bytes copied must be an
  11652.             even number and cannot be larger than 65536.  The copy may
  11653.             begin off the beginning of the source extended memory block by
  11654.             specifying an non zero offset.  If the function was
  11655.             unsuccessful, check XMSERROR for error codes.
  11656.  
  11657.             SEE ALSO
  11658.  
  11659.             WHICHXMS, XMSALLOCATE, XMSCOPY, XMSERROR, XMSFREE, XMSPUT
  11660.  
  11661.             EXAMPLE
  11662.  
  11663.             See XMSCOPY
  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.           XMSPUT
  11692.  
  11693.             PROTOTYPE
  11694.  
  11695.             extern int far xmsput (void far *sourcemem, int xmshandle,
  11696.             long offset, unsigned long count)
  11697.  
  11698.             INPUT
  11699.  
  11700.             sourcemem - source data in conventional memory
  11701.             xmshandle - handle of destination extended memory block
  11702.             offset - number of bytes from beginning of destination memory
  11703.             block
  11704.             count - number of bytes to copy from conventional memory to
  11705.             extended memory (must be even)
  11706.  
  11707.             OUTPUT
  11708.  
  11709.             XMSPUT returns 1 if the copy was successful, 0 otherwise.
  11710.  
  11711.             USAGE
  11712.  
  11713.             XMSPUT copies data from conventional memory to extended
  11714.             memory.  The number of bytes copied must be an even number and
  11715.             cannot be larger than 65536.  The destination may begin off
  11716.             the beginning of the extended memory block by specifying an
  11717.             non zero offset.  If the function was unsuccessful, check
  11718.             XMSERROR for error codes.
  11719.  
  11720.             SEE ALSO
  11721.  
  11722.             WHICHXMS, XMSALLOCATE, XMSCOPY, XMSERROR, XMSFREE, XMSGET
  11723.  
  11724.             EXAMPLE
  11725.  
  11726.             See XMSCOPY
  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.           APPENDIX A.  SVGACC.H
  11754.  
  11755.           This is the header file containing function prototypes and
  11756.           structure definitions for SVGACC.LIB.  This file should be
  11757.           included in every program module that uses this library.  To
  11758.           properly include the header file, place the following line at the
  11759.           top of the every code module:
  11760.  
  11761.                                  #include "svgacc.h"
  11762.  
  11763.           Without these prototypes and definitions, the C/C++ compiler will
  11764.           be unable to compile any code module using the commands found in
  11765.           this library.
  11766.  
  11767.             /* SVGA Graphics Library Include File for MS C and QuickC
  11768.              * Copyright 1994 by Stephen L. Balkum and Daniel A. Sill
  11769.              * Zephyr Software P.O. Box 7704, Austin, Texas  78713-7704
  11770.              */
  11771.  
  11772.             #ifndef SVGACC_H
  11773.             #define SVGACC_H
  11774.  
  11775.             typedef unsigned char byte;
  11776.  
  11777.             typedef struct {
  11778.                char r;
  11779.                char g;
  11780.                char b;
  11781.             } RGB;
  11782.  
  11783.             typedef RGB PaletteData[256];
  11784.  
  11785.             typedef struct {
  11786.                byte hotspotx;
  11787.                byte hotspoty;
  11788.                byte data[384];
  11789.             } MouseCursor;
  11790.  
  11791.             typedef struct {
  11792.                byte width;
  11793.                byte height;
  11794.                byte data[4096];
  11795.             } Font;
  11796.  
  11797.             typedef enum {
  11798.                NO_ACTION = 0,
  11799.                SET,
  11800.                XOR,
  11801.                OR,
  11802.                AND
  11803.             } PixelMode;
  11804.  
  11805.             typedef enum {
  11806.                UNKNOWN = 0,
  11807.  
  11808.  
  11809.                                                                         189
  11810.  
  11811.  
  11812.  
  11813.  
  11814.  
  11815.                ACUMOS,
  11816.                ATI,
  11817.                AHEADA,
  11818.                AHEADB,
  11819.                CHIPSTECH,
  11820.                CIRRUS,
  11821.                EVEREX,
  11822.                GENOA,
  11823.                NCR,
  11824.                OAKTECH,
  11825.                PARADISE,
  11826.                REALTEK,
  11827.                TRIDENT,
  11828.                TSENG3,
  11829.                TSENG4,
  11830.                VESA,
  11831.                VIDEO7,
  11832.                AVANCE,
  11833.                MXIC,
  11834.                PRIMUS
  11835.             } VGAChipset;
  11836.  
  11837.             typedef struct {
  11838.                unsigned int width;
  11839.                unsigned int height;
  11840.                byte data[];
  11841.             } RasterBlock;
  11842.  
  11843.             typedef struct {
  11844.                int x;
  11845.                int y;
  11846.             } D2Point;
  11847.  
  11848.             typedef struct {
  11849.                int x;
  11850.                int y;
  11851.                int z;
  11852.             } D3Point;
  11853.  
  11854.             typedef struct {
  11855.                int eyex;
  11856.                int eyey;
  11857.                int eyez;
  11858.                int scrd;
  11859.                int theta;
  11860.                int phi;
  11861.             } ProjParameters;
  11862.  
  11863.             #ifdef __cplusplus
  11864.             extern "C" {
  11865.             #endif
  11866.  
  11867.             /* Global variables */
  11868.             extern const int far maxx;
  11869.  
  11870.  
  11871.                                                                         190
  11872.  
  11873.  
  11874.  
  11875.  
  11876.  
  11877.             extern const int far maxy;
  11878.             extern const int far viewx1;
  11879.             extern const int far viewy1;
  11880.             extern const int far viewx2;
  11881.             extern const int far viewy2;
  11882.  
  11883.             /* 'BLocK' methods to manipulate RasterBlocks on and off the
  11884.                screen */
  11885.  
  11886.             extern int   far blkget (int x1, int y1, int x2, int y2,
  11887.                RasterBlock far *gfxblk);
  11888.             extern void  far blkput (PixelMode mode, int x, int y,
  11889.                RasterBlock far *gfxblk);
  11890.             extern void  far blkresize (unsigned newxsize, unsigned
  11891.                newysize, RasterBlock far *sourcegfxblk, RasterBlock far
  11892.                *destgfxblk);
  11893.             extern int   far blkrotate (int ang, int backfill, RasterBlock
  11894.                far *sourcegfxblk, RasterBlock far *destgfxblk);
  11895.             extern int   far blkrotatesize (int ang, RasterBlock far
  11896.                *sourcegfxblk);
  11897.  
  11898.             /* 'BYTECOPY' method for fast memory copy */
  11899.  
  11900.             extern void far bytecopy (void far *src, void far *dst,
  11901.                unsigned long numbytes);
  11902.  
  11903.             /* '2D' methods to transform D2Points */
  11904.  
  11905.             extern void  far d2rotate (int points, int xorigin, int
  11906.                yorigin, int ang, D2Point far *inary, D2Point far *outary);
  11907.             extern void  far d2scale (int points, int xscale, int yscale,
  11908.                D2Point far *inary, D2Point far *outary);
  11909.             extern void  far d2translate (int points, int xtrans, int
  11910.                ytrans, D2Point far *inary, D2Point far *outary);
  11911.  
  11912.             /* '3D' methods to transform D3Points */
  11913.  
  11914.             extern int   far d3project (int points, ProjParameters far
  11915.                *params, D3Point far *inary, D2Point far *outary);
  11916.             extern void  far d3rotate (int points, int xorigin, int
  11917.                yorigin, int zorigin, int zrang, int yrang, int xrang,
  11918.                D3Point far *inary, D3Point far *outary);
  11919.             extern void  far d3scale (int points, int xscale, int yscale,
  11920.                int zscale, D3Point far *inary, D3Point far *outary);
  11921.             extern void  far d3translate (int points, int xtrans, int
  11922.                ytrans, int ztrans, D3Point far *inary, D3Point far
  11923.                *outary);
  11924.  
  11925.             /* 'DRaW' methods for placing text and graphics primitives on
  11926.                screen */
  11927.  
  11928.             extern void  far drwbox (PixelMode mode, int colr, int x1, int
  11929.                y1, int x2, int y2);
  11930.  
  11931.  
  11932.  
  11933.                                                                         191
  11934.  
  11935.  
  11936.  
  11937.  
  11938.  
  11939.             extern void  far drwcircle (PixelMode mode, int colr, int
  11940.                centerx, int centery, int radius);
  11941.             extern void  far drwellipse (PixelMode mode, int colr, int
  11942.                centerx, int centery, int radiusx, int radiusy);
  11943.             extern void  far drwfillbox (PixelMode mode, int colr, int x1,
  11944.                int y1, int x2, int y2);
  11945.             extern void  far drwfillcircle (PixelMode mode, int colr, int
  11946.                centerx, int centery, int radius);
  11947.             extern void  far drwfillellipse (PixelMode mode, int colr, int
  11948.                centerx, int centery, int radiusx, int radiusy);
  11949.             extern void  far drwline (PixelMode mode, int colr, int x1, int
  11950.                y1, int x2, int y2);
  11951.             extern void  far drwpoint (PixelMode mode, int colr, int x, int
  11952.                y);
  11953.             extern void  far drwstring (PixelMode mode, int fcolr, int
  11954.                bcolr, const char far *strng, int x, int y);
  11955.             extern void  far drwstringdn (PixelMode mode, int fcolr, int
  11956.                bcolr, const char far *strng, int x, int y);
  11957.             extern void  far drwstringlt (PixelMode mode, int fcolr, int
  11958.                bcolr, const char far *strng, int x, int y);
  11959.             extern void  far drwstringrt (PixelMode mode, int fcolr, int
  11960.                bcolr, const char far *strng, int x, int y);
  11961.  
  11962.             /* 'FILL' methods for filling various regions on screen with a
  11963.                color */
  11964.  
  11965.             extern void  far fillarea (int xseed, int yseed, int
  11966.                bordercolr, int fillcolr);
  11967.             extern void  far fillcolor (int xseed, int yseed, int oldcolr,
  11968.                int newcolr);
  11969.             extern void  far fillpage (int colr);
  11970.             extern void  far fillscreen (int colr);
  11971.             extern void  far fillview (int colr);
  11972.  
  11973.             /* 'FONT' methods for setting the current font */
  11974.  
  11975.             extern void  far fontgetinfo (int far *wdth, int far *hght);
  11976.             extern void  far fontset (Font far *font);
  11977.             extern void  far fontsystem (void);
  11978.  
  11979.             /* 'GET' methods to return information held by library */
  11980.  
  11981.             extern void  far getlaststring (RasterBlock far *strnggfxblk);
  11982.             extern long  far getarccos (long cosvalue);
  11983.             extern long  far getarcsin (long sinvalue);
  11984.             extern long  far getarctan (long tanvalue);
  11985.             extern long  far getcos (long angle);
  11986.             extern int   far getpoint (int x, int y);
  11987.             extern long  far getsin (long angle);
  11988.             extern long  far gettan (long angle);
  11989.  
  11990.             /* 'GIF' methods to read / write GIF files and place images on
  11991.                screen */
  11992.  
  11993.  
  11994.  
  11995.                                                                         192
  11996.  
  11997.  
  11998.  
  11999.  
  12000.  
  12001.             extern int   far gifgetinfo (const char far *name, int far
  12002.                *gifxsize, int far *gifysize, int far *numcolors, RGB far
  12003.                *pal);
  12004.             extern int   far gifmake (int x1, int y1, int x2, int y2, const
  12005.                char far *name);
  12006.             extern int   far gifput (PixelMode mode, int xloc, int yloc,
  12007.                const char far *name);
  12008.  
  12009.             /* 'JOYSTICK' method to read joysticks' status */
  12010.  
  12011.             extern void  far joystickinfo (int far *jax, int far *jay, int
  12012.                far *jabuts, int far *jbx, int far *jby, int far *jbbuts);
  12013.  
  12014.             /* 'MOUSE' methods to interact with mouse driver */
  12015.  
  12016.             extern void  far mousebutpress (int reqbut, int far *xloc, int
  12017.                far *yloc, int far *num, int far *mbuts);
  12018.             extern void  far mousebutrelease (int reqbut, int far *xloc,
  12019.                int far *yloc, int far *num, int far *mbuts);
  12020.             extern void  far mousecursordefault (void);
  12021.             extern void  far mousecursorset (MouseCursor far *mousecursor);
  12022.             extern void  far mouseenter (void);
  12023.             extern void  far mouseexit (void);
  12024.             extern void  far mousehide (void);
  12025.             extern void  far mouseinfo (int far *drvmajorver, int far
  12026.                *drvminorver, int far *mousetype, int far *irqnumber);
  12027.             extern void  far mouselocset (int xloc, int yloc);
  12028.             extern void  far mouserangeset (int x1, int y1, int x2, int
  12029.                y2);
  12030.             extern void  far mouserestorestate (byte far *mousebuf);
  12031.             extern void  far mousesavestate (byte far *mousebuf);
  12032.             extern void  far mousesensset (int xsens, int ysens, int
  12033.                dblspdthresh);
  12034.             extern void  far mouseshow (void);
  12035.             extern void  far mousestatus (int far *x, int far *y, int far
  12036.                *mbuts);
  12037.             extern int   far mousestoragesize (void);
  12038.  
  12039.             extern void  far overscanset (int colr);
  12040.  
  12041.             /* 'PAGE' methods to control paging abilities */
  12042.             extern int   far pageactive (int page);
  12043.             extern int   far pagedisplay (int x, int y, int page);
  12044.  
  12045.             /* 'PALette' methods to manipulate and activate palettes */
  12046.             extern void  far palchgauto (RGB far *pal, RGB far *newpal, int
  12047.                firstcolr, int lastcolr, int speed);
  12048.             extern void  far palchgstep (RGB far *pal, RGB far *newpal, int
  12049.                firstcolr, int lastcolr, int percent);
  12050.             extern void  far palcopy (RGB far *srcpal, RGB far *destpal,
  12051.                int firstcolr, int lastcolr);
  12052.             extern void  far paldimstep (RGB far *pal, int firstcolr, int
  12053.                lastcolr, int percent);
  12054.  
  12055.  
  12056.  
  12057.                                                                         193
  12058.  
  12059.  
  12060.  
  12061.  
  12062.  
  12063.             extern void  far palget (RGB far *pal, int firstcolr, int
  12064.                lastcolr);
  12065.             extern void  far palioauto (RGB far *pal, int firstcolr, int
  12066.                lastcolr, int speed);
  12067.             extern void  far palrotate (RGB far *pal, int firstcolr, int
  12068.                lastcolr, int shift);
  12069.             extern void  far palset (RGB far *pal, int firstcolr, int
  12070.                lastcolr);
  12071.  
  12072.             /* 'RESolution' methods to set various video modes */
  12073.  
  12074.             extern int   far res320 (void);
  12075.             extern int   far res640 (void);
  12076.             extern int   far res640l (void);
  12077.             extern int   far res800 (void);
  12078.             extern int   far res1024 (void);
  12079.             extern int   far restext (void);
  12080.  
  12081.             /* 'SCROLL' methods for scrolling various sections of the
  12082.                screen */
  12083.  
  12084.             extern void  far scrolldn (int x1, int y1, int x2, int y2, int
  12085.                num, int colr);
  12086.             extern void  far scrolllt (int x1, int y1, int x2, int y2, int
  12087.                num, int colr);
  12088.             extern void  far scrollrt (int x1, int y1, int x2, int y2, int
  12089.                num, int colr);
  12090.             extern void  far scrollup (int x1, int y1, int x2, int y2, int
  12091.                num, int colr);
  12092.  
  12093.             /* 'Sync' delay method */
  12094.  
  12095.             extern void  far sdelay (int count);
  12096.  
  12097.             /* 'SET' methods to adjust library internal variables */
  12098.  
  12099.             extern void  far setcard (VGAChipset chip, int mem);
  12100.             extern void  far setview (int x1, int y1, int x2, int y2);
  12101.  
  12102.             /* 'SPRITE' methods for manipulating sprites on and off screen
  12103.                */
  12104.  
  12105.             extern int   far spritecolldetect (int transcolr, int x1, int
  12106.                y1, int x2, int y2, RasterBlock far *sprite1, RasterBlock
  12107.                far *sprite2);
  12108.             extern void  far spritegap (int transcolr, int x, int y,
  12109.                RasterBlock far *sprite, RasterBlock far *spritebkgnd);
  12110.             extern void  far spriteget (int transcolr, int x, int y,
  12111.                RasterBlock far *sprite, RasterBlock far *spritebkgnd);
  12112.             extern void  far spriteput (PixelMode mode, int transcolr, int
  12113.                x, int y, RasterBlock far *sprite);
  12114.  
  12115.             /* 'VIDEO' methods to interact with video mode and display */
  12116.  
  12117.  
  12118.  
  12119.                                                                         194
  12120.  
  12121.  
  12122.  
  12123.  
  12124.  
  12125.             extern int   far videomodeget (void);
  12126.             extern void  far videomodeset (int videomode);
  12127.             extern void  far videooff (void);
  12128.             extern void  far videoon (void);
  12129.  
  12130.             /* 'Identification' methods to discover WHICH hardware is
  12131.                available */
  12132.  
  12133.             extern int   far whichcpu (void);
  12134.             extern int   far whichjoystick (void);
  12135.             extern int   far whichmem (void);
  12136.             extern int   far whichmouse (void);
  12137.             extern VGAChipset far whichvga (void);
  12138.             extern int   far whichxms (unsigned int far *xmskbytesavail,
  12139.                unsigned int far *xmshandlesavail);
  12140.  
  12141.             /* 'XMS' methods to store and retrieve extended memory */
  12142.  
  12143.             extern int   far xmsallocate (unsigned int reqkbytes);
  12144.             extern int   far xmscopy (int xmssrchandle, long srcoffset, int
  12145.                xmsdesthandle, long destoffset, unsigned long count);
  12146.             extern int   far xmserror (void);
  12147.             extern int   far xmsfree (int xmshandle);
  12148.             extern int   far xmsget (int xmshandle, long offset, void far
  12149.                *destmem, unsigned long count);
  12150.             extern int   far xmsput (void far *sourcemem, int xmshandle,
  12151.                long offset, unsigned long count);
  12152.  
  12153.             #ifdef __cplusplus
  12154.             }
  12155.             #endif
  12156.  
  12157.             #endif
  12158.             /* SVGACC_H */
  12159.  
  12160.  
  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.           APPENDIX B.  JOYSTICK PORTS AND Y-CABLES
  12188.  
  12189.           SCHEMATIC WIRING DIAGRAM FOR A STANDARD JOYSTICK PORT
  12190.  
  12191.                                     DB15 male
  12192.                                     connector
  12193.                    Joystick B            ___       Joystick A
  12194.                                       __/   |
  12195.                                      /    o | 1 -------------------+
  12196.              +------------------  9 | o     |     ___Button A      |
  12197.              |     Button A___      |     o | 2 --o o-+            |
  12198.              |           +-o o-- 10 | o     |         |    X Axis  |
  12199.              |  X Axis   |          |     o | 3 -------------+     |
  12200.              |     +------------ 11 | o     |         |      |     |
  12201.              |     |     |          |     o | 4 ------+      |     |
  12202.              +--/\/\/\   +------ 12 | o     |         |    /\/\/\--+
  12203.              |           |          |     o | 5       |            |
  12204.              |     +------------ 13 | o     |         |            |
  12205.              |     |     | ___      |     o | 6 -------------+     |
  12206.              |     |     +-o o-- 14 | o     |     ___ |      |     |
  12207.              |     |    Button B    |     o | 7 --o o-+      |     |
  12208.              |     |             15 | o     |   Button B   /\/\/\--+
  12209.              +--/\/\/\               \__  o | 8            Y Axis
  12210.                Y Axis                   \___|
  12211.  
  12212.           Notes:
  12213.  
  12214.           1)This diagram comes with NO warranties expressed or implied.
  12215.             It is provided for information only.  In no event shall
  12216.             Stephen L. Balkum, Daniel A. Sill or Zephyr Software be held
  12217.             liable for damages resulting from use, misuse, or inability to
  12218.             use this information.
  12219.  
  12220.           2)The x and y axis potentiometers have a typical range of 0 to
  12221.             100k ohms.  Buttons are normally open and close when pressed.
  12222.  
  12223.           3)This diagram is correct for joystick ports that conform to the
  12224.             standard set forth by IBM. Some specialty joystick cards
  12225.             provide separate A and B joystick connectors.  For these
  12226.             cards, both connectors are wired to pins 1 through 8 as shown
  12227.             in the diagram.
  12228.  
  12229.           4)Many 'Super I/O' boards (2H/2F/2S/1P/1G) equipped with a
  12230.             joystick port will support only one joystick.  On these cards,
  12231.             pins 9 through 15 are not used.
  12232.  
  12233.           5)Commercially available joysticks are wired to use pins 1
  12234.             through 8 and, therefore, will always be 'Joystick A' if
  12235.             plugged directly into a dual joystick port connector.
  12236.  
  12237.           6)Many sound cards provide joystick ports; however, their
  12238.             connector wiring does not always conform to the standard shown
  12239.             above.  Some of these connectors may be used for other
  12240.  
  12241.  
  12242.  
  12243.                                                                         196
  12244.  
  12245.  
  12246.  
  12247.  
  12248.  
  12249.             purposes such as a MIDI port.  See the documentation that
  12250.             comes with the sound card.
  12251.  
  12252.           7)If there is more than one joystick port on a computer
  12253.             configured to operate the same joystick, only ONE port should
  12254.             be enabled at any given time for proper operation.  Disable
  12255.             all but one joystick port.  For example, if the computer has
  12256.             both a Super I/O card and a sound card, the joystick port on
  12257.             the Super I/O card should be disabled since the sound card's
  12258.             port probably supports two joysticks and the I/O card supports
  12259.             only one.
  12260.  
  12261.  
  12262.  
  12263.  
  12264.  
  12265.  
  12266.  
  12267.  
  12268.  
  12269.  
  12270.  
  12271.  
  12272.  
  12273.  
  12274.  
  12275.  
  12276.  
  12277.  
  12278.  
  12279.  
  12280.  
  12281.  
  12282.  
  12283.  
  12284.  
  12285.  
  12286.  
  12287.  
  12288.  
  12289.  
  12290.  
  12291.  
  12292.  
  12293.  
  12294.  
  12295.  
  12296.  
  12297.  
  12298.  
  12299.  
  12300.  
  12301.  
  12302.  
  12303.  
  12304.  
  12305.                                                                         197
  12306.  
  12307.  
  12308.  
  12309.  
  12310.  
  12311.           SCHEMATIC WIRING DIAGRAM FOR A JOYSTICK Y-CABLE
  12312.                                               ___
  12313.                          DB15 male         __/   |
  12314.                        connector to       /    o | 1 --------+
  12315.                        Joystick Port   9 | o     |           |
  12316.                         on computer      |     o | 2 --------|-+
  12317.                             +-------- 10 | o     |           | |
  12318.                             |            |     o | 3 --------|-|-+
  12319.                             | +------ 11 | o     |           | | |
  12320.                             | |          |     o | 4 --------|-|-|-+
  12321.                             | |       12 | o     |           | | | |
  12322.                             | |          |     o | 5         | | | |
  12323.                             | | +---- 13 | o     |           | | | |
  12324.                             | | |        |     o | 6 --------|-|-|-|-+
  12325.                             | | | +-- 14 | o     |           | | | | |
  12326.                             | | | |      |     o | 7 --------|-|-|-|-|-+
  12327.                             | | | |   15 | o     |           | | | | | |
  12328.                             | | | |       \__  o | 8         | | | | | |
  12329.                             | | | |          \___|           | | | | | |
  12330.                             | | | |                          | | | | | |
  12331.                             | | | |                          | | | | | |
  12332.                             | | | |  +-----------------------+ | | | | |
  12333.                             | | | |  |                       | | | | | |
  12334.                             | | | |  | +---------------------|-|-|-+ | |
  12335.                             | | | |  | |                     | | | | | |
  12336.                             | | | |  | |                     | | | | | |
  12337.            DB15 female      | | | |  | |     DB15 female     | | | | | |
  12338.            connector to     | | | |  | |     connector to    | | | | | |
  12339.             Joystick B      | | | |  | |      Joystick A     | | | | | |
  12340.                   ___       | | | |  | |            ___      | | | | | |
  12341.                __/   |      | | | |  | |         __/   |     | | | | | |
  12342.               /    o | 1 ---|-|-|-|--+ |        /    o | 1 --+ | | | | |
  12343.            9 | o     |      | | | |    |     9 | o     |       | | | | |
  12344.              |     o | 2 ---+ | | |    |       |     o | 2 ----+ | | | |
  12345.           10 | o     |        | | |    |    10 | o     |         | | | |
  12346.              |     o | 3 -----+ | |    |       |     o | 3 ------+ | | |
  12347.           11 | o     |          | |    |    11 | o     |           | | |
  12348.              |     o | 4 -------|-|----+       |     o | 4 --------+ | |
  12349.           12 | o     |          | |         12 | o     |             | |
  12350.              |     o | 5        | |            |     o | 5           | |
  12351.           13 | o     |          | |         13 | o     |             | |
  12352.              |     o | 6 -------+ |            |     o | 6 ----------+ |
  12353.           14 | o     |            |         14 | o     |               |
  12354.              |     o | 7 ---------+            |     o | 7 ------------+
  12355.           15 | o     |                      15 | o     |
  12356.               \__  o | 8                        \__  o | 8
  12357.                  \___|                             \___|
  12358.  
  12359.           Notes:
  12360.  
  12361.           1)This diagram comes with NO warranties expressed or implied.
  12362.             It is provided for information only.  In no event shall
  12363.             Stephen L. Balkum, Daniel A. Sill or Zephyr Software be held
  12364.  
  12365.  
  12366.  
  12367.                                                                         198
  12368.  
  12369.  
  12370.  
  12371.  
  12372.  
  12373.             liable for damages resulting from use, misuse, or inability to
  12374.             use this information.
  12375.  
  12376.           2)This cable has worked with a standard joystick port connector,
  12377.             a Sound Blaster port connector, and a Sound Blaster Pro
  12378.             joystick port connector.
  12379.  
  12380.  
  12381.  
  12382.  
  12383.  
  12384.  
  12385.  
  12386.  
  12387.  
  12388.  
  12389.  
  12390.  
  12391.  
  12392.  
  12393.  
  12394.  
  12395.  
  12396.  
  12397.  
  12398.  
  12399.  
  12400.  
  12401.  
  12402.  
  12403.  
  12404.  
  12405.  
  12406.  
  12407.  
  12408.  
  12409.  
  12410.  
  12411.  
  12412.  
  12413.  
  12414.  
  12415.  
  12416.  
  12417.  
  12418.  
  12419.  
  12420.  
  12421.  
  12422.  
  12423.  
  12424.  
  12425.  
  12426.  
  12427.  
  12428.  
  12429.                                                                         199