Diagram

By Gus Donnachaidh

Originally published in EUG #15

The main problem with a disk-based magazine is providing illustrations and diagrams to accompany articles. This is a shame because computers, especially the Elk, are quite good at drawing if you can get a program to do so.

I have written Diagram to do just that. I am not an experienced programmer and couldn't knock this up in the commercial break in the middle of "Blakes 7". It is in fact the biggest thing I've ever done.

I make no apologies for its limitations. It was designed to be simple. It will draw vertical, horizontal and diagonal lines. The angle of the diagonals can be varied.

It also has a facility for text input.

Control

The four arrows keys control the pointer.

Drawing Diagonals: Up Left - FUNC O
Up Right - FUNC P
Down Left - FUNC K
Down Right - FUNC L
Entering Text: FUNC T
Printing A Screen: FUNC /
Loading A Screen: FUNC <
Saving A Screen: FUNC >
Vary Angle: + : FUNC A
- : FUNC Z
Vary Speed: + : FUNC S
- : FUNC X

 

The keys needed to use the program are written at the bottom of the screen as are indicators of the angle, the pen position and if it is up or down.

The drawing can be saved and reloaded again to do further work.

The speed and angle indicators are initially both set at 5. For speed, this indicates the number of individual pixels drawn with each keypress. In the case of the size of the angle, this should be considered an arbitory figure mainly to compare with any changes you set. When you alter the speed with FUNC S/X, the figure for angle also increases at the same rate but the angle drawn will remain the same unless you vary the angle itself with FUNC A/Z. This is a problem with the maths in the program. To correct it though will slow the program down. You will soon get used to it.

It does not use different colours mainly because these can be difficult to print on paper, even with a colour printer.

When I started, I set a number of criteria:

  1. It should be simple to use. Some programs have manuals which can take hours to digest. Diagram should be understood by almost everyone in a few minutes.
  2. It must have a clear programming style to enable users to adapt or improve it easily. This meant using procedures wherever possible. Each procedure is clearly labelled, each function uses one procedure.
  3. It must be able to draw fine detail. I have used Mode 0 and the speed of the cursor movement (and therefore the length of each keypress) can be varied, as I said before.
  4. It must be possible to reLOAD a file for further work.
  5. It must be possible to load a file independent of Diagram. This can be done by switching to Mode 0 and *LOADing the file. Addresses are not necessary when doing this.

Problems for you to work on:

There is no facility to delete lines once they are drawn. This should be quite easy to setup.

If you try to load or save a file with a name preceeded by any spaces, the program will crash. I have turned on the cursor during LOADing, SAVEing and text to indicate if any spaces might be likely. If so, delete them before entering a filename. The spaces occur because the auto-repeat has been reset with *FX11,20.

The pen is always up after text input. This is necessary because a line is drawn otherwise before the end of the procedure.

The size of the angle is indicated by 5 = 45 degrees and so on.

If someone could devise a cursor which would be seen even when the pen was UP, the program would be easier to use.

Some enhancements needed

Printer dumps: I am working on a printer dump for my Star LC10 printer. It should work with any EPSON FX80 compatible but other printers may need different dumps. This is definitely over to you. If you have a dump for your printer, then send it in.

Icons: Sets of icons might be very useful. These might be programmed using VDU codes but in Mode 0 will be very small. Other larger icons might be more useful, e.g. furnitute symbols to allow diagrams of a room layout to be made, electronic symbols to suit those into electronics, some fancy letters, etc. These can be put into the numeric function keys or the spare letter keys which have all been reset with *FX226 and *FX227. See page 283 of the Elk User Guide.

The purpose of Diagram is for you to illustrate your submissions to EUG. Diagram is ready for use now. Use it. It will seem a little 'fiddly' and slow (certainly not like a pen and paper!) but do use it. Draw a diagram of the layout of your computer setup and any problems you may have. Draw something for the Practical Ideas section; if there needs to be a lot of text, write your text on your word processor and make reference to the diagram, then drawn the diagram. Send in both files. My wife has just suggested drawing a cartoon joke. Most of us could do with a laugh and, since few of you are ever likely to see my car, a cartoon would be the next best thing. Send it in.

I have drawn a cartoon called CARTOON. You can load it into Diagram or move to Mode 0 and *LOAD it. I first sketched the outline onto paper, then, as I drew each line, I noted the X and Y positions at the start and end of each line drawn. This helped me correctly join up lines as required.

Remember that a file can be re-LOADed and further work done on it so you don't need to spend ages trying to finish it. Start something now and save it again for later. Send it in.

Gus Donnachaidh, EUG #15