home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / PROGRAMM / FGL112B.ZIP / USER01.DOC < prev    next >
Text File  |  1992-10-05  |  53KB  |  1,156 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11. Fastgraph (tm)
  12.  
  13.  
  14.  
  15.  
  16.  
  17. User's Guide
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.                                                            Ted Gruber Software
  54.                                                                   PO Box 13408
  55.                                                           Las Vegas, NV  89112
  56.  
  57.                                                                 (702) 735-1980
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66. Copyright (c) 1991,1992 by Ted Gruber Software.
  67.  
  68. All rights reserved.  No part of this publication may be reproduced, stored
  69. in a retrieval system, or transmitted by any means, electronic, mechanical,
  70. photocopying, recording, or otherwise, without express written permission
  71. from Ted Gruber Software.  The software described in this publication is
  72. furnished under a license agreement and may be used or copied only in
  73. accordance with the terms of that agreement.
  74.  
  75. This publication and its associated software are sold without warranties,
  76. either expressed or implied, regarding their merchantability or fitness for
  77. any particular application or purpose.  The information in this publication
  78. is subject to change without notice and does not represent a commitment on
  79. the part of Ted Gruber Software.  In no event shall Ted Gruber Software be
  80. liable for any loss of profit or any other commercial damage, including but
  81. not limited to special, incidental, consequential, or other damages resulting
  82. from the use of or the inability to use this product, even if Ted Gruber
  83. Software has been notified of the possibility of such damages.
  84.  
  85.  
  86. Second Printing, January 1992
  87.  
  88. Fastgraph version 2.10
  89. Fastgraph/Light version 1.10
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98. DFI is a registered trademark of Diamond Flower Electric Instrument Co., Inc.
  99. Fastgraph and Fastgraph/Light  are trademarks of Ted Gruber Software.
  100. Hercules is a trademark of Hercules Computer Technology.
  101. IBM, IBM PC, IBM PC/XT, IBM PC/AT, PS/2, PCjr, and PC-DOS are registered
  102.    trademarks of International Business Machines, Inc.
  103. Intel is a registered trademark of Intel Corporation.
  104. Logitech is a trademark of LOGITECH, Inc.
  105. Microsoft, Microsoft Mouse, and MS-DOS are registered trademarks of Microsoft
  106.    Corporation.
  107. PC Paintbrush is a registered trademark of ZSoft, Inc.
  108. QuickBASIC and QuickC are trademarks of Microsoft Corporation.
  109. Tandy is a registered trademark of Tandy Corporation.
  110. Turbo C and Turbo Pascal are registered trademarks of Borland International,
  111.    Inc.
  112.  
  113.  
  114. All other brand and product names mentioned in this publication are
  115. trademarks or registered trademarks of their respective holders.
  116.  
  117.                       T a b l e   o f   C o n t e n t s
  118.  
  119. Chapter 1  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .    1
  120.      What is Fastgraph? . . . . . . . . . . . . . . . . . . . . . . . . .    2
  121.      Fastgraph/Light  . . . . . . . . . . . . . . . . . . . . . . . . . .    2
  122.      Prerequisite Knowledge . . . . . . . . . . . . . . . . . . . . . . .    2
  123.      Supported Compilers  . . . . . . . . . . . . . . . . . . . . . . . .    3
  124.      Memory Models  . . . . . . . . . . . . . . . . . . . . . . . . . . .    3
  125.      Installing Fastgraph . . . . . . . . . . . . . . . . . . . . . . . .    4
  126.      Fastgraph Naming Conventions . . . . . . . . . . . . . . . . . . . .    4
  127.      Compilation and Linking  . . . . . . . . . . . . . . . . . . . . . .    5
  128.           Borland C++ . . . . . . . . . . . . . . . . . . . . . . . . . .    7
  129.           Microsoft C . . . . . . . . . . . . . . . . . . . . . . . . . .    8
  130.           Microsoft FORTRAN . . . . . . . . . . . . . . . . . . . . . . .    9
  131.           Microsoft QuickBASIC  . . . . . . . . . . . . . . . . . . . . .   10
  132.           Microsoft QuickC  . . . . . . . . . . . . . . . . . . . . . . .   11
  133.           Power C . . . . . . . . . . . . . . . . . . . . . . . . . . . .   13
  134.           Turbo C and Turbo C++ . . . . . . . . . . . . . . . . . . . . .   14
  135.           Turbo Pascal  . . . . . . . . . . . . . . . . . . . . . . . . .   15
  136.      Fastgraph/Light Video Driver . . . . . . . . . . . . . . . . . . . .   16
  137.  
  138. Chapter 2  PC and PS/2 Video Modes  . . . . . . . . . . . . . . . . . . .   17
  139.      Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   18
  140.      Text Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   19
  141.      Graphics Modes . . . . . . . . . . . . . . . . . . . . . . . . . . .   21
  142.           CGA Graphics Modes  . . . . . . . . . . . . . . . . . . . . . .   21
  143.           Tandy 1000 and PCjr Graphics Modes  . . . . . . . . . . . . . .   22
  144.           Hercules Graphics Modes . . . . . . . . . . . . . . . . . . . .   22
  145.           EGA Graphics Modes  . . . . . . . . . . . . . . . . . . . . . .   23
  146.           VGA and MCGA Graphics Modes . . . . . . . . . . . . . . . . . .   24
  147.  
  148. Chapter 3  Initializing the Video Environment . . . . . . . . . . . . . .   27
  149.      Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   28
  150.      Establishing a Text Mode . . . . . . . . . . . . . . . . . . . . . .   28
  151.      43-line and 50-line Text Modes . . . . . . . . . . . . . . . . . . .   31
  152.      Establishing a Graphics Mode . . . . . . . . . . . . . . . . . . . .   32
  153.      Summary of Video Initialization Routines . . . . . . . . . . . . . .   36
  154.  
  155. Chapter 4  Coordinate Systems . . . . . . . . . . . . . . . . . . . . . .   39
  156.      Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   40
  157.      Character Space  . . . . . . . . . . . . . . . . . . . . . . . . . .   40
  158.      Screen Space . . . . . . . . . . . . . . . . . . . . . . . . . . . .   41
  159.      World Space  . . . . . . . . . . . . . . . . . . . . . . . . . . . .   42
  160.      Conversion Routines  . . . . . . . . . . . . . . . . . . . . . . . .   44
  161.      Summary of Coordinate Routines . . . . . . . . . . . . . . . . . . .   44
  162.  
  163. Chapter 5  The Use of Color . . . . . . . . . . . . . . . . . . . . . . .   47
  164.      Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   48
  165.      Text Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   48
  166.           Color Modes . . . . . . . . . . . . . . . . . . . . . . . . . .   48
  167.           Monochrome Mode . . . . . . . . . . . . . . . . . . . . . . . .   49
  168.      Graphics Modes . . . . . . . . . . . . . . . . . . . . . . . . . . .   50
  169.           CGA Color Modes . . . . . . . . . . . . . . . . . . . . . . . .   51
  170.           CGA Two-Color Mode  . . . . . . . . . . . . . . . . . . . . . .   52
  171.           Tandy and PCjr Modes  . . . . . . . . . . . . . . . . . . . . .   53
  172.           Hercules Mode . . . . . . . . . . . . . . . . . . . . . . . . .   54
  173.  
  174.                                      iii
  175.  
  176.           Hercules Low-Resolution Mode  . . . . . . . . . . . . . . . . .   55
  177.           EGA 200-Line Modes  . . . . . . . . . . . . . . . . . . . . . .   56
  178.           EGA Monochrome Mode . . . . . . . . . . . . . . . . . . . . . .   58
  179.           EGA Enhanced Mode . . . . . . . . . . . . . . . . . . . . . . .   59
  180.           VGA and MCGA Two-Color Mode . . . . . . . . . . . . . . . . . .   61
  181.           VGA 16-Color Mode . . . . . . . . . . . . . . . . . . . . . . .   63
  182.           VGA and MCGA 256-Color Modes  . . . . . . . . . . . . . . . . .   64
  183.      RGB Color Mapping  . . . . . . . . . . . . . . . . . . . . . . . . .   68
  184.      Defining All Palette Registers . . . . . . . . . . . . . . . . . . .   69
  185.      Virtual Colors . . . . . . . . . . . . . . . . . . . . . . . . . . .   69
  186.      A Multiple-Mode Example  . . . . . . . . . . . . . . . . . . . . . .   71
  187.      Summary of Color-Related Routines  . . . . . . . . . . . . . . . . .   73
  188.  
  189. Chapter 6  Graphics Fundamentals  . . . . . . . . . . . . . . . . . . . .   75
  190.      Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   76
  191.      Clearing the Screen  . . . . . . . . . . . . . . . . . . . . . . . .   76
  192.      Clipping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   76
  193.      Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   76
  194.      The Graphics Cursor  . . . . . . . . . . . . . . . . . . . . . . . .   79
  195.      Solid Lines  . . . . . . . . . . . . . . . . . . . . . . . . . . . .   79
  196.      Dashed Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . .   82
  197.      Polygons, Circles, and Ellipses  . . . . . . . . . . . . . . . . . .   83
  198.      Solid Rectangles . . . . . . . . . . . . . . . . . . . . . . . . . .   86
  199.      Unfilled Rectangles  . . . . . . . . . . . . . . . . . . . . . . . .   87
  200.      Dithered Rectangles  . . . . . . . . . . . . . . . . . . . . . . . .   88
  201.      Region Fill  . . . . . . . . . . . . . . . . . . . . . . . . . . . .   95
  202.      Summary of Fundamental Graphics Routines . . . . . . . . . . . . . .   96
  203.  
  204. Chapter 7  Character Display Routines . . . . . . . . . . . . . . . . . .   99
  205.      Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  100
  206.      Character Space  . . . . . . . . . . . . . . . . . . . . . . . . . .  100
  207.      Hardware Characters  . . . . . . . . . . . . . . . . . . . . . . . .  101
  208.      Conversion Routines  . . . . . . . . . . . . . . . . . . . . . . . .  107
  209.      Software Characters  . . . . . . . . . . . . . . . . . . . . . . . .  108
  210.      Bit-Mapped Characters  . . . . . . . . . . . . . . . . . . . . . . .  114
  211.      Summary of Character Display Routines  . . . . . . . . . . . . . . .  114
  212.  
  213. Chapter 8  Video Page Management  . . . . . . . . . . . . . . . . . . . .  117
  214.      Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  118
  215.      Physical Pages and Virtual Pages . . . . . . . . . . . . . . . . . .  118
  216.      Pages With Special Meanings  . . . . . . . . . . . . . . . . . . . .  119
  217.      Some Simple Examples . . . . . . . . . . . . . . . . . . . . . . . .  119
  218.      Text Cursors . . . . . . . . . . . . . . . . . . . . . . . . . . . .  126
  219.      Obtaining Video Page Information . . . . . . . . . . . . . . . . . .  127
  220.      Considerations for Virtual Pages . . . . . . . . . . . . . . . . . .  128
  221.      Logical Pages  . . . . . . . . . . . . . . . . . . . . . . . . . . .  129
  222.      Video Page Resizing  . . . . . . . . . . . . . . . . . . . . . . . .  131
  223.      Summary of Video Page Management Routines  . . . . . . . . . . . . .  132
  224.  
  225. Chapter 9 Images and Image Management . . . . . . . . . . . . . . . . . .  135
  226.      Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  136
  227.      Mode-Independent Bit-Mapped Images . . . . . . . . . . . . . . . . .  136
  228.      Mode-Specific Bit-Mapped Images  . . . . . . . . . . . . . . . . . .  140
  229.           Regular Images  . . . . . . . . . . . . . . . . . . . . . . . .  141
  230.           Clipped Images  . . . . . . . . . . . . . . . . . . . . . . . .  148
  231.           Reversed Images . . . . . . . . . . . . . . . . . . . . . . . .  149
  232.  
  233.                                       iv
  234.  
  235.           Reversed Clipped Images . . . . . . . . . . . . . . . . . . . .  149
  236.           Some Examples . . . . . . . . . . . . . . . . . . . . . . . . .  149
  237.      Pixel Run Maps . . . . . . . . . . . . . . . . . . . . . . . . . . .  152
  238.      Display Patterns . . . . . . . . . . . . . . . . . . . . . . . . . .  158
  239.      PCX Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  164
  240.      Masking Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . .  166
  241.      Retrieving Images  . . . . . . . . . . . . . . . . . . . . . . . . .  169
  242.      Byte Boundaries  . . . . . . . . . . . . . . . . . . . . . . . . . .  174
  243.      Image Transfer Routines  . . . . . . . . . . . . . . . . . . . . . .  175
  244.      Summary of Image Display Routines  . . . . . . . . . . . . . . . . .  184
  245.  
  246. Chapter 10  Animation Techniques  . . . . . . . . . . . . . . . . . . . .  187
  247.      Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  188
  248.      Simple Animation . . . . . . . . . . . . . . . . . . . . . . . . . .  188
  249.      XOR Animation  . . . . . . . . . . . . . . . . . . . . . . . . . . .  190
  250.      Static Frame Animation . . . . . . . . . . . . . . . . . . . . . . .  192
  251.      Dynamic Frame Animation  . . . . . . . . . . . . . . . . . . . . . .  194
  252.      Page Flipping  . . . . . . . . . . . . . . . . . . . . . . . . . . .  196
  253.      Summary of Animation Techniques  . . . . . . . . . . . . . . . . . .  198
  254.  
  255. Chapter 11  Special Effects . . . . . . . . . . . . . . . . . . . . . . .  199
  256.      Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  200
  257.      Screen Dissolving  . . . . . . . . . . . . . . . . . . . . . . . . .  200
  258.      Scrolling  . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  202
  259.      Changing the Screen Origin . . . . . . . . . . . . . . . . . . . . .  205
  260.      Summary of Special Effects Routines  . . . . . . . . . . . . . . . .  208
  261.  
  262. Chapter 12  Input Device Support  . . . . . . . . . . . . . . . . . . . .  209
  263.      Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  210
  264.      Keyboard Support . . . . . . . . . . . . . . . . . . . . . . . . . .  210
  265.           Reading Keystrokes  . . . . . . . . . . . . . . . . . . . . . .  212
  266.           Testing and Setting Key States  . . . . . . . . . . . . . . . .  213
  267.      Mouse Support  . . . . . . . . . . . . . . . . . . . . . . . . . . .  214
  268.           Initializing the Mouse  . . . . . . . . . . . . . . . . . . . .  215
  269.           Controlling the Mouse Cursor  . . . . . . . . . . . . . . . . .  216
  270.           Reporting the Mouse Status  . . . . . . . . . . . . . . . . . .  218
  271.           Defining the Mouse Cursor . . . . . . . . . . . . . . . . . . .  220
  272.      Joystick Support . . . . . . . . . . . . . . . . . . . . . . . . . .  227
  273.           Initializing Joysticks  . . . . . . . . . . . . . . . . . . . .  227
  274.           Reporting Joystick Status . . . . . . . . . . . . . . . . . . .  227
  275.           Keyboard Emulation  . . . . . . . . . . . . . . . . . . . . . .  229
  276.           Special Joystick Considerations . . . . . . . . . . . . . . . .  230
  277.      Summary of Input Routines  . . . . . . . . . . . . . . . . . . . . .  231
  278.  
  279. Chapter 13  Sound Effects . . . . . . . . . . . . . . . . . . . . . . . .  233
  280.      Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  234
  281.      Sound Sources  . . . . . . . . . . . . . . . . . . . . . . . . . . .  234
  282.      Synchronous Sound  . . . . . . . . . . . . . . . . . . . . . . . . .  234
  283.      Asynchronous Sound . . . . . . . . . . . . . . . . . . . . . . . . .  239
  284.      Summary of Sound Routines  . . . . . . . . . . . . . . . . . . . . .  244
  285.  
  286. Chapter 14  Program Timing  . . . . . . . . . . . . . . . . . . . . . . .  247
  287.      Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  248
  288.      Real-Time Routines . . . . . . . . . . . . . . . . . . . . . . . . .  248
  289.      Routines Dependent on the System Speed . . . . . . . . . . . . . . .  249
  290.      Summary of Timing Routines . . . . . . . . . . . . . . . . . . . . .  251
  291.  
  292.                                       v
  293.  
  294. Chapter 15  Miscellaneous Routines  . . . . . . . . . . . . . . . . . . .  253
  295.      Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  254
  296.      Determining Available Memory . . . . . . . . . . . . . . . . . . . .  254
  297.      Choosing the Video Memory Update Function  . . . . . . . . . . . . .  255
  298.      Summary of Miscellaneous Routines  . . . . . . . . . . . . . . . . .  256
  299.  
  300. Appendix A  Fastgraph Utilities . . . . . . . . . . . . . . . . . . . . .  257
  301.      Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  258
  302.      SNAPSHOT Utility . . . . . . . . . . . . . . . . . . . . . . . . . .  258
  303.      CLIP Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . .  259
  304.      CONVERT Utility  . . . . . . . . . . . . . . . . . . . . . . . . . .  261
  305.      EDITSPR Utility  . . . . . . . . . . . . . . . . . . . . . . . . . .  261
  306.      GrabRGB Utility  . . . . . . . . . . . . . . . . . . . . . . . . . .  262
  307.      HERCFIX Utility  . . . . . . . . . . . . . . . . . . . . . . . . . .  263
  308.  
  309. Appendix B  Using Fastgraph from Assembly Language  . . . . . . . . . . .  265
  310.  
  311. Appendix C  Interrupts and Fastgraph  . . . . . . . . . . . . . . . . . .  269
  312.      Interrupts Used by Fastgraph . . . . . . . . . . . . . . . . . . . .  270
  313.      Extending the Time-of-Day Interrupt  . . . . . . . . . . . . . . . .  270
  314.  
  315. Appendix D  Contents of the Compiler-Specific Libraries . . . . . . . . .  277
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.                                       vi
  352.  
  353.  
  354. Chapter 1
  355.  
  356. Introduction
  357. 2  Fastgraph User's Guide
  358.  
  359.  
  360. What is Fastgraph?
  361.  
  362.      Fastgraph is a library of more than 170 highly-optimized routines that
  363. are callable from high-level and assembly language programs running under the
  364. MS-DOS or PC-DOS operating systems.  This collection of routines provides a
  365. programmer with proven, powerful tools to take command of the PC and PS/2
  366. video environment.  In addition to its video support, Fastgraph also contains
  367. routines to perform keyboard, mouse, and joystick control, as well as music
  368. and sound capabilities.  Fastgraph is an ideal development tool for
  369. entertainment and educational software, presentation graphics products,
  370. scientific and engineering applications, CAD/CAM, animation, or any
  371. application that demands robust graphics.
  372.  
  373.      As its name implies, the most notable feature of Fastgraph is its speed.
  374. Virtually all of Fastgraph is written in 8086 assembly language, and each
  375. routine has been optimized by hand to provide maximum performance.
  376.  
  377.      Fastgraph supports all the standard text and graphics video modes used
  378. by the IBM PC (PC, PC/XT, and PC/AT) and PS/2 families and compatible
  379. systems.  In addition, Fastgraph provides support for four extended VGA
  380. graphics modes and a 16-color graphics mode unique to Tandy 1000 series
  381. computers and the PCjr.  Even though the graphics mode of the Hercules
  382. Graphics Card is not an IBM standard, its popularity has made it a de facto
  383. standard, and for this reason Fastgraph also supports it.  A complete
  384. discussion of all of Fastgraph's supported video modes appears in the next
  385. chapter.
  386.  
  387.  
  388. Fastgraph/Light
  389.  
  390.      Fastgraph/Light is a subset of Fastgraph.  It includes all of
  391. Fastgraph's features except the redefinable world space coordinate system and
  392. the routines pertaining to software characters.  Programs created using
  393. Fastgraph/Light are 100% source code compatible with Fastgraph.
  394.  
  395.      The most important difference between Fastgraph/Light and Fastgraph is
  396. the method of running a program created with the two products.  With
  397. Fastgraph, any of its routines used in your program are linked directly into
  398. the resulting .EXE file.  With Fastgraph/Light, however, this is not the
  399. case.  Instead, the Fastgraph/Light routines provide an interface to an
  400. external driver, called the Fastgraph/Light Video Driver, which must be
  401. loaded separately before running programs that call any Fastgraph/Light
  402. routines.  A further discussion of this driver begins on page 16.
  403.  
  404.      In this document, and in the accompanying Fastgraph Reference Manual,
  405. references to Fastgraph also apply to Fastgraph/Light unless stated
  406. otherwise.
  407.  
  408.  
  409. Prerequisite Knowledge
  410.  
  411.      Fastgraph is a programming tool, which means programmers are its
  412. intended audience.  For this reason, the Fastgraph User's Guide and the
  413. accompanying Fastgraph Reference Manual assume you have a knowledge of
  414. programming.  Additionally, a knowledge of converting numbers between binary,
  415. decimal, and hexadecimal is assumed.
  416.                                                    Chapter 1:  Introduction  3
  417.  
  418.      Virtually all the examples in this manual are written in the C
  419. programming language, so a knowledge of C would be especially helpful.  The
  420. examples intentionally avoid using any of C's features and idioms that might
  421. not be readily apparent to a programmer unfamiliar with C.  Finally, we'd
  422. like to point out that the examples are intended to be read not by
  423. themselves, but as part of the surrounding text.
  424.  
  425.  
  426. Supported Compilers
  427.  
  428.      You can use Fastgraph with any compilers or assemblers that use the same
  429. calling and naming conventions as the small, medium, or large memory models
  430. of the supported compilers.  Mixed language programming is allowed where
  431. supported by the language translators and linker being used.  Fastgraph
  432. supports the following compilers:
  433.  
  434.        Borland C++ (version 2.0 or later)
  435.        Microsoft C (version 5.0 or later)
  436.        Microsoft FORTRAN (version 4.0 or later)
  437.        Microsoft QuickBASIC (version 4.0 or later)
  438.        Microsoft QuickC (version 2.0 or later)
  439.        Power C (version 2.0 or later)
  440.        Turbo C or Turbo C++ (version 2.0 or later)
  441.        Turbo Pascal (version 6.0 or later)
  442.  
  443. The listed version numbers are the compiler versions under which Fastgraph
  444. was developed and tested.  Fastgraph may or may not work with earlier
  445. versions of these compilers.  The use of Fastgraph from assembly language
  446. programs is addressed in Appendix B.
  447.  
  448.  
  449. Memory Models
  450.  
  451.      All of Fastgraph's supported compilers except QuickBASIC and Turbo
  452. Pascal offer several memory models.  A memory model defines how memory is set
  453. up for a program's code and data segments.  Fastgraph includes libraries for
  454. the small, medium, and large memory models.
  455.  
  456.      The small memory model allows for one code segment and one data segment.
  457. Programs that use the small model can thus have a maximum of 64K bytes of
  458. code and 64K bytes of data.  Because the small model implements call
  459. instructions and data references through near pointers, it produces the most
  460. efficient code of the three supported memory models.
  461.  
  462.      The medium memory model allows for multiple code segments and one data
  463. segment.  Programs that use the medium model thus have no compiler-imposed
  464. limit to the code size (although no one segment can exceed 64K bytes) and a
  465. maximum of 64K bytes of data.  Like the small model, the medium model
  466. implements data references through near pointers, but it implements call
  467. instructions through far pointers.  The use of far pointers adds two bytes of
  468. code and 13 clock cycles for each subprogram call.  The medium model is a
  469. popular choice among programmers.
  470.  
  471.      The large memory model supports multiple code and data segments.
  472. Programs that use the large model do not have any compiler-imposed limits for
  473. code and data sizes.  However, no single code or data segment can exceed 64K
  474. bytes.  Because the large model implements call instructions and data
  475. 4  Fastgraph User's Guide
  476.  
  477. references through far pointers, it produces the least efficient code of the
  478. three supported memory models.
  479.  
  480.      For more information about memory models, please refer to the user's
  481. guide or reference manual for the compilers you'll be using with Fastgraph.
  482.  
  483.  
  484. Installing Fastgraph
  485.  
  486.      This section explains how to use the INSTALL program to load Fastgraph
  487. (or Fastgraph/Light) and its related files on a hard disk.  The installation
  488. program lets you select the compilers and memory models you wish to use with
  489. Fastgraph.  It also gives you the opportunity to load many example Fastgraph
  490. programs specific to the compilers you choose.
  491.  
  492.      Before you start the installation, you should use the DOS commands COPY
  493. or DISKCOPY to make working copies of the Fastgraph distribution disks (refer
  494. to your DOS reference manual if you are unfamiliar with these commands).
  495. Once you have created the working copies, store the original disks in a safe
  496. place.  Install Fastgraph from the working copies you just created.
  497.  
  498.      For simplicity, we'll assume you are installing Fastgraph from the
  499. diskette drive A: to the hard drive C:, but you can of course use any
  500. available drives.  The Fastgraph distribution disk labeled Installation and
  501. Utilities contains Fastgraph's INSTALL program.  Place this disk in the A:
  502. drive, make A: your current drive, and enter the command INSTALL, as shown
  503. below.
  504.  
  505.                                   C> A:
  506.                                   A> INSTALL
  507.  
  508. From this point, just follow the directions on each screen.  At any time, you
  509. can press the Esc key to abort the installation.
  510.  
  511.      The INSTALL program will ask you for the compilers and memory models
  512. you'll use with Fastgraph, as well as the directory names for the Fastgraph
  513. utilities, libraries, and include files.  For the utilities, the default
  514. directory is C:\FG.  For the include files and libraries, we recommend using
  515. directories where the compiler you've chosen normally searches for such
  516. files.  INSTALL will automatically try to determine these directories and
  517. propose them as defaults.
  518.  
  519.      You can install support for additional compilers or memory models at any
  520. time.  If you choose to do this, you should use the command INSTALL /L to
  521. avoid copying the files common to all compilers and memory models.
  522.  
  523.  
  524. Fastgraph Naming Conventions
  525.  
  526.      The names of all Fastgraph routines begin with the three characters
  527. "fg_".  This prefix helps identify Fastgraph routines within a program, and
  528. it also reduces the chance of name conflicts that might otherwise occur
  529. between Fastgraph and other third party libraries.
  530.  
  531.      Because QuickBASIC does not permit underscores in identifiers, the
  532. QuickBASIC versions of Fastgraph routines begin with the two characters "FG".
  533.                                                    Chapter 1:  Introduction  5
  534.  
  535. For example, the fg_version routine is named FGversion in the QuickBASIC
  536. libraries.  All subsequent references to Fastgraph routines in this manual
  537. and the accompanying Fastgraph Reference Manual will use the fg_ naming
  538. convention instead of the QuickBASIC names.
  539.  
  540.  
  541. Compilation and Linking
  542.  
  543.      To build an executable (.EXE) file for a program that uses Fastgraph
  544. routines, first compile or assemble the program using the small, medium, or
  545. large memory model.  This step produces an object file, which is then linked
  546. with Fastgraph and any other object libraries to produce an executable file.
  547.  
  548.      Examples 1-1 through 1-4 use the Fastgraph routine fg_version to display
  549. the version number for your copy of Fastgraph.  These examples are
  550. respectively written in the four high-level languages Fastgraph supports:
  551. C/C++, BASIC, FORTRAN, and Pascal.  If you loaded the example programs when
  552. you installed Fastgraph, the files \FG\EXAMPLES\01-01.C, 01-02.BAS,
  553. 01-03.FOR, and 01-04.PAS contain the source code for these examples.  You can
  554. use them to test the compilation and linking process for the memory models
  555. and compilers you'll be using with Fastgraph.
  556.  
  557.                                  Example 1-1.
  558.  
  559.       #include <fastgraf.h>
  560.       #include <stdio.h>
  561.       void main(void);
  562.  
  563.       void main()
  564.       {
  565.          int major;
  566.          int minor;
  567.  
  568.          fg_version(&major,&minor);
  569.          printf("This is version %d.%2.2d of Fastgraph.\n",major,minor);
  570.       }
  571.  
  572.      The file FASTGRAF.H contains the C function prototypes for each
  573. Fastgraph routine.  It should reside in a directory where the compiler
  574. normally searches for other .H files.  For Microsoft C and QuickC, FASTGRAF.H
  575. can reside in any of the directories specified by the INCLUDE environment
  576. variable.  For Power C, it can reside in any of the directories specified by
  577. the /i switch in the PCOPTION environment variable.
  578.  
  579.                                  Example 1-2.
  580.  
  581.           REM $INCLUDE: 'fastgraf.bi'
  582.  
  583.           DEFINT A-Z
  584.  
  585.           FGversion Major, Minor
  586.           Version! = Major + Minor*0.01
  587.  
  588.           PRINT USING "This is version #.## of Fastgraph."; Version!
  589.  
  590.           END
  591.  
  592. 6  Fastgraph User's Guide
  593.  
  594.  
  595.      You must include the DECLARE commands in the file FASTGRAF.BI at the
  596. beginning of each QuickBASIC module.  This file should reside in the
  597. directory where the compiler normally searches for other .BI files, or in any
  598. of the directories specified by the INCLUDE environment variable.  The
  599. DECLARE commands in this file automatically provide the calling convention
  600. and naming convention for each Fastgraph routine.  In addition, they relieve
  601. the QuickBASIC programmer of distinguishing arguments passed by value from
  602. those passed by reference.
  603.  
  604.                                  Example 1-3.
  605.  
  606.      $INCLUDE: '\FG\INTRFACE.FOR'
  607.  
  608.            PROGRAM MAIN
  609.  
  610.            INTEGER*2 MAJOR
  611.            INTEGER*2 MINOR
  612.  
  613.            CALL FG_VERSION (MAJOR, MINOR)
  614.  
  615.            WRITE (6,10) MAJOR, MINOR
  616.      10    FORMAT (' This is version ', I1, '.', I2.2, ' of Fastgraph.')
  617.  
  618.            STOP ' '
  619.            END
  620.  
  621.  
  622.  
  623.      You must include the INTERFACE statements in the file INTRFACE.FOR at
  624. the beginning of your program (this file should reside in the \FG directory).
  625. The INTERFACE statements in this file automatically provide the calling
  626. convention and naming convention for each Fastgraph routine.  In addition,
  627. they relieve the FORTRAN programmer of distinguishing arguments passed by
  628. value from those passed by reference.
  629.  
  630.                                  Example 1-4.
  631.  
  632.       program main;
  633.       uses fgtp;
  634.  
  635.       var
  636.         Major : integer;
  637.         Minor : integer;
  638.  
  639.       begin
  640.         fg_version(Major,Minor);
  641.         writeln('This is version ',Major,'.',Minor:2,' of Fastgraph.');
  642.       end.
  643.  
  644.  
  645.      Turbo Pascal programs that use Fastgraph or Fastgraph/Light must include
  646. a uses statement specifying the name of the Fastgraph unit, FGTP.  In
  647. addition, if the program calls any of the compiler-specific Fastgraph
  648. routines listed in Appendix D, the uses statement also must include the name
  649. of the extended Fastgraph unit, FGTPX.  The unit files must reside in a
  650. directory where Turbo Pascal normally searches for units.
  651.                                                    Chapter 1:  Introduction  7
  652.  
  653.      The following sections show the simplest compilation and linking
  654. procedures for the supported compilers.  In what follows, items enclosed in
  655. angle brackets, such as <filename>, are placeholders for parameters you must
  656. supply (the name of a file in this case).  Items enclosed in square brackets,
  657. such as [/E], are optional.
  658.  
  659.  
  660. Borland C++
  661.  
  662.      Borland C++ allows you to compile and link a program directly from the
  663. DOS command line, or from within its integrated development environment
  664. (IDE).  To use Fastgraph from the IDE, you must make sure the compiler
  665. options match one of Fastgraph's available memory models (small, medium, or
  666. large) and then create a project file that links with the corresponding
  667. Fastgraph libraries (as listed below).
  668.  
  669.      You also can compile and link a Borland C++ program from the DOS command
  670. line using the BCC command.  The format of the BCC command for compiling a
  671. program and linking it with Fastgraph is
  672.  
  673.              BCC <model> <filename> <fg_library> [<fg_extended>]
  674.  
  675. where:
  676.  
  677.      <model>        specifies the compiler memory model you'll be using.
  678.                     It must be either -ms (for the small model), -mm
  679.                     (for the medium model), or -ml (for the large
  680.                     model).
  681.  
  682.      <filename>     is the name of the file containing your
  683.                     program.  It may include a path specification.
  684.  
  685.      <fg_library>   is the name of a standard Fastgraph/Light or
  686.                     Fastgraph library.  For Fastgraph/Light, the library
  687.                     name is FGLS.LIB (for the small model), FGLM.LIB
  688.                     (for the medium model), or FGLL.LIB (for the large
  689.                     model).  For Fastgraph, the library name is FGS.LIB
  690.                     (for the small model), FGM.LIB (for the medium
  691.                     model), or FGL.LIB (for the large model).
  692.  
  693.      <fg_extended>  is the name of an optional compiler-specific
  694.                     extended Fastgraph library.  You need to specify an
  695.                     extended library name only if your program calls any
  696.                     of the Fastgraph routines listed in Appendix D.  The
  697.                     extended library name is FGTCS.LIB (for the small
  698.                     model), FGTCM.LIB (for the medium model), or
  699.                     FGTCL.LIB (for the large model).  Fastgraph/Light
  700.                     does not use extended libraries.
  701.  
  702.      For example, to compile the program 01-01.C under the medium memory
  703. model and then link it with Fastgraph, you could use the following BCC
  704. command:
  705.  
  706.                       BCC -mm 01-01.C FGM.LIB FGTCM.LIB
  707.  
  708. 8  Fastgraph User's Guide
  709.  
  710.  
  711. Although we specified the extended library name FGTCM.LIB on the command
  712. line, we didn't need to in this example because the program doesn't call any
  713. of the compiler-specific Fastgraph routines listed in Appendix D.  If you
  714. were using Fastgraph/Light instead of Fastgraph, the BCC command would be:
  715.  
  716.                            BCC -mm 01-01.C FGLM.LIB
  717.  
  718. For more information about memory models or other compilation and linking
  719. options, please refer to the Borland C++ User's Guide, published by Borland
  720. International.
  721.  
  722.  
  723. Microsoft C
  724.  
  725.      Microsoft C programs are compiled and linked by entering a CL command at
  726. the DOS command prompt.  The format of the CL command for compiling a program
  727. and linking it with Fastgraph is
  728.  
  729.         CL <model> <filename> /link <fg_library> [<fg_extended>] [/E]
  730.  
  731. where:
  732.  
  733.      <model>        specifies the compiler memory model you'll be using.
  734.                     It must be either /AS (for the small model), /AM
  735.                     (for the medium model), or /AL (for the large
  736.                     model).
  737.  
  738.      <filename>     is the name of the file containing your
  739.                     program.  It must include the file extension
  740.                     (typically .C) and may include a path
  741.                     specification.
  742.  
  743.      <fg_library>   is the name of a standard Fastgraph/Light or
  744.                     Fastgraph library.  For Fastgraph/Light, the library
  745.                     name is FGLS (for the small model), FGLM (for the
  746.                     medium model), or FGLL (for the large model).  For
  747.                     Fastgraph, the library name is FGS (for the small
  748.                     model), FGM (for the medium model), or FGL (for the
  749.                     large model).
  750.  
  751.      <fg_extended>  is the name of an optional compiler-specific
  752.                     extended Fastgraph library.  You need to specify an
  753.                     extended library name only if your program calls any
  754.                     of the Fastgraph routines listed in Appendix D.  The
  755.                     extended library name is FGMSCS (for the small
  756.                     model), FGMSCM (for the medium model), or FGMSCL
  757.                     (for the large model).  Fastgraph/Light does not use
  758.                     extended libraries.
  759.  
  760. The /E linker option is not required but will produce a smaller .EXE file if
  761. specified.
  762.                                                    Chapter 1:  Introduction  9
  763.  
  764.      For example, to compile the program 01-01.C under the medium memory
  765. model and then link it with Fastgraph, you could use the following CL
  766. command:
  767.  
  768.                       CL /AM 01-01.C /link FGM FGMSCM /E
  769.  
  770. Although we specified the extended library name FGMSCM on the command line,
  771. we didn't need to in this example because the program doesn't call any of the
  772. compiler-specific Fastgraph routines listed in Appendix D.  If you were using
  773. Fastgraph/Light instead of Fastgraph, the CL command would be:
  774.  
  775.                          CL /AM 01-01.C /link FGLM /E
  776.  
  777. For more information about memory models or other compilation and linking
  778. options, please refer to the Microsoft C Optimizing Compiler User's Guide,
  779. published by Microsoft Corporation.
  780.  
  781.  
  782. Microsoft FORTRAN
  783.  
  784.      Microsoft FORTRAN programs are compiled and linked by entering an FL
  785. command at the DOS command prompt.  The format of the FL command for
  786. compiling a program and linking it with Fastgraph is
  787.  
  788.  FL /FPi /4I2 /4Nt <model> <filename> /link <fg_library> [<fg_extended>] [/E]
  789.  
  790. where:
  791.  
  792.      <model>        specifies the compiler memory model you'll be using.
  793.                     It must be either /AM (for the medium model) or /AL
  794.                     (for the large model).  Microsoft FORTRAN does not
  795.                     support the small model.
  796.  
  797.      <filename>     is the name of the file containing your
  798.                     program.  It may include a path specification.
  799.  
  800.      <fg_library>   is the name of a standard Fastgraph/Light or
  801.                     Fastgraph library.  For Fastgraph/Light, the library
  802.                     name is FGLM (for the medium model) or FGLL (for the
  803.                     large model).  For Fastgraph, the library name is
  804.                     FGM (for the medium model) or FGL (for the large
  805.                     model).
  806.  
  807.      <fg_extended>  is the name of an optional compiler-specific
  808.                     extended Fastgraph library.  You need to specify an
  809.                     extended library name only if your program calls any
  810.                     of the Fastgraph routines listed in Appendix D.  The
  811.                     extended library name is FGMSFM (for the medium
  812. 10  Fastgraph User's Guide
  813.  
  814.                     model) or FGMSFL (for the large model).
  815.                     Fastgraph/Light does not use extended libraries.
  816.  
  817. The /E linker option is not required but will produce a smaller .EXE file if
  818. specified.
  819.  
  820.      For example, to compile the program 01-03.FOR under the medium memory
  821. model and then link it with Fastgraph, you could use the following FL
  822. command:
  823.  
  824.              FL /FPi /4I2 /4Nt /AM 01-03.FOR /link FGM FGMSFM /E
  825.  
  826. Although we specified the extended library name FGMSFM on the command line,
  827. we didn't need to in this example because the program doesn't call any of the
  828. compiler-specific Fastgraph routines listed in Appendix D.  If you were using
  829. Fastgraph/Light instead of Fastgraph, the FL command would be:
  830.  
  831.                 FL /FPi /4I2 /4Nt /AM 01-03.FOR /link FGLM /E
  832.  
  833. For more information about memory models or other compilation and linking
  834. options, please refer to the Microsoft FORTRAN Optimizing Compiler User's
  835. Guide, published by Microsoft Corporation.
  836.  
  837.      All the remaining example programs in the Fastgraph User's Guide are
  838. written in the C programming language.  However, when you install Fastgraph
  839. for the Microsoft FORTRAN compiler, the installation procedure copies FORTRAN
  840. versions of the example programs to the \FG\EXAMPLES directory.
  841.  
  842.  
  843. Microsoft QuickBASIC
  844.  
  845.      Microsoft QuickBASIC allows you to compile and link a program directly
  846. from the DOS command line, or from within its programming environment.  To
  847. use Fastgraph from QuickBASIC's programming environment, just specify the
  848. quick library name FGQB when starting QuickBASIC, as shown below.
  849.  
  850.                                   QB /lFGQB
  851.  
  852. If you are using Fastgraph/Light, use the library name FGLQB instead of FGQB.
  853.  
  854.      You also can compile and link a QuickBASIC program from the DOS command
  855. line using the BC and LINK commands.  The format of these commands for
  856. compiling a program and linking it with Fastgraph is
  857.  
  858.                   BC <filename>;
  859.                   LINK [/E] <object_file>,,NUL,<fg_library>
  860.  
  861. where:
  862.                                                   Chapter 1:  Introduction  11
  863.  
  864.      <filename>     is the name of the file containing your
  865.                     program.  It may include a path specification.
  866.  
  867.      <object_file>  is the name of the object file produced by the BC
  868.                     command.  By default, this will be the same as
  869.                     <filename>, but with an extension of .OBJ rather
  870.                     than .BAS.
  871.  
  872.      <fg_library>   is the name of the standard Fastgraph/Light or
  873.                     Fastgraph library.  For Fastgraph/Light, the library
  874.                     name is FGLQB.  For Fastgraph, the library name is
  875.                     FGQB.  QuickBASIC does not use extended Fastgraph
  876.                     libraries.
  877.  
  878. The /E linker option is not required but will produce a smaller .EXE file if
  879. specified.
  880.  
  881.      For example, to compile the program 01-02.BAS and then link it with
  882. Fastgraph, you could use the following commands:
  883.  
  884.                          BC 01-02.BAS;
  885.                          LINK /E 01-02.OBJ,,NUL,FGQB
  886.  
  887. If you were using Fastgraph/Light instead of Fastgraph, the commands would
  888. be:
  889.  
  890.                          BC 01-02.BAS;
  891.                          LINK /E 01-02.OBJ,,NUL,FGLQB
  892.  
  893. For more information about other compilation and linking options, please
  894. refer to the Microsoft QuickBASIC: Programming in BASIC manual, published by
  895. Microsoft Corporation.
  896.  
  897.      All the remaining example programs in the Fastgraph User's Guide are
  898. written in the C programming language.  However, when you install Fastgraph
  899. for Microsoft QuickBASIC, the installation procedure copies QuickBASIC
  900. versions of the example programs to the \FG\EXAMPLES directory.
  901.  
  902.  
  903. Microsoft QuickC
  904.  
  905.      Microsoft QuickC allows you to compile and link a program directly from
  906. the DOS command line, or from within its programming environment.  To use
  907. Fastgraph from the QuickC programming environment, you must make sure the
  908. compiler options match one of Fastgraph's available memory models (small,
  909. medium, or large) and then create a make file that includes one or more of
  910. the corresponding Fastgraph libraries (as listed below).
  911.  
  912.      You also can compile and link a QuickC program from the DOS command line
  913. using the QCL command.  The format of the QCL command for compiling a program
  914. and linking it with Fastgraph is
  915.  
  916.         QCL <model> <filename> /link <fg_library> [<fg_extended>] [/E]
  917.  
  918. 12  Fastgraph User's Guide
  919.  
  920.  
  921.  
  922. where:
  923.  
  924.      <model>        specifies the compiler memory model you'll be using.
  925.                     It must be either /AS (for the small model), /AM
  926.                     (for the medium model), or /AL (for the large
  927.                     model).
  928.  
  929.      <filename>     is the name of the file containing your
  930.                     program.  It must include the file extension
  931.                     (typically .C) and may include a path
  932.                     specification.
  933.  
  934.      <fg_library>   is the name of a standard Fastgraph/Light or
  935.                     Fastgraph library.  For Fastgraph/Light, the library
  936.                     name is FGLS (for the small model), FGLM (for the
  937.                     medium model), or FGLL (for the large model).  For
  938.                     Fastgraph, the library name is FGS (for the small
  939.                     model), FGM (for the medium model), or FGL (for the
  940.                     large model).
  941.  
  942.      <fg_extended>  is the name of an optional compiler-specific
  943.                     extended Fastgraph library.  You need to specify an
  944.                     extended library name only if your program calls any
  945.                     of the Fastgraph routines listed in Appendix D.  The
  946.                     extended library name is FGMSCS (for the small
  947.                     model), FGMSCM (for the medium model), or FGMSCL
  948.                     (for the large model).  Fastgraph/Light does not use
  949.                     extended libraries.
  950.  
  951. The /E linker option is not required but will produce a smaller .EXE file if
  952. specified.
  953.  
  954.      For example, to compile the program 01-01.C under the medium memory
  955. model and then link it with Fastgraph, you could use the following QCL
  956. command:
  957.  
  958.                      QCL /AM 01-01.C /link FGM FGMSCM /E
  959.  
  960. Although we specified the extended library name FGMSCM on the command line,
  961. we didn't need to in this example because the program doesn't call any of the
  962. compiler-specific Fastgraph routines listed in Appendix D.  If you were using
  963. Fastgraph/Light instead of Fastgraph, the QCL command would be:
  964.  
  965.                         QCL /AM 01-01.C /link FGLM /E
  966.  
  967. For more information about memory models or other compilation and linking
  968. options, please refer to the Microsoft QuickC Tool Kit manual, published by
  969. Microsoft Corporation.
  970.                                                   Chapter 1:  Introduction  13
  971.  
  972.  
  973. Power C
  974.  
  975.      Power C programs are compiled and linked from the DOS command line using
  976. the PC and PCL commands.  The format of these commands for compiling a
  977. program and linking it with Fastgraph is
  978.  
  979.                 PC <model> <filename>
  980.                 PCL <mix_file> ;<fg_library> [;<fg_extended>]
  981.  
  982. where:
  983.  
  984.      <model>        specifies the compiler memory model you'll be using.
  985.                     It must be either /ms (for the small model), /mm
  986.                     (for the medium model), or /ml (for the large
  987.                     model).
  988.  
  989.      <filename>     is the name of the file containing your
  990.                     program.  It may include a path specification.
  991.  
  992.      <mix_file>     is the name of the object file produced by the
  993.                     PC command.  By default, this will be the same
  994.                     as <filename>, but with an extension of .MIX
  995.                     rather than .C.
  996.  
  997.      <fg_library>   is the name of a standard Fastgraph/Light or
  998.                     Fastgraph library.  For Fastgraph/Light, the library
  999.                     name is FGLS (for the small model), FGLM (for the
  1000.                     medium model), or FGLL (for the large model).  For
  1001.                     Fastgraph, the library name is FGS (for the small
  1002.                     model), FGM (for the medium model), or FGL (for the
  1003.                     large model).
  1004.  
  1005.      <fg_extended>  is the name of an optional compiler-specific
  1006.                     extended Fastgraph library.  You need to specify an
  1007.                     extended library name only if your program calls any
  1008.                     of the Fastgraph routines listed in Appendix D.  The
  1009.                     extended library name is FGPCS (for the small
  1010.                     model), FGPCM (for the medium model), or FGPCL (for
  1011.                     the large model).  Fastgraph/Light does not use
  1012.                     extended libraries.
  1013.  
  1014.      For example, to compile the program 01-01.C under the medium memory
  1015. model and then link it with Fastgraph, you could use the following commands:
  1016.  
  1017.                           PC /mm 01-01.C
  1018.                           PCL 01-01.MIX ;FGM ;FGPCM
  1019.  
  1020. Although we specified the extended library name FGPCM on the command line, we
  1021. didn't need to in this example because the program doesn't call any of the
  1022. compiler-specific Fastgraph routines listed in Appendix D.  If you were using
  1023. Fastgraph/Light instead of Fastgraph, the commands would be:
  1024. 14  Fastgraph User's Guide
  1025.  
  1026.                              PC /mm 01-01.C
  1027.                              PCL 01-01.MIX ;FGPCM
  1028.  
  1029. For more information about memory models or other compilation and linking
  1030. options, please refer to the Power C manual, published by Mix Software, Inc.
  1031.  
  1032.  
  1033. Turbo C and Turbo C++
  1034.  
  1035.      Turbo C and Turbo C++ allow you to compile and link a program directly
  1036. from the DOS command line, or from within their integrated development
  1037. environment (IDE).  To use Fastgraph from the IDE, you must make sure the
  1038. compiler options match one of Fastgraph's available memory models (small,
  1039. medium, or large) and then create a project file that links with the
  1040. corresponding Fastgraph libraries (as listed below).
  1041.  
  1042.      You also can compile and link a Turbo C or Turbo C++ program from the
  1043. DOS command line using the TCC command.  The format of the TCC command for
  1044. compiling a program and linking it with Fastgraph is
  1045.  
  1046.              TCC <model> <filename> <fg_library> [<fg_extended>]
  1047.  
  1048. where:
  1049.  
  1050.      <model>        specifies the compiler memory model you'll be using.
  1051.                     It must be either -ms (for the small model), -mm
  1052.                     (for the medium model), or -ml (for the large
  1053.                     model).
  1054.  
  1055.      <filename>     is the name of the file containing your
  1056.                     program.  It may include a path specification.
  1057.  
  1058.      <fg_library>   is the name of a standard Fastgraph/Light or
  1059.                     Fastgraph library.  For Fastgraph/Light, the library
  1060.                     name is FGLS.LIB (for the small model), FGLM.LIB
  1061.                     (for the medium model), or FGLL.LIB (for the large
  1062.                     model).  For Fastgraph, the library name is FGS.LIB
  1063.                     (for the small model), FGM.LIB (for the medium
  1064.                     model), or FGL.LIB (for the large model).
  1065.  
  1066.      <fg_extended>  is the name of an optional compiler-specific
  1067.                     extended Fastgraph library.  You need to specify an
  1068.                     extended library name only if your program calls any
  1069.                     of the Fastgraph routines listed in Appendix D.  The
  1070.                     extended library name is FGTCS.LIB (for the small
  1071.                     model), FGTCM.LIB (for the medium model), or
  1072.                     FGTCL.LIB (for the large model).  Fastgraph/Light
  1073.                     does not use extended libraries.
  1074.  
  1075.      For example, to compile the program 01-01.C under the medium memory
  1076. model and then link it with Fastgraph, you could use the following TCC
  1077. command:
  1078.  
  1079.                       TCC -mm 01-01.C FGM.LIB FGTCM.LIB
  1080.  
  1081.                                                   Chapter 1:  Introduction  15
  1082.  
  1083.  
  1084.  
  1085. Although we specified the extended library name FGTCM.LIB on the command
  1086. line, we didn't need to in this example because the program doesn't call any
  1087. of the compiler-specific Fastgraph routines listed in Appendix D.  If you
  1088. were using Fastgraph/Light instead of Fastgraph, the TCC command would be:
  1089.  
  1090.                            TCC -mm 01-01.C FGLM.LIB
  1091.  
  1092. For more information about memory models or other compilation and linking
  1093. options, please refer to the Turbo C User's Guide and the Turbo C Reference
  1094. Guide, both published by Borland International.
  1095.  
  1096.  
  1097. Turbo Pascal
  1098.  
  1099.      Turbo Pascal allows you to compile and link a program directly from the
  1100. DOS command line with the TPC command, or from within its integrated
  1101. development environment (IDE) with the TURBO command.  To use Fastgraph from
  1102. the IDE, just start the IDE as you would for any other Pascal program, making
  1103. sure the standard unit (FGTP.TPU) and extended unit (FGTPX.TPU) reside in one
  1104. of the directories listed in the Unit Directories option.
  1105.  
  1106.      You also can compile and link a Turbo Pascal program from the DOS
  1107. command line using the TPC command.  The format of the TPC command for
  1108. compiling a program and linking it with Fastgraph is
  1109.  
  1110.                                 TPC <filename>
  1111.  
  1112. where:
  1113.  
  1114.      <filename>     is the name of the file containing your
  1115.                     program.  It may include a path specification.
  1116.  
  1117.      For example, to compile the program 01-04.PAS and then link it with
  1118. Fastgraph, you could use the following command:
  1119.  
  1120.                                 TPC 01-04.PAS
  1121.  
  1122. For more information about other compilation and linking options, please
  1123. refer to the Turbo Pascal User's Guide, published by Borland International.
  1124.  
  1125.      All the remaining example programs in the Fastgraph User's Guide are
  1126. written in the C programming language.  However, when you install Fastgraph
  1127. for Turbo Pascal, the installation procedure copies Pascal versions of the
  1128. example programs to the \FG\EXAMPLES directory.
  1129. 16  Fastgraph User's Guide
  1130.  
  1131.  
  1132. Fastgraph/Light Video Driver
  1133.  
  1134.      As mentioned earlier, running any program created with Fastgraph/Light
  1135. requires an external program called the Fastgraph/Light Video Driver.  The
  1136. video driver is a terminate and stay resident program (TSR) that provides an
  1137. interface between your program and Fastgraph.  Once loaded, the video driver
  1138. uses about 60,000 bytes of conventional memory.
  1139.  
  1140.      To load the video driver, enter the command FGDRIVER at the DOS command
  1141. prompt (assuming FGDRIVER.EXE is in the current directory, or the \FG
  1142. directory is in your DOS path specification).  The driver will display a
  1143. message indicating whether or not it loaded successfully.  After you load the
  1144. driver, just run a program created with Fastgraph/Light as you would any
  1145. other program.  If you try running a program that uses Fastgraph/Light
  1146. without first loading the video driver, the message "Fastgraph/Light video
  1147. driver not installed" will appear.
  1148.  
  1149.      You don't need to load the driver before running each program, just once
  1150. per system boot (in fact, the driver will display an "already loaded" message
  1151. if you try to load it more than once).  If you want to unload the video
  1152. driver, just enter FGDRIVER /U at the DOS command prompt.  The unload
  1153. operation will work completely only if the video driver was the last TSR
  1154. loaded.  If it wasn't the last TSR, the driver will still unload, but the
  1155. memory it uses will not be released back to DOS.
  1156.