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.
This commit is contained in:
dsh committed 2026-11-24 18:18:56 +08:00
1 parent 928c733909
commit e196306a49
3 files changed
+99 -175

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
# ROT-8 硬件:这个目录里有什么
做完大概就是 panel-mockup.png 那样(panel_mockup.py 画的草图,200 x 100 mm 面板、inside 是 160 x 100 mm Eurocard):
两个版本:`panel-mockup.png` 是 LED 面板(1975 味),`panel-mockup-vintage.png` 是**辉光管 + 氖泡**版本(1960 味,推荐):`n`n![辉光管面板](panel-mockup-vintage.png)`n
面板**不显示数字** —— 数字归终端(`0046`),面板只显示状态:`panel-mockup-vintage.png` 是最终取向(氖泡 + 灯泡 + 胶木按钮 + 锤纹漆):`n`n![辉光管面板](panel-mockup-vintage.png)`n
`docs/hardware.md` 的落地部分。三样东西都跑通了(Icarus Verilog 14.0):
Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 48 KiB

+98 -174
View File
@@ -1,10 +1,11 @@
"""Vintage front panel: Nixie digits, neon ring, filament lamps, hammertone panel.
"""Vintage front panel, no numeric display: state only.
Same machine as panel_mockup.py (200 x 100 mm, Eurocard inside), but the display.
Seven segment LEDs look 1975; the ROT-8 panel is nicer as a 1960 panel: Nixie
tubes for the digits (K155ID1 drivers and a 170 V rail), neon lamps for the ring
and the bit rows, grain of wheat bulbs for the instruction lamps, bakelite
buttons, hammertone paint and engraved lettering.
The panel shows the machine's *state* -- the 64 cell ring with dp lit, the eight
bit lamps of the pointed cell, the current instruction and a mechanical step
counter -- and nothing else. Numbers come from the serial terminal, where
`12 34 + .` prints `0046`; a decimal display on the panel would duplicate that
badly (and pull four Nixie tubes, four K155ID1 and a 170 V rail into a job they
are not needed for).
python hardware/panel_mockup_vintage.py hardware/panel-mockup-vintage.png
"""
@@ -16,28 +17,16 @@ from PIL import Image, ImageDraw, ImageFilter, ImageFont
S = 7
W, H = 200 * S, 100 * S
PAINT = (46, 44, 42) # hammertone, dark warm grey
PAINT = (46, 44, 42)
PAINT_EDGE = (22, 21, 20)
ENGRAVE = (216, 205, 178) # ivory filled engraving
ENGRAVE = (216, 205, 178)
ENGRAVE_DIM = (150, 141, 122)
GLASS = (26, 24, 28)
NIXIE = (255, 118, 24)
NIXIE_DIM = (86, 44, 20)
NEON = (255, 92, 58)
BULB = (255, 196, 96)
BAKELITE = (72, 33, 30)
CHROME = (176, 178, 182)
CHROME = (178, 180, 184)
DARK = (16, 15, 14)
DIGITS = { # straight wire segments, unit cell; 0 and 6 are drawn with arcs
"4": [((0.30, 0.98), (0.30, 0.42)), ((0.30, 0.42), (0.82, 0.42)),
((0.62, 0.02), (0.62, 0.98))],
"8": [], # arcs only
"6": [], # arcs only
"0": [], # arcs only
"-": [((0.25, 0.50), (0.75, 0.50))],
" ": [],
}
STEEL = (126, 122, 114)
def font(pt, serif=False):
@@ -55,113 +44,40 @@ def p(v):
return int(round(v * S))
def engraved(d, xy, text, f, fill=ENGRAVE):
"""Lettering with a dark offset behind it, like filled engraving."""
d.text((xy[0] + p(0.12), xy[1] + p(0.12)), text, font=f, fill=(14, 13, 12))
d.text(xy, text, font=f, fill=fill)
def digit_paths(x, y, w, h, ch):
return [((x + a[0] * w, y + a[1] * h), (x + b[0] * w, y + b[1] * h))
for a, b in DIGITS.get(ch, [])]
def draw_digit(d, g, x, y, w, h, ch, lit=True):
"""A Nixie digit: wire numerals, round where the numeral is round.
0 and 6 are arcs, 4 is three straight wires; the unlit neighbours of a real
tube are drawn as a faint 8 (all ten cathodes are stacked in there).
"""
color = NIXIE if lit else NIXIE_DIM
thick = 0.62 if lit else 0.32
if ch == "0":
rings = [(0.14, 0.02, 0.86, 0.98)]
elif ch == "6":
rings = [(0.16, 0.34, 0.84, 0.99)]
elif ch == "8":
rings = [(0.14, 0.02, 0.86, 0.50), (0.14, 0.50, 0.86, 0.98)]
else:
rings = []
for x0, y0, x1, y1 in rings:
bb = [p(x + x0 * w), p(y + y0 * h), p(x + x1 * w), p(y + y1 * h)]
if lit:
g.ellipse(bb, outline=color + (230,), width=p(thick))
d.ellipse(bb, outline=color, width=p(thick))
if ch == "6": # the tail of the 6, and the lid
pts = [(x + 0.50 * w, y + 0.02 * h), (x + 0.22 * w, y + 0.22 * h),
(x + 0.16 * w, y + 0.40 * h)]
for a, b in zip(pts, pts[1:]):
if lit:
g.line([p(a[0]), p(a[1]), p(b[0]), p(b[1])], fill=color + (230,),
width=p(thick))
d.line([p(a[0]), p(a[1]), p(b[0]), p(b[1])], fill=color, width=p(thick))
if lit:
g.ellipse([p(x + 0.16 * w), p(y + 0.34 * h), p(x + 0.84 * w),
p(y + 0.99 * h)], outline=color + (230,), width=p(thick))
d.ellipse([p(x + 0.16 * w), p(y + 0.34 * h), p(x + 0.84 * w),
p(y + 0.99 * h)], outline=color, width=p(thick))
for a, b in digit_paths(x, y, w, h, ch):
if lit:
g.line([p(a[0]), p(a[1]), p(b[0]), p(b[1])], fill=color + (230,),
width=p(thick))
d.line([p(a[0]), p(a[1]), p(b[0]), p(b[1])], fill=color, width=p(thick))
def main():
out = sys.argv[1] if len(sys.argv) > 1 else "panel-mockup-vintage.png"
img = Image.new("RGB", (W, H), (16, 16, 16))
d = ImageDraw.Draw(img)
# panel: paint + engraved frame
# hammertone panel with a filled engraved border
d.rounded_rectangle([p(4), p(4), p(196), p(96)], radius=p(2.4), fill=PAINT,
outline=PAINT_EDGE, width=p(0.8))
d.rounded_rectangle([p(8), p(8), p(192), p(92)], radius=p(1.4),
outline=(92, 88, 80), width=p(0.3))
# ---- glow layer: everything that emits light ------------------------------
glow = Image.new("RGBA", (W, H), (0, 0, 0, 0))
g = ImageDraw.Draw(glow)
# Nixie tubes: 4 glass envelopes, digits inside
for i, ch in enumerate(["0", "0", "4", "6"]):
x = 13.0 + i * 11.4
y = 20.5
w, h = 9.0, 15.0
# envelope
d.rounded_rectangle([p(x), p(y), p(x + w), p(y + h)], radius=p(1.0),
fill=GLASS, outline=(122, 118, 124), width=p(0.35))
d.ellipse([p(x + w / 2 - 0.9), p(y - 1.5), p(x + w / 2 + 0.9), p(y + 0.2)],
fill=GLASS, outline=(122, 118, 124), width=p(0.3))
# mesh plate
for k in range(6):
d.line([p(x + 1.0 + k * 1.18), p(y + 1.2), p(x + 1.0 + k * 1.18),
p(y + h - 1.2)], fill=(40, 38, 42), width=1)
ch_x, ch_y, ch_w, ch_h = x + 1.1, y + 2.0, w - 2.2, h - 4.2
draw_digit(d, g, ch_x, ch_y, ch_w, ch_h, ch)
# faint unlit neighbours, like a real tube
draw_digit(d, g, ch_x, ch_y, ch_w, ch_h, "8", lit=False)
# neon ring: 64 lamps, dp lit
cx, cy, r = 160, 32, 19
for i in range(64):
a = -math.pi / 2 + 2 * math.pi * i / 64
px, py = cx + r * math.cos(a), cy + r * math.sin(a)
lit = i == 33
rr = 0.85 if lit else 0.45
if lit:
g.ellipse([p(px - rr * 1.6), p(py - rr * 1.6), p(px + rr * 1.6),
p(py + rr * 1.6)], fill=NEON + (200,))
d.ellipse([p(px - rr), p(py - rr), p(px + rr), p(py + rr)], fill=NEON)
# ---- the eight bit lamps: the pointed cell, MSB first --------------------
bits = [1, 0, 0, 1, 1, 0, 1, 0]
for i, bit in enumerate(bits):
x = 13 + i * 8.4
y = 16.0
if bit:
g.ellipse([p(x - 0.8), p(y - 0.8), p(x + 6.4), p(y + 6.4)],
fill=BULB + (205,))
d.ellipse([p(x + 0.4), p(y + 0.4), p(x + 5.2), p(y + 5.2)], fill=BULB,
outline=(122, 90, 34), width=p(0.3))
else:
d.ellipse([p(px - rr), p(py - rr), p(px + rr), p(py + rr)],
fill=(58, 30, 26))
a = -math.pi / 2 + 2 * math.pi * 33 / 64
d.line([p(cx), p(cy), p(cx + r * math.cos(a)), p(cy + r * math.sin(a))],
fill=(196, 160, 96), width=p(0.35))
d.ellipse([p(x + 0.4), p(y + 0.4), p(x + 5.2), p(y + 5.2)],
fill=(38, 34, 28), outline=(74, 68, 58), width=p(0.3))
d.text((p(x + 1.9), p(26.8)), str(7 - i), font=font(1.4), fill=ENGRAVE_DIM)
# instruction lamps: 8 grain of wheat bulbs
for i in range(8):
x = 64 + i * 7.6
# ---- instruction lamps ---------------------------------------------------
for i, op in enumerate("><+-[].,"):
x = 76 + i * 7.6
lit = i == 1
if lit:
g.ellipse([p(x - 0.6), p(13.4 - 0.6), p(x + 5.9), p(13.4 + 5.9)],
@@ -171,21 +87,13 @@ def main():
else:
d.ellipse([p(x + 0.6), p(14.2), p(x + 5.0), p(18.6)], fill=(40, 36, 30),
outline=(74, 68, 58))
d.text((p(x + 1.7), p(19.6)), op, font=font(2.0), fill=ENGRAVE)
# bit rows as neon bars
for i in range(16):
lit = i % 3 == 0
x0, y0 = 64 + i * 4.4, 25.4
if lit:
g.rounded_rectangle([p(x0), p(y0), p(x0 + 3.4), p(y0 + 2.6)],
radius=p(0.8), fill=NEON + (190,))
d.rounded_rectangle([p(x0), p(y0), p(x0 + 3.4), p(y0 + 2.6)],
radius=p(0.8),
fill=(216, 96, 66) if lit else (54, 32, 28),
outline=(80, 44, 38))
# ---- dp lamps ------------------------------------------------------------
d.text((p(78.4), p(29.6)), "DP", font=font(1.4), fill=ENGRAVE_DIM)
for i in range(6):
lit = i < 4
x0, y0 = 64 + i * 5.8, 31.4
x0, y0 = 84 + i * 5.4, 29.4
if lit:
g.rounded_rectangle([p(x0), p(y0), p(x0 + 4.4), p(y0 + 2.8)],
radius=p(0.9), fill=NEON + (170,))
@@ -194,73 +102,89 @@ def main():
fill=(198, 88, 60) if lit else (54, 32, 28),
outline=(80, 44, 38))
# ---- composite the glow ------------------------------------------------
glow = glow.filter(ImageFilter.GaussianBlur(p(0.9)))
img = Image.alpha_composite(img.convert("RGBA"), glow).convert("RGB")
d = ImageDraw.Draw(img)
# ---- the 64 cell ring: neon, dp lit --------------------------------------
cx, cy, r = 162, 30, 17.5
for i in range(64):
a = -math.pi / 2 + 2 * math.pi * i / 64
px, py = cx + r * math.cos(a), cy + r * math.sin(a)
lit = i == 33
rr = 0.8 if lit else 0.45
if lit:
g.ellipse([p(px - rr * 1.8), p(py - rr * 1.8), p(px + rr * 1.8),
p(py + rr * 1.8)], fill=NEON + (210,))
d.ellipse([p(px - rr), p(py - rr), p(px + rr), p(py + rr)], fill=NEON)
else:
d.ellipse([p(px - rr), p(py - rr), p(px + rr), p(py + rr)],
fill=(64, 32, 27))
a = -math.pi / 2 + 2 * math.pi * 33 / 64
d.line([p(cx), p(cy), p(cx + r * math.cos(a)), p(cy + r * math.sin(a))],
fill=(198, 162, 96), width=p(0.35))
d.text((p(cx - 19), p(cy + 18.8)), "DATA RING 64 (dp lit)", font=font(1.4),
fill=ENGRAVE_DIM)
# ---- engraving over the top -------------------------------------------
d.text((p(12), p(8.6)), "ROT-8", font=font(5.0, serif=True), fill=ENGRAVE)
d.text((p(13.0), p(15.6)), "8 BIT · 64 CELLS · ONE INSTRUCTION PER BYTE",
font=font(1.6), fill=ENGRAVE_DIM)
d.text((p(13.0), p(37.4)), "CELL · IP · DP", font=font(1.5), fill=ENGRAVE_DIM)
d.text((p(64), p(10.6)), "INSTRUCTION", font=font(1.6), fill=ENGRAVE_DIM)
for i, op in enumerate("><+-[].,"):
d.text((p(64 + i * 7.6 + 1.7), p(19.6)), op, font=font(2.0), fill=ENGRAVE)
d.text((p(58.4), p(24.8)), "IP", font=font(1.5), fill=ENGRAVE_DIM)
d.text((p(58.4), p(30.8)), "DP", font=font(1.5), fill=ENGRAVE_DIM)
# ---- mechanical step counter --------------------------------------------
d.text((p(126), p(52.4)), "STEPS", font=font(1.5), fill=ENGRAVE_DIM)
d.rounded_rectangle([p(126), p(55.4), p(172), p(64.6)], radius=p(0.8),
fill=(28, 26, 24), outline=STEEL, width=p(0.35))
for k in range(5):
x = 127.4 + k * 8.8
d.rounded_rectangle([p(x), p(56.4), p(x + 8.0), p(63.4)], radius=p(0.5),
fill=(226, 216, 190), outline=(96, 90, 80))
tw = d.textlength(str(k), font=font(3.4))
d.text((p(x + 4.0) - tw / 2, p(57.0)), str((11859 >> (4 * (4 - k))) & 0xF)
if False else str([0, 1, 6, 3, 4][k]), font=font(3.2),
fill=(28, 26, 24))
d.text((p(126), p(65.8)), "MECHANICAL, CLUTCH ON IN STEP MODE", font=font(1.2),
fill=(128, 121, 106))
# bakelite buttons with chrome bezels
for cx_, label in ((70, "RUN"), (86, "STEP"), (102, "RESET")):
d.ellipse([p(cx_ - 4.8), p(42.6 - 4.8), p(cx_ + 4.8), p(42.6 + 4.8)],
# ---- buttons + input byte ------------------------------------------------
for cx_, label in ((18.0, "RUN"), (34.0, "STEP"), (50.0, "RESET")):
d.ellipse([p(cx_ - 4.6), p(40.0 - 4.6), p(cx_ + 4.6), p(40.0 + 4.6)],
fill=CHROME, outline=(96, 96, 98))
d.ellipse([p(cx_ - 4.0), p(42.6 - 4.0), p(cx_ + 4.0), p(42.6 + 4.0)],
d.ellipse([p(cx_ - 3.8), p(40.0 - 3.8), p(cx_ + 3.8), p(40.0 + 3.8)],
fill=BAKELITE, outline=(38, 18, 16))
tw = d.textlength(label, font=font(1.6))
d.text((p(cx_) - tw / 2, p(47.8)), label, font=font(1.6), fill=ENGRAVE)
tw = d.textlength(label, font=font(1.5))
d.text((p(cx_) - tw / 2, p(45.4)), label, font=font(1.5), fill=ENGRAVE)
d.text((p(13.0), p(41.0)), "INPUT BYTE", font=font(1.5), fill=ENGRAVE_DIM)
d.rounded_rectangle([p(13), p(44), p(55), p(51.4)], radius=p(0.5),
d.text((p(62), p(34.6)), "INPUT BYTE", font=font(1.5), fill=ENGRAVE_DIM)
d.rounded_rectangle([p(62), p(37.4), p(104), p(44.6)], radius=p(0.5),
outline=(112, 106, 96), width=p(0.3))
for i in range(8):
d.rectangle([p(14.6 + i * 5.0), p(45.4), p(17.6 + i * 5.0), p(49.8)],
d.rectangle([p(63.6 + i * 5.0), p(38.8), p(66.6 + i * 5.0), p(43.2)],
fill=(226, 216, 190), outline=(96, 90, 80))
d.text((p(13.0), p(52.6)), "8 SWITCHES + SEND", font=font(1.4), fill=(128, 121, 106))
d.text((p(62), p(45.6)), "8 SWITCHES + SEND", font=font(1.3), fill=(128, 121, 106))
# cartridge socket + engraving
d.rounded_rectangle([p(13), p(61), p(64), p(75.4)], radius=p(0.6),
# ---- cartridge + serial --------------------------------------------------
d.rounded_rectangle([p(12.6), p(52.4), p(64), p(66.6)], radius=p(0.6),
fill=(20, 19, 18), outline=(112, 106, 96), width=p(0.3))
d.text((p(14.6), p(62.6)), "27C512 · UV WINDOW", font=font(1.5), fill=ENGRAVE)
d.text((p(14.6), p(66.4)), "program cartridge", font=font(1.4), fill=ENGRAVE_DIM)
d.text((p(14.6), p(69.8)), "64K x 8, one byte", font=font(1.4), fill=ENGRAVE_DIM)
d.text((p(14.6), p(73.2)), "per instruction", font=font(1.4), fill=ENGRAVE_DIM)
d.text((p(14.2), p(54.0)), "27C512 · UV WINDOW", font=font(1.5), fill=ENGRAVE)
d.text((p(14.2), p(57.6)), "program cartridge", font=font(1.4), fill=ENGRAVE_DIM)
d.text((p(14.2), p(61.0)), "64K x 8, one byte", font=font(1.4), fill=ENGRAVE_DIM)
d.text((p(14.2), p(64.4)), "per instruction", font=font(1.4), fill=ENGRAVE_DIM)
d.text((p(72), p(58.4)), "SERIAL 9600 8N1", font=font(1.5), fill=ENGRAVE_DIM)
for k, txt, col in ((62.2, "> 12 34 + .", (188, 178, 156)),
(70.2, "0046", NEON)):
d.text((p(72), p(52.4)), "SERIAL 9600 8N1", font=font(1.5), fill=ENGRAVE_DIM)
for k, txt, col in ((55.8, "> 12 34 + .", (188, 178, 156)),
(63.8, "0046", NEON)):
d.rounded_rectangle([p(72), p(k), p(118), p(k + 6.2)], radius=p(0.4),
fill=DARK, outline=(96, 90, 80), width=p(0.25))
d.text((p(73.4), p(k + 1.3)), txt, font=font(1.4), fill=col)
d.text((p(72), p(71.0)), "NUMBERS COME FROM HERE, NOT FROM THE PANEL",
font=font(1.2), fill=(128, 121, 106))
# optional mechanical dial
d.ellipse([p(150), p(60), p(170), p(80)], fill=(146, 140, 128),
# ---- optional mechanical dp dial ----------------------------------------
d.ellipse([p(153), p(73), p(171), p(91)], fill=(146, 140, 128),
outline=(96, 90, 80), width=p(0.4))
d.ellipse([p(157.8), p(67.8), p(162.2), p(72.2)], fill=(60, 56, 50),
d.ellipse([p(159.9), p(79.9), p(164.1), p(84.1)], fill=(60, 56, 50),
outline=(32, 30, 26))
d.line([p(160), p(70), p(166), p(64)], fill=(56, 52, 46), width=p(0.45))
for k in range(12):
a = 2 * math.pi * k / 12
d.line([p(160 + 8.6 * math.cos(a)), p(70 + 8.6 * math.sin(a)),
p(160 + 9.6 * math.cos(a)), p(70 + 9.6 * math.sin(a))],
fill=(70, 66, 58), width=p(0.2))
d.text((p(146), p(82.0)), "MECHANICAL DP", font=font(1.3), fill=ENGRAVE_DIM)
d.line([p(162), p(82), p(167.4), p(76.6)], fill=(56, 52, 46), width=p(0.45))
d.text((p(152), p(92.0)), "MECHANICAL DP", font=font(1.3), fill=ENGRAVE_DIM)
d.text((p(13.0), p(79.4)),
"INSIDE: EUROCARD 160 x 100 mm · 34 DIP SOCKETS · 5 V 2 A",
img = Image.alpha_composite(img.convert("RGBA"),
glow.filter(ImageFilter.GaussianBlur(p(0.7)))).convert("RGB")
d = ImageDraw.Draw(img)
d.text((p(12), p(5.6)), "ROT-8", font=font(4.6, serif=True), fill=ENGRAVE)
d.text((p(12.6), p(12.4)), "8 BIT · 64 CELLS · ONE INSTRUCTION PER BYTE",
font=font(1.4), fill=ENGRAVE_DIM)
d.text((p(13.0), p(82.8)),
"1 MHz CAN · 27C512 + 6116 + 74LS · K155ID1 + 170 V FOR THE TUBES",
font=font(1.3), fill=(128, 121, 106))
img.save(out)
print("wrote", out)