Commit Graph
11 Commits
Author SHA1 Message Date
dsh c70c822afc hardware: relayout the panel on a grid, and drop the mechanical pointer
ci / linux-arm64 (push) Successful in 4m57s
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.
2026-11-24 18:28:21 +08:00
dsh 102f7db1de hardware: no step counter on the panel either
ci / linux-arm64 (push) Successful in 4m55s
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.
2026-11-24 18:22:19 +08:00
dsh e196306a49 hardware: the panel shows state, not numbers
ci / linux-arm64 (push) Successful in 5m3s
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.
2026-11-24 18:18:56 +08:00
dsh 928c733909 hardware: a vintage panel -- Nixie digits and a neon ring instead of LEDs
ci / linux-arm64 (push) Successful in 4m43s
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.
2026-11-24 18:15:27 +08:00
dsh 6ebc1c0a01 hardware: a panel mockup, so "what does it look like" has an answer
ci / linux-arm64 (push) Successful in 4m54s
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.
2026-11-24 18:11:49 +08:00
dsh 1b849f127a hardware: a board level wiring table for the 74LS machine
ci / linux-arm64 (push) Successful in 4m42s
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.
2026-11-24 18:08:26 +08:00
dsh 7170ad4813 mechanics: what the mechanical address register costs, tape by tape
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.
2026-11-20 17:20:15 +08:00
dsh 9590cfd35b mechanics: a VCR drum works as a spindle, and the numbers say only the delay
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.
2026-11-20 16:54:32 +08:00
dsh a5dfd70499 docs: what a mechanical dp can actually mean when the memory is electronic
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".
2026-11-20 16:43:57 +08:00
dsh 1e7acc018e hardware: the 74LS machine gets a period bill of materials, and a mechanics plan
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.
2026-11-20 16:35:02 +08:00
dsh 9b31a51fec hardware: M0 -- the packer, the RTL, and a simulator that agrees byte for byte
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.
2026-11-20 16:25:54 +08:00