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 / BEEHIVE / UTILITYS / PUDD.ARC / PUDD.DOC < prev    next >
Text File  |  1991-08-11  |  25KB  |  485 lines

  1. ******************************************************************************
  2.  
  3.                               P  U  D  D
  4.  
  5.                           PUblic Domain Draw
  6.  
  7. ******************************************************************************
  8.  
  9. a program written in Turbo Pascal for the TeleVideo TPCi and 803 computers
  10.  
  11. author:               Greg Jackson
  12. date:                 08/30/85
  13. major interest:       anyone with Televideo 803, 803H, or TPC-1
  14.  
  15. software required:    to run PUDD.COM          :none
  16.                       to create new PUDD.COM   :Turbo Pascal
  17.  
  18. contains:             A useful graphics drawing program
  19.                       and some introductory screen files (*.scr)
  20.  
  21. hardware:             Epson printers are supported
  22.  
  23. legal mumbo:          This program is public domain.  If you try
  24.                       to sell it you will burn in Hell in an
  25.                       infinite loop.  There is no Reset button for
  26.                       this situation.  Please keep the name of the
  27.                       files the same when you pass this program through
  28.                       the RBBS systems.  Please share this program with
  29.                       others who have the above mentioned computers
  30.  
  31. updates:              Future versions are best shared through the
  32.                         POWER BOARD @ (608) 251-3494
  33.                       If the Power Board is down or you don't have
  34.                       a modem, you may contact me directly....
  35.                          Greg Jackson
  36.                          1616 Capital Ave
  37.                          Madison, WI 53705
  38.                          (608) 233-0453
  39.                       The best time to call is early evening.  Please
  40.                       remember your time zone.
  41. modfications.....
  42.           10/85     added write functions and changed menus a bit  G.J
  43.           11/85     added the c(U)rve function                     G.J
  44.  
  45. NOTICE.......
  46.   This file is used by PUDD.COM for on-line help.  It should be on the default
  47.   drive if you want (H)elp to work.  It can be left off if you need room.
  48.  
  49.  
  50. Section 00           Documentation Sections
  51.  
  52.    The documentation is divided into numerous sections.  Each section has a
  53.    specific number associated with it.
  54.  
  55.    1  General Instructions                        15 Circles and curves
  56.    2  General Drawing
  57.    3  The Arrow
  58.    4  Entering text
  59.    5  Filling areas
  60.    6  Fill style and index
  61.    7  Erasing
  62.    8  Help files
  63.    9  Screen file                                 94 How to compile
  64.    10 Printing                                    95 (x,y) pairs & aspect ratio
  65.    11 Write                                       96 Purpose of program
  66.    12 Drafting                                    97 Turbo Pascal
  67.    13 System crash                                98 Invitation to source code
  68.    14 Drawing techniques                          99 Programming notes
  69.  
  70.  
  71. Section 01           General Instructions
  72.  
  73.  Pudd stands for PUblic Domain Draw.  It is a generally useful and simple
  74.  drawing program for CP/M Televideo computers with graphics capabilities.
  75.  
  76.    Some of the important things to note are....
  77.      Screens saved are 20k in size
  78.      Numeric lock must be ON to move the crosshair
  79.      The only printer supported is the Epson series
  80.      Source code is provided
  81.      The program is free
  82.  
  83.  The general idea is simple, from the main menu you can select printing, file
  84.  access, the graphic screen, or a menu which allows modification of all default
  85.  values.  In the graphic mode the full screen is provided. To return from the
  86.  graphic mode to the main menu just press the 'R' key.  All other functions
  87.  available from the graphic mode are noted on the main menu.  Some of these
  88.  functions may lead you to other sub-menus.  Most graphic functions are 
  89.  canceled by the same command that started them.  For example: to erase an
  90.  area press 'E' then move the crosshair around.  When you have the area
  91.  marked out press the 'E' again.  Some of the functions that work this way
  92.  are e(X)tensive, (B)ox, and (E)rase.
  93.  
  94. Section 02        General Drawing
  95.  
  96. There are two positions to keep in mind while running pudd.  One is obvious,
  97. if you have the crosshair turned on that is.  This is the crosshair position or
  98. current curser position.  The other is the current screen position.
  99.  
  100. Both of these positions are initially set at (0,0).  Both positions are indicated
  101. on the main menu.  The screen is seen as an x,y cartisean set in the first
  102. quadrant.  The horizontal ranges from 0-639 and the vertical goes from 0-239.
  103. All this means is that the lower left is position (0,0), the upper left is
  104. (0,239), the upper right is (639,239), and the lower right is (639,0).
  105.  
  106. The crosshair position is changed every time the crosshair is moved.  It is also
  107. changed when text is entered.  The current screen position is changed when
  108. drawing is done.  This is seen by using the Draw command.  Draw will draw
  109. a line from one position to the next and then set the screen position to
  110. where the crosshair is.  Draw is great for making any kind of polygons.
  111.  
  112. The line command is similar to the draw command except the screen position
  113. is not changed.  If you do a number of line commands while moving the
  114. crosshair between each one, you will create a number of lines radiating from
  115. a single point.  The arrow works in a similar fashion to the line.
  116.  
  117. The extensive draw command is a continous drawing function. You will leave a 
  118. line where ever you move the curser.  You may change the speed of the cross
  119. hair movement but you may not change the line style.  Extensive drawing is
  120. canceled by the (X) command.
  121. Another way to change the current screen position is to set a point.  This will
  122. set the screen position to where the crosshair is and light a single pixel at
  123. that point.
  124.  
  125. Section 03   The Arrow
  126.  
  127. The arrow is drawn from the current screen position to the current
  128. crosshair position.  In general the current screen position is the last
  129. (P)oint set or the end of the last line (D)rawn.
  130.  
  131. The arrow is like the line only an arrowhead is put on the end of the line.
  132. It is a bit slow because is does some trig functions while figuring the
  133. arrowhead.  It was done this way to make the code easy to modify.  If you
  134. want a longer, shorter, wider, or narrower it's a simple matter to modify
  135. the default values in the source code.  If you're really motivated you can
  136. make these defaults available in the program so they can be changed while
  137. running pudd.  See programming notes if you're interested.
  138.  
  139. Section 04       Entering Text on the Graphic screen
  140.  
  141. Entering text is pretty simple.  While in the graphic mode, enter a 't' for
  142. text. Then type anything you want. Both the back space and del key will work
  143. as destructive backspaces. Writing over with spaces can be a quick way to
  144. delete areas on the screen.
  145.  
  146. Section 05      Filling an area
  147.  
  148. An area is filled in the current fillstyle and index.  The area must be
  149. defined by either the edges of the screen itself or by a solid line or area.
  150. If you attempt to fill an area bounded by dotted lines you will have problems.
  151.  
  152. Section 06     FillStyle, index, and all that jazz........
  153.  
  154. If you are reading this only after having tried to understand this stuff by
  155. reading the menus, you are probably frustrated.  Don't worry, I'll get you
  156. through this.  The fillstyle and fill-index will affect both the fill and
  157. block functions.  Basically, anytime you deal with an area as a whole.
  158. There are 4 styles and 8 indices.  Always think of the style first:
  159.  
  160. --If you choose style `Hollow' then the index is meaningless. When you create
  161.  a block with the block function, you will have a nice little hollow
  162.  rectangle.  This also affects the fill function.  You will fill an area with
  163.  nothingness.  If you think this is nonsense, you're right, since an area
  164.  is defined as nothingness.  If effect, you are turning the fill function off
  165.  by selecting a fill style of `Hollow'
  166.  
  167. --When you choose a style of `Solid' the index is also meaningless.  The block
  168.  function will result in a solid block and the fill function will result in a
  169.  solid area.
  170.  
  171. --Select the `Pattern' function and the index becomes interesting.  Each index
  172.  will yield a different pattern when doing either a fill or a block.  The
  173.  patterns are pretty bland and really result in 8 different shades of gray.
  174.  The brightest of these yields the same result as selecting the `Solid' style.
  175.  
  176. --When you use the `Hatched' setting for style the index has a different
  177.  meaning.  Now there are 8 different types of hatched patterns.  Each index
  178.  will provide a different pattern.
  179.  
  180. Now that you've got this all down, the menu that you see when you (C)hange
  181. the settings should make some sense.
  182.  
  183. Section 07     Erasing things on the screen
  184.  
  185. You can erase  everything
  186.                a line or curve
  187.                a point
  188.                or a rectangular area
  189.  
  190. --To blow away everything you (W)ipe the screen.  You will be prompted to
  191.  confirm this radical solution
  192.  
  193. --To erase a line, curve, or point you actually set the color to black and the
  194.  mode to replace.  This means you are drawing with black.  If you have the
  195.  mode wrong you will still be drawing in black but it may be ignored.  The
  196.  functions work the same as they did before.  For example, if you want to
  197.  erase a line then set a (P)oint at one end and go to the other end, then
  198.  use either (D)raw or (L)ine.  Even the arrow can be blacked out by another
  199.  arrow.
  200.  
  201. --To erase a rectangular area use the (E)rase feature. The first 'E' entered
  202.  will begin the function. The move the crosshair around until you get the
  203.  stuff surrounded that you want out. After you have the box in the right
  204.  place just enter another 'E'. (E)rase is the easiest way to erase things.
  205.  It also works on horz lines, vertical lines, and points, since these are
  206.  really rectangular areas with one or both sides of dimension 1.
  207.  
  208. --To erase text you can enter spaces or backspaces over the top or else
  209.  use the (E)rase feature to cut out the area.
  210.  
  211. --To erase the crosshair you use the (C)hange status to turn it off.
  212.  
  213. Section 08       The Help File
  214.  
  215. The file that came with this program called PUDD.DOC is used by pudd for on-
  216. line help.  It is a standard text file.  As such you can add to it or subtract
  217. from it as you please.  If the file has been edited so that the section numbers
  218. are in the leading columns you will be able to read any section while running
  219. pudd.  If you delete sections the program will merely respond with an error
  220. message when you try to call them up.  If the file is missing entirely you
  221. also get an error message but no other problems will occur.
  222.  
  223. Section 09       The Screen Files
  224.  
  225. Every time you save the screen you create a 20k file.  This is true even
  226. if you are saving a blank screen.  The default file type is .SCR.  Since
  227. these files are pretty big you might want to squeeze them with something
  228. like NewSweep.Com.  If there is not enough room on the disk you may find
  229. that the program will crash during a save. sorry.......
  230.  
  231. Section 10       Printing the screen
  232.  
  233. There are 3 styles of printing.  The first is pretty quick.  It is small
  234. and in a horizontal format.  The second is vertical and has the correct
  235. aspect ratio.  As a larger picture, it takes a bit longer.  The major
  236. problem with the 2nd printout is that the horz lines have a different line
  237. width than the vertical lines.
  238.  
  239. The third is the largest printout.  It takes twice as long as #2.
  240. In addition to being the biggest, it also provides a balanced line width,
  241. correct aspect ratio, and darker lines.
  242.  
  243. As of this date the only printer that is supported is the Epson and various
  244. Epson clones.  If you want your printer supported but you don't know how to
  245. program in Pascal, there is a way out.  All you have to do is buy me a printer
  246. just like yours.  I intend to support all the printers I own. Right now all
  247. I have is an Epson.  I would particularly like to find someone who would buy
  248. me a laser printer.
  249.  
  250. Actually, I don't expect anyone to do this.  Since there are a number of
  251. different printers out there I have commented the printing procedures
  252. rather extensively.  It should be possible for even a beginning programmer
  253. to get his printer working.  Please send any other printer installations
  254. to the address listed at the head of the PUDD.DOC file.
  255.  
  256. Section 11     The write function
  257.  
  258. If you know what write is about you have no need to read this.  If you have
  259. not used the write function I suggest you try it out, often.  Real often.
  260. Write may turn out to be one of my favorite features.  One note though, it
  261. seems to work better when larger integers are chosen.  Don't be afraid to
  262. enter large numbers.
  263.  
  264. Section 12     Drafting (Pudd as a mini-CAD)
  265.  
  266. Drafting, as opposed to sketching or doodling, has quantitative vs qualitative
  267. implications.  While Pudd is nothing like the real Computer Aided Design tools,
  268. it can be used as a small scale drafting tool when used with printout #3.
  269.  
  270. Printout #3 provides hard copy where the screen is exactly 7.5" x 10".  With
  271. this size each pixel on the screen represents a printed area 1/64" wide and
  272. 1/32" high.  For example, if you set the curser speed to 2, then each movement
  273. of the curser represents 1/16" on the paper.  If you select the Box function
  274. then press the left arrow 16 times, the up key 16 times, then complete the box
  275. by pressing a second 'B', you will have created a box that will print out as
  276. 1" square when using printout #3.  Remember that the curser generally moves
  277. two units left or right for every one unit up and down (see help on aspect
  278. ratios).
  279.  
  280. Section 13     Screw Ups
  281.  
  282. There is a great deal of error trapping throughout the program.  Despite all
  283. of this you may find some way of dumping out the program when you don't want
  284. to.  This usually seems to happen when the screen is in the graphic mode.
  285. Since cp/m operates in the text mode you will end up at the `A>' prompt
  286. but not know it.  To force the machine into the alpha screen just press
  287. the 'alt' key while you are holding down the 'shift' key.  If you do a
  288. reset you will erase the screen.  If instead, you start up PUDD again you will
  289. probably find the drawing still there.
  290.  
  291. One note, don't use the shift/alt trick to try to find out where you are
  292. on the graphic screen by flipping to the alpha screen.  The Xpoz, Ypoz
  293. positions that are on the main menu are only updated when you do the proper
  294. mode change (ie: (R)eturn) from the graphic mode.
  295.  
  296. Section 14   Techniques for drawing
  297.  
  298. The combinations of modes, styles, and functions offer almost endless
  299. combinations which provide a great number of techniques.  I have included
  300. only a few here.  I would like to hear more from users of PUDD.
  301.  
  302.   To reverse image: Set fillstyle to pattern, fillindex to 7, and mode
  303.     to overwrite.  Now everytime you draw a box you will get the negative
  304.     of what you had before.  IE: white is black and black is white.
  305.  
  306.   Overlays: Using the file function of Overwrite screen you can create
  307.    templates to draw within.  This can serve a similar function to the
  308.    boilerplate approch to text editing on a word processor.
  309.  
  310. Section 15    Curves and other round things
  311.   
  312.   The (U) function will draw a circle or some portion thereof.  The 
  313.  position of the crosshair at the time you begin the function is taken
  314.  to be the center of the curve or arc.  The curser should then be moved
  315.  to the point where you want your arc to begin.  Any key pressed, other
  316.  than a curser movement key or curser speed selection, will serve to 
  317.  select the beginning of the arc.  This second point also sets the radius 
  318.  of the curve.  A third point is needed to find the end of the arc.  This
  319.  third point is used to find the angle but the radius remains the same as
  320.  the distance between the first and second points.  If you select the 
  321.  third point at the same position as the second point (ie: arc begins and
  322.  ends at same point) then you will be asked if you want a full circle or
  323.  nothing at all.  Respond to your pleasure.  Arcs will be drawn ccw or cw,
  324.  according to your wishes.  There is no default.
  325.  
  326.  
  327. Section 94     How to compile
  328.  
  329. You should have PUDD.COM with the other stuff so it really is not
  330. necessary to compile.  You will have to do it if you want to modify PUDD
  331. or if you just want to see Turbo sweat it out on a medium size program.  At
  332. last count there was ~2600 lines of source code.
  333.   to compile
  334.      1) have all *.pas files on the default drive
  335.      2) load Turbo
  336.      3) set (O)ptions to (C)om file
  337.      4) set (S)tart address to 2432
  338.      5) set (E)nd address to D942
  339.      6) set (M)ain to PUDD
  340.      7) compile
  341.  
  342. The only thing that is not obvious is the change in the start and end 
  343. address. These values are used for the TPCI (TelePort 1). 
  344. I have used a big array in the print2 and print3 routines (see pudd-04.pas)
  345. which is put between the pascal library and the beginning of the actual
  346. pudd code.  See your Turbo Pascal manual under "Execution of A Program File"
  347. and "Absolute variables".  It explains why you should move up the start
  348. address. 
  349.  
  350. I have found that sometimes the default end address will be moved down
  351. when you use a resident extension on your system (ie: EX.COM or others).  If
  352. you find that the end address is not at D942 then move it up there.  Turbo
  353. will look up to find what seems to be the end of memory.  If something is in
  354. the way it will see a system that's too small.
  355.  
  356. If none of this makes any sense to you, don't worry. Just do it as described
  357. and you should not have problems.
  358.  
  359. Section 95     The cartisean set and aspect ratios
  360.  
  361. If you remember anything from high school math you will recognize the screen
  362. coordinates are like the coordinates used in the first quadrant of the
  363. cartisean set.  The lower left corner is (0,0), the upper left is (0,239), the
  364. upper right is (639,239), and the lower left is (639,0).  You will also
  365. remember that lines between the points (0,0), (0,10), (10,10), (10,0) will
  366. form a square.  This is a fine theory but there is a problem on your computer
  367. screen.  Since there are so very many dots left to right and so few dots up and
  368. down, the points I mentioned will not look very square.  The aspect ratio of
  369. screen is about 3/4.  That means it's about 3/4 times tall as it is wide.  In
  370. order to make a square square (or a spade a spade), it would require 3/4 as
  371. many dots up and down as right to left.  Let's see......
  372.                        3/4 x 640 = 480
  373. Now the wizz kids out there will be quick to realize that the pixel (dot)
  374. height of the screen, 240 dots, is exactly 1/2 of what we want.  This makes
  375. a square out of (0,0), (0,10), (20,10), and (20,0).  Another way to see it is
  376. that 2 x "actual horz distance" = "actual vertical distance".  For this reason
  377. the curser moves two dots over for every one dot up or down.  This is true for
  378. all curser movements except when the curser movement speed is set to one.  If
  379. it were always true then you would never have access to half of the screen
  380. (every odd dot).  You can check this out by using one of the diagonal keys at
  381. different speeds.  At all speeds greater than 1 the line is pretty much a
  382. 45 degree line.  At a speed of one the slope is much less.  Keep this in mind
  383. so you don't muck up your drawings.
  384.  
  385. The stuff you put on the screen can be pretty useful but not in an exacting
  386. technical way.  Normally any technical work with a computer drawing program
  387. will be done from hard copy.  Since we don't have any fancy digitizers to
  388. play with the hard copy is what comes out of your printer.  With this in
  389. mind you should be aware that the aspect ratio on the small printout is
  390. not perfect.  We have stated that a block of 20 x 10 will be a square.
  391. Lets call it 400 x 200.  On the small printout the aspect ratio is about
  392. 17% off.  This means you should not take exact slopes or ratios or other
  393. relative measurements from the small printout.  The large printout has a very
  394. good aspect ratio.  You should find a 400 x 200 square to be square on your
  395. paper within a single printer point.
  396.  
  397. Section 96       Purpose of the program
  398.  
  399.  While this program is generally useful, it is not going to put the MacIntosh
  400.  out of business.  Nor is it going to keep me from buying an Amega as soon as
  401.  I have the $.  Drawing is only one of the purposes of this program.  I began
  402.  writing PUDD, not only to get a drawing program, but also to get some practice
  403.  in Pascal.  I hope that others get interested in the program for the same
  404.  reason.  Recreational programming can be a lot of fun but amortization tables
  405.  get a little boring after a while.  Since I find computer games about as
  406.  exciting as TV's Bloops and Blunders, I had to find another outlet for my
  407.  programming energies.  Pudd works well for absorbing personal energy. I would
  408.  like to invite you to get involved in PUDD as well.
  409.  
  410.  One of the nicest things about a structured language like pascal is that you
  411.  can add many procedures without having to deal with, or even understand, the
  412.  main body of the program.  While this is frowned on in many circles, it is
  413.  often the core of recreational programming. There is a lot of room left in
  414.  the 64k memory. If you want to add a special purpose feature to your version
  415.  of Pudd you need not read more than half a dozen short procedures in order to
  416.  gain enough of an understanding to write your own procedures.  I invite you
  417.  to give it a try.  Graphics programming can be fun.
  418.  
  419. Section 97     Turbo Pascal
  420.  
  421. Turbo Pascal is the greatest thing since a pocket on a shirt.  If you have an
  422. interest in recreational programming, or any programming for that matter, but
  423. all you know is Basic then you need Pascal.  I will not dignify Basic by trying to
  424. compare it to anything else. One might as well compare Pig Latin to
  425. Shakespeare. If you need to come to grips with real world computing then Pascal
  426. is a great first step.  Pascal is the best introduction to structured
  427. programming and provides an easy step to `C' (the language of Unix).
  428.  
  429. Turbo Pascal is an outstanding value.  I started programming on CP/M using
  430. MT+ Pascal.  MT+ cost more than $300 and is a pain in the butt to run.  If
  431. you are considering messing with Pascal, don't waste your time on MT+, JRT
  432. Pascal, or any of the others.  I have heard a number of rationalizations for
  433. stealing software.  Most of them are based on the high cost or low quality of
  434. the software in question.  None of these apply to Borland products.  Get Turbo
  435. but buy it, don't steal it.
  436.  
  437. Section 98     Source code
  438.  
  439. The source code for this program will always be available.  If you have
  440. PUDD.COM but none of the *.pas file from whence it was created, you can
  441. write or call to get the complete set of files.  See the beginning of the
  442. PUDD.DOC file (that's what you're reading right now) for info.
  443.  
  444. Section 99     Programming notes
  445.  
  446. The source code is an amateur product.  I did this as a means to learning
  447. pascal.  If you, as a more experienced programmer, find fault with the code;
  448. I would appreciate your comments.
  449.  
  450. A primary consideration in the code is readability.  In a number of places,
  451. this objective was considered more important than speed or elegance.  Taking
  452. a top-down approach, the primitive graphics procedures are usually called
  453. indirectly.  These are the things in files Tools#.pas.  They contain a lot
  454. of machine language inline code and are not easy to mess with unless you know
  455. a lot about the TeleVideo and machine language.  The most extensively commented
  456. procedure is the print routine.  This was done to help those who need to modify
  457. it to work on their printer.  If you get a modified version working on your
  458. printer, please send it to me.  If you cannot do so, drop me a line.  I will
  459. try to collect versions that run on as many printers as possible.
  460.  
  461. Other notes:
  462.  
  463. There are a number of places where trig is used.  If you have not worked with
  464. angles in software before remember that all the functions work with radians,
  465. not degrees.  If it's been a long time I'll prompt you....
  466.       there are 2 pi (about 6.28) radians in each 360 degrees
  467.       the slope of a line is (change in y)/(change in x)
  468.       the inverse tangent of slope yields the angle in radians
  469.  
  470. While inverse tangent is not a standard pascal function, it is part of
  471. Turbo Pascal. Thanks Borland!
  472.  
  473. The code is sort of a hacker special.  There are a number of global variables.
  474. I tried to point these out where they occur but I might have missed one.  Don't
  475. be too surprised if you also find an i,j,k or a temp declared which are never
  476. used.
  477.  
  478. There is a bit of order to the include files listed in the main file,
  479. PUDD.PAS.  The procedures generally reference those above them, as the order
  480. of the list would imply.  The files TOOLS# are the most primitive and contain
  481. direct references (through inline hex code) to the graphics procedures.
  482. As you look down the list you will see general procedures that you may even
  483. want to use elsewhere.  The files PUDD-##.PAS contain the procedures that
  484. the main program calls.
  485.