home *** CD-ROM | disk | FTP | other *** search
/ Clipart Library (Powersource) / Clipart Library.iso / program / prog_c / hgrph101.arc / HGRAPH.EPS < prev    next >
Encoding:
Text File  |  1989-02-25  |  74.0 KB  |  2,245 lines

  1.  
  2.  
  3.  
  4.                                     HGRAPH.LIB  V1.01
  5.                                     HGRAPH.LIB       
  6.  
  7.  
  8.           
  9.           
  10.                HGRAPH.LIB is a collection of subroutines to give Hercules
  11.                HGRAPH.LIB                                                
  12.           graphics capability to MSC and QuickC and are better than MSC's &
  13.           QuickC's in that they just have to be linked in.  They do not
  14.           require a driver to be loaded like with MSC & QC.
  15.           
  16.                This is version 1.01 release of these routines.  They have
  17.           been compiled and tested only on a Leading Edge Model "D" which
  18.           has a hercules clone card in it.  The only known difference
  19.           between this clone card and a real Hercules card is that this
  20.           clone fakes the light pen port (if you try to read its lightpen
  21.           port for the graphics state it always returns text mode).
  22.           
  23.           INTRODUCTION
  24.           INTRODUCTION
  25.           
  26.                The lib includes clearing and non-clearing subroutines to
  27.           switch between text and graphics modes.  A clear page and show
  28.           page for clearing and switching between the two graphics pages.
  29.           A pixel routine to read, write, and toggle a pixel.  Two line
  30.           subroutines one to draw a line in either white or black and one
  31.           to toggle a line.  And three string writing functions, one that
  32.           treats the graphics screen as 43 rows and 90 columns while the
  33.           other two let you define the upper left corner of where the
  34.           string is to be written.  There are also a save screen and a
  35.           restore screen, similar to BASIC's BSAVE & BLOAD and a print
  36.           screen routine for Epson printers.  All the routines that write
  37.           to the graphics screen are written in MSC MASM 5.1 for greater
  38.           speed.  The screen dump routines do their own buffering also for
  39.           this reason.
  40.           
  41.           
  42.           USAGE
  43.           USAGE
  44.           
  45.                There is now a XHGRAPH.LIB library for each memory model,
  46.                               XHGRAPH.LIB                               
  47.                               _                                         
  48.           where X is the model (S, M, C, L).  So you must link with the
  49.                 X               S  M  C  L                             
  50.                 _                                                      
  51.           library of the same type model as the program was compiled with.
  52.           The only restriction in using the libraries is that You must call
  53.           hgraph_init() before using any of the other routines.
  54.           hgraph_init()                                        
  55.           
  56.           
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.                                           i
  74.  
  75.  
  76.  
  77.  
  78.  
  79.                                     HGRAPH.LIB  V1.01
  80.                                     HGRAPH.LIB       
  81.  
  82.  
  83.           
  84.                The rest of the documentation is a list of library routines
  85.           and what they do.  The appendix holds a couple of examples and a
  86.           few programing tips.  The libraries are release into the public
  87.           domain with the following restrictions:
  88.           
  89.                1)   That they only be transmitted from one person to
  90.                     the next in a complete and unmodified form.
  91.                
  92.                2)   That the libraries, documentation, and algorithms
  93.                     remain copy righted to me, Steven P. Murphy.
  94.                
  95.                3)   No warranties are expressed or implied.  I am not
  96.                     responsible for the use, misuse, or abuse of these
  97.                     libraries.
  98.           
  99.           Any comments, suggestions, or bugs should be reported to:
  100.           
  101.                               Steven P. Murphy
  102.                               6581 Bing St.
  103.                               San Diego, CA 92115-6715
  104.           
  105.                               or
  106.           
  107.                               murphys@cod.nosc.mil    (USENET)
  108.           
  109.                And for those you who really like HGRAPH donations will not
  110.           be refused.
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.                                          ii
  141.  
  142.  
  143.  
  144.  
  145.  
  146.                                     HGRAPH.LIB  V1.01
  147.                                     HGRAPH.LIB       
  148.  
  149.  
  150.                All the routines treat the graphics screen as a grid of dots
  151.           except hwrite and hstr which treat it as a set of rows and
  152.                  ______     ____                                    
  153.           columns.  For all the routines except hwrite and hstr the screen
  154.                                                 ______     ____           
  155.           dimension are as follows:
  156.           
  157.           
  158.                     0                                              719
  159.                   0  -----------------------------------------------
  160.                     |                                               | 
  161.                     |                                               | 
  162.                     |                                               | 
  163.                     |                                               | 
  164.                     |                                               | 
  165.                     |                                               | 
  166.                     |                                               | 
  167.                     |                                               | 
  168.                     |                                               | 
  169.                     |                                               | 
  170.                     |                                               | 
  171.                     |                                               | 
  172.                  347 -----------------------------------------------
  173.           
  174.           
  175.           for hwrite and hstr the screen is:
  176.               ______     ____               
  177.           
  178.                     0                                              89
  179.                   0  -----------------------------------------------
  180.                     |                                               | 
  181.                     |                                               | 
  182.                     |                                               | 
  183.                     |                                               | 
  184.                     |                                               | 
  185.                     |                                               | 
  186.                     |                                               | 
  187.                     |                                               | 
  188.                     |                                               | 
  189.                     |                                               | 
  190.                     |                                               | 
  191.                     |                                               | 
  192.                   42 -----------------------------------------------
  193.           
  194.           
  195.           The conversion from rows & columns to dots is each row is eight
  196.           dots height and each column is eight dots wide.   
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.                                          iii
  211.  
  212.  
  213.  
  214.  
  215.  
  216.                                     HGRAPH.LIB  V1.01
  217.                                     HGRAPH.LIB       
  218.  
  219.  
  220.                                  TABLE  OF  CONTENTS
  221.                                  TABLE  OF  CONTENTS
  222.           
  223.           
  224.           
  225.           h_get_scrn     . . . . . . . . . . . . . . . . . .     1
  226.           h_sav_scrn     . . . . . . . . . . . . . . . . . .     2
  227.           hbox           . . . . . . . . . . . . . . . . . .     3
  228.           hchar          . . . . . . . . . . . . . . . . . .     4
  229.           hchar2         . . . . . . . . . . . . . . . . . .     5
  230.           hclearpg       . . . . . . . . . . . . . . . . . .     6
  231.           hellipse       . . . . . . . . . . . . . . . . . .     7
  232.           herc_there     . . . . . . . . . . . . . . . . . .     8
  233.           hgmode         . . . . . . . . . . . . . . . . . .     9
  234.           hgmode_nc      . . . . . . . . . . . . . . . . . .     10
  235.           hgraph_init    . . . . . . . . . . . . . . . . . .     11
  236.           hline          . . . . . . . . . . . . . . . . . .     12
  237.           hpixel         . . . . . . . . . . . . . . . . . .     13
  238.           hscdump        . . . . . . . . . . . . . . . . . .     14
  239.           hscdump2       . . . . . . . . . . . . . . . . . .     15
  240.           hshowpg        . . . . . . . . . . . . . . . . . .     16
  241.           hstr           . . . . . . . . . . . . . . . . . .     17
  242.           htmode         . . . . . . . . . . . . . . . . . .     18
  243.           htmode_nc      . . . . . . . . . . . . . . . . . .     19
  244.           hwrite         . . . . . . . . . . . . . . . . . .     20
  245.           hxchar         . . . . . . . . . . . . . . . . . .     21
  246.           hxchar2        . . . . . . . . . . . . . . . . . .     22
  247.           hxline         . . . . . . . . . . . . . . . . . .     23
  248.           hxstr          . . . . . . . . . . . . . . . . . .     24
  249.           
  250.           
  251.           Appendix A     . . . . . . . . . . . . . . . . . .     25
  252.                cornucopia.c  . . . . . . . . . . . . . . . .     26
  253.                demo1.c       . . . . . . . . . . . . . . . .     27
  254.           
  255.           Appendix B     . . . . . . . . . . . . . . . . . .     28
  256.                programing ideas  . . . . . . . . . . . . . .     29
  257.           
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.                                          iv
  279.  
  280.  
  281.  
  282.  
  283.  
  284.                                   HGRAPH.LIB  V1.01
  285.                                   HGRAPH.LIB       
  286.  
  287.  
  288.           H_GET_SCRN
  289.           H_GET_SCRN
  290.           
  291.                Summary        
  292.                _______        
  293.           
  294.                     #include <hgraph.h>   Contains function prototypes
  295.           
  296.                     int h_get_scrn(file_name);
  297.                         h_get_scrn            
  298.                                    _________  
  299.           
  300.                     char *file_name          /* name of file to get the */
  301.                           _________                                       
  302.                                              /* image from              */
  303.           
  304.                Description
  305.                ___________
  306.           
  307.                     Opens file_name for reading in binary mode and copies
  308.                           _________                                      
  309.                     32K bytes from file_name to graphics page 0 or 1
  310.                                    _________                        
  311.                     according to the current value of HGPAGE (see
  312.                                                       HGPAGE     
  313.                     hgraph_init).
  314.                     
  315.                     
  316.                Return Value
  317.                ____________
  318.           
  319.                     H_get_scrn returns a -1 if it could not successfully
  320.                     H_get_scrn                                          
  321.                     open file_name other wise it will return a 0.
  322.                          _________                               
  323.                     
  324.                See Also
  325.                ________
  326.           
  327.                     h_sav_scrn
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.                                                                         1
  359.  
  360.  
  361.  
  362.  
  363.  
  364.                                   HGRAPH.LIB  V1.01
  365.                                   HGRAPH.LIB       
  366.  
  367.  
  368.           H_SAV_SCRN
  369.           H_SAV_SCRN
  370.           
  371.                Summary        
  372.                _______        
  373.           
  374.                     #include <hgraph.h>   Contains function prototypes
  375.           
  376.                     int h_sav_scrn(file_name);
  377.                         h_sav_scrn            
  378.                                    _________  
  379.           
  380.                     char *file_name          /* name of file to store   */
  381.                           _________                                       
  382.                                              /* image in                */
  383.           
  384.                Description
  385.                ___________
  386.           
  387.                     Opens file_name for writing in binary mode and copies
  388.                           _________                                      
  389.                     32K bytes from graphics page 0 or 1 according to the
  390.                     current value of HGPAGE (see hgraph_init).
  391.                                      HGPAGE                   
  392.                     
  393.                     
  394.                Return Value
  395.                ____________
  396.           
  397.                     H_sav_scrn returns a -1 if it could not successfully
  398.                     H_sav_scrn                                          
  399.                     open file_name other wise it will return a 0.
  400.                          _________                               
  401.                     
  402.                See Also
  403.                ________
  404.           
  405.                     h_get_scrn
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.                                                                         2
  438.  
  439.  
  440.  
  441.  
  442.  
  443.                                   HGRAPH.LIB  V1.01
  444.                                   HGRAPH.LIB       
  445.  
  446.  
  447.           HBOX
  448.           HBOX
  449.           
  450.                Summary        
  451.                _______        
  452.           
  453.                     #include <hgraph.h>   Contains function prototypes
  454.           
  455.                     void hbox(color, trow, lcol, brow, rcol);
  456.                          hbox                                
  457.                               _____  ____  ____  ____  ____  
  458.           
  459.                     int  color;         /* should only be a 1 or 0    */
  460.                          _____                                          
  461.                     int  trow;          /* toprow 0 through 347       */
  462.                          ____                                           
  463.                     int  lcol;          /* left column 0 through 718  */
  464.                          ____                                           
  465.                     int  brow;          /* bottom row 1 through 348   */
  466.                          ____                                           
  467.                     int  rcol;          /* right column 1 through 719 */   
  468.                          ____                                              
  469.           
  470.                Description
  471.                ___________
  472.           
  473.                     Draws a box on page 0 or 1 according to the current
  474.                     value of HGPAGE (see hgraph_init).  Hbox calls hline
  475.                              HGPAGE                     Hbox       hline
  476.                     four time arranging the arguments each time so that a
  477.                     box is drawn where (trow, lcol) defines the upper left
  478.                                         ____  ____                        
  479.                     corner and (brow, rcol) is the lower right.  Hbox does
  480.                                                                  Hbox     
  481.                                 ____  ____                                
  482.                     no bounds checking so bad ranges will produce weird
  483.                     results.
  484.                     
  485.                     
  486.                Return Value
  487.                ____________
  488.           
  489.                     There is no return value.
  490.           
  491.                See Also
  492.                ________
  493.           
  494.                     hline
  495.           
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.                                                                         3
  521.  
  522.  
  523.  
  524.  
  525.  
  526.                                   HGRAPH.LIB  V1.01
  527.                                   HGRAPH.LIB       
  528.  
  529.  
  530.           HCHAR
  531.           HCHAR
  532.           
  533.                Summary        
  534.                _______        
  535.           
  536.                     #include <hgraph.h>   Contains function prototypes
  537.           
  538.                     void hchar(x, y, string, attrib, count);
  539.                          hchar                              
  540.                                _  _  ______  ______  _____  
  541.           
  542.                     int  x;             /* 0 through 719             */
  543.                          _                                             
  544.                     int  y;             /* 0 through 347             */
  545.                          _                                             
  546.                     char *string;       /* ASCII 0 through 127       */
  547.                           ______                                       
  548.                     char attrib;        /* HGNORM or HGINVS          */
  549.                                            HGNORM    HGINVS            
  550.                          ______                                        
  551.                     int  count;         /* number of chars in string */
  552.                          _____                                ______   
  553.           
  554.                Description
  555.                ___________
  556.           
  557.                     Writes the upper left most corner of the string pointed
  558.                     to by string at the coordinates given after each
  559.                           ______                                    
  560.                     character has been XORed with attrib.  Hchar writes to
  561.                                                            Hchar          
  562.                                                   ______                  
  563.                     the graphics page according to the current value of
  564.                     HGPAGE (see hgraph_init).  There is no bounds checking
  565.                     HGPAGE                                                
  566.                     done on x and y so numbers outside of range will give
  567.                             _     _                                      
  568.                     unknown results (probably not good).  Hchar uses the
  569.                                                           Hchar         
  570.                     IBM PC/XT/AT ROM character table.  This table only has
  571.                     ASCII characters 0 through 127, values outside this
  572.                     range will give garbage.  The attrib is xor with the
  573.                                                   ______                
  574.                     character's bits on each scan line, values other than
  575.                     HGNORM (normal) and HGINVS (inverse) will just produce
  576.                     HGNORM              HGINVS                            
  577.                     odd patterns.  Count tells hchar how many of string's
  578.                                                hchar                     
  579.                                    _____                         ______  
  580.                     characters to plot.  MSC regular run-time LIB has a
  581.                     functions strlen() and gcvt(), strlen() will produce a
  582.                     correct count and gcvt() will convert numbers to a
  583.                             _____                                     
  584.                     string.
  585.                     
  586.                Return Value
  587.                ____________
  588.           
  589.                     There is no return value.
  590.           
  591.                See Also
  592.                ________
  593.           
  594.                     hchar2, hstr, hwrite, hxchar, hxchar2, hxstr
  595.                     MSC's or QuickC's strlen() and gcvt()
  596.           
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.                                                                         4
  612.  
  613.  
  614.  
  615.  
  616.  
  617.                                   HGRAPH.LIB  V1.01
  618.                                   HGRAPH.LIB       
  619.  
  620.  
  621.           HCHAR2
  622.           HCHAR2
  623.           
  624.                Summary        
  625.                _______        
  626.           
  627.                     #include <hgraph.h>   Contains function prototypes
  628.           
  629.                     void hchar2(x, y, string, attrib, count);
  630.                          hchar2                              
  631.                                 _  _  ______  ______  _____  
  632.           
  633.                     int  x;             /* 0 through 719             */
  634.                          _                                             
  635.                     int  y;             /* 0 through 347             */
  636.                          _                                             
  637.                     char *string;       /* ASCII 0 through 127       */
  638.                           ______                                       
  639.                     char attrib;        /* HGNORM or HGINVS          */
  640.                                            HGNORM    HGINVS            
  641.                          ______                                        
  642.                     int  count;         /* number of chars in string */
  643.                          _____                                ______   
  644.           
  645.                Description
  646.                ___________
  647.           
  648.                     Writes the upper left most corner of the string pointed
  649.                     to by string at the coordinates given after each
  650.                           ______                                    
  651.                     character has been XORed with attrib.  Hchar2 writes to
  652.                                                            Hchar2          
  653.                                                   ______                   
  654.                     the graphics page according to the current value of
  655.                     HGPAGE (see hgraph_init).  There is no bounds checking
  656.                     HGPAGE                                                
  657.                     done on x and y so numbers outside of range will give
  658.                             _     _                                      
  659.                     unknown results (probably not good).  Hchar2's
  660.                                                           Hchar2  
  661.                     character table only has ASCII characters 0 through
  662.                     127, values outside this range will give garbage.  The
  663.                     attrib is xor with the character's bits on each scan
  664.                     ______                                              
  665.                     line, values other than HGNORM (normal) and HGINVS
  666.                                             HGNORM              HGINVS
  667.                     (inverse) will just produce odd patterns.  Count tells
  668.                                                                _____      
  669.                     hchar2 how many of string's characters to plot.  MSC
  670.                     hchar2                                              
  671.                                        ______                           
  672.                     regular run-time LIB has a functions strlen() and
  673.                     gcvt(), strlen() will produce a correct count and
  674.                                                             _____    
  675.                     gcvt() will convert numbers to a string.
  676.                     
  677.                Return Value
  678.                ____________
  679.           
  680.                     There is no return value.
  681.           
  682.                See Also
  683.                ________
  684.           
  685.                     hchar, hstr, hwrite, hxchar, hxchar2, hxstr
  686.                     MSC's or QuickC's strlen() and gcvt()
  687.           
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.                                                                         5
  704.  
  705.  
  706.  
  707.  
  708.  
  709.                                   HGRAPH.LIB  V1.01
  710.                                   HGRAPH.LIB       
  711.  
  712.  
  713.           HCLEARPG
  714.           HCLEARPG
  715.           
  716.                Summary        
  717.                _______        
  718.           
  719.                     #include <hgraph.h>   Contains function prototypes
  720.           
  721.                     void hclearpg(void);
  722.                          hclearpg       
  723.           
  724.           
  725.                Description
  726.                ___________
  727.           
  728.                     Clears graphics page 0 or 1 according to the current
  729.                     value of HGPAGE (see hgraph_init).
  730.                              HGPAGE                   
  731.                     
  732.                     
  733.                Return Value
  734.                ____________
  735.           
  736.                     There is no return value.
  737.           
  738.                See Also
  739.                ________
  740.           
  741.                     hgmode, hgmode_nc
  742.           
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.                                                                         6
  778.  
  779.  
  780.  
  781.  
  782.  
  783.                                   HGRAPH.LIB  V1.01
  784.                                   HGRAPH.LIB       
  785.  
  786.  
  787.           HELLIPSE
  788.           HELLIPSE
  789.           
  790.                Summary        
  791.                _______        
  792.           
  793.                     #include <hgraph.h>   Contains function prototypes
  794.           
  795.                     void hellipse(color, x, y, r);
  796.                          hellipse                 
  797.           
  798.                Description
  799.                ___________
  800.           
  801.                     Draws and ellipse on graphics page 0 or 1 according to
  802.                     the current value of HGPAGE (see hgraph_init) centered
  803.                                          HGPAGE                           
  804.                     at (x, y) with a radius of r.  the ellipse will have an
  805.                         _  _                   _                           
  806.                     aspect ratio of the current value of (int) HGRATIO.  If
  807.                                                                HGRATIO     
  808.                     the ratio is < 2 the major axis will be vertical, if it
  809.                     is > 2  the major axis will be horizontal, and if
  810.                     HGRATIO = 2 hellipse will produces the closes it can to
  811.                     HGRATIO     hellipse                                   
  812.                     a circle.  no bounds checking is done if any part of
  813.                     the ellipse is off the screen weird things may happen.
  814.                     
  815.                     
  816.                Return Value
  817.                ____________
  818.           
  819.                     There is no return value
  820.           
  821.                See Also
  822.                ________
  823.           
  824.                     
  825.           
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.                                                                         7
  855.  
  856.  
  857.  
  858.  
  859.  
  860.                                   HGRAPH.LIB  V1.01
  861.                                   HGRAPH.LIB       
  862.  
  863.  
  864.           HERC_THERE
  865.           HERC_THERE
  866.           
  867.                Summary        
  868.                _______        
  869.           
  870.                     #include <hgraph.h>   Contains function prototypes
  871.           
  872.                     int herc_there(void);
  873.                         herc_there       
  874.           
  875.                Description
  876.                ___________
  877.           
  878.                     First it tests for a mono display adapter, if there is
  879.                     one it then watches port 3BA (hex) for a fixed time to
  880.                     see if bit 7 goes high.  If bit 7 does go high it then
  881.                     pushes a 3 out port 3BF (hex) to turn on the second
  882.                     page of the herc card. Now it checks for memory in the
  883.                     second page.  If this check is good it's a herc other
  884.                     wise it's just a funny mono card. Before it returns it
  885.                     pushes a 0 out port 3BF to return a herc card to
  886.                     diagonal mode.
  887.                     
  888.                Return Value
  889.                ____________
  890.           
  891.                     Herc_there returns a one if both of the above test are
  892.                     Herc_there                                            
  893.                     true and a zero if either is false.  (I have tested
  894.                     this with my clone card, an EGA, a CGA, and a mono
  895.                     adapter, it worked correctly in all cases.)
  896.           
  897.                See Also
  898.                ________
  899.           
  900.                     
  901.           
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.                                                                         8
  929.  
  930.  
  931.  
  932.  
  933.  
  934.                                   HGRAPH.LIB  V1.01
  935.                                   HGRAPH.LIB       
  936.  
  937.  
  938.           HGMODE
  939.           HGMODE
  940.           
  941.                Summary        
  942.                _______        
  943.           
  944.                     #include <hgraph.h>   Contains function prototypes
  945.           
  946.                     void hgmode(void);
  947.                          hgmode       
  948.           
  949.                Description
  950.                ___________
  951.           
  952.                     Sets graphics mode, clears graphic pages 0 and 1 then
  953.                     switches to graphics page 0.
  954.           
  955.                Return Value
  956.                ____________
  957.           
  958.                     There is no return value.
  959.           
  960.                See Also
  961.                ________
  962.           
  963.                     hgmode_nc
  964.           
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.                                                                         9
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.                                   HGRAPH.LIB  V1.01
  1008.                                   HGRAPH.LIB       
  1009.  
  1010.  
  1011.           HGMODE_NC
  1012.           HGMODE_NC
  1013.           
  1014.                Summary        
  1015.                _______        
  1016.           
  1017.                     #include <hgraph.h>   Contains function prototypes
  1018.           
  1019.                     void hgmode_nc(void);
  1020.                          hgmode_nc       
  1021.           
  1022.                Description
  1023.                ___________
  1024.           
  1025.                     Sets graphics mode, does not clears graphic pages 0 and
  1026.                                         ________                           
  1027.                     1 then switches to graphics page 0.
  1028.           
  1029.                Return Value
  1030.                ____________
  1031.           
  1032.                     There is no return value.
  1033.           
  1034.                See Also
  1035.                ________
  1036.           
  1037.                     hgmode
  1038.           
  1039.  
  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.                                                                         10
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  
  1081.                                   HGRAPH.LIB  V1.01
  1082.                                   HGRAPH.LIB       
  1083.  
  1084.  
  1085.           HGRAPH_INIT
  1086.           HGRAPH_INIT
  1087.           
  1088.                Summary        
  1089.                _______        
  1090.           
  1091.                     #include <hgraph.h>   Contains function prototypes
  1092.           
  1093.                     void hgraph_init(void);
  1094.                          hgraph_init       
  1095.           
  1096.                Description
  1097.                ___________
  1098.           
  1099.                     Initializes the necessary global variables for
  1100.                     HGRAPH.LIB. These variables are:
  1101.           
  1102.                     int  HGPAGE;   /* current graphics page, used by all */
  1103.                          HGPAGE                                            
  1104.                                                                      ___   
  1105.                                    /* the library routines               */
  1106.           
  1107.                     char HGATRB;   /* character attribute for hwrite     */
  1108.                          HGATRB                               hwrite       
  1109.                          
  1110.                     int  HGRATIO;  /* aspect ratio for hellipse          */
  1111.                          HGRATIO                       hellipse            
  1112.                               
  1113.                     The initial values for are HGPAGE = 1, HGATRB = 0x00,
  1114.                                                HGPAGE      HGATRB        
  1115.                     and HGRATIO = 2.  HGPAGE should only be 1 or 0 if it is
  1116.                         HGRATIO       HGPAGE                               
  1117.                     set to some value other than these two all the routine
  1118.                     will default it to 1.  HGATRB should only be HGNORM or
  1119.                                            HGATRB                HGNORM   
  1120.                     HGINVS (defined in hgraph.h) other values will just
  1121.                     HGINVS                                             
  1122.                     cause the print to look funny.  HGRATIO should be a
  1123.                                                     HGRATIO            
  1124.                     positive int, 0 will cause it to draw a horizontal
  1125.                     line, and a negative will hellipse to crash.
  1126.                     
  1127.           
  1128.                Return Value
  1129.                ____________
  1130.           
  1131.                     There is no return value.
  1132.           
  1133.                See Also
  1134.                ________
  1135.           
  1136.           
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.                                                                         11
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.                                   HGRAPH.LIB  V1.01
  1164.                                   HGRAPH.LIB       
  1165.  
  1166.  
  1167.           HLINE
  1168.           HLINE
  1169.           
  1170.                Summary        
  1171.                _______        
  1172.           
  1173.                     #include <hgraph.h>   Contains function prototypes
  1174.           
  1175.                     void hline(function, x0, y0, x1, y1);
  1176.                          hline                           
  1177.                                ________  __  __  __  __  
  1178.           
  1179.                     int function;       /* 0 - write pixels in black */
  1180.                         ________                                       
  1181.                                         /* 1 - write pixels in white */    
  1182.                     int x0;             /* 0 through 719             */
  1183.                         __                                             
  1184.                     int y0;             /* 0 through 347             */
  1185.                         __                                             
  1186.                     int x1;             /* 0 through 719             */
  1187.                         __                                             
  1188.                     int y1;             /* 0 through 347             */
  1189.                         __                                             
  1190.           
  1191.                Description
  1192.                ___________
  1193.           
  1194.                     The default for function is 1, so if hline is called
  1195.                                                          hline          
  1196.                                     ________                            
  1197.                     with function not equal to those listed you get
  1198.                          ________                                  
  1199.                     function 1.  The graphics page is set according to the
  1200.                     ________                                              
  1201.                     current value of HGPAGE (see hgraph_init).  There is no
  1202.                                      HGPAGE                                
  1203.                     bounds checking done on x0, x1, y0, or y1 so numbers
  1204.                                             __  __  __     __           
  1205.                     outside of range will give unknown results (probably
  1206.                     not good).
  1207.                     
  1208.                Return Value
  1209.                ____________
  1210.           
  1211.                     There is no return value.
  1212.           
  1213.                See Also
  1214.                ________
  1215.           
  1216.                     hxline
  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.                                                                         12
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.                                   HGRAPH.LIB  V1.01
  1249.                                   HGRAPH.LIB       
  1250.  
  1251.  
  1252.           HPIXEL
  1253.           HPIXEL
  1254.           
  1255.                Summary        
  1256.                _______        
  1257.           
  1258.                     #include <hgraph.h>   Contains function prototypes
  1259.           
  1260.                     void hpixel(function, x, y);
  1261.                          hpixel                 
  1262.                                 ________  _  _  
  1263.           
  1264.                     int function;       /*  0 - write pixel in black  */
  1265.                         ________                                        
  1266.                                         /*  1 - write pixel in white  */   
  1267.                                         /*  2 - toggle pixel          */
  1268.                                         /*  3 - read pixel            */
  1269.                     int x;              /*  0 through 719             */
  1270.                         _                                               
  1271.                     int y;              /*  0 through 347             */
  1272.                         _                                               
  1273.           
  1274.                Description
  1275.                ___________
  1276.           
  1277.                     The default for function is 2, so if hpixel is called
  1278.                                                          hpixel          
  1279.                                     ________                             
  1280.                     with function not equal to those listed you get
  1281.                          ________                                  
  1282.                     function 2.  The pixel is plotted on the graphics page
  1283.                     ________                                              
  1284.                     according to the current value of HGPAGE (see
  1285.                                                       HGPAGE     
  1286.                     hgraph_init).  There is no bounds checking done on x
  1287.                                                                        _
  1288.                     and y so numbers outside of range will give unknown
  1289.                         _                                              
  1290.                     results (probably not good).
  1291.                     
  1292.                     
  1293.                Return Value
  1294.                ____________
  1295.           
  1296.                     The return value is the status the pixel was set to by
  1297.                     any of the four functions.  So hpixel while always
  1298.                                                    hpixel             
  1299.                                     ________                          
  1300.                     return a 0 (for black) or a 1 (for white).
  1301.           
  1302.                See Also
  1303.                ________
  1304.           
  1305.           
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.                                                                         13
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.                                   HGRAPH.LIB  V1.01
  1335.                                   HGRAPH.LIB       
  1336.  
  1337.  
  1338.           HSCDUMP
  1339.           HSCDUMP
  1340.           
  1341.                Summary        
  1342.                _______        
  1343.           
  1344.                     #include <hgraph.h>   Contains function prototypes
  1345.           
  1346.                     void hscdump(void);
  1347.                          hscdump       
  1348.           
  1349.           
  1350.                Description
  1351.                ___________
  1352.           
  1353.                     Dumps graphics page 0 or 1, according to the current
  1354.                     value of HGPAGE (see hgraph_init), to an Epson or
  1355.                              HGPAGE                                  
  1356.                     compatible printer.  Each line is double struck to
  1357.                     improve the clarity.
  1358.                     
  1359.                Return Value
  1360.                ____________
  1361.           
  1362.                     There is no return value.
  1363.           
  1364.                See Also
  1365.                ________
  1366.           
  1367.                     hscdump2
  1368.           
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  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.                                                                         14
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.                                   HGRAPH.LIB  V1.01
  1409.                                   HGRAPH.LIB       
  1410.  
  1411.  
  1412.           HSCDUMP2
  1413.           HSCDUMP2
  1414.           
  1415.                Summary        
  1416.                _______        
  1417.           
  1418.                     #include <hgraph.h>   Contains function prototypes
  1419.           
  1420.                     void hscdump2(void);
  1421.                          hscdump2       
  1422.           
  1423.           
  1424.                Description
  1425.                ___________
  1426.           
  1427.                     Dumps graphics page 0 or 1, according to the current
  1428.                     value of HGPAGE (see hgraph_init), to an Epson or
  1429.                              HGPAGE                                  
  1430.                     compatible printer.  Each line is only single struck to
  1431.                     improve the speed.
  1432.                     
  1433.                Return Value
  1434.                ____________
  1435.           
  1436.                     There is no return value.
  1437.           
  1438.                See Also
  1439.                ________
  1440.           
  1441.                     hscdump
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462.  
  1463.  
  1464.  
  1465.  
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.                                                                         15
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.                                   HGRAPH.LIB  V1.01
  1483.                                   HGRAPH.LIB       
  1484.  
  1485.  
  1486.           HSHOWPG
  1487.           HSHOWPG
  1488.           
  1489.                Summary        
  1490.                _______        
  1491.           
  1492.                     #include <hgraph.h>   Contains function prototypes
  1493.           
  1494.                     void hshowpg(void);
  1495.                          hshowpg       
  1496.           
  1497.           
  1498.                Description
  1499.                ___________
  1500.           
  1501.                     Set graphics page 0 or 1, according to the current
  1502.                     value of HGPAGE (see hgraph_init),  to the currently
  1503.                              HGPAGE                                     
  1504.                     displayed page.
  1505.                     
  1506.                     
  1507.                Return Value
  1508.                ____________
  1509.           
  1510.                     There is no return value.
  1511.           
  1512.                See Also
  1513.                ________
  1514.           
  1515.                     hgmode, hgmode_nc
  1516.           
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  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.                                                                         16
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.                                   HGRAPH.LIB  V1.01
  1557.                                   HGRAPH.LIB       
  1558.  
  1559.  
  1560.           HSTR
  1561.           HSTR
  1562.           
  1563.                Summary        
  1564.                _______        
  1565.           
  1566.                     #include <hgraph.h>   Contains function prototypes
  1567.           
  1568.                     void hstr(column, row, string, attrib, count);
  1569.                          hstr                                     
  1570.                               ______  ___  ______  ______  _____  
  1571.           
  1572.                     int  column;        /* 0 through 89              */
  1573.                          ______                                        
  1574.                     int  row;           /* 0 through 42              */
  1575.                          ___                                           
  1576.                     char *string;       /* pointer to the string     */
  1577.                           ______                                       
  1578.                     char attrib;        /* HGNORM or HGINVS          */
  1579.                                            HGNORM    HGINVS            
  1580.                          ______                                        
  1581.                     int  count;         /* number of chars in string */
  1582.                          _____                                ______   
  1583.           
  1584.                Description
  1585.                ___________
  1586.           
  1587.                     Writes the string pointed to by string at the row and
  1588.                                                     ______        ___    
  1589.                     column given after each character has been XORed with
  1590.                     ______                                               
  1591.                     attrib.  The graphics page written to is set according
  1592.                     ______                                                
  1593.                     to the current value of HGPAGE (see hgraph_init).
  1594.                                             HGPAGE                   
  1595.                     There is no bounds checking done on column and row so
  1596.                                                         ______     ___   
  1597.                     numbers outside of range will give unknown results
  1598.                     (probably not good).  Hstr's character table only has
  1599.                                           Hstr                           
  1600.                     ASCII characters 0 through 127, values outside this
  1601.                     range will give garbage.  The attrib is xor with the
  1602.                                                   ______                
  1603.                     character's bits on each scan line, values other than
  1604.                     HGNORM (normal) and HGINVS (inverse) will just produce
  1605.                     HGNORM              HGINVS                            
  1606.                     odd patterns.  Count tells hstr how many of string's
  1607.                                                hstr                     
  1608.                                    _____                        ______  
  1609.                     characters to plot.  MSC regular run-time LIB has a
  1610.                     functions strlen() and gcvt(), strlen() will produce a
  1611.                     correct count and gcvt() will convert numbers to a
  1612.                             _____                                     
  1613.                     string so they can be printed.
  1614.                     
  1615.                Return Value
  1616.                ____________
  1617.           
  1618.                     There is no return value.
  1619.           
  1620.                See Also
  1621.                ________
  1622.           
  1623.                     hchar, hchar2, hwrite, hxchar, hxchar2, hxstr
  1624.                     MSC's or QuickC's strlen() and gcvt()
  1625.           
  1626.                Note:
  1627.                _____
  1628.           
  1629.                     This is the fastest of hstr, hchar, and hchar2 for
  1630.                     writing strings because it operates on byte boundaries.
  1631.                     Only if you really need to write at a particular pixel
  1632.                     location should hchar or hchar2 be used and of these
  1633.                     two hchar2 is the better (only because its character
  1634.                     table is internal, the same as hstr, so it is
  1635.                     guaranteed to work on all machines).
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.                                                                         17
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.                                   HGRAPH.LIB  V1.01
  1649.                                   HGRAPH.LIB       
  1650.  
  1651.  
  1652.           HTMODE
  1653.           HTMODE
  1654.           
  1655.                Summary        
  1656.                _______        
  1657.           
  1658.                     #include <hgraph.h>   Contains function prototypes
  1659.           
  1660.                     void htmode(void);
  1661.                          htmode       
  1662.           
  1663.                Description
  1664.                ___________
  1665.           
  1666.                     Sets text mode, clears graphic pages 0 and 1 then
  1667.                     switches to text page.
  1668.           
  1669.                Return Value
  1670.                ____________
  1671.           
  1672.                     There is no return value.
  1673.           
  1674.                See Also
  1675.                ________
  1676.           
  1677.                     htmode_nc
  1678.           
  1679.  
  1680.  
  1681.  
  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.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.                                                                         18
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.                                   HGRAPH.LIB  V1.01
  1722.                                   HGRAPH.LIB       
  1723.  
  1724.  
  1725.           HTMODE_NC
  1726.           HTMODE_NC
  1727.           
  1728.                Summary        
  1729.                _______        
  1730.           
  1731.                     #include <hgraph.h>   Contains function prototypes
  1732.           
  1733.                     void htmode_nc(void);
  1734.                          htmode_nc       
  1735.           
  1736.                Description
  1737.                ___________
  1738.           
  1739.                     Sets text mode, does not clears graphic pages 0 and 1
  1740.                                     ________                             
  1741.                     then switches to text page.
  1742.           
  1743.                Return Value
  1744.                ____________
  1745.           
  1746.                     There is no return value.
  1747.           
  1748.                See Also
  1749.                ________
  1750.           
  1751.                     htmode
  1752.           
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.                                                                         19
  1790.  
  1791.  
  1792.  
  1793.  
  1794.  
  1795.                                   HGRAPH.LIB  V1.01
  1796.                                   HGRAPH.LIB       
  1797.  
  1798.  
  1799.           HWRITE
  1800.           HWRITE
  1801.           
  1802.                Summary        
  1803.                _______        
  1804.           
  1805.                     #include <hgraph.h>   Contains function prototypes
  1806.           
  1807.                     int hwrite(row, col, string);
  1808.                         hwrite                   
  1809.                                ___  ___  ______  
  1810.           
  1811.                     int row;            /* 0 through 42           */
  1812.                         ___                                         
  1813.                     int col;            /* 0 through 89           */
  1814.                         ___                                         
  1815.                     char *string;       /* pointer to the string  */
  1816.                           ______                                    
  1817.           
  1818.                Description
  1819.                ___________
  1820.           
  1821.                     Write string starting at (row, col) using the attribute
  1822.                           ______              ___  ___                     
  1823.                     value of HGATRB (see hgraph_init).  The string is
  1824.                              HGATRB                                  
  1825.                     written to the graphics page set according to the
  1826.                     current value of HGPAGE (see hgraph_init).  Hwrite
  1827.                                      HGPAGE                     Hwrite
  1828.                     checks for bounds on both row and col, if the start of
  1829.                                               ___     ___                 
  1830.                     the string is not on the screen the string will not be
  1831.                     written.  If the string runs off the right edge it will
  1832.                     just be truncated to avoid errors.  MSC regular run-
  1833.                     time LIB has a function gcvt() which will convert
  1834.                     numbers to a string so they can be printed.
  1835.                     
  1836.                     
  1837.                Return Value
  1838.                ____________
  1839.           
  1840.                     Hwrite will return a 1 if it wrote any thing on the
  1841.                     Hwrite                                             
  1842.                     screen (truncated or not) or a 0 if (row, col) was off
  1843.                                                          ___  ___         
  1844.                     the screen (nothing written).
  1845.           
  1846.                See Also
  1847.                ________
  1848.           
  1849.                     hchar, hchar2, hstr, hxchar, hxchar2, hxstr
  1850.                     MSC's or QuickC's  gcvt()
  1851.           
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.  
  1862.  
  1863.  
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.                                                                         20
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.                                   HGRAPH.LIB  V1.01
  1879.                                   HGRAPH.LIB       
  1880.  
  1881.  
  1882.           HXCHAR
  1883.           HXCHAR
  1884.           
  1885.                Summary        
  1886.                _______        
  1887.           
  1888.                     #include <hgraph.h>   Contains function prototypes
  1889.           
  1890.                     void hxchar(x, y, string, attrib, count);
  1891.                          hxchar                              
  1892.                                 _  _  ______  ______  _____  
  1893.           
  1894.                     int  x;             /* 0 through 719             */
  1895.                          _                                             
  1896.                     int  y;             /* 0 through 347             */
  1897.                          _                                             
  1898.                     char *string;       /* ASCII 0 through 127       */
  1899.                           ______                                       
  1900.                     char attrib;        /* HGNORM or HGINVS          */
  1901.                                            HGNORM    HGINVS            
  1902.                          ______                                        
  1903.                     int  count;         /* number of chars in string */
  1904.                          _____                                ______   
  1905.           
  1906.                Description
  1907.                ___________
  1908.           
  1909.                     XORs string starting at the upper left most corner of
  1910.                          ______                                          
  1911.                     the string pointed to by string at the coordinates
  1912.                                              ______                   
  1913.                     given after each character has been XORed with attrib.
  1914.                                                                    ______ 
  1915.                     Hxchar writes to the graphics page set by the current
  1916.                     Hxchar                                               
  1917.                     value of HGPAGE (see hgraph_init).  There is no bounds
  1918.                              HGPAGE                                       
  1919.                     checking done on x and y so numbers outside of range
  1920.                                      _     _                            
  1921.                     will give unknown results (probably not good).  Hxchar
  1922.                                                                     Hxchar
  1923.                     uses the IBM PC/XT/AT ROM character table.  This table
  1924.                     only has ASCII characters 0 through 127, values outside
  1925.                     this range will give garbage.  The attrib is xor with
  1926.                                                        ______            
  1927.                     the character's bits before it is xored to the screen,
  1928.                     values other than HGNORM (normal) and HGINVS (inverse)
  1929.                                       HGNORM              HGINVS          
  1930.                     for attrib will just produce odd patterns.  Count tells
  1931.                         ______                                  _____      
  1932.                     hchar how many of string's characters to plot.  MSC
  1933.                     hchar                                              
  1934.                                       ______                           
  1935.                     regular run-time LIB has a functions strlen() and
  1936.                     gcvt(), strlen() will produce a correct count and
  1937.                                                             _____    
  1938.                     gcvt() will convert numbers to a string.
  1939.                     
  1940.                Return Value
  1941.                ____________
  1942.           
  1943.                     There is no return value.
  1944.           
  1945.                See Also
  1946.                ________
  1947.           
  1948.                     hchar, hchar2, hstr, hwrite, hxchar2, hxstr
  1949.                     MSC's or QuickC's strlen() and gcvt()
  1950.           
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.                                                                         21
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.                                   HGRAPH.LIB  V1.01
  1972.                                   HGRAPH.LIB       
  1973.  
  1974.  
  1975.           HXCHAR2
  1976.           HXCHAR2
  1977.           
  1978.                Summary        
  1979.                _______        
  1980.           
  1981.                     #include <hgraph.h>   Contains function prototypes
  1982.           
  1983.                     void hxchar2(x, y, string, attrib, count);
  1984.                          hxchar2                              
  1985.                                  _  _  ______  ______  _____  
  1986.           
  1987.                     int  x;             /* 0 through 719             */
  1988.                          _                                             
  1989.                     int  y;             /* 0 through 347             */
  1990.                          _                                             
  1991.                     char *string;       /* ASCII 0 through 127       */
  1992.                           ______                                       
  1993.                     char attrib;        /* HGNORM  or HGINVS         */
  1994.                                            HGNORM     HGINVS           
  1995.                          ______                                        
  1996.                     int  count;         /* number of chars in string */
  1997.                          _____                                ______   
  1998.           
  1999.                Description
  2000.                ___________
  2001.           
  2002.                     XORs string starting at the upper left most corner of
  2003.                          ______                                          
  2004.                     the string pointed to by string at the coordinates
  2005.                                              ______                   
  2006.                     given after each character has been XORed with attrib.
  2007.                                                                    ______ 
  2008.                     Hxchar2 writes to the graphics page according to the
  2009.                     Hxchar2                                             
  2010.                     current value of HGPAGE (see hgraph_init).  There is no
  2011.                                      HGPAGE                                
  2012.                     bounds checking done on x and y so numbers outside of
  2013.                                             _     _                      
  2014.                     range will give unknown results (probably not good).
  2015.                     Hxchar2's character table only has ASCII characters 0
  2016.                     Hxchar2                                              
  2017.                     through 127, values outside this range will give
  2018.                     garbage.  The attrib is xor with the character's bits
  2019.                                   ______                                 
  2020.                     before it is xored to the screen, values other than
  2021.                     HGNORM (normal) and HGINVS (inverse) for attrib will
  2022.                     HGNORM              HGINVS                          
  2023.                                                              ______     
  2024.                     just produce odd patterns.  Count tells hxchar2 how
  2025.                                                             hxchar2    
  2026.                                                 _____                  
  2027.                     many of string's characters to plot.  MSC regular run-
  2028.                             ______                                        
  2029.                     time LIB has a functions strlen() and gcvt(), strlen()
  2030.                     will produce a correct count and gcvt() will convert
  2031.                                            _____                        
  2032.                     numbers to a string.
  2033.                     
  2034.                Return Value
  2035.                ____________
  2036.           
  2037.                     There is no return value.
  2038.           
  2039.                See Also
  2040.                ________
  2041.           
  2042.                     hchar, hchar2, hstr, hwrite, hxchar, hxstr
  2043.                     MSC's or QuickC's strlen() and gcvt()
  2044.           
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.  
  2054.  
  2055.  
  2056.  
  2057.  
  2058.  
  2059.                                                                         22
  2060.  
  2061.  
  2062.  
  2063.  
  2064.  
  2065.                                   HGRAPH.LIB  V1.01
  2066.                                   HGRAPH.LIB       
  2067.  
  2068.  
  2069.           HXLINE
  2070.           HXLINE
  2071.           
  2072.                Summary        
  2073.                _______        
  2074.           
  2075.                     #include <hgraph.h>   Contains function prototypes
  2076.           
  2077.                     void hxline(x0, y0, x1, y1);
  2078.                          hxline                 
  2079.                                 __  __  __  __  
  2080.           
  2081.                     int x0;             /* 0 through 719  */
  2082.                         __                                  
  2083.                     int y0;             /* 0 through 347  */
  2084.                         __                                  
  2085.                     int x1;             /* 0 through 719  */
  2086.                         __                                  
  2087.                     int y1;             /* 0 through 347  */
  2088.                         __                                  
  2089.           
  2090.                Description
  2091.                ___________
  2092.           
  2093.                     Toggles the status of all the pixels along the given
  2094.                     line.  The graphics page is set according to the
  2095.                     current value of HGPAGE (see hgraph_init).  There is no
  2096.                                      HGPAGE                                
  2097.                     bounds checking done on x0, x1, y0, or y1 so numbers
  2098.                                             __  __  __     __           
  2099.                     outside of range will give unknown results (probably
  2100.                     not good).
  2101.                     
  2102.                     
  2103.                Return Value
  2104.                ____________
  2105.           
  2106.                     There is no return value.
  2107.           
  2108.                See Also
  2109.                ________
  2110.           
  2111.                     hline
  2112.           
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.  
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130.  
  2131.  
  2132.  
  2133.  
  2134.  
  2135.  
  2136.  
  2137.  
  2138.  
  2139.                                                                         23
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.                                   HGRAPH.LIB  V1.01
  2146.                                   HGRAPH.LIB       
  2147.  
  2148.  
  2149.           HXSTR
  2150.           HXSTR
  2151.           
  2152.                Summary        
  2153.                _______        
  2154.           
  2155.                     #include <hgraph.h>   Contains function prototypes
  2156.           
  2157.                     void hxstr(column, row, string, attrib, count);
  2158.                          hxstr                                     
  2159.                                ______  ___  ______  ______  _____  
  2160.           
  2161.                     int  column;        /* 0 through 89              */
  2162.                          ______                                        
  2163.                     int  row;           /* 0 through 42              */
  2164.                          ___                                           
  2165.                     char *string;       /* pointer to the string     */
  2166.                           ______                                       
  2167.                     char attrib;        /* HGNORM or HGINVS          */
  2168.                                            HGNORM    HGINVS            
  2169.                          ______                                        
  2170.                     int  count;         /* number of chars in string */
  2171.                          _____                                ______   
  2172.           
  2173.                Description
  2174.                ___________
  2175.           
  2176.                     XORs the string pointed to by string at the row and
  2177.                                                   ______        ___    
  2178.                     column given after each character has been XORed with
  2179.                     ______                                               
  2180.                     attrib.  The graphics page written to is set according
  2181.                     ______                                                
  2182.                     to the current value of HGPAGE (see hgraph_init).
  2183.                                             HGPAGE                   
  2184.                     There is no bounds checking done on column and row so
  2185.                                                         ______     ___   
  2186.                     numbers outside of range will give unknown results
  2187.                     (probably not good).  Hstr's character table only has
  2188.                                           Hstr                           
  2189.                     ASCII characters 0 through 127, values outside this
  2190.                     range will give garbage.  The attrib is xor with the
  2191.                                                   ______                
  2192.                     character's bits before it is xored to the screen,
  2193.                     values other than HGNORM (normal) and HGINVS (inverse)
  2194.                                       HGNORM              HGINVS          
  2195.                     will just produce odd patterns.  Count tells hstr how
  2196.                                                                  hstr    
  2197.                                                      _____               
  2198.                     many of string's characters to plot.  MSC regular run-
  2199.                             ______                                        
  2200.                     time LIB has a functions strlen() and gcvt(), strlen()
  2201.                     will produce a correct count and gcvt() will convert
  2202.                                            _____                        
  2203.                     numbers to a string so they can be printed.
  2204.                     
  2205.                Return Value
  2206.                ____________
  2207.           
  2208.                     There is no return value.
  2209.           
  2210.                See Also
  2211.                ________
  2212.           
  2213.                     hchar, hchar2, hstr, hwrite, hxchar, hxchar2
  2214.                     MSC's or QuickC's strlen() and gcvt()
  2215.           
  2216.                Note:
  2217.                _____
  2218.           
  2219.                     This is the fastest of hxstr, hxchar, and hxchar2 for
  2220.                     writing strings because it operates on byte boundaries.
  2221.                     Only if you really need to write at a particular pixel
  2222.                     location should hxchar or hxchar2 be used and of these
  2223.                     two hxchar2 is the better (only because its character
  2224.                     table is internal, the same as hxstr, so it is
  2225.                     guaranteed to work on all machines).
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.                                                                         24
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.                                   HGRAPH.LIB  V1.01
  2239.                                   HGRAPH.LIB       
  2240.  
  2241.  
  2242.           
  2243.           
  2244.           
  2245.           
  2246.           
  2247.           
  2248.           
  2249.           
  2250.           
  2251.           
  2252.           
  2253.           
  2254.           
  2255.           
  2256.           
  2257.                                      Appendix  A
  2258.                                      Appendix  A
  2259.                                           
  2260.                                      (examples)
  2261.  
  2262.  
  2263.  
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.                                                                         25
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.                                   HGRAPH.LIB  V1.01
  2307.                                   HGRAPH.LIB       
  2308.  
  2309.  
  2310.           
  2311.           /* CORNUCOPIA -- see article on "pseudo-hidden line removal" */
  2312.           /* IBM-PC Exchange, May-June 1986 */
  2313.           
  2314.           #include <math.h>
  2315.           #include <conio.h>
  2316.           #include <hgraph.h>
  2317.           
  2318.           main()
  2319.           {
  2320.           
  2321.                int d, a0, b0, a1, b1, a, b;
  2322.                double r, rada, radb;
  2323.           
  2324.                hgraph_init();
  2325.                hgmode_nc();
  2326.                hclearpg();
  2327.                hshowpg();
  2328.                hstr(40, 1, " CORNUCOPIA ", 0xff, 12);
  2329.                for (d = 1; d <= 100; ++d)
  2330.                {
  2331.                      rada = (float)d;
  2332.                      radb = 0.65 * rada;
  2333.                      a0 = 20 + 4 * d;
  2334.                      b0 = 20 + 2 * d + (int)(radb * 0.6 * sin(d/10.0));
  2335.                      hline(0, a0, b0, a1 = a0, b1 = b0 + (int)radb);
  2336.                      for (r = 0.0; r < 6.3; r += 6.28/40.0)
  2337.                      {
  2338.                            a = a0 + (int)(rada * sin(r));
  2339.                            b = b0 + (int)(radb * cos(r));
  2340.                            hline(1, a1, b1, a, b);
  2341.                            hline(0, a0, b0, a1 = a, b1 = b);
  2342.                       }
  2343.                }
  2344.           
  2345.                /*  This next section flips back and forth from
  2346.                 *  text to graphics three time to show the use of the
  2347.                 *  non-clearing hgmode_nc & htmode_nc the user must hit a
  2348.                 *  key to cause the flip
  2349.                 */
  2350.           
  2351.                hstr(10, 40, "Press any key to continue ... ", 0x00, 30);
  2352.                   getch();
  2353.                htmode_nc();
  2354.                   puts("Press any key to continue ... ");
  2355.                   getch();
  2356.                hgmode_nc(); hshowpg();
  2357.                   getch();
  2358.                htmode_nc();
  2359.                   getch();
  2360.                hgmode_nc(); hshowpg();
  2361.                   getch();
  2362.                htmode();            /* this will clear the text screen */
  2363.           }
  2364.  
  2365.  
  2366.  
  2367.                                                                         26
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.                                   HGRAPH.LIB  V1.01
  2374.                                   HGRAPH.LIB       
  2375.  
  2376.  
  2377.           
  2378.           
  2379.           /* DEMO.C - a demo of hgraph.lib's string writing routines */
  2380.           
  2381.           #include <string.h>
  2382.           #include <conio.h>
  2383.           #include <hgraph.h>
  2384.           
  2385.           char string[40] = "HGRAPH.LIB";
  2386.           
  2387.           main()
  2388.           {
  2389.           int ct;
  2390.           char c;
  2391.           
  2392.                   ct = strlen(string);
  2393.                   hgraph_init();
  2394.                   hgmode_nc();
  2395.                   hclearpg();
  2396.                   hshowpg();
  2397.           
  2398.           
  2399.               hstr(40, 1, string, HGINVS, ct);
  2400.               hstr(20, 10,
  2401.                "This is a demo of hstr, hchar, and hchar2", HGNORM, 41);
  2402.               hstr(10, 20,
  2403.                "This is a sample of hstr with normal attrib", HGNORM,43);
  2404.               hstr(10, 21,
  2405.                "This is a sample of hstr with inverse attrib", HGINVS,44);
  2406.               hchar(80, 200,
  2407.                "This is a sample of hchar with normal attrib", HGNORM,44);
  2408.               hchar(80, 209,
  2409.                "This is a sample of hchar with inverse attrib",HGINVS,45);
  2410.               hchar2(80, 240,
  2411.                "This is a sample of hchar2 with normal attrib",HGNORM,45);
  2412.               hchar2(80, 249,
  2413.                "This is a sample of hchar2 with inverse attrib",HGINVS,46);
  2414.           
  2415.           
  2416.                hstr(10, 40,
  2417.                     "Press any key to continue ...", HGNORM, 29);
  2418.                    getch();
  2419.                htmode_nc();
  2420.           }
  2421.           
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.                                                                         27
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.                                   HGRAPH.LIB  V1.01
  2441.                                   HGRAPH.LIB       
  2442.  
  2443.  
  2444.           
  2445.           
  2446.           
  2447.           
  2448.           
  2449.           
  2450.           
  2451.           
  2452.           
  2453.           
  2454.           
  2455.           
  2456.           
  2457.           
  2458.           
  2459.                                      Appendix  B
  2460.                                      Appendix  B
  2461.                                           
  2462.                                  (programing ideas)
  2463.  
  2464.  
  2465.  
  2466.  
  2467.  
  2468.  
  2469.  
  2470.  
  2471.  
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.                                                                         28
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.                                   HGRAPH.LIB  V1.01
  2509.                                   HGRAPH.LIB       
  2510.  
  2511.  
  2512.           
  2513.                There are three ways to do screen swapping with these
  2514.           libraries to make it appear that you have a a full screen type
  2515.           window package.  I will start with the easiest and work up to
  2516.           what I would consider the best.  There is one thing to keep in
  2517.           mind, the text screen uses the same memory as the first half of
  2518.           graphics page 0.  This fact must be consider when using
  2519.           hgmode_nc() and htmode_nc() because if you have written stuff to
  2520.           the text screen and then go to graphics page 0 there will be
  2521.           garbage on the top half of the monitor.  The same is true if you
  2522.           do graphics on page 0 and switch to text with out clearing there
  2523.           will be trash all over the text screen.
  2524.           
  2525.           
  2526.           
  2527.                1)   If you do all your graphics on page 1 (the
  2528.                     default) you could use C's standard functions (i.e
  2529.                     printf, puts, ...) to write to the text screen
  2530.                     (you don't have to leave graphics mode to do
  2531.                     this).  This way you could have graphics displayed
  2532.                     and a help screen written to the text screen so if
  2533.                     the user hit F1 you could call htmode_nc() and the
  2534.                     help screen would appear, and then another key
  2535.                     would call hgmode_nc() and the graphics would
  2536.                     reappear.  The only problem with this is a half to
  2537.                     three quarters of a second delay built into both
  2538.                     htmode_nc() and hgmode_nc() this will cause
  2539.                     approximately a one second delay in switching form
  2540.                     one screen to another.
  2541.                
  2542.                
  2543.                2)   There are two undocumented routines in hgraph.lib.
  2544.                
  2545.                     void h_scrn_in( unsigned char *)
  2546.                     void h_scrn_out( unsigned char *)
  2547.                
  2548.                          where unsigned char * is a pointer to a
  2549.                     buffer of at least 32768 bytes.
  2550.                
  2551.                     The first, h_scrn_in reads the screen defined by
  2552.                     HGPAGE and stores it into the buffer it was passed
  2553.                     HGPAGE                                            
  2554.                     as an argument.  The second, h_scrn_out copies the
  2555.                     first 32767 bytes from the buffer it was passed as
  2556.                     an argument to the screen defined by HGPAGE.  So
  2557.                                                          HGPAGE     
  2558.                     in the middle of doing graphics the user hits a
  2559.                     key for help, the program would use h_scrn_in to
  2560.                     save a copy of the current screen.  Then it would
  2561.                     call hclearpg followed by hwrite to display help
  2562.                     messages.  When the user wanted to switch back
  2563.                     just call h_scrn_out and rewrite the image back.
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.                                                                         29
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.                                   HGRAPH.LIB  V1.01
  2578.                                   HGRAPH.LIB       
  2579.  
  2580.  
  2581.                
  2582.                
  2583.                3)   What I feel is the best is to use one graphics
  2584.                     page for graphics and one graphics page for help.
  2585.                     All that would have to be done is to reset HGPAGE
  2586.                                                                HGPAGE
  2587.                     and then call hshowpg to swap between the two.
  2588.                     The code in the library to figure out which page
  2589.                     and to set it is only ten lines in assembly.
  2590.                
  2591.  
  2592.  
  2593.  
  2594.  
  2595.  
  2596.  
  2597.  
  2598.  
  2599.  
  2600.  
  2601.  
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.                                                                         30
  2640.  
  2641.  
  2642.