home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / JSAGE / ZSUS / WORDPACK / ZPLOT10A.LBR / ZPLOT.DZC / ZPLOT.DOC
Text File  |  2000-06-30  |  37KB  |  690 lines

  1.         ZPLOT Version 1.0 DOCUMENTATION
  2.  
  3.  
  4.     ZPLOT USER'S GUIDE
  5.  
  6.      General Information
  7.      Running ZPLOT
  8.      Application Programming
  9.      ZPLOT Commands
  10.      Pitfalls and Limitations
  11.      Error Messages
  12.  
  13.     INSTALLATION INSTRUCTIONS
  14.  
  15.      Sizing the Memory Map
  16.      Printer Settings
  17.  
  18.  GENERAL INFORMATION
  19.  
  20.  ZPLOT is a program that can produce high resolution graphics on dot matrix 
  21. printers.  It reads a disk file created by the application program which is 
  22. used to describe the pictures to be printed, and prints them on an Epson- 
  23. compatible dot-matrix printer.
  24.  
  25.  The application program "plots" by writing simple plot commands to a disk file, 
  26. which is later read and printed by ZPLOT level driver. This file is the key to 
  27. the whole system, because it makes the application program independent of the 
  28. plotting device and vice versa. It also makes it possible to plot pictures that 
  29. were created on different computers or to plot the same picture on different 
  30. types of hardware, such as CRT's and printers.
  31.  
  32.  ZPLOT will work with any printer supporting Epson bit-mapped graphics which 
  33. includes most of the dot-matrix printers on the market today.  ZPLOT lets you 
  34. treat your printer as if it were a plotter capable of true vector graphics. All 
  35. future versions of ZPLOT will support the same basic file format and will be 
  36. compatible with each other. ZPLOT was derived from PLOT33 by Tom Speer and uses 
  37. an identical file format.
  38.  
  39.  This documentation describes how to get ZPLOT installed, specifies the format 
  40. for the disk file of plotting vectors (".VEC" files), and gives an overview of 
  41. the user program interface.  You will probably want to briefly skim over the 
  42. descriptions below and go right to the Installation section.
  43.  
  44.  Capabilities 
  45.  
  46.  ZPLOT's command set includes instructions for device independent graphics and 
  47. commands that provide access to the unique capabilities of specific devices. 
  48. The device independent commands are patterned after a pen plotter's 
  49. characteristics, with a rudimentary capability for filling areas on raster scan 
  50. devices. These device independent commands include the capability to move to a 
  51. point without plotting, to plot points and straight line segments, to change 
  52. the current color, and fill in a trapezoidal area. More complex areas can be 
  53. decomposed into simpler regions for filling.
  54.  
  55.  The device dependent commands include the ability to plot/print a string using 
  56. hardware character capabilities. The Upload command can be used to upload the 
  57. red-green-blue values used for the color table on color graphics terminals (or 
  58. stipple patterns to be used for "colors" on monochrome devices as in ZPLOT). 
  59. The Erase command will clear the screen, establish the background color, or 
  60. advance the page, as appropriate for the type of plotter or display. An Output 
  61. command is used to produce hardcopy output or print the memory map. A general 
  62. instruction that can be used to extend the command set for any other non- 
  63. standard command required rounds out the device dependent commands.
  64.  
  65.  As mentioned above, all future updates to this version of ZPLOT will be 
  66. compatible with the existing plot files and high level software. Future drivers 
  67. are also planned for creating and interpreting the vector command file on 
  68. mainframe computers using Calcomp or Tektronix plotters and terminals. As much 
  69. as possible, the eXtend command should be used for adding neat new features for 
  70. your printer or taking advantage of the capabilities of more advanced devices. 
  71. This will make it possible to maintain the file format as a means of exchanging 
  72. information without a fatal proliferation of exclusive versions.
  73.  
  74.  Acknowledgments 
  75.  
  76.  ZPLOT is based on PLOT33, by Tom Speer, and is basically a Z80 version of that 
  77. program, with rudimentary Z3 support (allowing .VEC files to be accessed from a 
  78. different drive/user). The extreme compactness of Tom's .VEC file format was 
  79. the primary attraction, especially if the format is to be used in real-time 
  80. applications, such as driving a CRT display.
  81.  
  82. RUNNING ZPLOT
  83.  
  84.  To use ZPLOT, first create a sequential disk file of plot commands. These are 
  85. described fully in the next section. Then execute ZPLOT by typing:
  86.  
  87.          ZPLOT ifn [ofn]
  88.  
  89.  ifn is the input file name. A file type of .VEC is assumed if no file type is 
  90. given.  [ofn] is an optional output file name. If no output file is given, the 
  91. output from ZPLOT will go directly to the printer (LST: device). If an output 
  92. file is specified, all of the information normally sent to the printer will be 
  93. stored in the disk file instead. In this case, no printed output will be 
  94. produced. PRINT or some other utility may be used to print the picture. This 
  95. option is useful for making multiple copies or for including graphics in the 
  96. middle of text files. The default output file type is .PLT .
  97.  
  98. Note: Output files are large- typically 40 to 60k. Be sure to leave enough 
  99. space on the disk for the entire file.
  100.  
  101.  APPLICATION PROGRAMMING 
  102.  
  103.  Application programs "plot" by writing the appropriate plot command to a disk 
  104. file. This file later becomes ZPLOT's input file. The plotting area is a square, 
  105. with the coordinates (0.0 , 0.0) located at the bottom left corner, and the 
  106. coordinates (1.0 , 1.0) located at the upper right corner.  These coordinate 
  107. values are independent of the resolution or aspect ratio of the plotting 
  108. device. ZPLOT converts these values to the actual number of rasters (dots) used 
  109. by the printer to produce a square plot approximately eight inches on a side.
  110.  
  111.  All plot commands are written to disk one after the other, with no spaces or 
  112. delimiting characters between them. Each command consists of an ASCII character 
  113. followed by the binary data which it requires. Many languages, such as BASIC, 
  114. insert extraneous characters, such as carriage returns or line feeds, at the 
  115. end of each block written. Because of this, plotting commands should not be 
  116. split between blocks, as these extra characters will be interpreted as data in 
  117. a command. If the extraneous character occupies the position of a command 
  118. character, however, it can be detected and ignored. The current application 
  119. programs output plot commands in 128 byte blocks. If a command will not fit in 
  120. a given block, the block is written to disk, and the next command written in a 
  121. new block. This ensures that the extraneous characters will fall between 
  122. commands where ZPLOT can deal with them. When using fixed length blocks or 
  123. records, each can be padded with "N"'s to preserve its length before it is 
  124. written.
  125.  The recommended command sequence to produce a picture is: 
  126.  
  127.     1. Set the color to black or white (color values 127 or 0) for a 
  128.        background. Usually white is used.
  129.     2. Erase the picture to initialize the memory map area and establish 
  130.        the background.
  131.      3. Set the color value for plotting. Usually black (127) is used. 
  132.     4. Establish a starting point by using the Move command, plotting a 
  133.        single point, or plotting a line segment using the Draw command.
  134.     5. Proceed to create the remainder of the plot. The Increment command 
  135.        is recommended when one line segment is connected to the previous
  136.        one, as in a curve.
  137.      6. Be sure to include an Output command to print the final plot. 
  138.     7. Use the Quit command to stop plotting. ZPLOT will terminate
  139.        automatically at an end-of-file, but with an error message,
  140.        and without printing the picture. 
  141.  
  142.  
  143.  ZPLOT COMMANDS 
  144.  
  145.  Each command is of the form: 
  146.  
  147.  Adata 
  148.  
  149.  "A" represents the single ASCII character as explained below.  "data" 
  150. represents 0 to 86 bytes of data required for the particular command. Usually 
  151. this consists of fixed point numbers giving the coordinates of points or ends 
  152. of line segments. No spaces or delimitating characters are used between fields 
  153. within a command or between commands. The individual commands are described in 
  154. Table 1.
  155.  
  156.  The data values required for the plot commands are not ASCII character strings, 
  157. but are binary byte values.  The coordinate values are 16 bit fixed point 
  158. binary fractions. This makes the format particularly easy to use in application 
  159. programs written in assembler.  Different word lengths, internal storage 
  160. formats, and file structures have to be considered when constructing the 
  161. command file on mainframes and microcomputers not based on the Z80 family.  For 
  162. instance on 68000-based machines the reversed byte order should be taken into 
  163. account.  The ability to structure a file as a byte stream is the basic 
  164. requirement. The Dump utility can be used to ensure that the contents of the 
  165. file are what you expected.
  166.  
  167.  The 16 bit data values are stored with the low order byte first (swapped 
  168. format). This is the standard way of storing words for the Z80 processor.  Note 
  169. that because the data values are not ASCII strings, the TYPE command will not 
  170. properly display the file at the console.
  171.  
  172.  
  173.                  TABLE 1 
  174.  
  175.  PLOT COMMANDS 
  176.  
  177.  
  178.  Command         Length 
  179.  Name     Character Data (bytes)       Command Data Description 
  180.  ---------------------------------------------------------------------- 
  181.  Color         C        b       2     8 bit integer specifying one of a range of 
  182.                  colors. 0 indicates white, 127 indicates black.
  183.  
  184.  Draw         D      X1,Y1,   9     Coordinate pairs for ends of line segments. 
  185.           X2,Y2 
  186.  
  187.  Erase        E           1     Sets the entire ploting area to the 
  188.                  currently selected Color value. 
  189.  
  190.  Fill        F    X1,Y1,  11     Coordinate pairs for ends of line segment 
  191.          X2,Y2,Yf     and horizontal level (Yf) defines area to 
  192.                  be filled in with currently selected color. 
  193.  
  194.  Incre-        I       X,Y       5     Coordinate pair for end of line segment. 
  195.  ment                 Starting coordinate is last point plotted. 
  196.  
  197.  Move         M     X,Y     5     Coordinate pair for new "pen" position. 
  198.  
  199.  No-op        N          1     Ignored. Used as space filler in sequence 
  200.                  of commands to exactly fill a disk record. 
  201.  
  202.  Output        O           1     Causes current picture to be printed. 
  203.  
  204.  Point         P       X,Y       5     Coordinate pair for point to be plotted. 
  205.  
  206.  Quit         Q          1     Commands normal termination of program. 
  207.  
  208.  String     S       X,Y,       6     Coordinate pair for start of character 
  209.          string      to     string to be printed. String 
  210.               86     MUST end with a Carriage Return. 
  211.  
  212.  Text         T     string      2+     String of arbitrary length. String MUST 
  213.                  end with a <NULL> (00H) character. 
  214.  
  215.  Upload     U        N,       3     N is a 16 bit unsigned integer giving the 
  216.          values      to     number of values to follow. Values 
  217.              N+3     specify basis for creating new "colors". 
  218.  
  219.  eXtend     X        N,       3     N is a 16 bit unsigned integer giving the 
  220.          values   to     number of values to follow. Values are N 
  221.              N+3     bytes of whatever data is necessary. 
  222.  
  223.  
  224.  The following sections describe the way in which the commands have been 
  225. implemented in ZPLOT Version 1.0.  Other drivers may not implement them in 
  226. exactly the same way, but the general sense should be preserved.
  227.  
  228.  Colors are simulated in ZPLOT by using stipple patterns.  These patterns apply 
  229. to all points, lines, and filled areas.  These patterns are based on 8 dot by 8 
  230. dot cells that tile the entire picture area. Imagine cutting each figure out of 
  231. a sheet entirely covered with the desired pattern and then pasting it on the 
  232. plot in progress. This gives a general idea of the way in which the patterns 
  233. work. Three different methods of generating the patterns are used. Each method 
  234. trades off the memory required to store the basic patterns with the ability to 
  235. specify exactly what the pattern will look like.
  236.  
  237.  When a Color command is given, all subsequent plotting will be done with that 
  238. "color", or pattern, until it is changed with another Color command. The Color 
  239. command simply acts as a selector to pick one of a number of colors or patterns 
  240. that are currently available. A color code of 0 corresponds to white.  Lines 
  241. and filled areas plotted with this color will absolutely erase any dots that 
  242. were previously plotted. Color codes from 1 through 48 will produce cross 
  243. hatched patterns that generate checkered areas and other distictive patterns. 
  244. Codes from 49 to 63 correspond to 15 special patterns that can be programmed to 
  245. exactly match any desired pattern based on the 8 x 8 dot cells. Codes from 64 
  246. through 127 are generated using an ordered dither matrix, in which each 
  247. succeeding code is the same as the previous one, except for one more dot per 
  248. cell being plotted. These are currently set to generate a range of shades of 
  249. gray. All of these patterns can be changed under the control of the application 
  250. program by using the Upload command.
  251.  
  252.  Each dot is added to the memory map by OR'ing it with the dots previously 
  253. plotted. Each subsequent figure does not totally obscure the existing picture. 
  254. For example, suppose that a gray shade is being used that consists of every 
  255. other dot being plotted. The dots that are not plotted will not cause the 
  256. existing dots to be set to white if they were previously plotted. Negative 
  257. color values (-1 to -127) will use the same pattern as their positive 
  258. counterpart, but will be XOR'ed with the existing picture. This means that the 
  259. figure will be plotted black on white or white on black, depending on what the 
  260. existing background is. Plotting the same figure twice with a negative color 
  261. value will have no net effect on the picture. Filling the whole picture with - 
  262. 127 (negative black) will have an effect like making a photographic negative.
  263.  
  264.  The String command is used to mix printed characters and graphics. The 
  265. characters are printed using the printers normal character set. No facility is 
  266. provided in ZPLOT to send <ESC> codes or control characters to the printer to 
  267. change character sizes or font styles. The string is printed starting near the 
  268. coordinates given in the command. The exact position will vary, but the first 
  269. character will cover the coordinate location. The ambiguity comes from the fact 
  270. that most printers can only print characters at their normal location on the 
  271. page, and can't use graphics commands to position the characters at any 
  272. arbitrary place on the line. In addition, a printed character can't be part on 
  273. one line of print and part on another. Therefore, ZPLOT computes the closest 
  274. character location to the desired coordinates and begins the string there.
  275.  
  276.  The Text command will immediately send a text string to the printer when the 
  277. command is encountered. This is quite different from the String command, 
  278. because the text is not put in the memory map and is not part of the picture. 
  279. This command is useful for positioning the plot on the page, for printing 
  280. titles and headers, and for advancing to the next page after the plot is 
  281. printed. Any ASCII characters may be included in the string, including control 
  282. codes, escape sequences, carriage returns, and linefeeds. The only exception is 
  283. the null character, 00H, which is used to signal the end of the string.  The 
  284. string may be of any length. This makes it a convenient way of imbedding a 
  285. figure in the middle of a document, since all of the text above the figure can 
  286. be included in one Text command, as can all of the text after the plot. Any 
  287. text to be included in the plotting area itself must be entered one line at a 
  288. time with the String command.
  289.  
  290.  Upload Command 
  291.  
  292. The Upload command deserves some special attention, because it is the least 
  293. standard of all of the commands currently implemented. Most dot matrix printers 
  294. can, of course, only print in black. To give these printers a "color" 
  295. capability, different patterns have been programmed to produce shades of gray 
  296. and distinctive cross hatched patterns. The cross hatched patterns are intended 
  297. to be used for bar charts, dotted and dashed lines, etc. The shades are the 
  298. closest that ZPLOT can come to true colors. The special patterns are very 
  299. useful for matching patterns produced by other systems, and for anything that 
  300. just can't be done with the other two methods.  The Color command acts as a 
  301. selector to choose between the pre-defined patterns. The Upload command is only 
  302. needed if the default patterns are not capable of producing the desired effect. 
  303. It will redefine the patterns from which the Color command can select.
  304.  
  305.  The cross hatched patterns are based on seven bytes that provide the basic 
  306. patterns in both the vertical and horizontal directions for each cell. One byte 
  307. from the seven is selected as the X pattern and one byte from the seven is 
  308. selected as the Y pattern. The X pattern is extended vertically throughout the 
  309. cell, and the Y pattern is extended horizontally throughout the cell. The two 
  310. patterns are reversed (XOR'ed) where they cross. The effect is much like 
  311. weaving a plaid material. The selection of the bytes for the X and Y patterns 
  312. is made by the Color code. The lower three bytes of the Color value select the 
  313. X byte and the next three bytes select the Y byte. The best way to determine 
  314. the exact apperance of each pattern is to experiment by filling blocks with 
  315. different patterns.
  316.  
  317.  If the existing patterns are not acceptable, new ones can be Uploaded. Set the 
  318. number field, N, to 07H. The next seven bytes will be the bytes that form the 
  319. basis for the patterns.  Each bit corresponds to a dot in the pattern. A byte 
  320. of 07H for the X pattern would produce the pattern .....*** . If an F0H is used 
  321. for the Y pattern, the final cell will look like:
  322.  
  323.              *****... 
  324.              *****... 
  325.               *****... 
  326.               *****... 
  327.              .....*** 
  328.              .....*** 
  329.              .....*** 
  330.              .....*** 
  331.  
  332.  The second type of pattern, used for the 15 special patterns, is specified by 
  333. giving the 8 bytes that produce the pattern. Thus, the sequence 00H 00H 99H 00H 
  334. 00H 99H 00H 00H will produce the pattern:
  335.  
  336.              ..*..*.. 
  337.              ........ 
  338.              ........ 
  339.              ..*..*.. 
  340.              ..*..*.. 
  341.              ........ 
  342.              ........ 
  343.              ..*..*.. 
  344.  
  345.  These patterns are uploaded by specifying 120 for N followed by the 120 bytes 
  346. that define all 15 of the special patterns. No facility is provided for just 
  347. uploading one set of 8 bytes.
  348.  
  349.  The other method for producing patterns for "colors" is an eight by eight byte 
  350. dither matrix. In this method, each byte in the matrix corresponds to one dot 
  351. in the eight by eight dot cell. These cells tile the picture plane, as before. 
  352. Color code values from 64 to 127 are used to select the 64 patterns created by 
  353. the dither matrix. Each element of the matrix is assigned a value from 63 to 
  354. 126. If the Color value is greater than the value in the matrix corresponding 
  355. to a given dot, that dot is plotted. Thus, 127 is greater than all of the 
  356. elements, and all dots in the matrix will be plotted, producing black.  If each 
  357. element of the matrix is assigned a different value, then a unique pattern will 
  358. be associated with each Color value. For example, if the Color code is 64, only 
  359. the element with a value of 63 will produce a dot. If the Color value is 65, 
  360. those elements with 63 and 64 will produce dots. As the Color code is 
  361. increased, and figures are plotted, another dot in the "tile" has the potential 
  362. for being plotted.
  363.  
  364.  The existing arrangement of values in the dither matrix is designed to produce 
  365. shades of gray with a minimum appearance of organized patterns. This matrix 
  366. came from Foley and Van Dam's "Fundamentals of Interactive Computer Graphics". 
  367. A common use of the Upload command is to change the matrix to provide diagonal 
  368. patterns for shading areas. This would produce a pattern that looks like (for 
  369. four cells):
  370.  
  371.              //// 
  372.              //// 
  373.              //// 
  374.              //// 
  375.  
  376.  To design an Upload sequence for a given pattern, lay out a matrix representing 
  377. a single cell. Start with 63 and place the numbers in the matrix in the pattern 
  378. desired. For example, a cell from the diagonal pattern above could be created 
  379. from the matrix:
  380.  
  381.           63 111  85 103  75 115  93  95 
  382.          112  64 104  86 116  76  96  94 
  383.           79 105  65 117  87  97  77 121 
  384.          106  80 118  66  98  88 122  78 
  385.           71 119  81  99  67 123  89 107 
  386.          120  72 100  82 124  68 108  90 
  387.           91 101  73 125  83 109  69 113 
  388.          102  92 126  74 110  84 114  70 
  389.  
  390.  To see the pattern, look at the matrix part way through its construction:
  391.  
  392.              63 75 
  393.              64 76 
  394.              65 77 
  395.              66 78 
  396.              71 67 
  397.              72 68 
  398.              73 69 
  399.              74 70 
  400.  
  401.  For this matrix, the Color code 79 will result in all of the above points being 
  402. plotted in any filled in area, and the diagonal pattern will emerge.
  403.  
  404.  Once the matrix is constructed, the Upload command to load it is formed by an 
  405. ASCII "U" followed by 40H, 00H to indicate 64 bytes to come, and finally 03H, 
  406. 6FH, etc., the bytes of the matrix. The matrix is read in one row after another 
  407. ( the [1,1] element followed by the [1,2] element, ..., to the [1,8] element, 
  408. then the [2,1] element, ...). All of the matrix values are binary 8 bit values.
  409.  
  410.  To summarize the Upload command: The Color codes from 1 to 48 are produced by 
  411. cross-hatched patterns based on eight pattern bytes. These can by Uploaded by a 
  412. "U" 08H 00H followed by eight new pattern bytes. The Color codes from 49 
  413. throuth 63 are Uploaded by a "U" 78H 00H and the 120 bytes that define the 15 
  414. cell patterns. The Color codes from 64 through 127 are produced by a dither 
  415. matrix. This is created by assigning elements of an eight by eight matrix the 
  416. values 63 through 126. The matrix is Uploaded by a "U" 40H 00H followed by the 
  417. 64 elements in row major order.
  418.  
  419.  
  420.  PITFALLS AND LIMITATIONS 
  421.  
  422.  This section amplifies the more subtle points and limitations of ZPLOT's 
  423. commands.
  424.  The valid range for coordinate values is 0 to 1. This corresponds to binary 
  425. integer values from 0 to 32767. As each point is plotted, a check is made to 
  426. insure that the coordinate is within the memory map. If it is not, the point is 
  427. not plotted. This is mainly to keep the program from running amok and writing 
  428. over parts of memory that are not part of the memory map of the picture. This 
  429. is not intended to be a form of windowing. If you want to zoom in on a part of 
  430. a larger picture, the picture should be clipped by the application program. 
  431. Note also, that most high level languages will not deal with positive integers 
  432. that are larger than 32767, as these larger numbers represent negative 
  433. integers.
  434.  
  435.  In contrast to the coordinate values used for all of the graphic commands, any 
  436. coordinate value outside the picture used to indicate the start of printing a 
  437. string will be set to zero. This is intended to make the String command act as 
  438. much as possible like a normal printer. When the string goes off of the right 
  439. hand side of the plot, the X coordinate for the next character will be set to 
  440. zero and the string will wrap around - just like a carriage return without a 
  441. linefeed. All characters that attempt to be printed above or below the plot 
  442. will be printed on the bottom line.
  443.  
  444.  String has a few other points of interest. Only printable characters should be 
  445. used. Control characters and escape codes will occupy their respective 
  446. positions in the memory map but will not be printed. This will cause the rest 
  447. of the line to be shifted to the left and destroy its alignment with the rest 
  448. of the page. Also, the character pitch must agree with the character width set 
  449. at assembly time, or the alignment will be affected.
  450.  
  451.  The coordinates for the start of the string are truncated to the nearest 
  452. multiple of the size of the character. Thus the specified point will be within 
  453. the first character, but the character will not be centered or aligned with the 
  454. given coordinate position. This was done because most printers insist that the 
  455. printed characters occupy these locations, and ZPLOT has to respect this or the 
  456. aligment of the rest of the line will again be affected.
  457.  
  458.  ZPLOT prints the strings, it does not plot them as line segments. Because of 
  459. this, a printed character will absolutely occupy its location on the plot, and 
  460. any overlapping lines or points will not appear. If a character is printed on a 
  461. patterned background, it will appear as if it were in a white box the size of 
  462. the character. If true graphic characters are desired, they must be drawn by 
  463. the application program as line segments. An additional implication of the 
  464. printed characters is is their size relative to the graphic bit images that are 
  465. sent to the printer. The graphics are printed in "strokes" that are one dot 
  466. wide and seven dots high. Many printed characters are higher than seven dots 
  467. especially those that have descenders. A printed character occupies a space 
  468. that is seven dots high in the memory map. Thus, the top line of capital 
  469. letters and the lower case descenders can overlap the graphics area above and 
  470. below the nominal area of a printed character. The distance that the paper is 
  471. advanced between lines is dictated by the height of a graphic "stroke", and is 
  472. nearly always smaller than the normal single spaced distance.  Printed lines 
  473. must therefore be "double spaced" by specifying starting coordinates that are 
  474. well separated vertically. This is a device dependent aspect, and a litle 
  475. experimentation may be needed to achieve a good appearance.
  476.  
  477.  The last caution about the String command is that it MUST end with a carriage 
  478. return character. This signals the end of the string, and without it, the 
  479. program will continue to read the rest of the input file as part of the string 
  480. until it either encounters a carriage return or the end of the file.  The 
  481. String and Text commands are the only commands with this potential, as all of 
  482. the others have a definite number of bytes of data. All these caveats regarding 
  483. the String command may sound a little gruesome, but it is really not much 
  484. different from normal printing. If its limitations are too inhibiting, you must 
  485. draw the characters instead of printing them.
  486.  
  487.  The Text command is output to the printer at a different time than any of the 
  488. other commands. Its contents are sent immediately when it is read, whereas all 
  489. other commands cause their actions to be stored in the memory map and only 
  490. printed when an Output command is received. Thus, it cannot be used to send 
  491. escape sequences to the printer in the middle of the plot. Whether graphics 
  492. commands (such as Draw, Fill, etc.) preceed or follow a Text command is 
  493. immaterial, since these commands affect the memory map at the time that they 
  494. are read and not the printer. What really matters is the position of a Text 
  495. command relative to the Output commands in the file.
  496.  
  497.  Like the carriage return at the end of the String command, omitting the 0 
  498. byte at the end of the Text command can have disastrous consequences.
  499.  
  500.  The line spacing used in the Text command is different from the line spacing 
  501. in the plot itself. The Output command sets the line spacing to be appropriate 
  502. for graphics, and then resets it to the normal text single spacing when done. 
  503. If a uniform appearance is required throughout, each Text command should 
  504. contain the control characters or escape sequences required to set the line 
  505. spacing to match that used in the plot itself.
  506.  
  507.  The final consequence of the line spacing is that the form length and the top 
  508. of form position set in the printer will be wrong. The Output command will 
  509. result in the printer being positioned at the bottom of the plot. This is to 
  510. allow several plots to be printed sequentially as one continuous picture 
  511. without any gaps between them. In order to advance to the top of the next page, 
  512. the Text command must be used to issue the correct number of line feeds and 
  513. then tell the printer to reset the top of form.
  514.  
  515.  The Output command does not erase the existing picture.  Thus several copies 
  516. of the same plot can be produced by repeating the command. In addition, this 
  517. allows building up a picture in stages and printing it at each stage. To print 
  518. one plot and start anew, you must Output the first, set the Color to white, 
  519. Erase the page, and then set the Color back to the plotting color or pattern. 
  520. The program does not automatically execute an Output command at the end-of-file 
  521. or when Quitting.  You must include an Output command to get any output at all. 
  522. This philosophy is to accomodate those devices, like graphic terminals, that 
  523. display the plot as it is being made, and only need an Output command for 
  524. hardcopy.
  525.  
  526.  
  527.     ERROR MESSAGES 
  528.  
  529. Disk is Full. 
  530.  
  531.  Fatal error. No more room exists on the designated disk for writing the output 
  532. file. Ensure that enough room is available and run ZPLOT again. Note that a 
  533. different drive/user/directory may be specified for the output file than the 
  534. one used for the input file (when running under ZCPR3). If disk space is not 
  535. available, run ZPLOT in the direct printing mode.
  536.  
  537.  Any remnant of the output file may be printed, but the last record will 
  538. probably contain an incomplete graphic output sequence. The printer will expect 
  539. to receive additional bytes of graphics. This will produce a swath of dots with 
  540. a random apperance, unless nulls are sent. In addition, the printer line 
  541. spacing will remain set for the size of the graphic output.
  542.  
  543. End of File.  
  544.  
  545.  Fatal error. The end of the input file was encountered when ZPLOT attempted to 
  546. read the next record. Add a Quit command for the normal termination of the 
  547. program.
  548.  
  549. File not Found.
  550.  
  551.  Fatal error. The file name given for the input file could not be found on the 
  552. disk. Make sure that the spelling was correct, that the proper drive is 
  553. specified in the file name, or the right drive is logged in as the default 
  554. drive.
  555.  
  556. No Directory Space Available.
  557.  
  558. xFatal error. When ZPLOT tried to make a new output file, there was no more 
  559. room in the disk directory.  Erase a file, use a different diskette, or run 
  560. ZPLOT in the direct printing mode, without making an output file.
  561.  
  562. No File Specified.
  563.  
  564. Fatal error. No input file name was given. ZPLOT will not prompt you for a 
  565. file name, and there is no interactive mode for entering commands. Create an 
  566. input file and try again.
  567.  
  568. Undefined Command Character Encountered.
  569.  
  570.  Warning error. When ZPLOT attempted to interpret the ASCII letter portion of a 
  571. command, a character was found which did not correspond to one of the 
  572. established commands. ZPLOT ignores these characters and attempts to interpret 
  573. the next character as a command. If a command does not have the proper number 
  574. of data bytes, or if an extraneous character is inserted in the middle of the 
  575. data portion of a command, the rest of the file will be out of sequence.  
  576. Eventually, ZPLOT should get back in step with the command stream, but the 
  577. overall effects are unpredictable.
  578.  
  579.  
  580.         INSTALLATION INSTRUCTIONS 
  581.  
  582.  
  583. SIZING THE MEMORY MAP 
  584.  
  585.  ZPLOT has been designed to keep the printer driver program small while 
  586. providing the necessary primitive graphic operations for producing most 
  587. pictures and plots. The reason for the simplicity of the of the command set is 
  588. because the bit map for the picture is LARGE. It can use as much memory as your 
  589. computer can give it. The size of the memory available for the bit-map, in 
  590. conjunction with the resoultion of your printer, sets the size of the plot that 
  591. can be made. The first step in installing the program is to decide how large 
  592. the memory area for the bit map can be. The program itself occupies about 4K. 
  593. Subtract this from the size of the TPA, and reduce the result by a little more 
  594. to provide a conservative pad. The end result is the target size for the size 
  595. of the memory map.
  596.  
  597.  Divide the target size by the printer resolution (dots per inch) in the 
  598. horizontal direction, and divide again by the printer's vertical resolution. 
  599. Multiply this result by 7 (7 dots are stored in each byte). You now have the 
  600. number of square inches that can be plotted. Take the square root, and round 
  601. down to a convenient size for each side of the plot.
  602.  
  603. Now multiply the height of the plot by the printer's vertical resolution and 
  604. round down to the nearest multiple of 7. The number of dots in the vertical 
  605. direction should be a multiple of 7 because seven dots are stored in each byte 
  606. of the memory map. ZPLOT has no provisions for handling a byte which is 
  607. contains bits that are part in and part out of the map. You now have the total 
  608. number of dots in the vertical direction, and dividing by 7 gives the number of 
  609. lines that will be printed when the plot is made. Finally, divide the number of 
  610. dots in the vertical direction by the vertical resolution to get the final 
  611. size, in inches, of the plot.
  612.  
  613.  Multiply the final size of the plot by the horizontal resolution to get the 
  614. final number of dots accross the page.  The final map size is the product of 
  615. the number of dots horizontally multiplied by the number of dots vertically, 
  616. divided by 7.
  617.  
  618.  As an example, consider a 56K system. Subtracting 4K for the PLOT program and 
  619. 100H for the start of the TPA:
  620.  
  621.     Target Size = 57344 - 4096 - 256 = 52992 bytes 
  622.  
  623.  The Epson MX-80 has 60 dots per inch horizontal and 72 dots per inch vertical 
  624. resolution.
  625.  
  626.     Target Size/HRes/VRes*7=52992/60/72*7=85.9 sq.in 
  627.     ==> 9.2 in. per side 
  628.  
  629.  Since the MX-80 can only plot 8 inches horizontally, the plot is limited by 
  630. the physical limits of the printer, not by the memory avalilable. Calculating 
  631. the vertical number of dots for an 8 inch plot:
  632.  
  633.     8*72=576 dots ==> 82 lines @ 7 dots/line 
  634.               ==> 574 dots vertically 
  635.  
  636.  Since only 2 dots were lost due to truncating to the nearest number of whole 
  637. bytes, there is little point in trying to adjust the horizontal size to keep 
  638. the plot square. The horizontal size is therefore:
  639.  
  640.     8*60=480 dots 
  641.  
  642. The final map size is calculated as: 
  643.  
  644.     480*574/7=39360 
  645.  
  646.  This is the default size to which the program is set, and if satisfactory, can 
  647. be used as is. Virtually all Epson-compatible printers will accept this setting.
  648.  
  649.     PRINTER SETTINGS 
  650.  
  651.  Once the plot has been sized, you are ready to modify the settings in the 
  652. assembly language source file (ZPLOT.Z80), if you require a setting other than 
  653. the default. The relevant equates are near the beginning of the program.  
  654. MAPSIZE should be set to the value calculated above. MAXX and MAXY must be set 
  655. to 1 less than the number of dots in the horizontal and vertical directions. 
  656. For the example above, MAPSIZE becomes 39360, MAXX is set to 479, and MAXY to 
  657. 573.  Once the settings are made for your printer, assemble the program using 
  658. ZAS or another Z80 assembler.
  659.  
  660.     DIFFERENCES BETWEEN ZPLOT AND PLOT33
  661.  
  662.  Functionally there are none. Every valid PLOT33 command is a valid ZPLOT 
  663. command and operates identically. However when ZPLOT is operated under ZCPR3, 
  664. it will recognize DU: or DIR: specifications in input or output files. The code 
  665. has been extensively changed to make full use of the Z80 instruction set. All 
  666. the registers are used (if your BIOS trashes IY, then ZPLOT won't work!). 
  667. Despite the extra features, the code is about 1/2K smaller. Since virtually all 
  668. dot-matrix printers today accept the Epson graphics commands, all the 
  669. conditionals in the source code for non-Epson printers has been removed, making 
  670. the source just editable by ZDE (if you have 60k tpa)
  671.  
  672.     FUTURE ENHANCEMENTS
  673.  
  674.  Zplot was intended to be a first step to a permanently resident plotting 
  675. utility, living in banked memory that could be called by a BDOS call by any 
  676. applications program. At the moment, there is no agreed method of handling 
  677. memory over 64k in a portable manner, though writing the code so to do is not 
  678. difficult. I had originally started writing a utility based on HP-GL plotter 
  679. commands, then I discovered PLOT33, by Tom Speer, and decided the command set 
  680. was much more elegant than the HP commands. So the first step was to translate 
  681. PLOT33 into Z80, optimize it for that CPU, and add ZCPR3 support. The result is 
  682. ZPLOT.
  683.  One big improvement possible would be to use the Z280 multiply and divide 
  684. instructions. This program is very multiplication and division intensive and 
  685. would really benefit by having a Z280.
  686.  Next, the error messages should be loaded into the Z3 message buffers instead
  687. of simply being displayed. With an appropriate error handler enabled, ZPLOT 
  688. should be able to operate very robustly inside aliases.
  689.  
  690.