Summary
You built a colour plotter and connected it to a computer. Everything it can do is a few formulas, and you derived each one from what the machine has to do:
- a step per arrow —
LXS = CKL AND (LEFT OR RIGHT): the 60 Hz clock reaches the motor while you hold the arrow; - the pen — a toggle flip-flop:
D = NOT Q, every PEN UP/DOWN press flips it; - the turret motor — two flip-flops in a ring: AB → BC → CD → DA;
- a quarter turn — 6 steps on the CD4017, the carry counts the pens:
CP1 CP0; - turn until they match —
MOVE = (C0 ⊕ CP0) OR (C1 ⊕ CP1); - pen down only in place —
PDN = PEN AND NOT BUSY,BUSY = MOVE OR MOVED; - our address — «none of the 14 bits differs»:
SELP = NOT (G1 OR G2 OR G3 OR G4); - who drives — the CD4019:
D = A·REMOTE + B·NOT REMOTE.
And the program knows only three addresses: $C090 — steps and the pen, $C091 — limit switches and BUSY, $C092 — the colour.
What next
- Draw your own picture: add
DATAlines in the plotter language (P,C,M,L,E) and a menu item. - Change the spirograph: a different ratio of the radii (
4 * T / 3in lines 2636 and 2640) — a different pattern. - Speed up the turret: the
CKTclock at 60 Hz instead of 10 (does the table keep up? watch BUSY). - A fifth pen will not fit — but why are there only four colours? Count the bits in the
$C092register.