diff --git a/hardware/mechanics.md b/hardware/mechanics.md index e440e7a..9a66b16 100644 --- a/hardware/mechanics.md +++ b/hardware/mechanics.md @@ -49,6 +49,9 @@ 绕环。**没有轴承、没有磁头、没有磨损**,只有一根在振动的线 —— 环在物理上就是个环。 代价是要自己绕线、做偏置磁铁、调放大和整形(有 DIY 先例,但要示波器)。 +> **面板上不预留机械指针的位置。** 它是外挂件:做得成就接上去,做不成机器照跑(`tape_run`、 +> RTL 和所有纸带的语义都与它无关)。下面这些是"想做的时候怎么做",不是必做项。 + **建议**:先做 **A**(当"机械地址寄存器",和电子记忆并存,两天能转起来),把它当 N1; 如果手感不够、想要"记忆本身也是机械的",再上 **C**(比 B 便宜一个数量级,而且是真正的 "环"),B 留给"必须有个转动的鼓"的场合。 diff --git a/hardware/panel-mockup-vintage.png b/hardware/panel-mockup-vintage.png index 77f4a84..7086e5b 100644 Binary files a/hardware/panel-mockup-vintage.png and b/hardware/panel-mockup-vintage.png differ diff --git a/hardware/panel_mockup_vintage.py b/hardware/panel_mockup_vintage.py index f991483..c4d8a2a 100644 --- a/hardware/panel_mockup_vintage.py +++ b/hardware/panel_mockup_vintage.py @@ -1,11 +1,10 @@ -"""Vintage front panel, no numeric display: state only. +"""Vintage ROT-8 panel, laid out on a grid: state only, no numbers, no dial. -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). +Three columns, three rows, one rule under the title, every block on the same +baseline. What it shows is machine state: the 64 cell data ring with dp lit, the +eight bit lamps of the pointed cell, the eight instruction lamps and the dp bits. +Numbers (results, step counts) come out of the serial port; there is no decimal +display, no step counter and no mechanical pointer. python hardware/panel_mockup_vintage.py hardware/panel-mockup-vintage.png """ @@ -19,14 +18,21 @@ W, H = 200 * S, 100 * S PAINT = (46, 44, 42) PAINT_EDGE = (22, 21, 20) +RULE = (86, 82, 75) ENGRAVE = (216, 205, 178) ENGRAVE_DIM = (150, 141, 122) +ENGRAVE_FAINT = (116, 110, 98) NEON = (255, 92, 58) BULB = (255, 196, 96) BAKELITE = (72, 33, 30) CHROME = (178, 180, 184) DARK = (16, 15, 14) -STEEL = (126, 122, 114) + +# grid: three columns, three content rows +CX = (12.0, 70.0, 132.0) +CW = (52.0, 54.0, 56.0) +ROW = (28.5, 56.0, 72.0) +MID = 188.0 def font(pt, serif=False): @@ -44,138 +50,138 @@ def p(v): return int(round(v * S)) +def head(d, x, y, text): + d.text((p(x), p(y)), text, font=font(1.4), fill=ENGRAVE_DIM) + + 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)) + img = Image.new("RGB", (W, H), (14, 14, 14)) d = ImageDraw.Draw(img) - # hammertone panel with a filled engraved border - d.rounded_rectangle([p(4), p(4), p(196), p(96)], radius=p(2.4), fill=PAINT, + d.rounded_rectangle([p(4), p(4), p(196), p(96)], radius=p(2.2), 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)) + d.rounded_rectangle([p(8), p(8), p(192), p(92)], radius=p(1.2), + outline=(74, 71, 65), width=p(0.3)) glow = Image.new("RGBA", (W, H), (0, 0, 0, 0)) g = ImageDraw.Draw(glow) - # ---- the eight bit lamps: the pointed cell, MSB first, two rows of four --- - # Two rows of four keeps this block to its own corner instead of stretching - # into the instruction lamps, which were crowding it. - d.text((p(12.6), p(15.4)), "CELL BITS 7 6 5 4 / 3 2 1 0", font=font(1.3), fill=ENGRAVE_DIM) - bits = [1, 0, 0, 1, 1, 0, 1, 0] - for i, bit in enumerate(bits): - x = 12.6 + (i % 4) * 8.6 - y = 18.2 + (i // 4) * 8.8 + # ---- title, rule -------------------------------------------------------- + d.text((p(12), p(11.0)), "ROT-8", font=font(4.4, serif=True), fill=ENGRAVE) + d.text((p(38.6), p(15.6)), "8 BIT · 64 CELLS · ONE INSTRUCTION PER BYTE", + font=font(1.3), fill=ENGRAVE_DIM) + d.line([p(12), p(21.5), p(MID), p(21.5)], fill=RULE, width=p(0.25)) + + # ---- column 1: the pointed cell ---------------------------------------- + head(d, CX[0], 24.4, "CELL BITS 7 6 5 4 / 3 2 1 0") + for i, bit in enumerate([1, 0, 0, 1, 1, 0, 1, 0]): + x = CX[0] + (i % 4) * 13.0 + y = ROW[0] + (i // 4) * 14.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, + g.ellipse([p(x - 0.9), p(y - 0.9), p(x + 8.9), p(y + 8.9)], + fill=BULB + (200,)) + d.ellipse([p(x + 0.6), p(y + 0.6), p(x + 7.4), p(y + 7.4)], fill=BULB, outline=(122, 90, 34), width=p(0.3)) else: - 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.ellipse([p(x + 0.6), p(y + 0.6), p(x + 7.4), p(y + 7.4)], + fill=(38, 34, 28), outline=(72, 67, 57), width=p(0.3)) - # ---- instruction lamps --------------------------------------------------- - d.text((p(56), p(15.4)), "INSTRUCTION", font=font(1.4), fill=ENGRAVE_DIM) + # ---- column 2: instruction lamps, then dp bits -------------------------- + head(d, CX[1], 24.4, "INSTRUCTION") for i, op in enumerate("><+-[].,"): - x = 56 + i * 7.4 + x = CX[1] + i * 6.8 lit = i == 1 if lit: - g.ellipse([p(x - 0.6), p(18.6 - 0.6), p(x + 5.1), p(18.6 + 5.1)], - fill=BULB + (210,)) - d.ellipse([p(x + 0.5), p(19.2), p(x + 4.1), p(22.8)], fill=BULB, - outline=(120, 88, 34)) + g.ellipse([p(x - 0.6), p(ROW[0] - 0.6), p(x + 5.8), p(ROW[0] + 5.8)], + fill=BULB + (205,)) + d.ellipse([p(x + 0.5), p(ROW[0] + 0.5), p(x + 4.7), p(ROW[0] + 4.7)], + fill=BULB, outline=(122, 90, 34), width=p(0.3)) else: - d.ellipse([p(x + 0.5), p(19.2), p(x + 4.1), p(22.8)], fill=(40, 36, 30), - outline=(74, 68, 58)) - d.text((p(x + 1.3), p(23.6)), op, font=font(1.9), fill=ENGRAVE) + d.ellipse([p(x + 0.5), p(ROW[0] + 0.5), p(x + 4.7), p(ROW[0] + 4.7)], + fill=(38, 34, 28), outline=(72, 67, 57), width=p(0.3)) + d.text((p(x + 1.6), p(ROW[0] + 6.2)), op, font=font(1.7), fill=ENGRAVE) - # ---- dp lamps ------------------------------------------------------------ - d.text((p(50.4), p(30.6)), "DP", font=font(1.4), fill=ENGRAVE_DIM) + head(d, CX[1], ROW[0] + 13.2, "DP") for i in range(6): lit = i < 4 - x0, y0 = 56 + i * 5.4, 30.4 + x0, y0 = CX[1] + 8.0 + i * 6.4, ROW[0] + 13.0 if lit: - g.rounded_rectangle([p(x0), p(y0), p(x0 + 4.4), p(y0 + 2.8)], - radius=p(0.9), fill=NEON + (170,)) - d.rounded_rectangle([p(x0), p(y0), p(x0 + 4.4), p(y0 + 2.8)], - radius=p(0.9), - fill=(198, 88, 60) if lit else (54, 32, 28), - outline=(80, 44, 38)) + g.rounded_rectangle([p(x0), p(y0), p(x0 + 5.0), p(y0 + 3.2)], + radius=p(1.0), fill=NEON + (165,)) + d.rounded_rectangle([p(x0), p(y0), p(x0 + 5.0), p(y0 + 3.2)], + radius=p(1.0), + fill=(200, 90, 62) if lit else (52, 31, 27), + outline=(78, 43, 37), width=p(0.2)) - # ---- the 64 cell ring: neon, dp lit -------------------------------------- - cx, cy, r = 162, 30, 17.5 + # ---- column 3: the data ring ------------------------------------------- + cx, cy, r = CX[2] + 28.0, ROW[0] + 9.0, 17.5 + d.ellipse([p(cx - r), p(cy - r), p(cx + r), p(cy + r)], outline=(52, 57, 62), + width=p(0.25)) 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 + rr = 0.78 if lit else 0.44 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,)) + g.ellipse([p(px - rr * 2.0), p(py - rr * 2.0), p(px + rr * 2.0), + p(py + rr * 2.0)], fill=NEON + (215,)) 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)) + fill=(62, 31, 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=(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), + d.text((p(CX[2] + 1.0), p(cy + r + 2.6)), "DATA RING 64 · dp lit", + font=font(1.35), fill=ENGRAVE_DIM) + + # ---- row 2: controls ---------------------------------------------------- + for cx_, label in ((18.0, "RUN"), (34.0, "STEP"), (50.0, "RESET")): + d.ellipse([p(cx_ - 4.6), p(ROW[1] - 4.6), p(cx_ + 4.6), p(ROW[1] + 4.6)], + fill=CHROME, outline=(96, 96, 98), width=p(0.25)) + d.ellipse([p(cx_ - 3.8), p(ROW[1] - 3.8), p(cx_ + 3.8), p(ROW[1] + 3.8)], + fill=BAKELITE, outline=(38, 18, 16), width=p(0.25)) + tw = d.textlength(label, font=font(1.4)) + d.text((p(cx_) - tw / 2, p(ROW[1] + 5.4)), label, font=font(1.4), fill=ENGRAVE) + + head(d, CX[1], ROW[1] - 3.6, "INPUT BYTE") + d.rounded_rectangle([p(CX[1]), p(ROW[1] + 0.2), p(CX[1] + 44), p(ROW[1] + 7.4)], + radius=p(0.5), outline=(104, 99, 90), width=p(0.3)) + for i in range(8): + d.rectangle([p(CX[1] + 1.6 + i * 5.2), p(ROW[1] + 1.6), + p(CX[1] + 4.6 + i * 5.2), p(ROW[1] + 6.0)], + fill=(226, 216, 190), outline=(94, 89, 79)) + d.text((p(CX[1]), p(ROW[1] + 8.6)), "8 SWITCHES + SEND", font=font(1.25), + fill=ENGRAVE_FAINT) + + # ---- row 3: cartridge and serial --------------------------------------- + d.rounded_rectangle([p(CX[0]), p(ROW[2]), p(CX[0] + CW[0] + 2), p(ROW[2] + 14)], + radius=p(0.6), fill=(20, 19, 18), outline=(104, 99, 90), + width=p(0.3)) + d.text((p(CX[0] + 1.6), p(ROW[2] + 1.6)), "27C512 · UV WINDOW", font=font(1.4), + fill=ENGRAVE) + d.text((p(CX[0] + 1.6), p(ROW[2] + 5.2)), "program cartridge", font=font(1.3), + fill=ENGRAVE_DIM) + d.text((p(CX[0] + 1.6), p(ROW[2] + 8.6)), "64K x 8, one byte", font=font(1.3), + fill=ENGRAVE_DIM) + d.text((p(CX[0] + 1.6), p(ROW[2] + 11.6)), "per instruction", font=font(1.3), fill=ENGRAVE_DIM) - # (there is deliberately no step counter here: the ISA cannot observe time, so - # the panel does not show time either. A running count is a debugging number, - # and debugging numbers come out of the serial port.) - - # ---- 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_ - 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.5)) - d.text((p(cx_) - tw / 2, p(45.4)), label, font=font(1.5), fill=ENGRAVE) - - 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(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(62), p(45.6)), "8 SWITCHES + SEND", font=font(1.3), fill=(128, 121, 106)) - - # ---- 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.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(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 dp dial ---------------------------------------- - d.ellipse([p(140), p(55), p(166), p(81)], fill=(146, 140, 128), - outline=(96, 90, 80), width=p(0.4)) - d.ellipse([p(151.2), p(66.2), p(157.4), p(72.4)], fill=(60, 56, 50), - outline=(32, 30, 26)) - d.line([p(153), p(68), p(161.4), p(59.6)], fill=(56, 52, 46), width=p(0.5)) - d.text((p(140), p(82.4)), "MECHANICAL DP", font=font(1.4), fill=ENGRAVE_DIM) - - 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) + head(d, CX[1], ROW[2] - 1.4, "SERIAL 9600 8N1") + for k, txt, col in ((ROW[2] + 1.6, "> 12 34 + .", (188, 178, 156)), + (ROW[2] + 9.0, "0046", NEON)): + d.rounded_rectangle([p(CX[1]), p(k), p(CX[1] + 72), p(k + 6.0)], + radius=p(0.4), fill=DARK, outline=(94, 89, 79), + width=p(0.25)) + d.text((p(CX[1] + 1.4), p(k + 1.2)), txt, font=font(1.4), fill=col) + for i, line in enumerate(("NUMBERS", "COME OUT", "HERE")): + d.text((p(CX[1] + 74.5), p(ROW[2] + 2.4 + i * 2.4)), line, + font=font(1.2), fill=ENGRAVE_FAINT) + img = Image.alpha_composite( + img.convert("RGBA"), + glow.filter(ImageFilter.GaussianBlur(p(0.6)))).convert("RGB") img.save(out) print("wrote", out)