-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpdp11.star
186 lines (162 loc) · 5.31 KB
/
pdp11.star
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
"""
Applet: PDP11
Summary: PDP11 with Blinking LEDs
Description: A PDP11/70 Visualizer with random blinking LEDs. Inspired by the PiDP11 kit, this
shows what the front panel of a PDP11 would look like. The PDP11 was a groundbreaking 16-bit
computer from the early 1970s made by Digital Equipment. The bottom row on a real system would be
physical address and control switches.
Author: Matt Fischer
"""
# Copyright (C) 2024 Matt Fischer - All Rights Reserved
load("encoding/base64.star", "base64")
load("random.star", "random")
load("render.star", "render")
PDP11_ICON = base64.decode("""
iVBORw0KGgoAAAANSUhEUgAAAB4AAAAJCAYAAAAl45yBAAAAeElEQVQ4T9VTQQ7AIAgb/3/0JktqaiNVDzuMy
yLUljKMy8TdIlo4jNZ271jSigR5rXPeNZtmIsEAwR3nmEDxWeOJzBoFF3N3YRV0Z4jzNxuoRCvc6/i3ws6tTg
PY43/MRNWSVWKcH0Y928TV81i5hZgu6SfCO+/+AT5O7ApMY07rAAAAAElFTkSuQmCC
""")
RED = "#a12627"
PURPLE = "#4f1932"
COLOR_BOX_HEIGHT = 2
def topRow():
return render.Row(
main_align = "start",
cross_align = "start",
children = [
render.Image(src = PDP11_ICON),
],
)
def makeLed(ledOn):
LED_ON = "#ff1111"
BOX_ON = "#202020"
LED_OFF = "#220000"
BOX_OFF = "#090909"
if ledOn == True:
ledColor = LED_ON
boxColor = BOX_ON
else:
ledColor = LED_OFF
boxColor = BOX_OFF
return render.Box(
width = 3,
height = 4,
color = boxColor,
child = render.Box(
width = 1,
height = 1,
color = ledColor,
),
)
def randomLedRow(leftPad, count = 22):
leds = []
leds.append(render.Box(width = leftPad, height = 1))
for _ in range(count):
state = bool(random.number(0, 1))
leds.append(makeLed(state))
return render.Row(
main_align = "start",
cross_align = "start",
expanded = True,
children = leds,
)
def ledRow(leftPad, frameDelay = 12):
state1 = [randomLedRow(leftPad)] * frameDelay
state2 = [randomLedRow(leftPad)] * frameDelay
state3 = [randomLedRow(leftPad)] * frameDelay
state4 = [randomLedRow(leftPad)] * frameDelay
state5 = [randomLedRow(leftPad)] * frameDelay
state6 = [randomLedRow(leftPad)] * frameDelay
return render.Animation(
children = state1 + state2 + state3 + state4 + state5 + state6,
)
def secondRow():
small = 3
wide = 7
return render.Row(
main_align = "start",
cross_align = "start",
expanded = True,
children = [
render.Box(width = small, height = COLOR_BOX_HEIGHT, color = RED),
render.Box(width = wide, height = COLOR_BOX_HEIGHT, color = PURPLE),
render.Box(width = wide, height = COLOR_BOX_HEIGHT, color = RED),
render.Box(width = wide, height = COLOR_BOX_HEIGHT, color = PURPLE),
render.Box(width = wide, height = COLOR_BOX_HEIGHT, color = RED),
render.Box(width = wide, height = COLOR_BOX_HEIGHT, color = PURPLE),
render.Box(width = wide, height = COLOR_BOX_HEIGHT, color = RED),
render.Box(width = wide, height = COLOR_BOX_HEIGHT, color = PURPLE),
render.Box(width = wide, height = COLOR_BOX_HEIGHT, color = RED),
render.Box(width = wide, height = COLOR_BOX_HEIGHT, color = PURPLE),
],
)
def thirdRow(leftPad):
small = 3
wide = 7
return render.Row(
main_align = "start",
cross_align = "start",
expanded = True,
children = [
render.Box(width = leftPad, height = COLOR_BOX_HEIGHT),
render.Box(width = small, height = COLOR_BOX_HEIGHT, color = RED),
render.Box(width = wide, height = COLOR_BOX_HEIGHT, color = PURPLE),
render.Box(width = wide, height = COLOR_BOX_HEIGHT, color = RED),
render.Box(width = wide, height = COLOR_BOX_HEIGHT, color = PURPLE),
render.Box(width = wide, height = COLOR_BOX_HEIGHT, color = RED),
render.Box(width = wide, height = COLOR_BOX_HEIGHT, color = PURPLE),
render.Box(width = wide, height = COLOR_BOX_HEIGHT, color = RED),
],
)
def emptyRow(rowHeight = 1):
return render.Row(
main_align = "start",
cross_align = "start",
expanded = True,
children = [
render.Box(width = 50, height = rowHeight),
],
)
def makeBox(boxSize, boxColor):
return render.Box(
width = boxSize,
height = boxSize,
color = boxColor,
)
def emptyBox(boxSize):
return render.Box(
width = 1,
height = boxSize,
)
def bottomRow():
boxSize = 3
boxes = []
for _ in range(8):
boxes.append(makeBox(boxSize, RED))
boxes.append(emptyBox(boxSize))
boxes.append(makeBox(boxSize, PURPLE))
boxes.append(emptyBox(boxSize))
return render.Row(
main_align = "start",
cross_align = "start",
expanded = True,
children = boxes,
)
def render_pdp():
return render.Root(
child = render.Column(
children = [
topRow(),
emptyRow(),
secondRow(),
ledRow(1),
emptyRow(3),
thirdRow(20),
ledRow(20),
emptyRow(4),
bottomRow(),
],
),
)
def main():
return render_pdp()