home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / zsys / znode-12 / i / plot33.lbr / PLOT-DOC.1Z / PLOT-DOC.1
Encoding:
Text File  |  1993-06-12  |  16.8 KB  |  369 lines

  1.  
  2.              PLOT Version 3.3 (PLOT33) DOCUMENTATION
  3.  
  4.         PART 1. PLOT USER'S GUIDE
  5.  
  6.              General Information
  7.              Running PLOT
  8.              Application Programming
  9.              PLOT Commands
  10.              Pitfalls and Limitations
  11.              Error Messages
  12.  
  13.         PART 2. APPLICATION PROGRAMS
  14.  
  15.              BASIC Programs
  16.              TURBO PASCAL Library
  17.              FORTRAN Library
  18.  
  19.         PART 3. INSTALLATION INSTRUCTIONS
  20.  
  21.              Sizing the Memory Map
  22.              Printer Settings
  23.  
  24. PART 1 USER'S GUIDE
  25.  
  26. General Information
  27.  
  28. This collection of programs contains a graphics system that can 
  29. produce high resolution graphics on dot matrix printers and other 
  30. graphic devices.  This system consists of three parts:
  31.  
  32. - high level language subprograms that you include in  your 
  33. application programs,
  34.  
  35. - a disk file created by the application program which is used 
  36. to describe the pictures to be printed,
  37.  
  38. - and low level device drivers that read the file and produce the 
  39. pictures on whatever sort of hardware you are using.
  40.  
  41. The application program "plots" by writing simple plot commands 
  42. to a disk file, which is later read and printed by the low level 
  43. driver. This file is the key to the whole system, because it 
  44. makes the application program independent of the plotting device 
  45. and vice versa. It also makes it possible to plot pictures that 
  46. were created on different computers or to plot the same picture 
  47. on different types of hardware, such as CRT's and printers.
  48.  
  49. The system contained in this collection has high level subprogram 
  50. libraries written in BASIC (GRAPH.BAS), Turbo Pascal (GRAF1.PAS 
  51. and GRAF2.PAS), and FORTRAN (GRAF.FOR). A C library is being 
  52. debugged. It contains one assembly language device driver, 
  53. PLOT33.ASM, which will plot on a variety of dot matrix printers.  
  54. These printers include the Epson MX-80 etc., CItoh Prowriter, 
  55. Okidata 92, NEC, Gemini-10, Apple Dot Matrix, and IDS printers.  
  56. PLOT33 lets you treat your printer as if it were a plotter 
  57. capable of true vector graphics. All future versions of PLOT 
  58. (3.x) will support the same basic file format and will be 
  59. compatible with each other.
  60.  
  61. This documentation describes how to get PLOT33 installed, 
  62. specifies the format for the disk file of plotting vectors 
  63. (".VEC" files), and gives an overview of the high level language 
  64. packages. You will probably want to briefly skim over the 
  65. descriptions below and go right to the Installation section. If 
  66. you intend to mainly use the programs and subprogram libraries 
  67. provided, the exact details of the format of the commands in the 
  68. file are not important.
  69.  
  70. Capabilities
  71.  
  72. PLOT's command set includes instructions for device independent 
  73. graphics and commands that provide access to the unique 
  74. capabilities of specific devices. The device independent commands 
  75. are patterned after a pen plotter's characteristics, with a 
  76. rudimentary capability for filling areas on raster scan devices.  
  77. These device independent commands include the capability to move 
  78. to a point without plotting, to plot points and straight line 
  79. segments, to change the current color, and fill in a trapezoidal 
  80. area. More complex areas can be decomposed into simpler regions 
  81. for filling.
  82.  
  83. The device dependent commands include the ability to plot/print a 
  84. string using hardware character capabilities. The Upload command 
  85. can be used to upload the red-green-blue values used for the 
  86. color table on color graphics terminals (or stipple patterns to 
  87. be used for "colors" on monochrome devices as in PLOT33). The 
  88. Erase command will clear the screen, establish the background 
  89. color, or advance the page, as appropriate for the type of 
  90. plotter or display. An Output command is used to produce hardcopy 
  91. output or print the memory map. A general instruction that can be 
  92. used to extend the command set for any other non-standard command 
  93. required rounds out the device dependent commands.
  94.  
  95. Bug Fixes and Future Versions
  96.  
  97. The assembly language and BASIC programs in this system have been 
  98. tested so far on four different computers and six different types 
  99. of printers. I would appreciate hearing about any problems you 
  100. have or changes that you make to the program. I am particularly 
  101. interested in versions for different printers or drivers for 
  102. other plotting devices such as graphic terminals and plotters.  
  103. Please send your comments and questions to the author at:
  104.  
  105.   Tom Speer
  106.   887 Briddlewood Ln.
  107.   Dayton, Ohio 45430
  108.   (513)429-2781
  109.  
  110. It is important that a common version be maintained that 
  111. incorporates fixes to all of the bugs and implements the 
  112. improvements that are of general interest.
  113.  
  114. As mentioned above, all future updates to this version of PLOT 
  115. will be compatible with the existing plot files and high level 
  116. software. Future drivers are also planned for creating and 
  117. interpreting the vector command file on mainframe computers using 
  118. CALCOMP or Tektronics plotters and terminals. As much as 
  119. possible, the eXtend command should be used for adding neat new 
  120. features for your printer or taking advantage of the capabilities 
  121. of more advanced devices. This will make it possible to maintain 
  122. the file format as a means of exchanging information without a 
  123. fatal proliferation of exclusive versions.
  124.  
  125. Acknowledgments
  126.  
  127. I owe a special debt of thanks to all the people that have been 
  128. my guinea pigs in adding new printers and discovering bugs.  
  129. Especially Hal Carter for his help and encouragement, Kirk Horton 
  130. for really wringing out the system in his VLSI applications, and 
  131. Mike Gingrich for his critiques of the system and documentation.
  132.  
  133. Running PLOT
  134.  
  135. To use PLOT, first create a sequential disk file of plot 
  136. commands. These are described fully in the next section. Then 
  137. execute PLOT by typing:
  138.  
  139.     PLOT33 ifn [ofn]
  140.  
  141. ifn is the input file name. A file type of .VEC is assumed if no 
  142. file type is given.
  143.  
  144. [ofn] is an optional output file name. If no output file is 
  145. given, the output from PLOT will go directly to the printer (CP/M 
  146. LST: device). If an output file is specified, all of the 
  147. information normally sent to the printer will be stored in the 
  148. disk file instead. In this case, no printed output will be 
  149. produced. PIP or some other utility may be used to print the 
  150. picture. This option is useful for making multiple copies or for 
  151. including graphics in the middle of text files. The default 
  152. output file type is .PLT.
  153.  
  154. Note: Output files are large- typically 40 to 60k. Be sure to 
  155. leave enough space on the disk for the entire file.
  156.  
  157. Application Programming
  158.  
  159. Application programs "plot" by writing the appropriate plot 
  160. command to a disk file. This file later becomes PLOT's input 
  161. file. The plotting area is a square, with the coordinates 
  162. (0.0,0.0) located at the bottom left corner, and the coordinates 
  163. (1.0,1.0) located at the upper right corner. These coordinate 
  164. values are independent of the resolution or aspect ratio of the 
  165. plotting device. PLOT converts these values to the actual number 
  166. of rasters (dots) used by the printer to produce a square plot 
  167. approximately eight inches on a side.
  168.  
  169. All plot commands are written to disk one after the other, with 
  170. no spaces or delimiting characters between them. Each command 
  171. consists of an ASCII character followed by the binary data which 
  172. it requires. Many languages, such as BASIC, insert extraneous 
  173. characters, such as carriage returns or line feeds, at the end of 
  174. each block written. Because of this, plotting commands should not 
  175. be split between blocks, as these extra characters will be 
  176. interpreted as data in a command. If the extraneous character 
  177. occupies the position of a command character, however, it can be 
  178. detected and ignored. The current application programs output 
  179. plot commands in 128 byte blocks. If a command will not fit in a 
  180. given block, the block is written to disk, and the next command 
  181. written in a new block. This ensures that the extraneous 
  182. characters will fall between commands where PLOT can deal with 
  183. them. When using fixed length blocks or records, each can be 
  184. padded with "N"'s to preserve its length before it is written.
  185.  
  186. The recommended command sequence to produce a picture is:
  187.  
  188. 1. Set the color to black or white (color values 127 or 0) for a 
  189. background. Usually white is used.
  190.  
  191. 2. Erase the picture to initialize the memory map area and 
  192. establish the background.
  193.  
  194. 3. Set the color value for plotting. Usually black (127) is used.
  195.  
  196. 4. Establish a starting point by using the Move command, plotting 
  197. a single point, or plotting a line segment using the Draw 
  198. command.
  199.  
  200. 5. Proceed to create the remainder of the plot. The Increment 
  201. command is recommended when one line segment is connected to the 
  202. previous one, as in a curve.
  203.  
  204. 6. Be sure to include an Output command to print the final plot.
  205.  
  206. 7. Use the Quit command to stop plotting. PLOT will terminate 
  207. automatically at an end-of-file, but with an error message, and 
  208. without printing the picture.
  209.  
  210. PLOT Commands
  211.  
  212. Each command is of the form:
  213.  
  214.      Adata
  215.  
  216. "A" represents the single ASCII character as explained below.  
  217. "data" represents 0 to 86 bytes of data required for the 
  218. particular command. Usually this consists of fixed point numbers 
  219. giving the coordinates of points or ends of line segments. No 
  220. spaces or delimitating characters are used between fields within 
  221. a command or between commands. The individual commands are 
  222. described in Table 1.
  223.  
  224. The data values required for the plot commands are not ASCII 
  225. character strings. Thus, they cannot be made using normal 
  226. formatted output of the coordinate variables in the application 
  227. program. The coordinate values are 16 bit fixed point numbers.  
  228. These are created in a high level program by multiplying the 
  229. floating point value (between 0.0 and 1.0) by 32767 and 
  230. truncating the result to an integer. In BASIC, the MKI$ function 
  231. can be used to store the data in a string variable, which is then 
  232. written to the disk file. FORTRAN programmers can simply use 
  233. unformatted files or convert everything to characters and use A 
  234. formats. Under PASCAL, the file can be declared to be a FILE OF 
  235. CHAR and the binary values converted the characters using the CHR 
  236. function. This does not work well for Turbo Pascal, however, 
  237. since Turbo places the file size and record length at the head of 
  238. a FILE OF CHAR. Turbo Pascal users should use TEXT files instead. 
  239. The different word lengths, internal storage formats, and file 
  240. structures have to be considered when constructing the command 
  241. file on mainframes and microcomputers other than CP/M based 
  242. machines. The ability to structure a file as a byte stream is the 
  243. basic requirement. The CP/M Dump utility can be used to ensure 
  244. that the contents of the file are what you expected.
  245.  
  246. The 16 bit data values are stored with the low order byte first 
  247. (swapped format). This is the standard way of storing words for 
  248. the 8080 and Z80 processors. In the case of the one byte integer 
  249. required by the Color command, the first element of the string 
  250. created by MKI$ should be used, as MKI$ automatically places the 
  251. bytes in swapped format.
  252.  
  253. Note that because the data values are not ASCII strings, the CP/M 
  254. TYPE command will not properly display the file at the console. 
  255. In addition, the [O] option must be specified when using PIP to 
  256. transfer either the vector command file (.VEC) or the printer 
  257. (.PLT) file.
  258.  
  259.                              TABLE 1
  260.  
  261.                           PLOT COMMANDS
  262.  
  263.        Command    Length
  264. Name   Character  Data  (bytes)      Command Data Description
  265. ---------------------------------------------------------------
  266. Color     C       b       2    8 bit integer specifying one of a
  267.                                range of colors. 0 indicates white,
  268.                                127 indicates black.
  269.  
  270. Draw      D       X1,Y1,  9    Coordinate pairs for ends of line
  271.                   X2,Y2        segments. 
  272.  
  273. Erase     E               1    Sets the entire ploting area to
  274.                                the currently selected Color value.
  275.  
  276. Fill      F       X1,Y1, 11    Coordinate pairs for ends of line
  277.                X2,Y2,Yf        segment and horizontal level (Yf) 
  278.                                defines area to be filled in with
  279.                                currently selected color.
  280.  
  281. Incre-    I       X,Y     5    Coordinate pair for end of line 
  282.                                segment. Starting coordinate is l
  283.                                ast point plotted.
  284.  
  285. Move      M       X,Y     5    Coordinate pair for new "pen"
  286.                                position.
  287.  
  288. No-op     N               1    Ignored. Used as space filler in
  289.                                sequence of commands to exactly 
  290.                                fill a disk record.
  291.  
  292. Output    O               1    Causes current picture to be
  293.                                printed.
  294.  
  295. Point     P       X,Y     5    Coordinate pair for point to be 
  296.                                plotted.
  297.  
  298. Quit      Q               1    Commands normal termination of
  299.                                program.
  300.  
  301. String    S       X,Y,    6    Coordinate pair for start of
  302.                   string to    character string to be printed.
  303.                          86    String MUST end with a Carriage
  304.                                Return.
  305.  
  306. Text      T     string   2+    String of arbitrary length. String
  307.                                MUST end with a <NULL> (00H)
  308.                                character.
  309.  
  310. Upload    U       N,      3    N is a 16 bit unsigned integer
  311.                 values   to    giving the number of values to
  312.                         N+3    follow. Values specify the basis
  313.                                for creating new "colors".
  314.  
  315. eXtend    X       N,      3    N is a 16 bit unsigned integer
  316.                 values   to    giving the number of values to
  317.                         N+3    follow. Values are Nbytes of
  318.                                whatever data is necessary.
  319.  
  320. The following sections describe the way in which the commands 
  321. have been implemented in PLOT Version 3.3 (PLOT33). Other drivers 
  322. may not implement them in exactly the same way, but the general 
  323. sense should be preserved.
  324.  
  325. Colors are simulated in PLOT33 by using stipple patterns. These 
  326. patterns apply to all points, lines, and filled areas. These 
  327. patterns are based on 8 dot by 8 dot cells that tile the entire 
  328. picture area. Imagine cutting each figure out of a sheet entirely 
  329. covered with the desired pattern and then pasting it on the plot 
  330. in progress. This gives a general idea of the way in which the 
  331. patterns work. Three different methods of generating the patterns 
  332. are used. Each method trades off the memory required to store the 
  333. basic patterns with the ability to specify exactly what the 
  334. pattern will look like.
  335.  
  336. When a Color command is given, all subsequent plotting will be 
  337. done with that "color", or pattern, until it is changed with 
  338. another Color command. The Color command simply acts as a 
  339. selector to pick one of a number of colors or patterns that are 
  340. currently available. A color code of 0 corresponds to white.  
  341. Lines and filled areas plotted with this color will absolutely 
  342. erase any dots that were previously plotted. Color codes from 1 
  343. through 48 will produce cross hatched patterns that generate 
  344. checkered areas and other distictive patterns. Codes from 49 to 
  345. 63 correspond to 15 special patterns that can be programmed to 
  346. exactly match any desired pattern based on the 8 x 8 dot cells.  
  347. Codes from 64 through 127 are generated using an ordered dither 
  348. matrix, in which each succeeding code is the same as the previous 
  349. one, except for one more dot per cell being plotted. These are 
  350. currently set to generate a range of shades of gray. All of these 
  351. patterns can be changed under the control of the application 
  352. program by using the Upload command.
  353.  
  354. Each dot is added to the memory map by OR'ing it with the dots 
  355. previously plotted. Each subsequent figure does not totally 
  356. obscure the existing picture. For example, suppose that a gray 
  357. shade is being used that consists of every other dot being 
  358. plotted. The dots that are not plotted will not cause the 
  359. existing dots to be set to white if they were previously plotted. 
  360. Negative color values (-1 to -127) will use the same pattern as 
  361. their positive counterpart, but will be XOR'ed with the existing 
  362. picture. This means that the figure will be plotted black on 
  363. white or white on black, depending on what the existing 
  364. background is. Plotting the same figure twice with a negative 
  365. color value will have no net effect on the picture. Filling the 
  366. whole picture with -127 (negative black) will have an effect like 
  367. making a photographic negative.
  368.  
  369.