diff --git a/hardware/panel-mockup-vintage.png b/hardware/panel-mockup-vintage.png index 4118568..1f75658 100644 Binary files a/hardware/panel-mockup-vintage.png and b/hardware/panel-mockup-vintage.png differ diff --git a/hardware/panel.md b/hardware/panel.md index ab7f441..f9b45d9 100644 --- a/hardware/panel.md +++ b/hardware/panel.md @@ -7,19 +7,22 @@ | 项 | 值 | |---|---| -| 面板 | **200 × 100 mm**,2 mm 铝或 3 mm 亚克力,米白锤纹漆(RAL 7035 相近)+ 橙线 **#B54E2A** 丝印 | +| 面板 | **200 × 100 mm**,2 mm 铝,**Altair 蓝灰漆(≈ #748494)** + 白色丝印(照 8800 的配色;想换回米白 + 橙线也行,布局不变) | | 外壳 | 约 **220 × 130 × 70 mm**,金属或木质,黑色侧板,四只脚垫 | | 四角 | 4 × M3 螺钉(面板内侧固定) | | 卡带槽 | 2 × 22 卡边连接器(2.54 mm 间距),槽口 58 × 10 mm,两侧 M3 | | 串口 | DE-9 母座(6850 + MAX232 侧出) | -## 2. 分区(栅格:三列 56 mm,列间 4 mm;两行,行间 6 mm) +## 2. 布局(Altair 8800 的排法) + +照着 8800 的面板语言排:**指示灯排在上、拨动开关排在中、功能键压在底部**,右侧留给 I/O。 + | 区 | 位置 | 内容 | |---|---|---| | **CELL** | 列一 / 上行 | 8 颗灯泡成一圈:**bit 0 在 9 点带楔形、刻 `0`**,其余顺时针标 `1..7` | | **INSTRUCTION** | 列二 / 上行 | 8 颗灯 + 符号 `> < + - [ ] . ,`,当前那条亮 | -| **INPUT BYTE** | 列二 / 上行偏下 | **8 个拨动开关**,下面刻 `7 6 5 4 3 2 1 0`;右边红色 **SEND** 按钮 | +| **INPUT BYTE** | 左半 / 第四行 | **8 个拨动开关(chrome 拨杆,8800 那种)**,下面刻 `7 6 5 4 3 2 1 0`;右边红色 **SEND** 按钮 | | **DATA POINTER** | 列三 / 上行 | **6 颗红氖泡**,二进制显示 `dp`(bit 5 在左,bit 0 在右) | | **PROGRAM CARTRIDGE** | 列一 / 下行 | 卡边槽,插 27C512 卡带 | | **SERIAL / 6850** | 列三 / 下行 | DE-9 | diff --git a/hardware/panel_mockup_vintage.py b/hardware/panel_mockup_vintage.py index 7a0f40c..631017b 100644 --- a/hardware/panel_mockup_vintage.py +++ b/hardware/panel_mockup_vintage.py @@ -1,16 +1,18 @@ -"""ROT-8 front panel: light "trainer" paint, orange group rules, real hardware I/O. +"""ROT-8 panel in the Altair 8800 idiom: bands of indicators above a bank of toggles. -Two rows of sections divided by orange hairlines, the way a 1970s instrument panel -was painted: cell bits on a dial (LSB at nine o'clock, wedge marked 0, the rest -labelled 1..7), the instruction lamps, eight labelled slide switches with a SEND -button, the 64 cells as an 8 x 8 lamp matrix with the pointer blinking, a card edge -cartridge slot for the 27C512 program "tape", and a DE-9 for the 6850 serial line. +The 8800's panel is a field of rows -- indicator rows at the top, a toggle switch +bank below them, function switches along the bottom -- in blue-grey with white +legends. This panel keeps that arrangement and those proportions and puts the +ROT-8 state in it: six neons for the data pointer, eight for the pointed cell +(bit 0 marked with a wedge), eight for the instruction, eight toggle switches for +the input byte, and STEP / START / HALT / RESET along the bottom. The cartridge +slot and the serial connector sit at the right, as the 8800 puts its I/O at the +edges. -Nothing numeric is displayed: results come out of the serial port. +No numeric display: results come out of the serial port. python hardware/panel_mockup_vintage.py hardware/panel-mockup-vintage.png """ -import math import sys from PIL import Image, ImageDraw, ImageFilter, ImageFont @@ -18,25 +20,19 @@ from PIL import Image, ImageDraw, ImageFilter, ImageFont S = 7 W, H = 200 * S, 100 * S -BEZEL = (176, 173, 166) -BEZEL_EDGE = (128, 125, 119) -PAINT = (206, 200, 188) -PAINT_SHADE = (196, 190, 177) -ORANGE = (181, 78, 42) -INK = (62, 56, 48) -INK_DIM = (116, 108, 96) -STEEL = (150, 148, 144) -DARK = (30, 27, 24) -LAMP_OFF = (58, 44, 32) -LAMP_ON = (255, 116, 44) # neon orange-red -CURSOR = (255, 96, 36) # same neon for the dp lamps -RED_BUTTON = (122, 40, 32) - -# one module grid: three columns, two rows, 4 mm gutters -COL = (12.0, 72.0, 132.0) -COLW = 56.0 -RIGHT = 188.0 -ROW_B = 68.0 +PAINT = (116, 132, 146) # Altair blue-grey +PAINT_HI = (132, 148, 162) +PAINT_LO = (98, 113, 127) +BEZEL = (74, 78, 82) +LEGEND = (238, 241, 243) +LEGEND_DIM = (198, 206, 214) +NEON = (255, 104, 52) +NEON_DIM = (44, 39, 38) +CURSOR = (255, 92, 40) +CHROME = (198, 202, 206) +CHROME_DARK = (128, 132, 136) +RED_BTN = (150, 34, 28) +GREEN_BTN = (40, 96, 60) def font(pt, serif=False): @@ -54,175 +50,147 @@ def p(v): return int(round(v * S)) -def spaced(d, x, y, text, f, fill, tracking=1.6): - """Letter spaced small caps, the way panel legends were engraved.""" +def legend(d, x, y, text, size=1.35, fill=LEGEND_DIM, track=0.55): + f = font(size) cx = x for ch in text: d.text((p(cx), p(y)), ch, font=f, fill=fill) - cx += (d.textlength(ch, font=f) / S) + tracking / 10.0 + cx += d.textlength(ch, font=f) / S + track -def section(d, x, y, text, width): - d.text((p(x), p(y)), text, font=font(1.6), fill=INK) - d.line([p(x), p(y + 3.4), p(x + width), p(y + 3.4)], fill=ORANGE, - width=max(1, p(0.3))) - - -def screw(d, x, y, r=1.5): - d.ellipse([p(x - r), p(y - r), p(x + r), p(y + r)], fill=STEEL, - outline=(96, 94, 90), width=max(1, p(0.2))) - d.line([p(x - r * 0.65), p(y), p(x + r * 0.65), p(y)], fill=(84, 82, 78), - width=max(1, p(0.25))) - - -def lamp(d, g, x, y, r, lit, colour=LAMP_ON): - d.ellipse([p(x - r - 0.5), p(y - r - 0.5), p(x + r + 0.5), p(y + r + 0.5)], - fill=(92, 86, 78), outline=(70, 65, 58), width=max(1, p(0.18))) +def lamp(d, g, x, y, r, lit, colour=NEON): + d.ellipse([p(x - r - 0.45), p(y - r - 0.45), p(x + r + 0.45), p(y + r + 0.45)], + fill=(28, 26, 26), outline=(88, 96, 104), width=max(1, p(0.16))) if lit: - g.ellipse([p(x - r * 1.5), p(y - r * 1.5), p(x + r * 1.5), p(y + r * 1.5)], - fill=colour + (190,)) + g.ellipse([p(x - r * 1.7), p(y - r * 1.7), p(x + r * 1.7), p(y + r * 1.7)], + fill=colour + (200,)) d.ellipse([p(x - r), p(y - r), p(x + r), p(y + r)], - fill=colour if lit else LAMP_OFF) + fill=colour if lit else NEON_DIM) -def slide_switch(d, x, y, up): - d.rounded_rectangle([p(x), p(y), p(x + 3.4), p(y + 6.0)], radius=p(0.4), - fill=(150, 146, 138), outline=(104, 100, 94), - width=max(1, p(0.18))) - ly = y + 1.0 if not up else y + 3.0 - d.rounded_rectangle([p(x + 0.7), p(ly), p(x + 2.7), p(ly + 2.0)], - radius=p(0.3), fill=(226, 222, 210), - outline=(120, 116, 108), width=max(1, p(0.15))) +def toggle(d, x, y, up): + """A toggle switch from the front: chrome bushing and a bat lever.""" + d.ellipse([p(x - 1.9), p(y - 1.9), p(x + 1.9), p(y + 1.9)], fill=CHROME_DARK, + outline=(70, 74, 78), width=max(1, p(0.15))) + d.ellipse([p(x - 1.5), p(y - 1.5), p(x + 1.5), p(y + 1.5)], fill=(96, 100, 104)) + tipx, tipy = (x, y - 4.3) if up else (x, y + 4.3) + d.line([p(x), p(y), p(tipx), p(tipy)], fill=CHROME, width=p(0.75)) + d.ellipse([p(tipx - 1.0), p(tipy - 1.0), p(tipx + 1.0), p(tipy + 1.0)], + fill=(232, 234, 236)) -def de9(d, x, y, w, h): - d.polygon([(p(x + 2.4), p(y)), (p(x + w - 2.4), p(y)), - (p(x + w), p(y + h)), (p(x), p(y + h))], - fill=STEEL, outline=(104, 102, 98)) - d.polygon([(p(x + 3.4), p(y + 1.2), ), (p(x + w - 3.4), p(y + 1.2)), - (p(x + w - 1.4), p(y + h - 1.2)), (p(x + 1.4), p(y + h - 1.2))], - fill=(64, 62, 58)) - for i in range(5): - px = x + 5.0 + i * (w - 10.0) / 4.0 - d.ellipse([p(px - 0.75), p(y + 2.4), p(px + 0.75), p(y + 3.9)], - fill=(198, 194, 184)) - for i in range(4): - px = x + 7.1 + i * (w - 14.2) / 3.0 - d.ellipse([p(px - 0.75), p(y + 4.6), p(px + 0.75), p(y + 6.1)], - fill=(198, 194, 184)) +def button(d, x, y, r, colour, label): + d.ellipse([p(x - r), p(y - r), p(x + r), p(y + r)], fill=CHROME_DARK, + outline=(70, 74, 78), width=max(1, p(0.18))) + d.ellipse([p(x - r + 0.8), p(y - r + 0.8), p(x + r - 0.8), p(y + r - 0.8)], + fill=colour, outline=(52, 56, 60), width=max(1, p(0.18))) + tw = d.textlength(label, font=font(1.1)) + d.text((p(x) - tw / 2, p(y + r + 1.0)), label, font=font(1.1), fill=LEGEND_DIM) def card_slot(d, x, y, w, h): - d.rounded_rectangle([p(x), p(y), p(x + w), p(y + h)], radius=p(1.0), - fill=(44, 42, 39), outline=(104, 100, 94), - width=max(1, p(0.3))) - d.rounded_rectangle([p(x + 3.0), p(y + 3.0), p(x + w - 3.0), p(y + h - 3.0)], - radius=p(0.5), fill=(18, 17, 16)) - for i in range(22): - fx = x + 5.2 + i * (w - 10.4) / 21.0 - d.line([p(fx), p(y + 4.2), p(fx), p(y + h - 4.2)], fill=(120, 108, 84), - width=max(1, p(0.2))) - for sx in (x + 2.2, x + w - 2.2): - screw(d, sx, y + h / 2, r=1.2) + d.rounded_rectangle([p(x), p(y), p(x + w), p(y + h)], radius=p(0.8), + fill=(36, 38, 40), outline=(84, 90, 96), + width=max(1, p(0.28))) + d.rounded_rectangle([p(x + 2.4), p(y + 2.4), p(x + w - 2.4), p(y + h - 2.4)], + radius=p(0.4), fill=(14, 15, 16)) + for i in range(20): + fx = x + 4.4 + i * (w - 8.8) / 19.0 + d.line([p(fx), p(y + 3.6), p(fx), p(y + h - 3.6)], fill=(126, 112, 88), + width=max(1, p(0.18))) + + +def de9(d, x, y, w, h): + d.polygon([(p(x + 2.2), p(y)), (p(x + w - 2.2), p(y)), + (p(x + w), p(y + h)), (p(x), p(y + h))], + fill=CHROME, outline=(70, 74, 78)) + d.polygon([(p(x + 3.2), p(y + 1.2)), (p(x + w - 3.2), p(y + 1.2)), + (p(x + w - 1.4), p(y + h - 1.2)), (p(x + 1.4), p(y + h - 1.2))], + fill=(56, 58, 60)) + for i in range(5): + px = x + 4.8 + i * (w - 9.6) / 4.0 + d.ellipse([p(px - 0.7), p(y + 2.3), p(px + 0.7), p(y + 3.7)], + fill=(206, 210, 212)) + for i in range(4): + px = x + 6.8 + i * (w - 13.6) / 3.0 + d.ellipse([p(px - 0.7), p(y + 4.5), p(px + 0.7), p(y + 5.9)], + fill=(206, 210, 212)) def main(): out = sys.argv[1] if len(sys.argv) > 1 else "panel-mockup-vintage.png" - img = Image.new("RGB", (W, H), (18, 18, 18)) + img = Image.new("RGB", (W, H), (16, 16, 18)) d = ImageDraw.Draw(img) - # bezel, paint, corner screws - d.rounded_rectangle([p(2.5), p(2.5), p(197.5), p(97.5)], radius=p(2.6), - fill=BEZEL, outline=BEZEL_EDGE, width=p(0.5)) - d.rounded_rectangle([p(6.5), p(6.5), p(193.5), p(93.5)], radius=p(1.4), - fill=PAINT, outline=PAINT_SHADE, width=p(0.3)) - for sx, sy in ((10.5, 10.5), (189.5, 10.5), (10.5, 89.5), (189.5, 89.5)): - screw(d, sx, sy, r=1.6) + d.rounded_rectangle([p(2.4), p(2.4), p(197.6), p(97.6)], radius=p(1.8), + fill=BEZEL, outline=(40, 42, 44), width=p(0.5)) + d.rounded_rectangle([p(5.0), p(5.0), p(195.0), p(95.0)], radius=p(0.6), + fill=PAINT, outline=PAINT_LO, width=p(0.35)) + d.rectangle([p(5.0), p(5.0), p(195.0), p(6.2)], fill=PAINT_HI) glow = Image.new("RGBA", (W, H), (0, 0, 0, 0)) g = ImageDraw.Draw(glow) - # ---- title ------------------------------------------------------------- - d.text((p(12), p(10.4)), "ROT-8", font=font(5.2, serif=True), fill=INK) - d.rectangle([p(41.5), p(10.8), p(43.0), p(19.6)], fill=ORANGE) - spaced(d, 45.0, 14.2, "8-BIT MICROCOMPUTER TRAINER", font(1.55), INK) - d.line([p(12), p(22.4), p(RIGHT), p(22.4)], fill=ORANGE, width=max(1, p(0.3))) + # title, the way the 8800 sets its name: heavy, left, white + d.text((p(11.5), p(8.8)), "ROT-8", font=font(5.0), fill=LEGEND) + d.line([p(11.5), p(16.2), p(56.0), p(16.2)], fill=LEGEND_DIM, + width=max(1, p(0.25))) + legend(d, 11.5, 17.0, "8-BIT COMPUTER · 64 CELL DATA RING") - # ---- CELL: eight lamps on a dial, LSB at nine o'clock ------------------- - section(d, COL[0], 24.6, "CELL", 44) - ccx, ccy, cr = COL[0] + 26.0, 42.4, 9.2 - d.ellipse([p(ccx - cr), p(ccy - cr), p(ccx + cr), p(ccy + cr)], - outline=(178, 172, 160), width=p(0.25)) - bits = [1, 0, 0, 1, 1, 0, 1, 0] # bit 0 .. bit 7 - lr = 2.9 - for i, bit in enumerate(bits): - a = math.pi - i * (2 * math.pi / 8) # bit 0 at nine, clockwise - px, py = ccx + cr * math.cos(a), ccy + cr * math.sin(a) - lamp(d, g, px, py, lr, bool(bit)) - if i: - lx = ccx + (cr + lr + 2.6) * math.cos(a) - 0.8 - ly = ccy + (cr + lr + 2.6) * math.sin(a) - 1.1 - d.text((p(lx), p(ly)), str(i), font=font(1.5), fill=INK_DIM) - tip = (ccx - (cr + lr + 0.7), ccy) - base = (ccx - (cr + lr + 4.6), ccy) - d.polygon([(p(tip[0]), p(tip[1])), (p(base[0]), p(base[1] - 2.2)), - (p(base[0]), p(base[1] + 2.2))], fill=INK) - d.text((p(base[0] - 3.4), p(ccy - 1.0)), "0", font=font(1.6), fill=INK) - - # ---- INSTRUCTION ------------------------------------------------------- - section(d, COL[1], 24.6, "INSTRUCTION", 50) - for i, op in enumerate("><+-[].,"): - x = COL[1] + 2.4 + i * 6.9 - lamp(d, g, x, 33.6, 2.5, i == 1) - d.text((p(x - 1.2), p(38.0)), op, font=font(1.9), fill=INK) - - # ---- INPUT BYTE: eight switches, numbered, plus SEND ------------------- - section(d, COL[1], 43.4, "INPUT BYTE", 34) - for i in range(8): - x = COL[1] + 2.6 + i * 5.4 - slide_switch(d, x, 48.8, up=(i % 3 != 0)) - d.text((p(x + 0.5), p(55.8)), str(7 - i), font=font(1.5), fill=INK_DIM) - d.text((p(COL[1] + 46.0), p(44.4)), "SEND", font=font(1.5), fill=INK) - d.ellipse([p(COL[1] + 44.4), p(48.0), p(COL[1] + 53.6), p(57.2)], - fill=STEEL, outline=(104, 100, 94), width=p(0.25)) - d.ellipse([p(COL[1] + 45.4), p(49.0), p(COL[1] + 52.6), p(56.2)], - fill=RED_BUTTON, outline=(70, 24, 20), width=p(0.25)) - - # ---- DP: six red neons, binary, straight off the counter ---------------- - # A lamp matrix would need a decoder and could not mark one cell specially; - # six lamps show the pointer exactly, with no logic at all. - section(d, COL[2], 24.6, "DATA POINTER", 56) + # ---- indicator row 1: data pointer ------------------------------------- + legend(d, 11.5, 23.6, "DATA POINTER") dp = 33 for i in range(6): - x = COL[2] + 6.0 + (5 - i) * 8.6 # bit 5 left, bit 0 right - lamp(d, g, x, 33.4, 2.3, bool((dp >> (5 - i)) & 1), CURSOR) - d.text((p(x - 0.7), p(37.0)), str(5 - i), font=font(1.3), fill=INK_DIM) + x = 12.8 + (5 - i) * 8.4 + lamp(d, g, x, 30.2, 2.0, bool((dp >> (5 - i)) & 1), CURSOR) + d.text((p(x - 0.6), p(33.4)), str(5 - i), font=font(1.2), fill=LEGEND_DIM) - # ---- buttons: STEP START HALT RESET ------------------------------------ - for cx_, colour, label in ((17.0, RED_BUTTON, "STEP"), - (30.0, (52, 92, 58), "START"), - (43.0, (146, 60, 44), "HALT"), - (56.0, (58, 56, 52), "RESET")): - d.ellipse([p(cx_ - 4.0), p(59.3 - 3.9), p(cx_ + 3.9), p(59.3 + 3.9)], - fill=STEEL, outline=(104, 100, 94), width=p(0.22)) - d.ellipse([p(cx_ - 3.2), p(59.3 - 3.1), p(cx_ + 3.1), p(59.3 + 3.1)], - fill=colour, outline=(66, 60, 54), width=p(0.22)) - tw = d.textlength(label, font=font(1.15)) - d.text((p(cx_) - tw / 2, p(63.9)), label, font=font(1.1), fill=INK_DIM) - # ---- lower row --------------------------------------------------------- - d.line([p(12), p(65.4), p(RIGHT), p(65.4)], fill=ORANGE, width=max(1, p(0.3))) - d.text((p(COL[0]), p(ROW_B)), "PROGRAM / 27C512", font=font(1.6), fill=INK) - card_slot(d, COL[0], ROW_B + 3.6, COLW, 13.0) - d.text((p(COL[2]), p(ROW_B)), "SERIAL / 6850", font=font(1.6), fill=INK) - de9(d, COL[2] + 4.0, ROW_B + 3.6, 30.0, 10.0) + # ---- indicator row 2: the pointed cell, bit 7 .. bit 0 ------------------ + legend(d, 11.5, 39.0, "CELL") + bits = [1, 0, 0, 1, 1, 0, 1, 0] # bit 7 .. bit 0, left to right + for i, bit in enumerate(bits): + x = 12.8 + i * 8.4 + lamp(d, g, x, 45.6, 2.0, bool(bit)) + d.text((p(x - 0.6), p(48.8)), str(7 - i), font=font(1.2), fill=LEGEND_DIM) + d.polygon([(p(12.8 + 7 * 8.4 + 3.4), p(45.6)), + (p(12.8 + 7 * 8.4 + 6.0), p(45.6 - 1.9)), + (p(12.8 + 7 * 8.4 + 6.0), p(45.6 + 1.9))], fill=LEGEND) + d.text((p(12.8 + 7 * 8.4 + 6.6), p(44.7)), "LSB", font=font(1.15), + fill=LEGEND_DIM) - # the middle of the lower row carries the plate legend, not a readout - d.text((p(COL[1]), p(ROW_B + 1.0)), "1 MHz · 8 BIT CELLS · 64 CELL DATA RING", - font=font(1.4), fill=INK_DIM) - d.text((p(COL[1]), p(ROW_B + 5.0)), "27C512 PROGRAM · 6116 DATA · 74LS CONTROL", - font=font(1.4), fill=INK_DIM) - d.text((p(COL[1]), p(ROW_B + 9.0)), "NO NUMBERS ON THE PANEL: RESULTS VIA SERIAL", - font=font(1.4), fill=INK_DIM) + # ---- indicator row 3: instruction -------------------------------------- + legend(d, 11.5, 55.0, "INSTRUCTION") + for i, op in enumerate("><+-[].,"): + x = 12.8 + i * 8.4 + lamp(d, g, x, 61.4, 2.0, i == 1) + d.text((p(x - 1.1), p(64.4)), op, font=font(1.6), fill=LEGEND) + + # ---- toggle bank: the input byte --------------------------------------- + legend(d, 11.5, 70.0, "INPUT BYTE") + for i in range(8): + x = 12.8 + i * 8.4 + toggle(d, x, 77.0, up=(i % 3 != 0)) + d.text((p(x - 0.6), p(82.6)), str(7 - i), font=font(1.2), fill=LEGEND_DIM) + button(d, 92.0, 77.0, 4.0, RED_BTN, "SEND") + + # ---- function switches along the bottom -------------------------------- + for x, colour, label in ((17.0, RED_BTN, "STEP"), + (33.0, GREEN_BTN, "START"), + (49.0, RED_BTN, "HALT"), + (65.0, (58, 62, 66), "RESET")): + button(d, x, 88.4, 3.5, colour, label) + + # ---- right side: cartridge and serial ---------------------------------- + legend(d, 106.0, 23.6, "PROGRAM / 27C512") + card_slot(d, 106.0, 27.6, 50.0, 12.0) + legend(d, 106.0, 44.6, "SERIAL / 6850") + de9(d, 106.0, 48.6, 26.0, 10.0) + + for i, line in enumerate(("1 MHz · 8 BIT CELLS", + "27C512 + 6116 + 74LS", + "NO NUMBERS: RESULTS VIA SERIAL")): + d.text((p(106.0), p(65.0 + i * 3.6)), line, font=font(1.3), + fill=LEGEND_DIM) img = Image.alpha_composite( img.convert("RGBA"),