Detailed Description
Line 40 Sets up variables and arrays used.
LAT (300, 1) Coordinates of letters. LAB$ (300) Letters. COORD (50, 4) Type of symbol and its coordinates.
50-60 Sets colours used.
70-150 Description and instructions.
180-220 Set up text window, flush key buffer, disable cursor editing keys (so they can be used to move the blip).
230-350 Uses GET and IF-THEN statement to test keyboard and call appropriate procedures.
360 Erase blip (at coordinate P, Q).
370-400 Scan cursor keys to move blip (in steps of 30).
420 Replace blip at same or new position (280 and 410 draw lines on the screen as blip moves).
430 Return to 230 and scan keys again.
PROCRES - This procedure will be examined in detail
320 If R is pressed (ASCII-82), then K=P: L=Q PROCRES (H, J, K, L) P & Q are the coordinates of the blip (drawn by 420) H & J - the coordinates of the other end were set earlier either by line 290 (if B was pressed earlier), or at the end of the last drawing procedure (see later).
460 PROCRES(A, B, C, D) - Simply substitutes A=H, B=J, C=K, D=L.
470 Local variables.
490 COORD is a 50 x 5 array. It may be thought of as 50 rows corresponding to 50 symbols. Each row has 5 elements - the first identifies the symbol - 1 for a resistor, 2 for a capacitor and so on. The other 4 are the X, Y coordinates of the ends of that symbol. This line is therefore recording the coordinates in memory.
500 N = N + 1 so the next symbol will occupy the next row.
510 Necessary trap (in case a key is pressed for too long). This line would be better moved to 485 so as not to waste array space.
530 In the actual drawing of a horizontal register it will be assumed that C>A. If it were not, this would result in an odd symbol. This line swops C and A if necessary, and 'remembers' that it has done so by setting flag F=1.
540 As for 530 for vertical resistors.
550 Vertical resistors.
560 Horizontal resistors.
570-580 Trap for others.
600-680 Draws vertical symbols.
690-710 Draws horizontal symbols.
730 Sets the coordinates of the next symbol to the end of this one.
740 Moves the blip to the correct end if misplaced by line 530.
760-810 PROCLINE - as PROCRES but simpler (but lines).
820-1060 PROCCAP - as PROCRES (but capacitors).
1070-1240 PROCTRN - as PROCRES but (i) only draws vertical transistors and (ii) in order that the base should link neatly with the other components it must be centred on a possible line (the blip moves in steps of 30 - line 400).
1250-1460 PROCDIO - Draws DIODES (called by I not D).
1470 PROCLET - Lettering.
1490 Print text at graphics cursor.
1500-1570 REPEAT-UNTIL loop - Flushes keyboard buffer, waits until key is pressed, stores coordinates of the blip in the 300 × 2 array LAT and the actual key pressed in the 300 x 1 array LAB$ - Increments the X coordinate (P) by 30 and the array rows (LL) by 1. Line 1570 checks if the key pressed was the terminator.
1580-1600 Sends text cursor back to text window and flushes the keyboard buffer.
1610 PROCSAVE - Saves diagrams to tape.
1640-1660 Opens channel to tape.
1670 Sends the number of symbols.
1680-1770 FOR-NEXT loop - Sends type and coordinates of each symbol. (These are in fact divided by 10 because BPUT# requires numbers below 255 (FF in Hex).
1780-1880 REPEAT-UNTIL loop - Sends coordinates of each letter (again divided by 10) and its ASCII code, then closes the channel.
1900 PROCBACK - Fetches diagrams from tape.
1910-1950 Options title of required diagram - opens that channel.
1960-2040 FOR-NEXT loop - accepts first of symbols (compare line 1670) then the type and coordinate of each which are stored in the same 50 x 5 array COORD (after being multiplied by 10).
2050-2150 REPEAT-UNTIL loop - accepts coordinates of lettering and stores in LAT and LAB$.
2160-2240 REPEAT-UNTIL loop - prints symbols.
2250-2320 REPEAT-UNTIL loop - prints lettering.
2340-2370 PROCMENU - Displays instructions.
Educational Notes
This program is largely a demonstration program for the teacher. Children have experimented with it but find that is command structure is difficult to use. It needs a large colour monitor.
It can be used to generate and save a variety of simple line drawings and not just circuit diagrams. It loads the data quickly from tape and thus if you, as a teacher, can think far enough ahead to generate a data tape with all your different diagrams in sequence on the tape, as a classroom tool it will prove very useful.