home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / diskplot / diskplot.lbr / DISKPLOT.MQG / DISKPLOT.MSG
Encoding:
Text File  |  1985-06-17  |  10.6 KB  |  242 lines

  1. Date: 18 Jan 1984 13:54:34 EST (Wednesday)
  2. From: Robert Bloom
  3. Subject: Plotting w/ a dot-matrix
  4. To: All
  5.  
  6. Ever get frustrated because you have this great multi-k$ CP/M machine 
  7. with a dot-matrix printer probably with graphics capability and you 
  8. can't do any kind of graphics other than the dumb typewriter character 
  9. pictures while the Apple, Atari, IBM, Commodore (etc.) people have 
  10. those nice screen drawing and screen dump to the printer programs that 
  11. just drive you green from jealousy?  Is that's what bothering you 
  12. bunky?
  13.  
  14. (Boy, would my English teacher have fun with that paragraph!)
  15.  
  16. Well, I can't help you intirely but based on a Dec BYTE article you can 
  17. at least make a token response if you have MBASIC.
  18.  
  19. The BYTE article described "Dragon Curves" - those curves that result 
  20. from folding and unfolding a strip of paper.  (You got to read the 
  21. article to see what I mean.)  These curves were then plotted ON DISK 
  22. which was then output to a dot-matrix printer put in graphics mode, 
  23. reproducing the plot on paper without any need to display it on the 
  24. screen.  The BYTE program was written in TRS-80 Disk Basic and for a 
  25. IDS Paper Tiger (6 dots per pass).
  26.  
  27. I've re-written it for MBASIC making the following changes:  allowing 
  28. any number of dots per pass (7 is what my printer does, I believe the 
  29. Epsons print 8) unlimited width and length, and auto file sizing is 
  30. possible.
  31.  
  32. So, if your interested in the capability of making pictures to be 
  33. output on a graphics dot-matrix printer WHILE USING A VANILA CP/M 
  34. SYSTEM read on.
  35.  
  36. I've made up two examples of programs that use the diskplot routines - 
  37. one does the dragon curves of the BYTE article and the other draws 
  38. "mandalas" - a plot of a polygon where a line is drawn from every 
  39. vertex to every other.  Both are standard MBASIC files.  Files are 
  40. gendragn.bas and mandala.bas.
  41.  
  42. The diskplot program has the following routines:  set up (must be 
  43. called first - initializes disk file for plot, asks for size of plot if 
  44. not given); plot a single point at X,Y; plot a line from X1,Y1 to 
  45. X2,Y2; close file; and print file.  More information is available in 
  46. the BYTE article.
  47.  
  48. If interested, try them yourself and report back to me.  Please forward 
  49. to others, tell you friends, etc.  After any obvious bugs are 
  50. found/corrected, I'll make a general annoucement to net.micro.cpm.  As 
  51. written there is some easily identifiable hardware-specfic code for 
  52. clear screen/cursor positioning.  The printer I used was a IDS 
  53. Microprism 480.  (7 dots per pass, 84 dots/inch)
  54.  
  55. What I really like to see is someone take these algorithyms (or 
  56. something like that) and convert to .ASM or .C or something 
  57. compileable.  (Maybe add routines for scaling of the plot, plot 
  58. circles, arcs?)  DiskPlotting in MBASIC is not fast, it took ~100 
  59. minutes to plot the 13 order Dragon curve (~8000 segments) and ~2.5 
  60. HOURS for a 25 point polygon mandala (314 lines).  It only takes 2 
  61. minutes of so to print the plot after is is generated.  The order 13 
  62. dragon (classical w/ segment size 2) diskplot file was 69k, the 25 
  63. point mandala 29k.
  64.    
  65. can upload these too if anyone asks (full 8-bit binary files).
  66.  
  67. Tell what you think of it!   -Bob Bloom
  68.  
  69. -----------------------------------------------------------------------------
  70.  
  71. Date:     Fri, 20 Jan 84 9:47:16 EST
  72. From:     Eli H. Freedman
  73. To:       Bob Bloom
  74. cc:       George Keller
  75. Subject:  Purty pictures, anybody?
  76.  
  77. You are so right!!  I am sooo envious of the plotting capabilities of 
  78. what are otherwise inferior micros that I turn multicolor, not just 
  79. green.
  80.     
  81. This program appears to run OK with MBASIC (interpreter).  Please 
  82. suggest some good input values for a 10-15 min run.
  83.     
  84. My own major requirement for a graphics program is not for one that 
  85. will produce a figure; rather, I need a program that will produce a 
  86. line plot from a given equation, and that will superimpose small 
  87. circles or squares on this plot.  I have seen ads for such programs in 
  88. MICROSYSTEMS mag.  Do you know anything about them?  I'd be glad to 
  89. order one if I was confident it would do the job.
  90.  
  91. ---------------------------------------------------------------------------
  92.  
  93. Date:     Sun, 29 Jan 84 21:57:03 EST
  94. From:     Bob Bloom
  95. To:       All
  96. Subject:  Eli's answer
  97.  
  98. Eli (and George):
  99.  
  100. Later on in this msg is an example .BAS file for your type problem - 
  101. adapt to suit.
  102.  
  103. Notes on the DiskPlot routines:
  104.  
  105.      1.  Diskplot assumes one dot per x or y value (Horz or Vert)
  106.  
  107.      2.  x runs from 0 to [the given max horz value] and is 
  108. plotted from left to right; y runs from 0 to [the given max vert 
  109. value] and is plotted TOP TO BOTTOM.
  110.  
  111.      3.  after plotting a line from (x1,y1) to (x2,y2), Diskplot 
  112. returns with the old value of (x2,y2) in (x1,y1).  Therefore, by 
  113. just redefining (x2,y2) and calling 1000 (GOSUB 1000) 
  114. repetitively will plot a continous segmented line.
  115.  
  116.      4.  Diskplot must know the size of the plot BEFORE the plot 
  117. is started.  One may pass the size to diskplot (in p9,p10) or 
  118. diskplot will ask for the size.  GenDragn calculates in the 
  119. autocentering routine the max size of the dragon before calling 
  120. diskplot.
  121.  
  122.      5.  Before any plotting is done, call 3000 (GOSUB 3000) to 
  123. intialize plot and file.  Then do plot.  Close file with GOSUB 
  124. 4000 and print with GOSUB 4000.
  125.  
  126.      6.  One can OVERLAY plots - open a "old" plot file and 
  127. diskplot will put the new lines overtop the old plot.  This is 
  128. good if one has a grid with axis as a template file and wish to 
  129. plot over it.
  130.  
  131.      7.  Scaling and offset must be applied BEFORE plotting so 
  132. all value are positive and within maximums.  The program will not 
  133. crash but will complain about out-of-range points.
  134.  
  135.      8.  take the "'" mark off statements number 1580, 2720, and 
  136. 2820 to watch as points are plotted.  It will run half as fast.
  137.  
  138.      9.  As diskplot is written now, the character to put the 
  139. printer into graphics mode is 03 (^C), graphics new-line is 
  140. 03,14; print a 03 is 03,03; and exit graphics is 03,02.  Check 
  141. these against you printer documentation.  Also my printer prints 
  142. 7 dots at a pass (diskplot variable p12).  Bit 7 (MSB) is 
  143. initialized as set so a graphics "space" is output as 80h.  This 
  144. was done because my parallel output BIOS driver was doing 
  145. something funny with some of the lower characters.  Again, check 
  146. what your printer expects.
  147.  
  148. for a fast running GenDragn:  use any order less than 8 and 
  149. segment size less than 10; use autocentering.  For a fast running 
  150. Mandala:  use a radius of 60 or less and 5 or less points.
  151.  
  152. (George:  would a discussion of diskplot be germane to cp/m 
  153. hackers? - I'd be willing to discuss it and give pointers on how 
  154. to use the routines)
  155.  
  156. Now:  a sample program to plot a F(x)=sin(x); x in rads.
  157.  
  158.  <<< see SINEWAVE.BAS >>>
  159.  
  160. Copy lines 1000 through 6000 from mandala (or gendragn - there're 
  161. the same) for the diskplot routines and add them on to the end of 
  162. this.  (NOTE:  I did not try to run this yet - but it "should" 
  163. work.  I'll try it later and msg you if i goofed anywhere.)
  164.  
  165. I'll also leave it as an "exercise for the reader" to write 
  166. subroutines to draw boxes, circles, etc. around designated 
  167. points; fancy axis; labeling; etc.  It's not hard, just teadious.
  168.  
  169. As Richard Conn likes to say, enjoy!               -bob bloom
  170.  
  171. -----------------------------------------------------------------------------
  172.  
  173. Date:     Sun, 29 Jan 84 20:56:45 EST
  174. From:     Ferd S. Brundick
  175. To:       Bob Bloom
  176. Subject:  Graphic Alphabet
  177.  
  178. Haaah,
  179.  
  180. Friday night I typed in the DotPlot program, then read the Byte article 
  181. and my printer manual.  I haven't actually run the program yet because 
  182. I have 256 byte sectors (like the TRaSh 80) and my printer prints all 8 
  183. bits.  There are some other peculiarities as well.  I wrote a little 
  184. BassIC program to try out graphics mode, and when it worked I got a 
  185. little crazy -- yesterday and today I built an alphabet!  I found a 
  186. "balloon" alphabet in a cross stitch book of mine: each letter (upper 
  187. case) is 20 dots high by 15 dots wide [I have lower case patterns but 
  188. haven't installed them yet].  At a resolution of 144 dots per inch the 
  189. letters come out a reasonable size (of course I'll bring samples to 
  190. work).  I simply (but tediously) built an array AL(26,2,14) [each index 
  191. starts at 0] where each cell contains an 8-bit value.  Here is a sample 
  192. letter:
  193.  
  194.        XXXXXXXXXXXX
  195.       XXXXXXXXXXXXXX       Of course this example is distorted because  
  196.      XXXXXX      XXX       the X's are not square. I had to write the   
  197.      XXXXX        XX       program in NEC-BASIC because EBASIC doesn't  
  198.      XXXXX                 have an LPRINT command OR POKE OR USR (and it
  199.      XXXXX                 can't print 8-bit anyway).  That means I     
  200.      XXXXX                 can't upload the file, but I did run off a   
  201.      XXXXX                 hard copy.  Once the program worked, I       
  202.      XXXXXX                modified it so that it would either print a  
  203.      XXXXXXXXX             string or display a single letter on the CRT 
  204.      XXXXXXXXX             (using PSET).  My future goal is to write a  
  205.      XXXXXX                CP/M program (hopefully in Turbo Pascal) that
  206.      XXXXX                 would be an interactive character editor     
  207.      XXXXX                 (similar to Fancy Font).  Storing alphabets  
  208.      XXXXX                 in files would be a LOT easier than stuffing 
  209.      XXXXX                 them into DATA statements.  Stay tuned....   
  210.      XXXXX        XX
  211.      XXXXXX      XXX
  212.      XXXXXXXXXXXXXXX
  213.      XXXXXXXXXXXXXX
  214.  
  215.                                     dsw, fferd
  216.  
  217. ----------------------------------------------------------------------------
  218.  
  219. Date:     Fri, 3 Feb 84 13:44:13 EST
  220. From:     Eli H. Freedman
  221. To:       Bob Bloom
  222. Subject:  Graphics on EPSON--how?
  223.  
  224. Do you know anyone who has used your graphics program with an EPSON 
  225. printer?  I cannot figure out what value PE$ should be.  If I 
  226. understand the Manual, I'm supposed to specify the no. of columns in 
  227. each line.  Can this be so?
  228.  
  229. ----------------------------------------------------------------------------
  230.  
  231. Date:     Sat, 4 Feb 84 22:08:32 EST
  232. From:     Bob Bloom
  233. To:       Eli H. Freedman
  234. Subject:  Re:  Graphics on EPSON--how?
  235.  
  236. PE$ is the character (or characters) than when sent to the printer put 
  237. it into the graphics mode.  There is also some code to be able to send 
  238. PE$ as a graphics CODE, vs. sending it as a control-code.
  239.  
  240. If you'll bring the EPSON manual over to my office, I'd be quite 
  241. willing to try to see what you need to do.
  242.