hardware/bom.md prices the whole machine: 34 logic chips and the peripherals come to
about 420 CNY, the plate, case, PCB and cartridge boards about 190, so a standard build
is roughly 650 CNY. A cheap build (flash instead of UV EPROM, NE-2 lamps, acrylic open
frame, single board) is about 400, and a deluxe one (10 mm neons, illuminated buttons,
silkscreened aluminium, eraser, spare cartridges) about 950.
Not in the table: the programmer (CH341A about 20, or a TL866 for 200), the UV eraser
(40, and only if the EPROM is a real 27C512), and the usual bench tools. Shipping and
the PCB lead time add a little.
The honest number is the hours: 8 to 12 for schematic and layout, 10 to 15 on a
breadboard, 15 to 20 to solder and debug, 5 to 8 for the plate -- call it 40 to 60 hours,
which is a month and a half of weekends. Money is not the constraint here.
Noted for later: the 6850 ACIA at 20 CNY a chip and getting scarce is the one part with
a real supply risk, and replacing it with a 16550 plus glue or an MCU bridge would cost
a lot of the period charm.
The dial was overlapping the CELL group rule: it is smaller and lower now, with the
buttons under it, and the rule runs clear above the top lamp.
The real question was cost of going all neon. The panel has 22 lamps -- eight on the
cell dial, eight instruction lamps, six on the dp row -- so it is about 65 CNY with
NE-2 and about 150 with 10 mm NH-4 lamps and illuminated buttons, against roughly 35
for 6 V filament bulbs. The money is not the issue; the high voltage is.
Notes recorded in panel.md: 65 to 90 V strike, 0.3 to 1 mA hold, so all 22 lit draw
two watts; ULN2803 is only rated for 50 V, so the drivers have to be MPSA42; and DC
electroplates the cathode until one side blackens, which is why old equipment lit
neons from AC -- either the rail or a reverse diode across each lamp. NE-2 glow dots
are 2 mm, which is small on a 200 mm panel, so the bigger domestic neons are the ones
that actually look impressive.
The matrix could not answer the one question a pointer display has to answer: where
am I now. A lamp cannot change colour and a matrix cannot light one cell on its own,
so the matrix was showing a field of bits with no indication of which one the machine
was standing on. Eleven square centimetres and 64 bulbs for that is a bad trade, so
it is gone.
What remains answers three questions and nothing else: the pointed cell byte on the
eight lamp dial, the current instruction on the eight instruction lamps, and the
pointer on six red neons fed straight from the dp counter. The buttons are now on
the plate too: STEP, START, HALT, RESET, with STEP resolved as staying -- single step
is the point of a trainer.
panel.md follows: the display table loses the matrix row, the button question is
closed, and section 3.1 explains why a matrix was the wrong device rather than the
pointer being hard to show.
The crosshair was a compromise: sixteen lamps to say where one pointer is. Six
red neons on the dp counter outputs say it exactly, need no decoder (open collector
buffers are enough for neon at two milliamps), and leave the matrix to do its own
job -- showing the LSB of every cell and nothing else.
It also fits the display rule better than it looks: six bits are the machine own
representation of its pointer, not a decimal readout, so results and step counts
still come only out of the serial port. panel.md records the decision with the two
alternatives that lost: the sixteen lamp crosshair and a red neon ring in every cell.
Mockup: the row sits under the matrix, bit 5 on the left, index digits beneath.
It is showing 33, which is bit 5 and bit 0 lit.
The question was what kind of lamp can turn from yellow to red, and the honest
answer is none, and it would not help anyway: in a lamp matrix a single cell cannot
be driven on its own. The matrix lights cells by row and column, so changing either
line lights eight cells, and giving every cell its own override would mean 64 extra
gates or 64 separate lines.
So the cursor is a separate indicator. Eight red neons down the left of the matrix
and eight across the top form a crosshair, and the lit pair crosses at the data
pointer. dp is six bits, which splits exactly into dp[5:3] for the row and dp[2:0]
for the column: sixteen lamps, zero decode logic.
The alternative is a red neon ring in every cell, driven as a second 8 by 8 matrix
that shares the sixteen drive lines and is selected in time, so the red dot lands on
the cell itself. That is 64 more neons and twice the panel density; the crosshair is
recommended for now. panel.md records both, with the reasoning.
hardware/panel.md is the orderable version of the mockup: mechanical sizes (200 x 100
mm plate in a 220 x 130 x 70 mm case), the grid, the section list, the connector
types (2 x 22 card edge slot, DE-9), the electrical budget (ULN2803 arrays, an 8 row
by 8 column lamp matrix, a 555 for the cursor blink), and the rule the panel has been
converging on -- every piece of information has exactly one representation, and all
numbers go out of the serial port.
One item left open on purpose: whether the button row keeps STEP. GPT render shows
START / HALT / RESET, but single step is the whole point of a trainer, so it should
either stay as a fourth button or START should distinguish tap from hold. That has
to be settled before the plate is drilled.
Light hammertone paint, orange hairline rules under small section legends, dark
lamps with amber lit ones, a red SEND button, and real hardware drawn on the plate:
a card edge slot with fingers and two screws for the 27C512 program cartridge, and a
DE-9 for the 6850 serial line. The cell dial keeps the LSB wedge at nine oclock and
labels the other seven lamps 1 to 7, which is better than labelling all eight:
the wedge already says which one is 0.
Also recorded in docs/hardware.md: the cartridge is a card edge one (a small PCB with
the EPROM, fingers into a 2x22 edge connector), with a bare ZIF-28 socket as the cheap
version. Neither needs a cable, because strict Harvard means there is no way to feed
a program in at run time -- swapping the chip is the delivery mechanism.
The wedge now sits at nine oclock, pointing right at the bit 0 lamp, and the bits
run clockwise from there, so bit 7 lands at half past ten. That puts the LSB mark
in the open space left of the dial instead of crowded under the CELL label.
The layout is no longer placed element by element. There is one module grid: three
columns of 56 mm at x 12, 72 and 132 with 4 mm gutters, two rows starting at y 25
and y 67, one rule at y 21.5, and the serial line spanning columns two and three in
the lower row. Every block is in a cell, so nothing can drift: a new element has to
occupy a cell or it does not go on the panel.
A row of six neon bars showing dp is a second, numeric way to say what the matrix
cursor already says in the place it belongs, so it goes. The comment left behind
says why, in the same terms as the missing step counter and the missing digits.
Panel now: the cell dial in column one, the instruction lamps and the input byte
and the serial line in column two, the 8 x 8 lamp matrix in column three, the
cartridge below the dial. One pointer representation, one byte representation,
one instruction representation, no numbers.
The ISA says nothing about how long memory is -- ">" and "<" are just moves, so
the model is an unbounded line of cells. Our implementations bound it: the build
option sets a ring of N cells (default 259, the machine 64) and the pointers wrap
modulo N. Measured peaks over every tape we ship are 155 cells (flagship), 51
(calculator), 49 (hello), 27 (term), so 64 never wraps in practice and the wrap
costs nothing in hardware: a six bit counter just rolls over.
The panel display follows the model rather than a circle: an 8 by 8 matrix of
lamps, one per cell, showing that cell LSB -- the only bit biz and rnz ever look
at -- with the pointer blinking like a cursor so dp is visible without a number.
The small dial in column one still shows the whole byte of the pointed cell, so
the two displays answer different questions: which cells are set, and what is in
the one the machine is standing on.
Hardware side this is the classic lamp matrix: eight row lines and eight column
lamp drivers, plus one gate that ORs the cursor into the pointed column and row.
Bulbs, not LEDs, but the drive is the same.
The eight bit lamps are no longer a block of two rows: they sit on a circle, the
same visual language as the 64 cell ring, so the panel reads as two dials of
different size. bit 7 is at twelve o'clock and bits run clockwise, which puts
bit 0 -- the LSB, the only bit biz and rnz ever look at -- at half past ten, and
that one gets an engraved wedge pointing at it plus a small 0. On the real panel
the wedge is a notch in the lamp bezel rather than a printed mark.
Lamps of 6.2 mm on a 22.8 mm circle leave three millimetres between neighbours, so
the dial stays legible at arms length. Buttons moved down a little to clear it.
The last panel was laid out element by element and looked it. It is now three
columns and three rows with a single rule under the title: cell bits in column one,
instruction lamps and dp bits in column two, the data ring in column three, then
controls and the input byte, then the cartridge and the serial line. Every block
shares a baseline and the gaps are uniform.
The mechanical dp dial is gone from the panel. It is an add on that either gets
built or does not; nothing in the machine depends on it, so the panel does not
reserve space. mechanics.md now says the same where it discusses the mechanical
address register.
The step count is the machine time, and nothing in the ISA can observe time -- so
the panel does not show it either. A running count is a debugging number, and
debugging numbers come out of the serial port; there is a comment where the
counter used to be saying exactly that.
The panel is now: the 64 cell ring with dp lit, the eight bit lamps of the pointed
cell, the eight instruction lamps, the dp bars, RUN / STEP / RESET, the eight input
switches, the ZIF cartridge and the serial line. The mechanical dp dial moved into
the space the counter left.
Dropping the decimal display is right on three counts and the mockup now reflects
it. The panel has the 64 cell ring with dp lit, the eight bit lamps of the pointed
cell with their bit numbers, the eight instruction lamps with the current one lit,
the dp bit bars, bakelite RUN / STEP / RESET, the eight input switches, the ZIF
cartridge and the serial line showing "> 12 34 + ." then "0046". A mechanical step
counter shows how far a single step run has gone.
Why it is better: numbers are the terminal job, and the "//->digits" machinery is
already in software where it belongs; the panel showing bits and position is the
truer picture of the machine; and it removes four Nixie tubes, four K155ID1 and the
170 V rail -- 150 to 300 CNY and a high voltage supply -- leaving only the 90 V neon
rail and 6 V for the bulbs.
panel_mockup_vintage.py now draws this state only panel, so the drawing and the
hardware stay in step.
Seven segment LEDs read as 1975, so the panel got a second mockup with period
display technology: four Nixie tubes for the digits (K155ID1 / 74141 BCD to
decimal drivers and a 170 V rail), a ring of 64 neon lamps with dp lit, grain of
wheat filament bulbs for the eight instruction lamps, neon bars for the ip and dp
rows, bakelite buttons with chrome bezels, hammertone paint and filled engraving,
and a second hand dial for the optional mechanical dp.
The honest costs: four IN-12 tubes are 100 to 240 CNY, four K155ID1 40 to 80, the
HV supply 20 to 40 more, 64 neon lamps around 60, plus a driver array for them --
a 6 bit to 1 of 64 decode is two 74LS154 and the lamps can be wired as an 8 by 8
matrix so only 16 high voltage transistors are needed, since a half selected
neon sees half the strike voltage and stays dark.
Rails become the 1960s set: 5 V for the TTL, 6 V for the bulbs, 90 V for the neon,
170 V for the tubes -- a transformer with several secondaries, or small modules
per rail. Both mockups are checked in with the scripts that draw them, so the
layout can be edited and regenerated.
hardware/panel-mockup.png (drawn by hardware/panel_mockup.py, no external assets
needed) is a 200 x 100 mm front panel sketch: four seven segment digits showing
the pointed cell, eight instruction lamps with the current one lit, a sixteen lamp
ip row and a six lamp dp row, RUN / STEP / RESET buttons, an eight switch input
byte with a SEND button, the 64 cell ring drawn as a dial with dp lit, the ZIF-28
socket for the 27C512 program cartridge, a UART line showing "> 12 34 + ." and
"0046", and the optional mechanical dp dial. Behind it all sits a 160 x 100 mm
Eurocard with about 34 DIP sockets, a 1 MHz can and a 5 V 2 A supply.
The script is checked in because the drawing is meant to be edited: python
hardware/panel_mockup.py out.png regenerates it.
hardware/ttl-schematic.md turns the verified RTL into a wiring plan: signal names,
the chip list with what each part does, clock/reset/single step, the one byte per
instruction fetch (ip counter straight into a 27C512, D2..D0 into a 74LS138), the
data path (6116 plus a 74LS299 for the rotate, a 74LS86 for the flip), dp from
either two 161s or the mechanical encoder behind a jumper, the loop stack, the
microcode ROM, the 6850 and the panel, plus a bring up order that installs one
block at a time.
Two decisions folded in while writing it:
* the loop stack lives in the unused part of the 6116 instead of a 74LS670 pair.
The stack has to hold 16 bit ip values and a 670 is four bits wide, so the
discrete version is four pairs and eight chips; the 6116 has 1984 free bytes
after the 64 cell ring, so one extra pointer and two accesses per push or pop
buys a 496 deep stack and keeps ip width and stack width independent.
* halt needs LEN: four 74LS688 comparing ip against a 16 bit DIP switch. That
brings the board to about 34 chips, which the note now says.
Mechanical dp plugs into the same board: a 74LS244 puts the encoder on the DP bus
behind a jumper, the step pulses come from DP_UP/DP_DN, and a BUSY contact gates
the clock so the sequencer waits for the mechanism to arrive -- slower, not
different, because nothing in the ISA can observe time.
Answering "is it acceptable for shorter tapes": with the mechanical register the
cost is one physical step per pointer move, in either direction -- no direction
penalty like the drum, but every move pays. Measured move counts at 8 bits
(tape_run --profile), and the times for a 3 ms direct drive stepper (200 steps per
rev, 3.1 steps per cell) and a 20 ms telephone uniselector:
full_add 95 instructions 11 moves 0.03 s / 0.2 s
hello 577 139 0.4 s / 2.8 s
term 16414 13077 39 s / 4.4 min
asm/test.r8asm 43676 71885 3.6 min / 24 min
signed_demo 37511 122178 6 min / 41 min
calc 51378 130589 6.5 min / 44 min
So short tapes are fine, comfortably: hello finishes inside a second even on the
slowest mechanism, and the practical line is about 20000 moves, which is roughly
20000 instructions, for "under a minute". term sits right at the edge at 39 s.
The three big tapes need the two speed design: mechanical position authoritative
in single step and demo mode, a clutch that disengages it in run mode so an
electronic counter drives the 6116. Same clutch idea as the step counter.
line is fast enough to be a daily machine
Size first, since that is the constraint. A VHS head drum is 62 mm across and
spins at 1500 rpm with its own direct drive motor and a very good bearing, so it
is usable -- but as a spindle, not as a medium: its own heads are for tape, and
the video tape transport is exactly the complexity we do not want. Strip the
heads, glue an annulus of floppy media onto the upper drum, and put two fixed
heads (cassette or stripe heads) at the rim: at 62 mm one cell is 3.0 mm of
circumference, so the heads can be crude and the read-modify-write pair sits 3 mm
apart with no machining. A dead 2.5 inch hard disk spindle is cheaper and spins
five times faster, with a floppy head (100 um track) parked open loop over a disc
of floppy media.
What that costs in practice is now measured rather than guessed. The 8 bit
calculator session is 166348 steps: 65311 forward pointer moves and 65278
backward ones. On a 25 rev/s drum a forward move waits one cell (625 us) but a
backward move waits 64-k cells, about 38 ms for the usual k, so a session is 41
minutes and the flagship tape 23 minutes. hello is 0.3 seconds. A
magnetostrictive delay line has a full revolution of 0.5 ms instead of 40 ms: the
same session is 32 s and the flagship 18 s, because its backward move waits at
most one revolution. So the drum is an exhibit machine, and the delay line is the
only mechanical memory that can be used interactively -- both because of the same
property, how long one lap takes.
Also recorded: what the drum needs besides the mechanism -- an index pulse, a 64x
clock resynchronised to it every revolution, a plain FM channel (one clock
transition per cell plus a data transition for a 1) read with a windowed latch,
and the second head for read-modify-write.
The question that exposes the gap in the previous note: if the ring lives in a
6116, what is a mechanical pointer pointing at? The honest answer is that dp is
an address, so there are three coherent designs and they are different machines.
A. a mechanical address register. The physical position of a 64 position device
(uniselector, or stepper plus ratchet) feeds A0..A5 of the SRAM through its
contact bank. The position is genuinely part of the machine state and the panel
pointer does not lie, but it only selects which byte is addressed -- it is not
the byte. Cheap (50-200 CNY) and two days of work, so it stays N1.
B. a drum. Eight tracks by 64 cells rotating under fixed read and write heads:
then the memory itself is mechanical, dp becomes the phase of the rotation, >
waits for the next cell pulse, < waits almost a full turn, and + or - does a
read-modify-write between two heads one cell apart. Expensive and months of
machining, but it is the 1950s machine.
C. a magnetostrictive delay line. 512 bits of sound circulating in a loop of
nickel wire with a transducer at each end: the ring is literally a loop, there
are no bearings and no heads to wear, > is free (wait for the next time slot), <
costs at most one revolution (0.5 ms at 1 Mbit/s). An order of magnitude cheaper
than the drum and still electrically genuine, but it needs winding, biasing and
scope time.
Recommendation stays: A first because it is cheap and it is honest about being an
address register, then C if the wish is for the memory itself to be mechanical,
with B kept for when there must be a spinning drum. The section now says all of
this, and the summary table no longer claims dp can simply "be mechanical".
Two things: the TTL build is now the main target (Tang Nano looks too modern), and
the packer learned the format that makes the TTL build simple.
Format: r8forge_tape_pack --eprom writes one byte per instruction with the opcode
in the low three bits. Then ip is the EPROM address and D2..D0 are the opcode --
no shift register, no 16 bit window, no decoder. It wastes five bits per
instruction, and a 27C512 is exactly 64K, which is the historical instruction
budget: the 8 bit calculator (51378) and the flagship (43676) both fit. Both
formats live in the same .r8t trailer now (format byte 1 = packed, 2 = one byte
per instruction), decode dispatches on it, and the test runs both and requires
the same output and step count.
Carrier: 74LS DIPs on a green board, 27C512 in a socket with its quartz window,
6116 SRAM, 74LS299 for the rotate, 6850 ACIA for serial, 74LS47 and four seven
segment displays on the panel, 1 MHz can oscillator. About 31 to 40 chips, 400
to 700 CNY, a few weeks. The FPGA stays as a bench-only stepping stone.
hardware/mechanics.md: where mechanics actually pays. The program must stay
electronic (130 metres of paper tape for the calculator), and 512 relays for the
data ring are out, but the pointer is worth it -- > and < are 71 to 73 percent of
all steps, so a 64 position ratchet or uniselector makes the machine physically
walk the ring. Also listed: an electromagnetic step counter (10 to 20 Hz, so
only in single step mode, with a clutch for free running), a paper tape punch or
plotter for output, a tape/card reader or plain keypad for input, and a hand crank
as the clock. The rule that keeps this safe: mechanics only ever sit on sensor
and actuator pins and never in the logic path, and the handshake just stops the
sequencer while something moves -- since nothing in the ISA can observe time,
slower is not different. A relay-only machine is priced honestly too: 60 to 120
relays, 10 to 50 Hz, hello in 10 to 40 seconds, the calculator in four hours, so
that one is an exhibit.
Also fixed: the synthesised macro fallback file name now carries a per-run token.
When the system temp directory is not writable every r8asm falls back to the same
working directory, so parallel ctest runs could write and import the same file --
which showed up as a random one-test failure in 0.39 seconds and nothing else.
The two things software cannot check by reading its own source are the 3 bit
packing and the bracket strategy, so both got a tool and a test.
New in the library (r8forge/tape.hh, src/tape.cc): the opcode numbering (taken
from ROT-8-viz enum, so the packed image and the hardware decoder cannot drift),
text <-> opcodes, opcodes <-> 3 bit bytes, the .r8t image with its trailer and
crc32, and a machine model that runs a packed tape the way a board would. The
model takes the bracket strategy as an option: backward scan with loop stack or
not, and jump-back-onto-the-[ (the contract) or past it (what the interpreters
do). All four combinations print the same thing, and the step count differs by
exactly the number of taken ] instructions -- which is what the test asserts.
Found and fixed while writing it: the loop stack discipline depends on the jump
convention. Jumping onto the [ means the [ re-pushes, so ] must pop on the jump;
jumping past it means the entry must stay until the loop exits. Mixing them up
emptied the stack on the second iteration of the calculator main loop -- caught
by the equivalence test on examples/calc.r8asm, not by reading the code.
Tools: r8forge_tape_pack (text tape -> image + --hex for $readmemh + --verify,
727 instructions become 273 bytes for hello, 62%, and the trailer sits past the
halt so address 0 of a ROM is instruction 0), and r8forge_tape_run now reads an
image directly and takes --loop-stack / --retest.
hardware/rot8.v: the 8 bit / 64 cell machine -- 3 bit opcodes from a byte
addressed memory read as a 16 bit window, a 6 bit dp with free wrap, the loop
stack bracket jump, blocking input, halt on ip == length, and a step counter that
counts instructions rather than cycles. hardware/tb_rot8.v loads a --hex image
and prints the OUT stream in tape_run format.
Verified with Icarus Verilog 14 (the RTL against tape_run --loop-stack --retest):
hello 577 instructions 417 steps 10 outs
term 16414 17643 11 (fed "lhi")
calc 51378 166741 19 (fed "12 34 + .": prints the prompt,
046 and the next prompt)
flagship 43676 100142 93
Every OUT stream identical. ctest -R rtl_sim runs that comparison from an 8 bit
build (11 tests in the default build now, where the RTL test self-skips because
the RTL is the 8 bit machine).
Two traps worth remembering: Icarus passes plusargs through as raw bytes, so an
absolute +HEX path containing non-ASCII (this checkout is under a Chinese
directory name) arrives mangled, $readmemh silently leaves the memory empty and
the machine obediently runs LEN steps of opcode 0 printing nothing -- run vvp
from the directory holding the hex with a relative name. And in_ready must not
be qualified with !in_valid or the input handshake deadlocks.