home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / GRAPHICS / SIMGRAFC.ZIP / SIMGC.DOC < prev    next >
Encoding:
Text File  |  1985-06-15  |  30.1 KB  |  2,381 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.     This library was placed on The Consultants' Exchange by the author.
  8.             ( 7 1 4 )   8 4 2 - 6 3 4 8
  9.                   24 hours
  10.  
  11.  
  12.  
  13.  
  14.  
  15.                     SIMGRAPH
  16.  
  17.                  Simple Graphics Library
  18.  
  19.                        for
  20.  
  21.                   C, FORTRAN and BASIC
  22.  
  23.  
  24.  
  25.                Copyright 1983, 1984, 1985
  26.  
  27.                   Ryan Software
  28.  
  29.                   Version 3.00
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.                  TABLE OF CONTENTS
  66.  
  67.                                   Page
  68.  
  69.     1. Important Notice                        1
  70.  
  71.     2. Registration Information                    1
  72.  
  73.     3. General                            2
  74.  
  75.     4. What is on the Diskette                    3
  76.  
  77.     5. List of Functions                        4
  78.  
  79.     6. Appendices
  80.  
  81.          a. C Functions
  82.  
  83.          b. FORTRAN Functions
  84.  
  85.          c. BASIC Functions
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.                  IMPORTANT NOTICE
  127.  
  128.  
  129.  
  130.     SIMGRAPH  is copyrighted, written and maintained by:
  131.  
  132.                    Ryan  Software
  133.                    P.O.  Box 3064
  134.                    Orange, CA  92665
  135.  
  136.     Users  of this program are encouraged to copy and distribute  the
  137.     graphics  library and demonstrations programs which are a part of
  138.     this package for non-commericial purposes.
  139.  
  140.     No fee or other charges may be made in the distribution of  these
  141.     programs without the written permission of Ryan Software.
  142.  
  143.     Version  numbers  appear in the documentation and in  the  source
  144.     code.  The most current version of the programs and the  SIMGRAPH
  145.     libraries may be obtained from Ryan Software.
  146.  
  147.     SIMGRAPH is a trademark of Ryan Sofware.
  148.  
  149.  
  150.  
  151.  
  152.                  REGISTRATION INFORMATION
  153.  
  154.     If you find the program library useful you are encouraged to make
  155.     a donation of $40.  Those who make a donation will be entitled to
  156.     receive the following:
  157.  
  158.            o  Become a registered user
  159.            o  A printed manual.
  160.            o  All  assembly language source code for the  C,  FORTRAN
  161.           and BASIC versions.
  162.            o  Source code of additional demonstration programs.
  163.            o  Any new enhancements
  164.            o  Free upgrades if you return the original diskette  with
  165.           a postage paid diskette mailer. ($10 if you do not send
  166.           a diskette and mailer)
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.                           1
  184.  
  185.  
  186.  
  187.  
  188.                       GENERAL
  189.  
  190.     This  software was written originally written to enable  programs
  191.     written  in Lattice and Microsoft C to display color graphics  in
  192.     the   medium  resolution  mode    on  an    IBM-PC    with  a  standard
  193.     color/graphics adapter card.
  194.  
  195.     The  C,  FORTRAN  and BASIC library of routines  are  distributed
  196.     without  charge to interested parties for the express purpose  of
  197.     being  able to display graphics in any of  those  languages.  The
  198.     libraries  or portions of those libraries may not be used in  any
  199.     commercial program or program sold for profit without the written
  200.     permission of Ryan Software.
  201.  
  202.     The routines are all written in assembly language to optimize for
  203.     speed.    The first code was written in 1983 by Lance Robinson  and
  204.     has since been enhanced and added to by Tracy Lenocker.
  205.  
  206.     The  SIMGRAPH libraries runs faster than any other public  domain
  207.     graphics  programs  and faster than many  commerically    available
  208.     programs.
  209.  
  210.     Although  this    library  represents  only  fundamental     graphics
  211.     display routines,  they will allow you to perform the most wanted
  212.     features  for  screen plotting.  With the  SIMGRAPH  library  any
  213.     programmer  can  easily construct other needed types of  graphics
  214.     such as circles,  and arcs.  Using only these basic routines  you
  215.     can  easily  construct    more comprehensive  programs  to  general
  216.     screen    plotting,  bar    charts,  pie  charts and other    types  of
  217.     programs.  Due    to  the  speed of the SIMGRAPH    library  you  can
  218.     quickly display and rotate objects.
  219.  
  220.     For   more  comprehensive  graphic  routines  the   user   should
  221.     investigate  the commercially available programs such as the HALO
  222.     graphics programs.
  223.  
  224.      Lattice C version
  225.  
  226.     When  linking  a  program  all    you need to  do  is  specify  the
  227.     SIMGRAFC.LIB  along  with  the Lattice C model    library  you  are
  228.     using.    An example of a batch file which will compile and link    a
  229.     single program is given below:
  230.  
  231.           lc1 %1
  232.           if errorlevel 1 goto err
  233.           lc2 %1
  234.           if errorlevel 1 goto err
  235.           link cs+%1,%1,,simgraph+lcs
  236.           if errorlevel 1 goto err
  237.           rem COMPILE COMPLETE
  238.           goto end
  239.           :err
  240.           rem ERRORS ENCOUNTERED
  241.           :end
  242.  
  243.  
  244.                           2
  245.  
  246.  
  247.  
  248.      FORTRAN Version
  249.  
  250.     The library SIMGRAFF.LIB must be linked with the program you have
  251.     written.
  252.  
  253.      BASIC Version
  254.  
  255.     The library SIMGRAFB.LIB must be linke with the program you  have
  256.     written and compiled using BASCOM.
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.                           3
  306.  
  307.  
  308.  
  309.                   WHAT IS ON THE DISKETTE
  310.  
  311.  
  312.     SIMGRAFC.LIB    -  The C graphic and non-graphic library routines
  313.  
  314.     SIMGRAFF.LIB    -  The FORTRAN graphic and non-graphic library
  315.                routines
  316.  
  317.     SIMGRAFB.LIB    -  The BASIC graphic and non-graphic library
  318.                routines
  319.  
  320.     SIMGRAPH.DOC    -  This document file
  321.  
  322.     DEMOn.COM    -  A series of demonstration programs
  323.  
  324.     DEMOn.C     -  Source code for the C demonstration programs
  325.  
  326.     DEMOn.FOR    -  Source  code  for  the  FORTRAN  demonstration
  327.                programs
  328.  
  329.     DEMOn.BAS    -  Source   code  for  the  BASIC   demonstration
  330.                programs
  331.  
  332.     READ.ME     -  Most current changes and announcements
  333.  
  334.  
  335.  
  336.  
  337.     Additionally the registered users diskette contains:
  338.  
  339.     LIBHEAD.ASM    -  Header code for all the function libraries
  340.  
  341.     SIMGRAPH.ASM    -  Source code for the graphic functions
  342.  
  343.     NGFALL.ASM    -  Source  code  for  the  non-graphic    functions
  344.                including those that are C specific.
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.                           4
  367.  
  368.  
  369.  
  370.                 LIST OF C FUNCTIONS
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.     Graphics Functions        Functional Description
  379.     ----------------------------    ---------------------------------
  380.     g_init()            Initialize medium resolution mode
  381.     g_clear()            Clear the graphics screen
  382.     g_text(mode)            Reset back to text mode
  383.     g_pal(color)            Select a color palette
  384.     g_bakgnd(color)         Select a background color
  385.     g_dot(x,y,color)        Display a dot
  386.     g_line(x1,y1,x2,y2,color)    Display a line
  387.     g_getdot(x,y)            Get the color of a displayed dot
  388.     g_xormode()            Set or reset XOR mode
  389.     g_window(xmin,ymin,xmax,ymax)    Set graphics window limits
  390.     g_limits(xmin,ymin,xmax,ymax)    Get current window limits
  391.     g_vert(x1,y1,y2,color)        DIsplays a vertical line
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.     Non-graphic Functions        Functional Description
  403.     -----------------------------    ---------------------------------
  404.     randseed()            Initialize rand() with a seed
  405.     rand()                Random number generator
  406.     cls()                Clear the text screen
  407.     locate()            Locate the cursor to a position
  408.     keyboard()            Returns keyboard information
  409.     peekb()             Read a byte from memory
  410.     peekw()             Read a word from memory
  411.     pokeb()             Poke a byte into memory
  412.     pokew()             Poke a word into memory
  413.     sysint()            Sets registers, then 8086 INT
  414.     getreg()            Returns a given 8086 register
  415.     inton()             Enables interrupts
  416.     intoff()            Disables interrupts
  417.     movblock()            Move a block of memory
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.                           5
  428.  
  429.  
  430.  
  431.                  LIST OF FORTRAN FUNCTIONS
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.     Graphics Functions        Functional Description
  440.     ----------------------------    ---------------------------------
  441.     GSCRN(MODE)            Initialize medium resolution mode
  442.     GCLEAR(MODE)            Clear the graphics screen
  443.     GTEXT(MODE)            Reset back to text mode
  444.     GPAL(COLORS)            Select a color palette
  445.     GBKGND(COLOR)            Select a background color
  446.     GDOT(X,Y,COLOR)         Display a dot
  447.     GLINE(X1,Y1,X2,Y2,COLOR)    Display a line
  448.     GETDOT(X,Y)            Get the color of a displayed dot
  449.     GXOR()                Set or reset XOR mode
  450.     GWINDOW(XMIN,YMIN,XMAX,YMAX)    Set graphics window limits
  451.     GLIMITS(XMIN,YMIN,XMAX,YMAX)    Get current window limits
  452.     GVERT(X1,Y1,Y2,COLOR)        Draw a vertical line
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.     Non-graphic Functions        Functional Description
  464.     -----------------------------    ---------------------------------
  465.     RSEED()             Initialize RAND() with a seed
  466.     RAND()                Random number generator
  467.     CLS()                Clear the text screen
  468.     LOCATE()            Locate the cursor to a position
  469.     KEYB()                Return keyboard information
  470.     SCREAD()            Read character and attribute
  471.     SCWRIT()            Write a character and attribute
  472.     SCUP()                Scroll the screen up
  473.     SCDOWN()            Scroll the screen down
  474.     PEEKB()             Read a byte from memory
  475.     PEEKW()             Read a word from memory
  476.     POKEB()             Poke a byte into memory
  477.     POKEW()             Poke a word into memory
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.                           6
  489.  
  490.  
  491.  
  492.                   LIST OF BASIC FUNCTIONS
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.     Graphics Functions        Functional Description
  501.     ----------------------------    ---------------------------------
  502.     GSCRN(MODE)            Initialize medium resolution mode
  503.     GCLEAR(MODE)            Clear the graphics screen
  504.     GTEXT(MODE)            Reset back to text mode
  505.     GPAL(COLORS)            Select a color palette
  506.     GBKGND(COLOR)            Select a background color
  507.     GDOT(X,Y,COLOR)         Display a dot
  508.     GLINE(X1,Y1,X2,Y2,COLOR)    Display a line
  509.     GETDOT(X,Y)            Get the color of a displayed dot
  510.     GXOR()                Set or reset XOR mode
  511.     GWINDOW(XMIN,YMIN,XMAX,YMAX)    Set graphics window limits
  512.     GLIMITS(XMIN,YMIN,XMAX,YMAX)    Get current window limits
  513.     GVERT(X1,Y1,Y2,COLOR)        Draw a vertical line
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.     Non-graphic Functions        Functional Description
  525.     -----------------------------    ---------------------------------
  526.     RSEED()             Initialize RAND() with a seed
  527.     RAND()                Random number generator
  528.     CLS()                Clear the text screen
  529.     LOCATE()            Locate the cursor to a position
  530.     KEYB()                Return keyboard information
  531.     SCREAD()            Read character and attribute
  532.     SCWRIT()            Write a character and attribute
  533.     SCUP()                Scroll the screen up
  534.     SCDOWN()            Scroll the screen down
  535.     PEEKB()             Read a byte from memory
  536.     PEEKW()             Read a word from memory
  537.     POKEB()             Poke a byte into memory
  538.     POKEW()             Poke a word into memory
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.                           7
  550.                 C FUNCTIONS
  551.  
  552.  
  553.  
  554.  
  555.  
  556.      NAME
  557.  
  558.        g_init        --> initialize the medium graphics mode
  559.  
  560.      SYNOPSIS
  561.  
  562.        g_init();
  563.  
  564.  
  565.      DESCRIPTION
  566.  
  567.       This    function initializes the standard color/graphics  adapter
  568.       to 320x200 medium resolution mode.
  569.  
  570.  
  571.      RETURNS
  572.  
  573.       Nothing
  574.  
  575.  
  576.      SAMPLE CALL
  577.  
  578.       main()
  579.  
  580.       {
  581.       g_init();
  582.       }
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.                   C - 1
  611.                 C FUNCTIONS
  612.  
  613.  
  614.      NAME
  615.  
  616.       g_clear           --> clears the graphics screen
  617.  
  618.      SYNOPSIS
  619.  
  620.       g_clear();
  621.  
  622.  
  623.      DESCRIPTION
  624.  
  625.       This    function will clear the graphic screen to the  background
  626.       color.
  627.  
  628.  
  629.      RETURNS
  630.  
  631.       Nothing
  632.  
  633.  
  634.      SAMPLE CALL
  635.  
  636.  
  637.       main()
  638.       {
  639.       g_clear();
  640.       }
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.                   C - 2
  672.                 C FUNCTIONS
  673.  
  674.  
  675.      NAME
  676.  
  677.       g_text()        --> Resets the display to 40 or 80
  678.                 column mode.
  679.  
  680.      SYNOPSIS
  681.  
  682.       g_text(mode);
  683.  
  684.       int mode;              mode is either 40 or 80
  685.  
  686.      DESCRIPTION
  687.  
  688.       This    function  resets the display from graphics to text  mode.
  689.  
  690.       This    function  should be called upon exiting from  a  graphics
  691.       program  or  else  the display will continue to  be  in  medium
  692.       resolution  graphics    mode  and cannot display  the  normal  80
  693.       column text mode.
  694.  
  695.      RETURNS
  696.  
  697.       Nothing
  698.  
  699.      SAMPLE CALL
  700.  
  701.       main()
  702.       {
  703.  
  704.       g_init();
  705.       g_clear();
  706.       g_text(80);               /* resets back to 80 column
  707.                       mode               */
  708.       }
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.                   C - 3
  733.                 C FUNCTIONS
  734.  
  735.  
  736.      NAME
  737.  
  738.       g_pal             --> Sets the palette number
  739.  
  740.      SYNOPSIS
  741.  
  742.       g_pal(pn);
  743.  
  744.       int pn;            palette number
  745.  
  746.  
  747.      DESCRIPTION
  748.  
  749.  
  750.       The  palette    number,  pn,  corresponds  to  the  two  standard
  751.       palettes  that may be used used in the medium resolution  mode.
  752.       Functions  using colors will have their colors chosen from  the
  753.       current palette. The palettes are:
  754.  
  755.             Color    Palette 0     Palette 1
  756.             -----    ---------     ---------
  757.               1       Green        Cyan
  758.               2       Red           Magenta
  759.               3       Brown        White
  760.  
  761.      RETURNS
  762.  
  763.       Nothing
  764.  
  765.  
  766.      SAMPLE CALL
  767.  
  768.       main()
  769.       {
  770.       int pn;
  771.       g_init();
  772.       g_clear();
  773.       pn = 1;              /* select palette 1 (RGBrn) */
  774.       g_pal(pn);
  775.       }
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.                   C - 4
  794.                 C FUNCTIONS
  795.  
  796.  
  797.      NAME
  798.  
  799.       g_bakgnd()          ---> Sets the background color
  800.  
  801.      SYNOPSIS
  802.  
  803.       g_bakgnd(bc);
  804.  
  805.       int bc;        bc is the background color
  806.  
  807.  
  808.      DESCRIPTION
  809.  
  810.       The  background  color  may  be  set    to  any  of  the  sixteen
  811.       selectable  colors  in the medium resolution    mode.  The  color
  812.       number and the corresponding color is given below:
  813.  
  814.           Number    Color           Number      Color
  815.           ------    -------        ------      -------
  816.         0    Black             8          Gray
  817.         1    Blue             9          Light Blue
  818.         2    Green            10          Light Green
  819.         3    Cyan            11          Light Cyan
  820.         4    Red            12          Light Red
  821.         5    Magenta         13          Light Magenta
  822.         6    Brown            14          Yellow
  823.         7    White            15          High Intensity
  824.                               White
  825.  
  826.  
  827.  
  828.      RETURNS
  829.  
  830.  
  831.       Nothing
  832.  
  833.      SAMPLE CALL
  834.  
  835.  
  836.       main()
  837.       {
  838.  
  839.       int pn = 2;            /* selects palette 1 (GRBrn)  */
  840.       int bc = 1;            /* background color is blue   */
  841.  
  842.       g_init();
  843.       g_clear();
  844.       g_pal(pn);
  845.       g_bakgnd(bc);
  846.       }
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.                   C - 5
  855.                 C FUNCTIONS
  856.  
  857.  
  858.      NAME
  859.  
  860.       g_dot()             --> Displays a colored dot
  861.  
  862.      SYNOPSIS
  863.  
  864.       g_dot(x,y,clr);
  865.  
  866.       int x, y, clr;        dot at coordinates x, y
  867.                     in color clr
  868.  
  869.  
  870.      DESCRIPTION
  871.  
  872.  
  873.       This function displays a dot at the coordinates x,  and y where
  874.       both x and y are integer numbers. The maximum limits of x are 0
  875.       and  319.  the limits of y are 0 and 199.  The  actual  display
  876.       region  on the screen may be limited by the use of the g_window
  877.       function.
  878.  
  879.       The  color  is determined by both the numerical value  and  the
  880.       palette number. The color number may be between 1 and 3 and the
  881.       table of colors are given in the g_pal() function above.
  882.  
  883.      RETURNS
  884.  
  885.       Nothing
  886.  
  887.  
  888.      SAMPLE CALL
  889.  
  890.       main()
  891.       {
  892.  
  893.       int pn = 2;            /* selects palette 1 (GRB)  */
  894.       int bc = 1;            /* background color is blue */
  895.       int x, y, clr;
  896.  
  897.       g_init();
  898.       g_clear();
  899.       g_pal(pn);
  900.       g_bakgnd(bc);
  901.       x = 159;
  902.       y = 99;
  903.       clr = 2;
  904.       g_dot(x,y,clr);        /*  displays  a blue dot  in  the
  905.                         center of the screen     */
  906.       }
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.                   C - 6
  916.                 C FUNCTIONS
  917.  
  918.  
  919.      NAME
  920.  
  921.       g_line()            --> draws a line between points
  922.  
  923.      SYNOPSIS
  924.  
  925.       g_line(x1,y1,x2,y2,clr);
  926.  
  927.       int x1;      x coordinate of the beginning of the line
  928.       int y1;       y coordinate of the beginning of the line
  929.       int x2;       x coordinate of the end of the line
  930.       int y2;       y coordinate of the end of the line
  931.       int clr;       color to be chosen from the current palette
  932.  
  933.  
  934.      DESCRIPTION
  935.  
  936.       This function draws a line between the two defined points.  The
  937.       limits of the line are determined by the use of the  g_window()
  938.       function.  The maximum limits are the full screen limits, 0-219
  939.       in   the  horizontal    direction  and    0-199  in  the     vertical
  940.       direction. The color is selected from the current palette.
  941.  
  942.      RETURNS
  943.  
  944.       Nothing
  945.  
  946.      SAMPLE CALL
  947.  
  948.       main()
  949.       {
  950.  
  951.       int pn = 2;            /* selects palette 1 (GRB)  */
  952.       int bc = 1;            /* background color is blue */
  953.       int x1, y1, x2, y2, clr;
  954.  
  955.       g_init();
  956.       g_clear();
  957.       g_pal(pn);
  958.       g_bakgnd(bc);
  959.       x1 = 0, y1 = 0;
  960.       x2 = 219, y2 = 199;
  961.       clr = 2;
  962.       g_line(x1,y1,x2,y2,clr);    /* draws a diagonal line
  963.                        across the screen in red */
  964.       }
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.                   C - 7
  977.                 C FUNCTIONS
  978.  
  979.  
  980.      NAME
  981.  
  982.       g_getdot()              --> Return the color of a dot
  983.  
  984.      SYNOPSIS
  985.  
  986.       rclr = g_dot(x,y);
  987.  
  988.       int x;        x coordinate of the dot
  989.       int y;        y coordinate of the dot
  990.       int rclr;        the value of the color of the dot
  991.  
  992.  
  993.      DESCRIPTION
  994.  
  995.       This    function  returns  the    color of a  dot  which    has  been
  996.       displayed on the screen at coordinates x and y.
  997.  
  998.      RETURNS
  999.  
  1000.       rclr = the color value corresponding to the current palette and
  1001.          color number. The values are between 1 and 3.
  1002.  
  1003.  
  1004.      SAMPLE CALL
  1005.  
  1006.  
  1007.       main()
  1008.       {
  1009.  
  1010.       int pn = 2;            /* selects palette 1 (GRB)  */
  1011.       int bc = 1;            /* background color is blue */
  1012.       int x, y, clr, rclr;
  1013.  
  1014.       g_init();
  1015.       g_clear();
  1016.       g_pal(pn);
  1017.       g_bakgnd(bc);
  1018.       x = 159;
  1019.       y = 99;
  1020.       clr = 2;
  1021.       g_dot(x,y,clr);        /*  displays  a blue dot  in  the
  1022.                         center of the screen     */
  1023.       rclr = g_getdot(x,y);     /* gets the color        */
  1024.       }
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.                   C - 8
  1038.                 C FUNCTIONS
  1039.  
  1040.  
  1041.      NAME
  1042.  
  1043.       g_xormode()         --> Sets/resets displaying to an
  1044.                       exclusive-or mode
  1045.  
  1046.      SYNOPSIS
  1047.  
  1048.       g_xormode(ltf);
  1049.  
  1050.       int ltf;             /* logical value for setting xor
  1051.                     on or off             */
  1052.  
  1053.      DESCRIPTION
  1054.  
  1055.       This    function  sets the display mode of dots and lines  to  be
  1056.       either  in an exclusive-or mode or not in an exclusive-or mode.
  1057.       The argument is a logical value. The values are:
  1058.  
  1059.                  0 = normal (no exclusive-or)
  1060.             anything else  = XOR mode
  1061.  
  1062.      RETURNS
  1063.  
  1064.       Nothing
  1065.  
  1066.      SAMPLE CALL
  1067.  
  1068.       #DEFINE FALSE 0
  1069.       #DEFINE TRUE    ~FALSE
  1070.  
  1071.       g_xormode(TRUE);         /* set display to XOR mode) */
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.                   C - 9
  1099.                 C FUNCTIONS
  1100.  
  1101.  
  1102.      NAME
  1103.  
  1104.       g_window()        --> Sets windowing limits for the display
  1105.                 of dots and lines
  1106.  
  1107.      SYNOPSIS
  1108.  
  1109.       g_window(x1,y1,x2,y2);
  1110.  
  1111.       int x1, y1;     coordinates of the lower left display window
  1112.       int x2, y2;     coordinates of the upper right display window
  1113.  
  1114.      DESCRIPTION
  1115.  
  1116.       This    function sets a display window for the display of dots or
  1117.       lines.  All displaying is limited to the window area.  Function
  1118.       calls  to areas outside the window will not disturb the  screen
  1119.       area outside the window. Lines will be chopped if out of range.
  1120.  
  1121.      RETURNS
  1122.  
  1123.       Nothing
  1124.  
  1125.      SAMPLE CALL
  1126.  
  1127.       main()
  1128.       {
  1129.  
  1130.       int pn = 2;            /* selects palette 1 (GRB)  */
  1131.       int bc = 1;            /* background color is blue */
  1132.       int x1, y1, x2, y2;
  1133.  
  1134.       g_init();
  1135.       g_clear();
  1136.       g_pal(pn);
  1137.       g_bakgnd(bc);
  1138.       x1 = 0, y1 = 0;
  1139.       x2 = 50, y2 = 50;
  1140.       clr = 2;
  1141.       g_window(x1,y1,x2,y2);      /* sets the display window to
  1142.                      an area in the upper left
  1143.                      of the screen           */
  1144.       }
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.                   C - 10
  1160.                 C FUNCTIONS
  1161.  
  1162.  
  1163.      NAME
  1164.  
  1165.       g_limits()        --> Returns the window limits which have
  1166.                 been previously set with a window
  1167.                 function.
  1168.  
  1169.      SYNOPSIS
  1170.  
  1171.       g_limits(x1,y1,x2,y2);
  1172.  
  1173.       int x1, y1;     coordinates of the lower left display window
  1174.       int x2, y2;     coordinates of the upper right display window
  1175.  
  1176.      DESCRIPTION
  1177.  
  1178.       This function returns the display window limits for the display
  1179.       of dots or lines.
  1180.  
  1181.      RETURNS
  1182.  
  1183.       Values are returned in the x1, y1, x2, y2 arguments
  1184.  
  1185.      SAMPLE CALL
  1186.  
  1187.       main()
  1188.       {
  1189.  
  1190.       int pn = 2;            /* selects palette 1 (GRB)  */
  1191.       int bc = 1;            /* background color is blue */
  1192.       int x1, y1, x2, y2;
  1193.  
  1194.       g_init();
  1195.       g_clear();
  1196.       g_pal(pn);
  1197.       g_bakgnd(bc);
  1198.       x1 = 0, y1 = 0;
  1199.       x2 = 50, y2 = 50;
  1200.       clr = 2;
  1201.       g_limits(x1,y1,x2,y2);      /* returns the display window
  1202.                      limits            */
  1203.       }
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.                   C - 11
  1221.                 C FUNCTIONS
  1222.  
  1223.  
  1224.      NAME
  1225.  
  1226.          g_vert               --> Displays a vertical line
  1227.  
  1228.      SYNOPSIS
  1229.  
  1230.          g_vert((x1,y1,y2,clr);
  1231.  
  1232.          int X1;         x position
  1233.          int y1, y2;     y minimum and y maximum respectively
  1234.          int clr;         color of the line
  1235.  
  1236.  
  1237.      DESCRIPTION
  1238.  
  1239.          This   routine  will  draw  vertical  lines.   It    uses   an
  1240.          optimization  which causes the lines to be drawn even faster
  1241.          than g_line.
  1242.  
  1243.  
  1244.      RETURNS
  1245.  
  1246.          Nothing
  1247.  
  1248.  
  1249.      SAMPLE CALL
  1250.  
  1251.       main()
  1252.       {
  1253.  
  1254.       int pn = 2;            /* selects palette 1 (GRB)  */
  1255.       int bc = 1;            /* background color is blue */
  1256.       int x1, y1, x2, y2, clr;
  1257.  
  1258.       g_init();
  1259.       g_clear();
  1260.       g_pal(pn);
  1261.       g_bakgnd(bc);
  1262.       x1 = 0, y1 = 0;
  1263.       x2 = 219, y2 = 199;
  1264.       clr = 2;
  1265.       g_vert(x1,y1,y2,clr);      /* draws a vertical line
  1266.                     down the screen in red */
  1267.       }
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.                   C - 12
  1282.                 C FUNCTIONS
  1283.  
  1284.  
  1285.      NAME
  1286.  
  1287.        randseed()        --> initializes the random seed
  1288.  
  1289.      SYNOPSIS
  1290.  
  1291.        randseed(w1,w2);
  1292.  
  1293.        int w1;           word 1 value
  1294.        int w2;           word 2 value
  1295.  
  1296.      DESCRIPTION
  1297.  
  1298.       This    function  initializes the random number seed to  a  value
  1299.       chosen  by  word1 and word2.    A predictable sequence of  random
  1300.       sequences  may be obtained.  If both word1 and word2    are  zero
  1301.       then    the  function gets a value from the system clock for  the
  1302.       seed.
  1303.  
  1304.      RETURNS
  1305.  
  1306.       Nothing
  1307.  
  1308.      SAMPLE CALL
  1309.  
  1310.       randseed(0,0);
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.                   C - 13
  1343.                 C FUNCTIONS
  1344.  
  1345.  
  1346.      NAME
  1347.  
  1348.       rand()           --> Returns a random number
  1349.  
  1350.      SYNOPSIS
  1351.  
  1352.       value = rand(range);
  1353.  
  1354.       unsigned value;          value returned
  1355.       unsigned range;          range for determining the value
  1356.  
  1357.  
  1358.      DESCRIPTION
  1359.  
  1360.       This    function returns a value within a  specified  range.  The
  1361.       range  may be from 1 to 65535.  The value will be between 0 and
  1362.       range-1. If range is 0 then the value will default to between 0
  1363.       and 65535.
  1364.  
  1365.  
  1366.      RETURNS
  1367.  
  1368.       The random number in value.
  1369.  
  1370.  
  1371.      SAMPLE CALL
  1372.  
  1373.  
  1374.       value = rand(range);
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402.  
  1403.                   C - 14
  1404.                 C FUNCTIONS
  1405.  
  1406.  
  1407.      NAME
  1408.  
  1409.       cls()            --> Clears the text screen
  1410.  
  1411.      SYNOPSIS
  1412.  
  1413.       cls(atr);
  1414.  
  1415.       int atr:           desired screen attribute
  1416.  
  1417.  
  1418.      DESCRIPTION
  1419.  
  1420.       This    function  will    clear  the screen  to  the  given  screen
  1421.       attribute.  These  attributes  are given in the  IBM    Technical
  1422.       Reference Manual.
  1423.  
  1424.  
  1425.      RETURNS
  1426.  
  1427.       Nothing
  1428.  
  1429.  
  1430.      SAMPLE CALL
  1431.  
  1432.  
  1433.       cls(0);
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462.  
  1463.  
  1464.                   C - 15
  1465.                 C FUNCTIONS
  1466.  
  1467.  
  1468.      NAME
  1469.  
  1470.       locate()         --> Positions the cursor on the text
  1471.                      screen.
  1472.  
  1473.  
  1474.      SYNOPSIS
  1475.  
  1476.       locate(row,column);
  1477.  
  1478.       int row;              cursor row
  1479.       int column;              cursor column
  1480.  
  1481.  
  1482.      DESCRIPTION
  1483.  
  1484.     This  function    positions  the cursor to the  specified  row  and
  1485.     column.
  1486.  
  1487.  
  1488.      RETURNS
  1489.  
  1490.       Nothing
  1491.  
  1492.  
  1493.      SAMPLE CALL
  1494.  
  1495.       int row = 10;
  1496.       int column = 24;
  1497.       locate(row,column);
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.                   C - 16
  1526.                 C FUNCTIONS
  1527.  
  1528.  
  1529.      NAME
  1530.  
  1531.       keyboard()         --> Returns keyboard information
  1532.  
  1533.      SYNOPSIS
  1534.  
  1535.       c = keyboard(option);
  1536.  
  1537.       unsigned c;         value returned
  1538.       int option;         keyboard command:
  1539.                     0 = return next character from keyboard
  1540.                     1 = return character if any (0 otherwise)
  1541.                     2 = return the SHIFT status
  1542.                     3 = returns character if any, also takes
  1543.                     character out of input buffer.
  1544.                     4 = clears buffer, then returns next key.
  1545.                     5 = Clear keyboard buffer.
  1546.  
  1547.      DESCRIPTION
  1548.  
  1549.       This    function provides direct access to the keyboard interrupt
  1550.       16h.    The  main use of this routine is to test the keyboard  to
  1551.       see if any keys are waiting.
  1552.  
  1553.  
  1554.      RETURNS
  1555.  
  1556.       It returns the value waiting at the keyboard.
  1557.  
  1558.      SAMPLE CALL
  1559.  
  1560.  
  1561.       c = keyboard(0);
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.                   C - 17
  1587.                 C FUNCTIONS
  1588.  
  1589.  
  1590.      NAME
  1591.  
  1592.        scr_read              --> Reads the character and the
  1593.                       attribute byte
  1594.      SYNOPSIS
  1595.  
  1596.        ca = scr_read();
  1597.        unsigned ca;        the character/attribute byte
  1598.  
  1599.  
  1600.      DESCRIPTION
  1601.  
  1602.        This  routine returns the character and attribute byte at  the
  1603.        current  cursor position.  The lower 8 bits are the    character
  1604.        value and the upper 8 bits are the screen attribute.
  1605.  
  1606.  
  1607.  
  1608.      RETURNS
  1609.  
  1610.        The character and attribute
  1611.  
  1612.  
  1613.      SAMPLE CALL
  1614.  
  1615.       main()
  1616.       {
  1617.       unsigned ca;
  1618.  
  1619.       ca = scr_read();
  1620.       }
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.                   C - 18
  1648.                 C FUNCTIONS
  1649.  
  1650.  
  1651.      NAME
  1652.  
  1653.        scr_write              --> Writes the character and the
  1654.                       attribute byte, count times
  1655.  
  1656.      SYNOPSIS
  1657.  
  1658.        scr_write(c,attr,count);
  1659.  
  1660.        int c;         Character to write
  1661.        int attr;         Attribute to write to screen
  1662.        int count;         Count of character/attributes to write
  1663.  
  1664.  
  1665.      DESCRIPTION
  1666.  
  1667.        This routine writes the character and an attribute byte to the
  1668.        screen beginning at the current cursor location. The character
  1669.        may be written any number of times.
  1670.  
  1671.  
  1672.      RETURNS
  1673.  
  1674.        Nothing
  1675.  
  1676.  
  1677.      SAMPLE CALL
  1678.  
  1679.        int c, attr, count;
  1680.  
  1681.        scr_write(c,attr,count);
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.                   C - 19
  1709.                 C FUNCTIONS
  1710.  
  1711.  
  1712.      NAME
  1713.  
  1714.        scr_up           --> Scrolls the screen up a given
  1715.                        number of lines
  1716.      SYNOPSIS
  1717.  
  1718.          scr_up(col1,row1,col2,row2,lines,attr);
  1719.  
  1720.          int col1,row1;     Upper left corner of window to scroll.
  1721.          int col2,row2;     Lower right corner of window to scroll.
  1722.          int lines;      Number of lines to scroll up. 0=full screen.
  1723.          int attr;         Attribute to fill vacant lines
  1724.  
  1725.  
  1726.      DESCRIPTION
  1727.  
  1728.        This routine scrolls the screen up a given number of lines.
  1729.  
  1730.  
  1731.      RETURNS
  1732.  
  1733.        Nothing
  1734.  
  1735.  
  1736.      SAMPLE CALL
  1737.  
  1738.        int col1,row1,col2,row2,lines,attr;
  1739.  
  1740.        scr_up(row1,col1,row2,col2,lines,attr);
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.                   C - 20
  1770.                 C FUNCTIONS
  1771.  
  1772.  
  1773.      NAME
  1774.  
  1775.        sc_down           --> Scrolls the screen down a given
  1776.                        number of lines
  1777.      SYNOPSIS
  1778.  
  1779.          scr_down(col1,row1,col2,row2,lines,attr);
  1780.  
  1781.          int col1,row1;     Upper left corner of window to scroll.
  1782.          int col2,row2;     Lower right corner of window to scroll.
  1783.          int lines;      Number of lines to scroll down. 0=full screen.
  1784.          int attr;         Attribute to fill vacant lines
  1785.  
  1786.  
  1787.      DESCRIPTION
  1788.  
  1789.        This routine scrolls the screen down a given number of lines.
  1790.  
  1791.  
  1792.      RETURNS
  1793.  
  1794.        Nothing
  1795.  
  1796.  
  1797.      SAMPLE CALL
  1798.  
  1799.        int c1,r1,c2,r2,lines,attr;
  1800.  
  1801.        scr_down(c1,r1,c2,r2,lines,attr);
  1802.  
  1803.  
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.                   C - 21
  1831.                 C FUNCTIONS
  1832.  
  1833.  
  1834.  
  1835.      NAME
  1836.  
  1837.       peekb()        --> Gets a byte from memory
  1838.  
  1839.      SYNOPSIS
  1840.  
  1841.       c = peekb(offset,segment);
  1842.  
  1843.       int c;              returned byte
  1844.       unsigned offset;          offset from segment of memory
  1845.       unsigned segment;          segment of data
  1846.  
  1847.      DESCRIPTION
  1848.  
  1849.       This function reads a byte from the specified memory address
  1850.  
  1851.  
  1852.      RETURNS
  1853.  
  1854.       The memory value in c.
  1855.  
  1856.  
  1857.      SAMPLE CALL
  1858.  
  1859.       c = peekb(offset,segment);
  1860.  
  1861.  
  1862.  
  1863.  
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.                   C - 22
  1892.                 C FUNCTIONS
  1893.  
  1894.  
  1895.  
  1896.      NAME
  1897.  
  1898.       peekw()        --> Gets a word from memory
  1899.  
  1900.      SYNOPSIS
  1901.  
  1902.       c = peekw(offset,segment);
  1903.  
  1904.       unsigned c;              returned word
  1905.       unsigned offset;          offset from segment of memory
  1906.       unsigned segment;          segment of data
  1907.  
  1908.      DESCRIPTION
  1909.  
  1910.       This function reads a word from the specified memory address
  1911.  
  1912.  
  1913.      RETURNS
  1914.  
  1915.       The memory value in c.
  1916.  
  1917.  
  1918.      SAMPLE CALL
  1919.  
  1920.       c = peekw(offset,segment);
  1921.  
  1922.  
  1923.  
  1924.  
  1925.  
  1926.  
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932.  
  1933.  
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.                   C - 23
  1953.                 C FUNCTIONS
  1954.  
  1955.  
  1956.      NAME
  1957.  
  1958.       pokeb()        --> writes a byte to memory
  1959.  
  1960.      SYNOPSIS
  1961.  
  1962.       c = pokeb(offset,segment,byte);
  1963.  
  1964.       int c;            value at memory address before write
  1965.       unsigned offset;        offset from segment of memory
  1966.       unsigned segment;        segment of data
  1967.       int byte;            data to be written
  1968.  
  1969.      DESCRIPTION
  1970.  
  1971.       This function writes a byte of data to memory.  It also returns
  1972.       the value in memory before the new byte is written.
  1973.  
  1974.  
  1975.      RETURNS
  1976.  
  1977.       The previous value in memory.
  1978.  
  1979.  
  1980.      SAMPLE CALL
  1981.  
  1982.  
  1983.       c = pokeb(offset,segment,byte);
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.  
  1992.  
  1993.  
  1994.  
  1995.  
  1996.  
  1997.  
  1998.  
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.  
  2006.  
  2007.  
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.                   C - 24
  2014.                 C FUNCTIONS
  2015.  
  2016.  
  2017.      NAME
  2018.  
  2019.       pokew()        --> writes a word to memory
  2020.  
  2021.      SYNOPSIS
  2022.  
  2023.       c = pokew(offset,segment,word);
  2024.  
  2025.       unsigned c;              value at memory address before write
  2026.       unsigned offset;        offset from segment of memory
  2027.       unsigned segment;        segment of data
  2028.       unsigned word;        data to be written to memory
  2029.  
  2030.      DESCRIPTION
  2031.  
  2032.       This function writes a word of data to memory.  It also returns
  2033.       the value in memory before the new byte is written.
  2034.  
  2035.  
  2036.      RETURNS
  2037.  
  2038.       The previous value in memory.
  2039.  
  2040.  
  2041.      SAMPLE CALL
  2042.  
  2043.  
  2044.       c = pokew(offset,segment,word);
  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.                   C - 25
  2075.                 C FUNCTIONS
  2076.  
  2077.  
  2078.      NAME
  2079.  
  2080.       sysint()        --> Performs an 8086 system interrupt
  2081.  
  2082.      SYNOPSIS
  2083.  
  2084.       int sysint(vec,sreg,rreg);
  2085.  
  2086.       unsigned char vec;          interrupt to execute
  2087.       struct regval *sreg          registers before interrupt
  2088.       struct regval *rreg          registers after interrupt
  2089.  
  2090.  
  2091.  
  2092.      DESCRIPTION
  2093.  
  2094.       This    function will perform a system interrupt.  The for of the
  2095.       structure is:
  2096.  
  2097.           struct regval {int  ax,bx,cx,dx,si,di,ds,es;};
  2098.  
  2099.      RETURNS
  2100.  
  2101.       This    function  returns the registers after  the  interrupt  in
  2102.       rreg.
  2103.  
  2104.  
  2105.      SAMPLE CALL
  2106.  
  2107.  
  2108.       sysint(vec.sreg,rreg);
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.  
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130.  
  2131.  
  2132.  
  2133.  
  2134.  
  2135.                   C - 26
  2136.                 C FUNCTIONS
  2137.  
  2138.  
  2139.      NAME
  2140.  
  2141.       getreg()        --> Get the value of a specified 8086
  2142.                 register
  2143.  
  2144.      SYNOPSIS
  2145.  
  2146.       c = getreg(regnum);
  2147.  
  2148.       unsigned c;         value of the specified register
  2149.       int regnum;         0 = return with CS
  2150.                  1 = return with DS
  2151.                  2 = return with SP
  2152.              any other = return with CS
  2153.  
  2154.  
  2155.      DESCRIPTION
  2156.  
  2157.       This    function  returns  the    registered as  specified  in  the
  2158.       argument regnum.
  2159.  
  2160.  
  2161.      RETURNS
  2162.  
  2163.       The value of the register is returned.
  2164.  
  2165.  
  2166.      SAMPLE CALL
  2167.  
  2168.  
  2169.       c = getreg(regnum);
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186.  
  2187.  
  2188.  
  2189.  
  2190.  
  2191.  
  2192.  
  2193.  
  2194.  
  2195.  
  2196.                   C - 27
  2197.                 C FUNCTIONS
  2198.  
  2199.  
  2200.      NAME
  2201.  
  2202.       inton()        --> Enables the system interrupts
  2203.  
  2204.      SYNOPSIS
  2205.  
  2206.       inton();         Enables interrupts
  2207.  
  2208.  
  2209.      DESCRIPTION
  2210.  
  2211.       This function enables the system interrupts.
  2212.  
  2213.  
  2214.  
  2215.      RETURNS
  2216.  
  2217.       Nothing
  2218.  
  2219.  
  2220.      SAMPLE CALL
  2221.  
  2222.  
  2223.       inton();
  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.                   C - 28
  2258.                 C FUNCTIONS
  2259.  
  2260.  
  2261.      NAME
  2262.  
  2263.       intoff()         --> Disables the system interrupts
  2264.  
  2265.      SYNOPSIS
  2266.  
  2267.       intoff()         disables the interrupts
  2268.  
  2269.  
  2270.      DESCRIPTION
  2271.  
  2272.       This function disables the system interrupts.
  2273.  
  2274.  
  2275.  
  2276.      RETURNS
  2277.  
  2278.       Nothing
  2279.  
  2280.  
  2281.      SAMPLE CALL
  2282.  
  2283.  
  2284.       intoff();
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.  
  2318.                   C - 29
  2319.                 C FUNCTIONS
  2320.  
  2321.  
  2322.      NAME
  2323.  
  2324.       movblock()        --> Moves a block of memory from one address
  2325.                 to another.
  2326.      SYNOPSIS
  2327.  
  2328.       movblock(source.ofs,source.seg,destin.ofs,destin.seg,byte.count)
  2329.  
  2330.       unsigned source.ofs;          source offset from segment
  2331.       unsigned source.seg;          segment of data
  2332.       unsigned destin.ofs;          destination offset from segment
  2333.       unsigned destin.seg;          destination segment of data
  2334.       unsigned byte.count;          number of bytes to be moved
  2335.  
  2336.  
  2337.      DESCRIPTION
  2338.  
  2339.       This    function  moves  a block of byte.count    memory    from  one
  2340.       address to another.
  2341.  
  2342.  
  2343.      RETURNS
  2344.  
  2345.       Nothing
  2346.  
  2347.  
  2348.      SAMPLE CALL
  2349.  
  2350.       movblock(soff,sseg,doff,dseg,count);
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.                   C - 30
  2380.  
  2381.