… | |
… | |
15 | # |
15 | # |
16 | |
16 | |
17 | # If this file contains embedded ROMs, the above copyright notice does |
17 | # If this file contains embedded ROMs, the above copyright notice does |
18 | # not apply to them. |
18 | # not apply to them. |
19 | |
19 | |
20 | # this hack is not considered release ready in and way, shape, or form |
20 | use 5.010; |
21 | # ./vt102 bash |
21 | use strict; |
22 | # ./vt102 telnet towel.blinkenlights.nl |
22 | use integer; |
23 | # ./vt102 curl http://artscene.textfiles.com/vt100/trekvid.vt |
|
|
24 | # ./vt102 curl http://artscene.textfiles.com/vt100/surf.vt # in 3d! |
|
|
25 | |
|
|
26 | # TODO: ctrl |
|
|
27 | |
|
|
28 | use common::sense; |
23 | #use common::sense; |
29 | |
|
|
30 | $| = 1; |
|
|
31 | |
24 | |
32 | my $VT102 = 1; |
25 | my $VT102 = 1; |
33 | my $AVO = $VT102 || 1; |
26 | my $VT131 = 0; |
|
|
27 | my $AVO = 1; |
|
|
28 | |
|
|
29 | shift, ($VT102 = 0), ($AVO = 0) if $ARGV[0] =~ /^-?-vt100$/; |
|
|
30 | shift, ($VT102 = 0) if $ARGV[0] =~ /^-?-vt100\+avo$/; |
|
|
31 | shift if $ARGV[0] =~ /^-?-vt102$/; |
|
|
32 | shift, ($VT131 = 1) if $ARGV[0] =~ /^-?-vt131$/; |
|
|
33 | |
|
|
34 | # vt100 wps = word processing roms |
|
|
35 | # vt101 = vt102 - avo, but custom rom? really? |
|
|
36 | # vt103 = vt100 + tu58 tape drive |
|
|
37 | # vt125 = vt100 + gpo graphics processor |
|
|
38 | # vt132 = vt100 + avo, stp |
|
|
39 | # vt180 = vt100 + z80 cp/m |
|
|
40 | |
|
|
41 | if ($ARGV[0] =~ /^-/) { |
|
|
42 | die <<EOF; |
|
|
43 | |
|
|
44 | VT102, A VT100/102/131 SIMULATOR |
|
|
45 | |
|
|
46 | Usage: |
|
|
47 | |
|
|
48 | $0 [option] [program [args]] |
|
|
49 | |
|
|
50 | Examples: |
|
|
51 | |
|
|
52 | $0 bash |
|
|
53 | $0 telnet towel.blinkenlights.nl |
|
|
54 | $0 curl http://artscene.textfiles.com/vt100/trekvid.vt |
|
|
55 | $0 curl http://artscene.textfiles.com/vt100/surf.vt # in 3d! |
|
|
56 | |
|
|
57 | Option can be one of: |
|
|
58 | |
|
|
59 | --vt100 |
|
|
60 | --vt100+avo |
|
|
61 | --vt102 |
|
|
62 | --vt131 |
|
|
63 | |
|
|
64 | Non-obvious special keys are: |
|
|
65 | |
|
|
66 | SET UP Home |
|
|
67 | BACKSPACE Rubout |
|
|
68 | CAPS LOCK Prior/PgUp |
|
|
69 | NO SCROLL Next/PgDown |
|
|
70 | BREAK End |
|
|
71 | |
|
|
72 | Set-Up Guide: |
|
|
73 | |
|
|
74 | http://vt100.net/docs/vt102-ug/chapter3.html#S3.6 |
|
|
75 | |
|
|
76 | Author: |
|
|
77 | |
|
|
78 | Marc Lehmann <vt102\@schmorp.de> |
|
|
79 | |
|
|
80 | EOF |
|
|
81 | } |
|
|
82 | |
|
|
83 | ############################################################################# |
|
|
84 | # ROM/hardware init |
|
|
85 | |
|
|
86 | my $PTY; # the pty we allocated, if any |
34 | my $KBD = 1; |
87 | my $KBD = 1; |
35 | |
88 | |
36 | ############################################################################# |
|
|
37 | # rom initialising |
|
|
38 | |
|
|
39 | my $ROM = do { |
89 | my $ROMS = do { |
40 | binmode DATA; |
90 | binmode DATA; |
41 | local $/; |
91 | local $/; |
42 | <DATA> |
92 | <DATA> |
43 | }; |
93 | }; |
44 | |
94 | |
45 | 0x6001 == length $ROM or die "corrupted rom image"; |
95 | 0x6801 == length $ROMS or die "corrupted rom image"; |
46 | |
|
|
47 | binmode STDOUT; |
|
|
48 | |
96 | |
49 | my @M = (0xff) x 65536; # main memory, = (0xff) x 65536; |
97 | my @M = (0xff) x 65536; # main memory, = (0xff) x 65536; |
50 | |
98 | |
51 | # populate mem with rom contents |
99 | # populate mem with rom contents |
52 | if ($VT102) { |
100 | if ($VT102) { |
53 | @M[0x0000 .. 0x1fff] = unpack "C*", substr $ROM, 0x2000, 0x2000; |
101 | @M[0x0000 .. 0x1fff] = unpack "C*", substr $ROMS, 0x2000, 0x2000; |
54 | @M[0x8000 .. 0x9fff] = unpack "C*", substr $ROM, 0x4000, 0x2000; |
102 | @M[0x8000 .. 0x9fff] = unpack "C*", substr $ROMS, 0x4000, 0x2000; |
|
|
103 | @M[0xa000 .. 0xa7ff] = unpack "C*", substr $ROMS, 0x6000, 0x0800 if $VT131; |
55 | } else { |
104 | } else { |
56 | @M[0x0000 .. 0x1fff] = unpack "C*", substr $ROM, 0x0000, 0x2000; |
105 | @M[0x0000 .. 0x1fff] = unpack "C*", substr $ROMS, 0x0000, 0x2000; |
57 | } |
106 | } |
58 | |
107 | |
59 | ############################################################################# |
108 | ############################################################################# |
60 | # cpu registers and I/O support |
109 | # 8085 CPU registers and I/O support |
61 | |
|
|
62 | my $PTY; # the pty we allocated, if any |
|
|
63 | my $PRSTATUS = 0; |
|
|
64 | |
110 | |
65 | # 8080/8085 registers |
111 | # 8080/8085 registers |
66 | # b, c, d, e, h, l, a |
112 | my ($A, $B, $C, $D, $E, $H, $L); # 8 bit general purpose |
67 | my ($A, $B, $C, $D, $E, $H, $L, $A); |
113 | my ($PC, $SP, $IFF); # program counter, stack pointer, interrupt flag |
68 | my ($PC, $SP, $IFF, $FA, $FZ, $FS, $FP, $FC); |
114 | my ($FA, $FZ, $FS, $FP, $FC); # condition codes (psw) |
69 | |
115 | |
70 | my $RST = 0; # 8080 pending interrupts |
116 | my $RST = 0; # pending interrupts (external interrupt logic) |
71 | my $INTMASK = 7; # 8085 half interrupts |
117 | my $INTMASK = 7; # 8085 half interrupt mask |
72 | my $INTPEND = 0; # 8085 half interrupts |
118 | my $INTPEND = 0; # 8085 half interrupts pending |
73 | |
119 | |
74 | my $x; # dummy temp for instructions |
120 | my $CLK; # rather inexact clock, counts extended basic blocks |
75 | |
121 | |
76 | my $CLK; # rather inexact clock |
|
|
77 | |
|
|
78 | ############################################################################# |
122 | ############################################################################# |
79 | # the dreaded nvr1400 chip. not needed to get it going, but provided for reference |
123 | # the dreaded NVR1400 chip. not needed to get it going, but provided anyway |
80 | |
124 | |
81 | # nvram |
125 | # nvram |
82 | my @NVR = (0x3fff) x 100; # vt102: 214e accum, 214f only lower 8 bit used, first 44 bytes |
126 | my @NVR = (0x3fff) x 100; # vt102: 214e accum, 214f only lower 8 bit used, first 44 bytes |
83 | my $NVRADDR; |
127 | my $NVRADDR; |
84 | my $NVRDATA; |
128 | my $NVRDATA; |
… | |
… | |
93 | sub { $NVR[$_[0]] = 0x3fff; }, # 5 erase |
137 | sub { $NVR[$_[0]] = 0x3fff; }, # 5 erase |
94 | sub { $NVRDATA = $NVR[$_[0]]; }, # 6 read |
138 | sub { $NVRDATA = $NVR[$_[0]]; }, # 6 read |
95 | sub { }, # 7 standby |
139 | sub { }, # 7 standby |
96 | ); |
140 | ); |
97 | |
141 | |
98 | my @bitidx; |
142 | my @NVR_BITIDX; $NVR_BITIDX[1 << $_] = 9 - $_ for 0..9; |
99 | $bitidx[1 << $_] = 9 - $_ for 0..9; |
|
|
100 | |
143 | |
101 | # the nvr1400 state machine. what a monster |
144 | # the nvr1400 state machine. what a monster |
102 | sub nvr() { |
145 | sub nvr() { |
103 | my $a1 = $bitidx[(~$NVRADDR ) & 0x3ff]; |
146 | my $a1 = $NVR_BITIDX[(~$NVRADDR ) & 0x3ff]; |
104 | my $a0 = $bitidx[(~$NVRADDR >> 10) & 0x3ff]; |
147 | my $a0 = $NVR_BITIDX[(~$NVRADDR >> 10) & 0x3ff]; |
105 | |
|
|
106 | # printf "NVR %02x A %020b %d %d D %02x\n", $NVRLATCH, $NVRADDR & 0xfffff, $a1, $a0, $NVRDATA; |
|
|
107 | |
148 | |
108 | $NVRCMD[($NVRLATCH >> 1) & 7]($a1 * 10 + $a0, $NVRLATCH & 1) |
149 | $NVRCMD[($NVRLATCH >> 1) & 7]($a1 * 10 + $a0, $NVRLATCH & 1) |
109 | } |
150 | } |
110 | |
151 | |
111 | ############################################################################# |
152 | ############################################################################# |
|
|
153 | # I/O ports - output |
112 | |
154 | |
113 | my $DC11_REVERSE = 0; |
155 | my $DC11_REVERSE = 0; # light background? |
114 | |
156 | |
115 | my $XON = 1; # false if terminal wants us to pause |
157 | my $XON = 1; # false if terminal wants us to pause |
116 | my $PUSARTCMD; |
158 | my $PUSARTCMD; |
117 | |
159 | |
|
|
160 | my $KSTATUS; # keyboard status (click + scan flag + leds) |
118 | my @KXMIT; # current scan queue |
161 | my @KXMIT; # current scan queue |
119 | my %KXMIT; # currently pressed keys |
162 | my %KXMIT; # currently pressed keys |
120 | my @KQUEUE; # key event queue |
163 | my @KQUEUE; # key event queue |
121 | my $KXCNT; # count for debouncew |
164 | my $KXCNT; # count for debouncew |
122 | my @PUSARTRECV; |
165 | |
123 | my $KSTATUS; |
166 | my @PUSARTRECV; # serial input (to terminal) queue |
124 | |
167 | |
125 | sub out_00 { # pusartdata |
168 | sub out_00 { # pusartdata |
126 | # handle xon/xoff, but also pass it through |
169 | # handle xon/xoff, but also pass it through |
127 | if ($_[0] == 0x13) { |
170 | if ($_[0] == 0x13) { |
128 | $XON = 0; |
171 | $XON = 0; |
… | |
… | |
135 | syswrite $PTY, chr $_[0]; |
178 | syswrite $PTY, chr $_[0]; |
136 | |
179 | |
137 | $INTPEND |= 1; |
180 | $INTPEND |= 1; |
138 | } |
181 | } |
139 | |
182 | |
140 | sub out_01 { |
183 | sub out_01 { # pusartcmd |
141 | $PUSARTCMD = shift; |
184 | $PUSARTCMD = shift; |
142 | |
185 | |
143 | $INTPEND |= 1 if $PUSARTCMD & 0x01; # VT102, 5.5 txrdy |
186 | $INTPEND |= 1 if $PUSARTCMD & 0x01; # VT102, 5.5 txrdy |
144 | $INTPEND |= 2 if $PUSARTCMD & 0x04 && !@PUSARTRECV; # VT102, 6.5 rxrdy, needed for some reason |
187 | $INTPEND |= 2 if $PUSARTCMD & 0x04 && !@PUSARTRECV; # VT102, 6.5 rxrdy, needed for some reason |
145 | } |
188 | } |
146 | |
189 | |
147 | sub out_02 { } # baudrate generator |
190 | sub out_02 { } # baudrate generator |
148 | |
191 | |
149 | sub out_23 { } # unknown |
192 | sub out_23 { } # vt102 unknown |
150 | sub out_27 { } # unknown |
193 | sub out_27 { } # vt102 unknown |
151 | sub out_2f { } # unknown, connected to in 0f |
194 | sub out_2f { } # vt102 unknown, connected to in 0f |
152 | |
195 | |
153 | sub out_42 { } # brightness |
196 | sub out_42 { } # brightness |
154 | |
197 | |
155 | sub out_62 { |
198 | sub out_62 { # nvr latch register (4 bits) |
156 | $NVRLATCH = shift; |
199 | $NVRLATCH = shift; |
157 | } |
200 | } |
158 | |
201 | |
159 | sub out_a2 { |
202 | sub out_a2 { # device control 011 |
160 | my $dc11 = 0x0f & shift; |
203 | my $dc11 = 0x0f & shift; |
161 | |
204 | |
162 | $DC11_REVERSE = 1 if $dc11 == 0b1010; |
205 | $DC11_REVERSE = 1 if $dc11 == 0b1010; |
163 | $DC11_REVERSE = 0 if $dc11 == 0b1011; |
206 | $DC11_REVERSE = 0 if $dc11 == 0b1011; |
164 | } |
207 | } |
165 | |
208 | |
166 | sub out_c2 { } # unknown |
209 | sub out_c2 { } # unknown |
167 | sub out_d2 { } # 0..3 == 80c/132c/60hz/50hz |
210 | sub out_d2 { } # device control 012, 0..3 == 80c/132c/60hz/50hz |
168 | |
211 | |
169 | sub out_82 { |
212 | sub out_82 { # keyboard txmit |
170 | # keyboard |
213 | # CLICK STARTSCAN ONLINE LOCKED | L1 L2 L3 L4 (vt100) |
171 | |
|
|
172 | # CLICK STARTSCAN ONLINE LOCKED | CTS DSR INSERT L1(?) |
214 | # CLICK STARTSCAN ONLINE LOCKED | CTS DSR INS L1 (vt102) |
173 | # CLICK STARTSCAN ONLINE LOCKED | LED1 LED2 LED3 LED4 |
|
|
174 | $KSTATUS = $_[0]; |
215 | $KSTATUS = $_[0]; |
175 | |
216 | |
176 | # start new scan unless scan in progress |
217 | # start new scan unless scan is in progress |
177 | if (($_[0] & 0x40) && !@KXMIT) { |
218 | if (($_[0] & 0x40) && !@KXMIT) { |
178 | # do not reply with keys in locked mode |
219 | # do not reply with keys in locked mode |
179 | # or during post (0xff), |
220 | # or during post (0xff), |
180 | # mostly to skip init and not fail POST, |
221 | # mostly to skip init and not fail POST, |
181 | # and to send startup keys only when terminal is ready |
222 | # and to send startup keys only when terminal is ready |
… | |
… | |
201 | $RST |= 1; |
242 | $RST |= 1; |
202 | } |
243 | } |
203 | } |
244 | } |
204 | |
245 | |
205 | ############################################################################# |
246 | ############################################################################# |
|
|
247 | # I/O ports - input |
206 | |
248 | |
207 | my $NVRBIT; |
249 | my $NVRBIT; # the current nvr data bit |
208 | my $LBA; |
250 | my $LBA6; # twice the frequenxy of LBA7 |
209 | |
251 | |
210 | sub in_00 { # pusart data |
252 | sub in_00 { # pusart data |
211 | # interrupt not generated here, because infinite |
253 | # interrupt not generated here, because infinite |
212 | # speed does not go well with the vt102. |
254 | # speed does not go well with the vt102. |
213 | |
255 | |
… | |
… | |
217 | sub in_01 { # pusart status |
259 | sub in_01 { # pusart status |
218 | # DSR SYNDET FE OE | PE TXEMPTY RXRDY TXRDY |
260 | # DSR SYNDET FE OE | PE TXEMPTY RXRDY TXRDY |
219 | 0x85 + (@PUSARTRECV && 0x02) |
261 | 0x85 + (@PUSARTRECV && 0x02) |
220 | } |
262 | } |
221 | |
263 | |
222 | sub in_22 { # modem buffer(?) |
264 | sub in_22 { # modem buffer |
223 | # wild guess: -CTS -SPDI -RI -CD 0 0 0 0 |
265 | # wild guess: -CTS -SPDI -RI -CD 0 0 0 0 |
224 | 0x20 |
266 | 0x20 |
225 | } |
267 | } |
226 | |
268 | |
227 | sub in_0f { } # unknown, connected to out 2f |
269 | sub in_0f { 0xff } # vt102 unknown, connected to out 2f |
228 | |
270 | |
229 | sub in_42 { # flag buffer |
271 | sub in_42 { # flag buffer |
230 | ++$LBA; |
272 | ++$LBA6; |
231 | |
273 | |
232 | $NVRBIT = nvr ? 0x20 : 0x00 if ($LBA & 0x3) == 0x2; |
274 | $NVRBIT = nvr ? 0x20 : 0x00 if ($LBA6 & 0x3) == 0x2; |
233 | |
275 | |
234 | # KBD_XMITEMPTY LBA7 NVRDATA ODDFIELD - OPTION !GFX !AVO PUSART_TXRDY |
276 | # KBD_XMITEMPTY LBA7 NVRDATA ODDFIELD - OPTION !GFX !AVO PUSART_TXRDY |
235 | |
277 | |
236 | my $f = 0x85 | $NVRBIT; |
278 | my $f = 0x85 | $NVRBIT; |
237 | |
279 | |
238 | $f |= 0x02 unless $AVO; |
280 | $f |= 0x02 unless $AVO; |
239 | $f |= 0x40 if $LBA & 0x2; |
281 | $f |= 0x40 if $LBA6 & 0x2; |
240 | |
282 | |
241 | $f |
283 | $f |
242 | } |
284 | } |
243 | |
285 | |
244 | sub in_82 { # tbmt keyboard uart |
286 | sub in_82 { # tbmt keyboard uart |
… | |
… | |
246 | |
288 | |
247 | $RST |= 1; |
289 | $RST |= 1; |
248 | shift @KXMIT |
290 | shift @KXMIT |
249 | } |
291 | } |
250 | |
292 | |
251 | sub in_03 { 0xff } # unknown, printer uart input? |
293 | sub in_03 { 0xff } # vt102 unknown, printer uart input? |
252 | sub in_0b { 0xff } # unknown |
294 | sub in_0b { 0xff } # vt102 unknown |
253 | sub in_17 { 0xff } # unknown, printer status clear by reading? |
295 | sub in_17 { 0xff } # vt102 unknown, printer status clear by reading? |
254 | sub in_1b { 0xff } # unknown |
296 | sub in_1b { 0xff } # vt102 unknown |
255 | |
297 | |
256 | ############################################################################# |
298 | ############################################################################# |
|
|
299 | # 8085 cpu opcodes and flag handling |
257 | |
300 | |
|
|
301 | my $x; # dummy scratchpad for opcodes |
|
|
302 | |
258 | sub sf { # set flags (ZSC - AP not implemented) |
303 | sub sf { # set flags, full version (ZSC - AP not implemented) |
|
|
304 | $FS = $_[0] & 0x080; |
|
|
305 | $FZ = !($_[0] & 0x0ff); |
|
|
306 | $FC = $_[0] & 0x100; |
|
|
307 | |
|
|
308 | $_[0] &= 0xff; |
|
|
309 | } |
|
|
310 | |
|
|
311 | sub sf8 { # set flags, for 8-bit results (ZSC - AP not implemented) |
|
|
312 | $FS = $_[0] & 0x080; |
|
|
313 | $FZ = !($_[0] & 0x0ff); |
|
|
314 | $FC = 0; |
|
|
315 | } |
|
|
316 | |
|
|
317 | sub sf_nc { # set flags, except carry |
259 | $FS = $_[0] & 0x080; |
318 | $FS = $_[0] & 0x080; |
260 | $FZ = ($_[0] & 0x0ff) == 0; |
319 | $FZ = ($_[0] & 0x0ff) == 0; |
261 | $FC = $_[0] & 0x100; |
|
|
262 | |
320 | |
263 | $_[0] & 0xff |
321 | $_[0] &= 0xff; |
264 | } |
322 | } |
265 | |
323 | |
266 | sub sf_nc { # set flags except carry |
324 | # opcode table |
267 | $FS = $_[0] & 0x080; |
|
|
268 | $FZ = ($_[0] & 0x0ff) == 0; |
|
|
269 | |
|
|
270 | $_[0] & 0xff |
|
|
271 | } |
|
|
272 | |
|
|
273 | my @op = map { sprintf "status(); die 'unknown op %02x'", $_ } 0 .. 255; |
325 | my @op = map { sprintf "status(); die 'unknown op %02x'", $_ } 0x00 .. 0xff; |
274 | my @ops; |
|
|
275 | |
326 | |
276 | my @reg = qw($B $C $D $E $H $L $M[$H*256+$L] $A); |
327 | my @reg = qw($B $C $D $E $H $L $M[$H*256+$L] $A); # r/m encoding |
277 | my @cc = ('if !$FZ', 'if $FZ', 'if !$FC', 'if $FC', ';die', ';die', 'if !$FS', 'if $FS'); # die == unimplemented $FP parity |
328 | my @cc = ('!$FZ', '$FZ', '!$FC', '$FC', 'die;', 'die;', '!$FS', '$FS'); # cc encoding. die == unimplemented $FP parity |
|
|
329 | |
|
|
330 | $op[0x00] = ''; # nop |
278 | |
331 | |
279 | # mov r,r / r,M / M,r |
332 | # mov r,r / r,M / M,r |
280 | for my $s (0..7) { |
333 | for my $s (0..7) { |
281 | for my $d (0..7) { |
334 | for my $d (0..7) { |
282 | $op[0x40 + $d * 8 + $s] = "$reg[$d] = $reg[$s]"; |
335 | $op[0x40 + $d * 8 + $s] = "$reg[$d] = $reg[$s]"; # mov |
283 | } |
336 | } |
284 | } |
337 | } |
285 | |
338 | |
286 | $op[0x00] = ''; |
339 | $op[0x76] = 'die "HLT"'; # hlt (mov m,m) |
|
|
340 | |
|
|
341 | # mvi r / M |
|
|
342 | $op[0x06 + $_ * 8] = "$reg[$_] = IMM8" for 0..7; |
287 | |
343 | |
288 | $op[0x01] = '($B, $C) = (IMM16 >> 8, IMM16 & 0xff)'; # lxi |
344 | $op[0x01] = '($B, $C) = (IMM16 >> 8, IMM16 & 0xff)'; # lxi |
289 | $op[0x11] = '($D, $E) = (IMM16 >> 8, IMM16 & 0xff)'; # lxi |
345 | $op[0x11] = '($D, $E) = (IMM16 >> 8, IMM16 & 0xff)'; # lxi |
290 | $op[0x21] = '($H, $L) = (IMM16 >> 8, IMM16 & 0xff)'; # lxi |
346 | $op[0x21] = '($H, $L) = (IMM16 >> 8, IMM16 & 0xff)'; # lxi |
291 | $op[0x31] = '$SP = IMM16' ; # lxi #d# 0xf000 because of limited stack |
347 | $op[0x31] = '$SP = IMM16' ; # lxi |
292 | |
348 | |
293 | $op[0x02] = '$M[$B * 256 + $C] = $A'; # stax |
349 | $op[0x02] = '$M[$B * 256 + $C] = $A'; # stax |
294 | $op[0x12] = '$M[$D * 256 + $E] = $A'; # stax |
350 | $op[0x12] = '$M[$D * 256 + $E] = $A'; # stax |
295 | $op[0x32] = '$M[IMM16 ] = $A'; # sta |
351 | $op[0x32] = '$M[IMM16 ] = $A'; # sta |
296 | |
352 | |
|
|
353 | $op[0x0a] = '$A = $M[$B * 256 + $C]'; # ldax b |
|
|
354 | $op[0x1a] = '$A = $M[$D * 256 + $E]'; # ldax d |
|
|
355 | $op[0x3a] = '$A = $M[IMM16]'; # lda |
|
|
356 | |
|
|
357 | $op[0x22] = '($M[IMM16], $M[IMM16 + 1]) = ($L, $H)'; # shld |
|
|
358 | $op[0x2a] = '($L, $H) = ($M[IMM16], $M[IMM16 + 1])'; # lhld |
|
|
359 | |
297 | sub inxdcx($$$) { |
360 | sub inxdcx($$$) { |
298 | $x = ($_[0] * 256 + $_[1] + $_[2]) & 0xffff; |
361 | $x = $_[0] * 256 + $_[1] + $_[2]; |
299 | $_[0] = $x >> 8; |
362 | ($_[0], $_[1]) = (($x >> 8) & 0xff, $x & 0xff); |
300 | $_[1] = $x & 0xff; |
|
|
301 | } |
363 | } |
302 | |
364 | |
303 | $op[0x03] = 'inxdcx $B, $C, 1'; # inx |
365 | $op[0x03] = 'inxdcx $B, $C, 1'; # inx |
304 | $op[0x13] = 'inxdcx $D, $E, 1'; # inx |
366 | $op[0x13] = 'inxdcx $D, $E, 1'; # inx |
305 | $op[0x23] = 'inxdcx $H, $L, 1'; # inx |
367 | $op[0x23] = 'inxdcx $H, $L, 1'; # inx |
… | |
… | |
308 | $op[0x1b] = 'inxdcx $D, $E, -1'; # dcx |
370 | $op[0x1b] = 'inxdcx $D, $E, -1'; # dcx |
309 | $op[0x2b] = 'inxdcx $H, $L, -1'; # dcx |
371 | $op[0x2b] = 'inxdcx $H, $L, -1'; # dcx |
310 | $op[0x3b] = '--$SP' ; # dcx |
372 | $op[0x3b] = '--$SP' ; # dcx |
311 | |
373 | |
312 | # "no carry" doesn't seem to be needed for vt100 - optimize? |
374 | # "no carry" doesn't seem to be needed for vt100 - optimize? |
313 | $op[0x04 + $_ * 8] = "$reg[$_] = sf_nc $reg[$_] + 1" for 0..7; # inr |
|
|
314 | $op[0x05 + $_ * 8] = "$reg[$_] = sf_nc $reg[$_] - 1" for 0..7; # dcr |
|
|
315 | |
|
|
316 | # mvi r / M |
|
|
317 | $op[0x06 + $_ * 8] = "$reg[$_] = IMM8" for 0..7; |
375 | $op[0x04 + $_ * 8] = "sf_nc ++$reg[$_]" for 0..7; # inr |
|
|
376 | $op[0x05 + $_ * 8] = "sf_nc --$reg[$_]" for 0..7; # dcr |
|
|
377 | |
|
|
378 | $op[0x07] = ' $FC = $A & 0x80; $A = (($A << 1) + ($FC && 0x01)) & 0xff '; # rlc |
|
|
379 | $op[0x17] = ' ($FC, $A) = ($A & 0x80, (($A << 1) + ($FC && 0x01)) & 0xff)'; # ral |
|
|
380 | $op[0x0f] = ' $FC = $A & 0x01; $A = ($A >> 1) | ($FC && 0x80) '; # rrc |
|
|
381 | $op[0x1f] = ' ($FC, $A) = ($A & 0x01, ($A >> 1) | ($FC && 0x80))'; # rar |
318 | |
382 | |
319 | # getting this insn wrong (its the only 16 bit insn to modify flags) |
383 | # getting this insn wrong (its the only 16 bit insn to modify flags) |
320 | # wasted three of my best days with mindless vt102 rom reverse engineering |
384 | # wasted three of my best days with mindless vt102 rom reverse engineering |
321 | sub dad { |
385 | sub dad { |
322 | $x = $H * 256 + $L + $_[0]; |
386 | $x = $H * 256 + $L + $_[0]; |
… | |
… | |
328 | $op[0x09] = 'dad $B * 256 + $C'; # dad |
392 | $op[0x09] = 'dad $B * 256 + $C'; # dad |
329 | $op[0x19] = 'dad $D * 256 + $E'; # dad |
393 | $op[0x19] = 'dad $D * 256 + $E'; # dad |
330 | $op[0x29] = 'dad $H * 256 + $L'; # dad |
394 | $op[0x29] = 'dad $H * 256 + $L'; # dad |
331 | $op[0x39] = 'dad $SP '; # dad |
395 | $op[0x39] = 'dad $SP '; # dad |
332 | |
396 | |
333 | $op[0x07] = ' $FC = $A >> 7; $A = ($A * 2 + $FC) & 0xff '; # rlc |
397 | $op[0x2f] = '$A ^= 0xff'; # cma |
334 | $op[0x17] = ' ($FC, $A) = ($A >> 7, ($A * 2 + $FC) & 0xff)'; # ral |
|
|
335 | |
398 | |
336 | $op[0x0f] = ' $FC = $A & 1; $A = ($A >> 1) | ($FC && 0x80) '; # rrc |
399 | $op[0x80 + $_] = 'sf $A += + ' . $reg[$_] for 0..7; # add |
337 | $op[0x1f] = ' ($FC, $A) = ($A & 1, ($A >> 1) | ($FC && 0x80))'; # rar |
400 | $op[0x88 + $_] = 'sf $A += ($FC && 1) + ' . $reg[$_] for 0..7; # adc |
|
|
401 | $op[0x90 + $_] = 'sf $A -= + ' . $reg[$_] for 0..7; # sub |
|
|
402 | $op[0x98 + $_] = 'sf $A -= ($FC && 1) + ' . $reg[$_] for 0..7; # sbb |
|
|
403 | $op[0xa0 + $_] = 'sf8 $A &= ' . $reg[$_] for 0..7; # ana |
|
|
404 | $op[0xa8 + $_] = 'sf8 $A ^= ' . $reg[$_] for 0..7; # xra |
|
|
405 | $op[0xb0 + $_] = 'sf8 $A |= ' . $reg[$_] for 0..7; # ora |
|
|
406 | $op[0xb8 + $_] = 'sf $x = $A - ' . $reg[$_] for 0..7; # cmp |
|
|
407 | # possible todo: optimize ora a, maybe xra a, possibly ana |
338 | |
408 | |
339 | $op[0x0a] = '$A = $M[$B * 256 + $C]'; # ldax b |
409 | $op[0xc6] = 'sf $A += IMM8'; # adi |
340 | $op[0x1a] = '$A = $M[$D * 256 + $E]'; # ldax d |
410 | $op[0xd6] = 'sf $A -= IMM8'; # sui |
341 | $op[0x3a] = '$A = $M[IMM16]'; # lda |
411 | $op[0xe6] = 'sf8 $A &= IMM8'; # ani |
|
|
412 | $op[0xee] = 'sf8 $A ^= IMM8'; # xri |
|
|
413 | $op[0xf6] = 'sf8 $A |= IMM8'; # ori |
|
|
414 | $op[0xfe] = 'sf $A - IMM8'; # cpi |
|
|
415 | # ce ACI NYI, apparently unused |
|
|
416 | # de SBI NYI, apparently unused |
342 | |
417 | |
|
|
418 | $op[0xc5] = 'PUSH $B; PUSH $C'; |
|
|
419 | $op[0xd5] = 'PUSH $D; PUSH $E'; |
|
|
420 | $op[0xe5] = 'PUSH $H; PUSH $L'; |
|
|
421 | $op[0xf5] = 'PUSH $A; PUSH +($FS && 0x80) | ($FZ && 0x40) | ($FA && 0x10) | ($FP && 0x04) | ($FC && 0x01)'; # psw |
|
|
422 | |
|
|
423 | $op[0xc1] = '($C, $B) = (POP, POP)'; # pop |
|
|
424 | $op[0xd1] = '($E, $D) = (POP, POP)'; # pop |
|
|
425 | $op[0xe1] = '($L, $H) = (POP, POP)'; # pop |
|
|
426 | $op[0xf1] = '($x, $A) = (POP, POP); ($FS, $FZ, $FA, $FP, $FC) = ($x & 0x80, $x & 0x40, $x & 0x10, $x & 0x04, $x & 0x01)'; # pop psw |
|
|
427 | |
|
|
428 | $op[0xc2 + $_ * 8] = 'BRA IMM16 if ' . $cc[$_] for 0..7; # jcc |
|
|
429 | $op[0xc3] = 'JMP IMM16'; # jmp |
|
|
430 | |
|
|
431 | $op[0xc4 + $_ * 8] = '(PUSH PC >> 8), (PUSH PC & 0xff), (BRA IMM16) if ' . $cc[$_] for 0..7; # ccc |
|
|
432 | $op[0xcd] = '(PUSH PC >> 8), (PUSH PC & 0xff), (BRA IMM16)'; # call |
|
|
433 | |
|
|
434 | $op[0xc0 + $_ * 8] = 'BRA POP + POP * 256 if ' . $cc[$_] for 0..7; # rcc |
|
|
435 | $op[0xc9] = 'JMP POP + POP * 256'; # ret |
|
|
436 | |
|
|
437 | $op[0xc7 + $_ * 8] = "JMP $_ * 8" for 0..7; # rst |
|
|
438 | |
|
|
439 | $op[0xe9] = 'JMP $H * 256 + $L'; # pchl |
|
|
440 | # f9 SPHL NYI, apparently unused |
|
|
441 | |
|
|
442 | $op[0x37] = '$FC = 1 '; # stc |
|
|
443 | $op[0x3f] = '$FC = !$FC'; # cmc |
|
|
444 | |
|
|
445 | $op[0xd3] = 'OUT'; # out |
|
|
446 | $op[0xdb] = 'IN'; # in |
|
|
447 | |
|
|
448 | $op[0xeb] = '($D, $E, $H, $L) = ($H, $L, $D, $E)'; # xchg |
|
|
449 | |
|
|
450 | # e3 xthl NYI # @ 917b in e69, hl <-> (sp) |
|
|
451 | |
343 | $op[0x20] = '$A = $INTPEND * 16 + $INTMASK + ($IFF && 8)'; # rim (incomplete) |
452 | $op[0x20] = '$A = $INTPEND * 16 + $INTMASK + ($IFF && 8)'; # rim (8085, incomplete) |
344 | $op[0x30] = '$INTMASK = $A & 7 if $A & 8'; # sim (incomplete) |
453 | $op[0x30] = '$INTMASK = $A & 7 if $A & 8'; # sim (8085, incomplete) |
345 | |
454 | |
346 | $op[0x22] = '($M[IMM16], $M[IMM16 + 1]) = ($L, $H)'; # shld |
455 | $op[0xf3] = '$IFF = 0'; # di |
347 | $op[0x2a] = '($L, $H) = ($M[IMM16], $M[IMM16 + 1])'; # lhld |
456 | $op[0xfb] = '$IFF = 1'; # ei |
348 | |
457 | |
349 | # yeah, the fucking setup screens actually use daa... |
458 | # yeah, the fucking setup screen actually uses daa... |
350 | $op[0x27] = ' |
459 | $op[0x27] = ' |
351 | my ($h, $l); |
460 | my ($h, $l); |
352 | |
461 | |
353 | ($h, $l) = ($A >> 4, $A & 15); |
462 | ($h, $l) = ($A >> 4, $A & 15); |
354 | |
463 | |
355 | if ($l > 9 || $FA) { |
464 | if ($l > 9 || $FA) { |
356 | $A = sf $A + 6; |
465 | sf $A += 6; |
357 | ($h, $l) = ($A >> 4, $A & 15); |
466 | ($h, $l) = ($A >> 4, $A & 15); |
358 | } |
467 | } |
359 | |
468 | |
360 | if ($h > 9 || $FC) { |
469 | if ($h > 9 || $FC) { |
361 | $h += 6; |
470 | $h += 6; |
362 | $A = ($h * 16 + $l) & 0xff; |
471 | $A = ($h * 16 + $l) & 0xff; |
363 | } |
472 | } |
364 | '; # daa, almost certainly borked, also, acarry not set by sf |
473 | '; # daa, almost certainly borked, also, acarry not set by sf |
365 | |
474 | |
366 | $op[0x2f] = '$A ^= 0xff'; # cma |
|
|
367 | |
|
|
368 | $op[0x37] = '$FC = 1 '; # stc |
|
|
369 | $op[0x3f] = '$FC = !$FC'; # cmc |
|
|
370 | |
|
|
371 | $op[0x76] = 'die "HLT"'; # hlt |
|
|
372 | |
|
|
373 | $op[0x80 + $_] = '$A = sf $A + ' . $reg[$_] for 0..7; # add |
|
|
374 | $op[0x88 + $_] = '$A = sf $A + $FC + ' . $reg[$_] for 0..7; # adc |
|
|
375 | $op[0x90 + $_] = '$A = sf $A - ' . $reg[$_] for 0..7; # sub |
|
|
376 | $op[0x98 + $_] = '$A = sf $A - $FC - ' . $reg[$_] for 0..7; # sbb |
|
|
377 | $op[0xa0 + $_] = '$A = sf $A & ' . $reg[$_] for 0..7; # ana |
|
|
378 | $op[0xa8 + $_] = '$A = sf $A ^ ' . $reg[$_] for 0..7; # xra |
|
|
379 | $op[0xb0 + $_] = '$A = sf $A | ' . $reg[$_] for 0..7; # ora |
|
|
380 | $op[0xb8 + $_] = ' sf $A - ' . $reg[$_] for 0..7; # cmp |
|
|
381 | # possible todo: optimize ora a, maybe xra a |
|
|
382 | |
|
|
383 | $op[0xc6 + $_] = '$A = sf $A + IMM8'; # adi |
|
|
384 | $op[0xd6 + $_] = '$A = sf $A - IMM8'; # sui |
|
|
385 | $op[0xe6 + $_] = '$A = sf $A & IMM8'; # ani |
|
|
386 | $op[0xee + $_] = '$A = sf $A ^ IMM8'; # xri |
|
|
387 | $op[0xf6 + $_] = '$A = sf $A | IMM8'; # ori |
|
|
388 | $op[0xfe + $_] = ' sf $A - IMM8'; # cpi |
|
|
389 | |
|
|
390 | $op[0xc1] = '($C, $B) = (POP, POP)'; # pop |
|
|
391 | $op[0xd1] = '($E, $D) = (POP, POP)'; # pop |
|
|
392 | $op[0xe1] = '($L, $H) = (POP, POP)'; # pop |
|
|
393 | $op[0xf1] = '($x, $A) = (POP, POP); ($FS, $FZ, $FA, $FP, $FC) = (!!($x & 0x80), !!($x & 0x40), !!($x & 0x10), !!($x & 0x04), !!($x & 0x01))'; # pop psw |
|
|
394 | |
|
|
395 | $op[0xeb] = '($D, $E, $H, $L) = ($H, $L, $D, $E)'; # xchg |
|
|
396 | |
|
|
397 | $op[0xc2 + $_ * 8] = 'BRA IMM16 ' . $cc[$_] for 0..7; # jcc |
|
|
398 | $op[0xc3] = 'JMP IMM16'; # jmp |
|
|
399 | |
|
|
400 | $op[0xc4 + $_ * 8] = '(PUSH PC >> 8), (PUSH PC & 0xff), (BRA IMM16) ' . $cc[$_] for 0..7; # ccc |
|
|
401 | $op[0xcd] = '(PUSH PC >> 8), (PUSH PC & 0xff), (BRA IMM16)'; # call |
|
|
402 | |
|
|
403 | $op[0xc7 + $_ * 8] = "JMP $_ * 8" for 0..7; # rst |
|
|
404 | |
|
|
405 | $op[0xc0 + $_ * 8] = 'BRA POP + POP * 256 ' . $cc[$_] for 0..7; # rcc |
|
|
406 | $op[0xc9] = 'JMP POP + POP * 256'; # ret |
|
|
407 | |
|
|
408 | $op[0xc5] = 'PUSH $B; PUSH $C'; |
|
|
409 | $op[0xd5] = 'PUSH $D; PUSH $E'; |
|
|
410 | $op[0xe5] = 'PUSH $H; PUSH $L'; |
|
|
411 | $op[0xf5] = 'PUSH $A; PUSH +($FS && 0x80) | ($FZ && 0x40) | ($FA && 0x10) | ($FP && 0x04) | ($FC && 0x01)'; # psw |
|
|
412 | |
|
|
413 | $op[0xd3] = 'OUT'; # out |
|
|
414 | $op[0xdb] = 'IN'; # in |
|
|
415 | |
|
|
416 | # e3 xthl @ 917b, hl <-> (sp) |
|
|
417 | |
|
|
418 | $op[0xe9] = 'JMP $H * 256 + $L'; # pchl |
|
|
419 | |
|
|
420 | $op[0xf3] = '$IFF = 0'; # DI |
|
|
421 | $op[0xfb] = '$IFF = 1'; # EI |
|
|
422 | |
|
|
423 | @ops = @op; # for debugging #d# |
|
|
424 | |
|
|
425 | ############################################################################# |
475 | ############################################################################# |
|
|
476 | # debug |
426 | |
477 | |
427 | # print cpu status, for debugging |
478 | # print cpu status, for debugging |
428 | sub status { |
479 | sub status { |
429 | my $PC = shift || $PC; |
480 | my $PC = shift || $PC; |
430 | |
481 | |
… | |
… | |
434 | ($FZ ? "1" : "0") |
485 | ($FZ ? "1" : "0") |
435 | . ($FS ? "1" : "0") |
486 | . ($FS ? "1" : "0") |
436 | . ($FC ? "1" : "0") |
487 | . ($FC ? "1" : "0") |
437 | . ($FA ? "1" : "0") |
488 | . ($FA ? "1" : "0") |
438 | . ($FP ? "1" : "0"), |
489 | . ($FP ? "1" : "0"), |
439 | $M[$PC], $ops[$M[$PC]]; |
490 | $M[$PC], $op[$M[$PC]]; |
440 | } |
491 | } |
441 | |
492 | |
442 | ############################################################################# |
493 | ############################################################################# |
|
|
494 | # video emulation |
443 | |
495 | |
444 | my @chr = ( |
496 | binmode STDOUT; |
|
|
497 | |
|
|
498 | my @CHARMAP = ( # acschars / chars 0..31 |
445 | " " , "\x{29eb}", "\x{2592}", "\x{2409}", |
499 | " " , "\x{29eb}", "\x{2592}", "\x{2409}", |
446 | "\x{240c}", "\x{240d}", "\x{240a}", "\x{00b0}", |
500 | "\x{240c}", "\x{240d}", "\x{240a}", "\x{00b0}", |
447 | "\x{00b1}", "\x{2424}", "\x{240b}", "\x{2518}", |
501 | "\x{00b1}", "\x{2424}", "\x{240b}", "\x{2518}", |
448 | "\x{2510}", "\x{250c}", "\x{2514}", "\x{253c}", |
502 | "\x{2510}", "\x{250c}", "\x{2514}", "\x{253c}", |
449 | "\x{23ba}", "\x{23bb}", "\x{2500}", "\x{23bc}", |
503 | "\x{23ba}", "\x{23bb}", "\x{2500}", "\x{23bc}", |
… | |
… | |
451 | "\x{252c}", "\x{2502}", "\x{2264}", "\x{2265}", |
505 | "\x{252c}", "\x{2502}", "\x{2264}", "\x{2265}", |
452 | "\x{03c0}", "\x{2260}", "\x{00a3}", "\x{00b7}", |
506 | "\x{03c0}", "\x{2260}", "\x{00a3}", "\x{00b7}", |
453 | (map chr, 0x020 .. 0x7e), |
507 | (map chr, 0x020 .. 0x7e), |
454 | ); |
508 | ); |
455 | |
509 | |
456 | utf8::encode $_ for @chr; |
510 | utf8::encode $_ for @CHARMAP; |
457 | |
511 | |
458 | my @sgr; # sgr sequences for attributes |
512 | my @SGR; # sgr sequences for attributes |
459 | |
513 | |
460 | for (0x00 .. 0xff) { |
514 | for (0x00 .. 0xff) { |
461 | my $sgr = ""; |
515 | my $sgr = ""; |
|
|
516 | |
|
|
517 | # ~1 sgr 5 blink |
|
|
518 | # ~2 sgr 4 underline |
|
|
519 | # ~4 sgr 1 bold |
|
|
520 | # 0x80 in attr, sgr 7, reversed |
462 | |
521 | |
463 | $sgr .= ";5" unless $_ & 0x01; |
522 | $sgr .= ";5" unless $_ & 0x01; |
464 | $sgr .= ";4" unless $_ & 0x02; |
523 | $sgr .= ";4" unless $_ & 0x02; |
465 | $sgr .= ";1" unless $_ & 0x04; |
524 | $sgr .= ";1" unless $_ & 0x04; |
466 | $sgr .= ";7" if $_ & 0x80; |
525 | $sgr .= ";7" if $_ & 0x80; |
467 | |
526 | |
468 | $sgr[$_] = "\e[${sgr}m"; |
527 | $SGR[$_] = "\e[${sgr}m"; |
469 | } |
528 | } |
470 | |
529 | |
471 | sub prscr { |
530 | my @LED = $VT102 |
|
|
531 | ? qw(L1 INSERT DSR CTS LOCKED LOCAL SCAN BEEP) |
|
|
532 | : qw(L4 L3 L2 L1 LOCKED LOCAL SCAN BEEP); |
|
|
533 | |
|
|
534 | my $CURSOR_IS_ON; |
|
|
535 | |
|
|
536 | # display screen |
|
|
537 | sub display { |
|
|
538 | # this is for the powersave mode - check whether the cursor is on here, |
|
|
539 | # and only allow powersave later when it was on the last display time |
|
|
540 | $CURSOR_IS_ON = $M[$VT102 ? 0x207b : 0x21ba]; |
|
|
541 | |
472 | my $i = 0x2000; |
542 | my $i = 0x2000; |
473 | |
543 | |
|
|
544 | my $leds = join " ", map $KSTATUS & 2**$_ ? "\e[7m$LED[$_]\e[m" : "$LED[$_]", reverse 0 .. $#LED; |
|
|
545 | |
474 | my $scr = sprintf "\e[H--- KBD %08b CLK %d\e[K\n", $KSTATUS, $CLK; |
546 | my $scr = sprintf "\e[H--- LED [ %s ] CLK %d\e[K\n", $leds, $CLK; |
475 | |
547 | |
476 | $scr .= "\e[?5" . ($DC11_REVERSE ? "h" : "l"); |
548 | $scr .= "\e[?5" . ($DC11_REVERSE ? "h" : "l"); |
477 | |
549 | |
478 | line: |
550 | line: |
479 | for my $y (0 .. 25) { # ntsc, two vblank delay lines, up to 24 text lines |
551 | for my $y (0 .. 25) { # ntsc, two vblank delay lines, up to 24 text lines |
480 | my $prev_sgr; |
552 | my $prev_sgr; |
481 | |
553 | |
482 | $scr .= sprintf "%2d |", ++$y; |
554 | $scr .= sprintf "%2d \xe2\x94\x82", $y; |
483 | |
555 | |
484 | for (0..139) { |
556 | for (0..139) { |
485 | my $c = $M[$i]; |
557 | my $c = $M[$i]; |
486 | |
558 | |
487 | if ($c == 0x7f) { # also 0xff, but the firmware avoids that |
559 | if ($c == 0x7f) { # also 0xff, but the firmware avoids that |
488 | $scr .= "\e[m|\e[K\n"; |
560 | $scr .= "\e[m\xe2\x94\x82\e[K\n"; |
489 | |
561 | |
490 | my $a1 = $M[$i + 1]; |
562 | my $a1 = $M[$i + 1]; |
491 | my $a0 = $M[$i + 2]; |
563 | my $a0 = $M[$i + 2]; |
492 | |
564 | |
493 | $i = 0x2000 + (($a1 * 256 + $a0) & 0xfff); |
565 | $i = 0x2000 + (($a1 * 256 + $a0) & 0xfff); |
494 | |
566 | |
495 | next line; |
567 | next line; |
496 | } |
568 | } |
497 | |
569 | |
498 | my $sgr = $sgr[ ($M[$i++ + 0x1000] & 15) | ($c & 0x80)]; |
570 | my $sgr = $SGR[ ($M[$i++ + 0x1000] & 15) | ($c & 0x80)]; |
499 | |
|
|
500 | # ~1 sgr 5 blink |
|
|
501 | # ~2 sgr 4 underline |
|
|
502 | # ~4 sgr 1 bold |
|
|
503 | # 0x80 in attr, sgr 7, reversed |
|
|
504 | |
571 | |
505 | $scr .= $prev_sgr = $sgr if $sgr ne $prev_sgr; |
572 | $scr .= $prev_sgr = $sgr if $sgr ne $prev_sgr; |
506 | |
573 | |
507 | $scr .= $chr[$c & 0x7f]; |
574 | $scr .= $CHARMAP[$c & 0x7f]; |
508 | } |
575 | } |
509 | |
576 | |
510 | $scr .= "\e[K\nvideo overflow\e[K\n"; |
577 | $scr .= "\e[K\nvideo overflow\e[K\n"; |
511 | last; |
578 | last; |
512 | } |
579 | } |
513 | |
580 | |
514 | $scr .= "\e[m"; |
581 | $scr .= "\e[m\e[J"; |
515 | |
|
|
516 | if (0) { |
|
|
517 | $scr .= "\e[K\n"; |
|
|
518 | for my $o (0x200 .. 0x232) { |
|
|
519 | $scr .= sprintf "%04x:", $o * 16; |
|
|
520 | for (0..15) { |
|
|
521 | $scr .= sprintf " %02x", $M[$o * 16 + $_]; |
|
|
522 | } |
|
|
523 | $scr .= "\e[K\n"; |
|
|
524 | } |
|
|
525 | } |
|
|
526 | |
|
|
527 | $scr .= "\e[J"; |
|
|
528 | |
582 | |
529 | syswrite STDOUT, $scr; |
583 | syswrite STDOUT, $scr; |
530 | } |
584 | } |
531 | |
585 | |
532 | ############################################################################# |
586 | ############################################################################# |
|
|
587 | # keyboard handling |
533 | |
588 | |
534 | if (@ARGV) { |
589 | # 0x080 shift, 0x100 ctrl |
535 | require IO::Pty; |
590 | my %KEYMAP = ( |
536 | $PTY = IO::Pty->new; |
591 | "\t" => 0x3a, |
|
|
592 | "\r" => 0x64, |
|
|
593 | "\n" => 0x44, |
|
|
594 | |
|
|
595 | "\x00" => 0x77 | 0x100, # CTRL-SPACE |
|
|
596 | "\x1c" => 0x45 | 0x100, # CTRL-\ |
|
|
597 | "\x1d" => 0x14 | 0x100, # CTRL-] |
|
|
598 | "\x1e" => 0x24 | 0x100, # CTRL-~ |
|
|
599 | "\x1f" => 0x75 | 0x100, # CTRL-? |
|
|
600 | |
|
|
601 | # hardcoded rxvt keys |
|
|
602 | "\e" => 0x2a, # ESC |
|
|
603 | "\e[3~" => 0x03, # DC |
|
|
604 | "\e[5~" => 0x7e, # CAPS LOCK (prior) |
|
|
605 | "\e[6~" => 0x6a, # NO SCROLL (next) |
|
|
606 | "\e[A" => 0x30, # UP |
|
|
607 | "\e[B" => 0x22, # DOWN |
|
|
608 | "\e[C" => 0x10, # RIGHT |
|
|
609 | "\e[D" => 0x20, # LEFT |
|
|
610 | "\e[a" => 0x30 | 0x080, # UP |
|
|
611 | "\e[b" => 0x22 | 0x080, # DOWN |
|
|
612 | "\e[c" => 0x10 | 0x080, # RIGHT |
|
|
613 | "\e[d" => 0x20 | 0x080, # LEFT |
|
|
614 | "\e[7~" => 0x7b, # SETUP (home) |
|
|
615 | "\e[8~" => 0x23, # BREAK (end) |
|
|
616 | "\e[8\$" => 0x23 | 0x080, # SHIFT BREAK / DISCONNECT (shift-end) |
|
|
617 | "\x7f" => 0x33, # BACKSPACE |
|
|
618 | |
|
|
619 | "\e[11~" => 0x32, # F1 |
|
|
620 | "\e[11~" => 0x42, # F2 |
|
|
621 | "\e[11~" => 0x31, # F3 |
|
|
622 | "\e[11~" => 0x41, # F4 |
|
|
623 | ); |
537 | |
624 | |
538 | my $slave = $PTY->slave; |
625 | @KEYMAP{map chr, 0x20 .. 0x40, 0x5b .. 0x7e} = unpack "C*", pack "H*", |
|
|
626 | "779ad5a9a8b8a755a6b5b6b466256575" . "351a3929283837273626d656e634e5f5" . "b9" # 20..40 |
|
|
627 | . "154514b7a5" . "244a6879591949485816574746766706" . "050a185a0817780969077a95c594a4"; # 5b..7e |
539 | |
628 | |
540 | $PTY->set_winsize (24, 80); |
629 | $KEYMAP{"\x1f" & $_} ||= $KEYMAP{$_} | 0x100 for "a" .. "z"; # ctrl |
|
|
630 | $KEYMAP{"\x20" ^ $_} ||= $KEYMAP{$_} | 0x080 for "a" .. "z"; # shift |
541 | |
631 | |
542 | unless (fork) { |
632 | my $KEYMATCH = join "|", map quotemeta, reverse sort keys %KEYMAP; |
543 | $ENV{TERM} = $VT102 ? "vt102" : "vt100"; |
633 | $KEYMATCH = qr{^($KEYMATCH)}s; |
544 | |
634 | |
545 | close $PTY; |
635 | my %KMOD; # currently pressed modifier keys |
546 | |
636 | |
547 | open STDIN , "<&", $slave; |
637 | sub key { |
548 | open STDOUT, ">&", $slave; |
638 | my ($key) = @_; |
549 | open STDERR, ">&", $slave; |
|
|
550 | |
639 | |
551 | system "stty ixoff erase ^H"; |
640 | push @KQUEUE, -0x7c if !($key & 0x100) && delete $KMOD{0x7c}; # ctrl-up |
|
|
641 | push @KQUEUE, -0x7d if !($key & 0x080) && delete $KMOD{0x7d}; # shift-up |
552 | |
642 | |
553 | $PTY->make_slave_controlling_terminal; |
643 | push @KQUEUE, 0x7c if $key & 0x100 && !$KMOD{0x7c}++; # ctrl-down |
554 | $PTY->close_slave; |
644 | push @KQUEUE, 0x7d if $key & 0x080 && !$KMOD{0x7d}++; # shift-down |
555 | |
645 | |
556 | exec @ARGV; |
646 | $key &= 0x7f; |
557 | } |
647 | push @KQUEUE, $key, -$key; |
558 | |
|
|
559 | $PTY->close_slave; |
|
|
560 | |
|
|
561 | } else { |
|
|
562 | open $PTY, "</dev/null" or die;#d |
|
|
563 | } |
648 | } |
564 | |
649 | |
565 | ############################################################################# |
650 | my $STDIN_BUF; |
566 | |
651 | |
|
|
652 | sub stdin_parse { |
|
|
653 | key $KEYMAP{$1} |
|
|
654 | while $STDIN_BUF =~ s/$KEYMATCH//; |
|
|
655 | |
|
|
656 | # skip input we can't decipher |
|
|
657 | substr $STDIN_BUF, 0, 1, ""; |
|
|
658 | } |
|
|
659 | |
|
|
660 | if ($KBD) { |
|
|
661 | system "stty -icanon -icrnl -inlcr -echo min 1 time 0"; |
|
|
662 | eval q{ sub END { system "stty sane" } }; |
|
|
663 | $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = sub { exit 1 }; |
|
|
664 | } |
|
|
665 | |
|
|
666 | ############################################################################# |
567 | # initial key input, to set up online mode etc. |
667 | # initial key input, to set up online mode etc. |
|
|
668 | # could be done via nvram defaults |
|
|
669 | |
568 | @KQUEUE = ( |
670 | @KQUEUE = ( |
569 | 0x7b, -0x7b, # setup |
671 | 0x7b, -0x7b, # setup |
570 | 0, # delay |
672 | 0, # delay |
571 | 0x28, -0x28, # 4, toggle local/online |
673 | 0x28, -0x28, # 4, toggle local/online |
572 | 0x38, -0x38, # 5, setup b |
674 | 0x38, -0x38, # 5, setup b |
… | |
… | |
583 | 0x37, -0x37, # 6 toggle wrap around |
685 | 0x37, -0x37, # 6 toggle wrap around |
584 | 0x7b, -0x7b, # leave setup |
686 | 0x7b, -0x7b, # leave setup |
585 | ); |
687 | ); |
586 | |
688 | |
587 | ############################################################################# |
689 | ############################################################################# |
|
|
690 | # process/pty management |
588 | |
691 | |
589 | # 0x80 shift, 0x100 ctrl, 0x200 toggle |
692 | if (1) { |
590 | my %KEYMAP = ( |
693 | require IO::Pty; |
591 | "\t" => 0x3a, |
694 | $PTY = IO::Pty->new; |
592 | "\r" => 0x64, |
|
|
593 | "\n" => 0x44, |
|
|
594 | |
695 | |
595 | # hardcoded rxvt keys |
696 | my $slave = $PTY->slave; |
596 | "\e" => 0x2a, # ESC |
|
|
597 | "\e[3~" => 0x03, # DC |
|
|
598 | "\e[5~" => 0x7e, # CAPS LOCK (prior) |
|
|
599 | "\e[6~" => 0x6a, # NO SCROLL (next) |
|
|
600 | "\e[A" => 0x30, # UP |
|
|
601 | "\e[B" => 0x22, # DOWN |
|
|
602 | "\e[C" => 0x10, # RIGHT |
|
|
603 | "\e[D" => 0x20, # LEFT |
|
|
604 | "\e[a" => 0x30 | 0x080, # UP |
|
|
605 | "\e[b" => 0x22 | 0x080, # DOWN |
|
|
606 | "\e[c" => 0x10 | 0x080, # RIGHT |
|
|
607 | "\e[d" => 0x20 | 0x080, # LEFT |
|
|
608 | "\e[7~" => 0x7b, # SETUP (home) |
|
|
609 | "\e[8~" => 0x23, # BREAK (end) |
|
|
610 | "\e[8\$" => 0x23 | 0x080, # SHIFT BREAK / DISCONNECT (shift-end) |
|
|
611 | "\x7f" => 0x33, # BACKSPACE |
|
|
612 | |
697 | |
613 | "\e[11~" => 0x32, # F1 |
698 | $PTY->set_winsize (24, 80); |
614 | "\e[11~" => 0x42, # F2 |
|
|
615 | "\e[11~" => 0x31, # F3 |
|
|
616 | "\e[11~" => 0x41, # F4 |
|
|
617 | ); |
|
|
618 | |
699 | |
619 | @KEYMAP{map chr, 0x20..0x40} = unpack "C*", pack "H*", |
700 | unless (fork) { |
620 | "779ad5a9a8b8a755a6b5b6b466256575" . "351a3929283837273626d656e634e5f5" . "b9"; |
701 | $ENV{LC_ALL} = "C"; |
|
|
702 | $ENV{TERM} = $VT102 ? "vt102" : "vt100"; |
621 | |
703 | |
622 | @KEYMAP{map chr, 0x5b .. 0x7e} = unpack "C*", pack "H*", |
704 | close $PTY; |
623 | "154514b7a5" . "244a6879591949485816574746766706" . "050a185a0817780969077a95c594a4"; |
|
|
624 | |
705 | |
625 | $KEYMAP{"\x3f" & $_} ||= $KEYMAP{$_} | 0x100 for "a" .. "z"; # ctrl |
706 | open STDIN , "<&", $slave; |
626 | $KEYMAP{uc $_} ||= $KEYMAP{$_} | 0x080 for "a" .. "z"; # shift |
707 | open STDOUT, ">&", $slave; |
|
|
708 | open STDERR, ">&", $slave; |
627 | |
709 | |
628 | my $KEYMATCH = join "|", map quotemeta, reverse sort keys %KEYMAP; |
710 | system "stty ixoff erase ^H"; |
629 | $KEYMATCH = qr{^($KEYMATCH)}s; |
|
|
630 | |
711 | |
631 | sub key { |
712 | $PTY->make_slave_controlling_terminal; |
632 | my ($key) = @_; |
713 | $PTY->close_slave; |
633 | |
714 | |
634 | state %MOD; |
715 | @ARGV = "sh" unless @ARGV; |
|
|
716 | exec @ARGV; |
|
|
717 | } |
635 | |
718 | |
636 | push @KQUEUE, -0x7c if !($key & 0x100) && delete $MOD{0x7c}; # ctrl-up |
719 | $PTY->close_slave; |
637 | push @KQUEUE, -0x7d if !($key & 0x080) && delete $MOD{0x7d}; # shift-up |
720 | } else { |
638 | |
721 | open $PTY, "+</dev/null" |
639 | push @KQUEUE, 0x7c if $key & 0x100 && !$MOD{0x7c}++; # ctrl-down |
722 | or die "/dev/null: $!"; |
640 | push @KQUEUE, 0x7d if $key & 0x080 && !$MOD{0x7d}++; # shift-down |
|
|
641 | |
|
|
642 | $key &= 0x7f; |
|
|
643 | push @KQUEUE, $key, -$key; |
|
|
644 | } |
723 | } |
645 | |
724 | |
646 | my $STDIN_BUF; |
|
|
647 | |
|
|
648 | sub stdin_parse { |
|
|
649 | key $KEYMAP{$1} |
|
|
650 | while $STDIN_BUF =~ s/$KEYMATCH//; |
|
|
651 | |
|
|
652 | # skip input we can't decipher |
|
|
653 | substr $STDIN_BUF, 0, 1, ""; |
|
|
654 | } |
|
|
655 | |
|
|
656 | if ($KBD) { |
|
|
657 | system "stty -icanon -icrnl -inlcr -echo min 1 time 0"; |
|
|
658 | eval q{ sub END { system "stty sane" } }; |
|
|
659 | $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = sub { exit 1 }; |
|
|
660 | } |
|
|
661 | |
|
|
662 | ############################################################################# |
725 | ############################################################################# |
|
|
726 | # the actual hardware simulator |
663 | |
727 | |
664 | my @ICACHE; # compiled instruction cache |
728 | my @ICACHE; # compiled instruction/basic block cache |
665 | |
729 | |
|
|
730 | my $POWERSAVE; # powersave counter |
|
|
731 | |
|
|
732 | my $RIN; # libev for the less well-off |
|
|
733 | |
|
|
734 | (vec $RIN, 0, 1) = 1 if $KBD; |
|
|
735 | (vec $RIN, fileno $PTY, 1) = 1 if $PTY; |
|
|
736 | |
666 | # the cpu |
737 | # the cpu. |
667 | while () { |
738 | while () { |
668 | |
|
|
669 | # execute extended basic blocks |
739 | # execute an extended basic block |
670 | $PC = ($ICACHE[$PC] ||= do { |
740 | $PC = ($ICACHE[$PC] ||= do { |
671 | my $pc = $PC; |
741 | my $pc = $PC; |
672 | |
742 | |
673 | my $insn = ""; |
743 | my $insn = ""; |
674 | |
744 | |
675 | # the jit compiler |
745 | # the jit compiler |
676 | for (0..15) { |
746 | for (0..31) { |
677 | |
|
|
678 | # optional tracing support |
|
|
679 | if (0) { |
|
|
680 | $insn .= qq< |
|
|
681 | if (\$PRSTATUS) { |
|
|
682 | status $pc; |
|
|
683 | die unless --\$PRSTATUS; |
|
|
684 | } |
|
|
685 | >; |
|
|
686 | } |
|
|
687 | |
|
|
688 | my $imm; |
747 | my $imm; |
689 | my $op = $op[$M[$pc++]]; |
748 | my $op = $op[$M[$pc++]]; |
690 | |
749 | |
691 | for ($op) { |
750 | for ($op) { |
692 | s/\bPUSH\b/\$M[--\$SP] =/g; # push byte to stack |
751 | s/\bPUSH\b/\$M[--\$SP] =/g; # push byte to stack |
… | |
… | |
697 | |
756 | |
698 | s/\bPC\b/$pc/ge; # PC at end of insn |
757 | s/\bPC\b/$pc/ge; # PC at end of insn |
699 | s/\bBRA\b/return/g; # conditional jump |
758 | s/\bBRA\b/return/g; # conditional jump |
700 | s/\bJMP\b(.*)/$1\x00/sg; # unconditional jump |
759 | s/\bJMP\b(.*)/$1\x00/sg; # unconditional jump |
701 | |
760 | |
702 | s/\bIN\b/ sprintf "\$A = in_%02x", $M[$pc++]/xge; |
761 | s/\bIN\b/ sprintf "\$A = in_%02x", $M[$pc++]/xge; # in insns call in_HEX |
703 | s/\bOUT\b/sprintf "out_%02x \$A ", $M[$pc++]/xge; |
762 | s/\bOUT\b/sprintf "out_%02x \$A ", $M[$pc++]/xge; # out likewise |
704 | } |
763 | } |
705 | |
764 | |
706 | $insn .= "$op;\n"; |
765 | $insn .= "$op;\n"; |
707 | } |
766 | } |
708 | |
767 | |
709 | |
768 | |
710 | $insn .= "$pc"; |
769 | $insn .= $pc; |
711 | $insn =~ s/\x00.*$//s; |
770 | $insn =~ s/\x00.*$//s; |
712 | |
771 | |
713 | eval "use integer; sub { $insn }" or die "$insn: $@" |
772 | eval "sub { $insn }" or die "$insn: $@" |
714 | })->(); |
773 | })->(); |
715 | |
774 | |
716 | ++$CLK; |
775 | ++$CLK; |
717 | |
776 | |
718 | # things we do from time too time only |
777 | # things we do from time to time only |
719 | unless ($CLK & 0xf) { |
778 | unless ($CLK & 0xf) { |
720 | # do I/O |
779 | # do I/O |
721 | |
780 | |
722 | unless ($CLK & 0x7ff) { |
781 | unless ($CLK & 0xfff) { |
|
|
782 | if (select $x = $RIN, undef, undef, $POWERSAVE < 100 ? 0 : $CURSOR_IS_ON && 60) { |
723 | |
783 | |
724 | # pty/serial I/O |
784 | # pty/serial I/O |
725 | unless (@PUSARTRECV || @KQUEUE || !$PTY) { |
785 | if ($PTY && (vec $x, fileno $PTY, 1) && (@PUSARTRECV < 128) && !@KQUEUE) { |
726 | my $rin = ""; (vec $rin, fileno $PTY, 1) = 1; |
|
|
727 | |
|
|
728 | if (select $rin, undef, undef, 0) { |
|
|
729 | sysread $PTY, my $buf, 256; |
786 | sysread $PTY, my $buf, 256; |
|
|
787 | |
|
|
788 | # linux don't do cs7 and/or parity anymore, so we need to filter # out xoff characters to avoid freezes. |
730 | push @PUSARTRECV, unpack "C*", $buf; |
789 | push @PUSARTRECV, grep { ($_ & 0x7f) != 0x13 } unpack "C*", $buf; |
731 | } |
790 | } |
732 | } |
|
|
733 | |
791 | |
734 | # keyboard input |
792 | # keyboard input |
735 | if ($KBD) { |
793 | if ($KBD && (vec $x, 0, 1)) { |
|
|
794 | # to avoid non-blocking mode on stdin (and stty min 0), we |
|
|
795 | # just read byte-by-byte after a select says there is data. |
736 | while (select my $rin = "\x01", undef, undef, 0) { |
796 | while (select my $rin = "\x01", undef, undef, 0) { |
737 | sysread STDIN, $STDIN_BUF, 1, length $STDIN_BUF |
797 | sysread STDIN, $STDIN_BUF, 1, length $STDIN_BUF |
738 | or last; |
798 | or last; |
|
|
799 | } |
|
|
800 | |
|
|
801 | stdin_parse if length $STDIN_BUF; |
739 | } |
802 | } |
740 | |
803 | |
741 | stdin_parse if length $STDIN_BUF; |
804 | $POWERSAVE = 0; # activity |
|
|
805 | } elsif (@PUSARTRECV || @KQUEUE) { |
|
|
806 | $POWERSAVE = 0; |
|
|
807 | } else { |
|
|
808 | ++$POWERSAVE; |
742 | } |
809 | } |
743 | } |
810 | } |
744 | |
811 | |
745 | # kick off various interrupts |
812 | # kick off serial input interrupt quite often |
746 | |
|
|
747 | $RST |= 2 if @PUSARTRECV && $XON; # VT100, but works on vt102, too (probably not used on real hardware though) |
813 | $RST |= 2 if @PUSARTRECV && $XON; # VT100, but works on vt102, too (probably not used on real hardware though) |
748 | #$INTPEND |= 2 if @PUSARTRECV && $XON; # VT102, 6.5 rxrdy |
814 | #$INTPEND |= 2 if @PUSARTRECV && $XON; # VT102, 6.5 rxrdy |
749 | |
815 | |
750 | # kick off vertical retrace form time to time |
816 | # kick off vertical retrace interrupt from time to time |
751 | unless ($CLK & 0x1ff) { |
817 | unless ($CLK & 0x1ff) { |
752 | $RST |= 4; # vertical retrace |
818 | $RST |= 4; # vertical retrace |
753 | } |
819 | } |
754 | |
820 | |
755 | # handle video hardware |
821 | # handle video hardware |
756 | |
|
|
757 | unless ($CLK & 0x1fff) { |
822 | unless ($CLK & 0x3fff) { |
758 | prscr; |
823 | display; |
759 | } |
824 | } |
760 | } |
825 | } |
761 | |
826 | |
762 | # the interrupt logic |
827 | # the interrupt logic - we only interrupt after basic blocks |
763 | $x = $INTPEND & ~$INTMASK; |
828 | # which, as a side effect, ensures that we don't interrupt |
764 | if (($RST || $x) && $IFF) { |
829 | # "ei; ret" sequences and thus reduce the risk of stack overflows. |
|
|
830 | if (($RST || ($INTPEND & ~$INTMASK)) && $IFF) { |
765 | # rst 1 kbd data available |
831 | # rst 1 kbd data available |
766 | # rst 2 pusart xmit+recv flag |
832 | # rst 2 pusart xmit+recv flag |
767 | # rst 4 vertical retrace |
833 | # rst 4 vertical retrace |
768 | # 5.5 vt125 mb7 trans ready (serial send?) |
834 | # 5.5 vt125 mb7 trans ready (serial send?) |
769 | # 6.5 vt125 mb7 read ready (something modem?) |
835 | # 6.5 vt125 mb7 read ready (something modem?) |
770 | # 7.5 vt125 mb7 vblank h(?) |
836 | # 7.5 vt125 mb7 vblank h(?) |
771 | # trap vt125 mbi init h(?) |
837 | # trap vt125 mbi init h(?) |
772 | my $vec; |
838 | my $vec; |
773 | |
839 | |
|
|
840 | my $pend = $INTPEND & ~$INTMASK; |
|
|
841 | |
774 | if ($x & 1) { $vec = 0x2c; $INTPEND &= ~1; |
842 | if ($pend & 1) { $vec = 0x2c; $INTPEND &= ~1; |
775 | } elsif ($x & 2) { $vec = 0x34; $INTPEND &= ~2; |
843 | } elsif ($pend & 2) { $vec = 0x34; $INTPEND &= ~2; |
776 | } elsif ($x & 4) { $vec = 0x3c; $INTPEND &= ~4; |
844 | } elsif ($pend & 4) { $vec = 0x3c; $INTPEND &= ~4; |
777 | # } elsif ($RST ) { $vec = $RST * 8; $RST = 0; # for some reason, this breaks vt102 |
845 | # } elsif ($RST ) { $vec = $RST * 8; $RST = 0; # the vt102 firmware doesn't like combined interrupts |
778 | } elsif ($RST & 1) { $vec = 0x08; $RST &= ~1; # separate is better for vt102 |
846 | } elsif ($RST & 1) { $vec = 0x08; $RST &= ~1; # separate is better for vt102 |
779 | } elsif ($RST & 2) { $vec = 0x10; $RST &= ~2; |
847 | } elsif ($RST & 2) { $vec = 0x10; $RST &= ~2; |
780 | } elsif ($RST & 4) { $vec = 0x20; $RST &= ~4; |
848 | } elsif ($RST & 4) { $vec = 0x20; $RST &= ~4; |
781 | } else { |
849 | } else { |
782 | die; |
850 | die; |
783 | } |
851 | } |
784 | |
852 | |
|
|
853 | # jump to the interrupt vector |
785 | $M[--$SP] = $PC >> 8; |
854 | $M[--$SP] = $PC >> 8; |
786 | $M[--$SP] = $PC & 0xff; |
855 | $M[--$SP] = $PC & 0xff; |
787 | $PC = $vec; |
856 | $PC = $vec; |
788 | |
857 | |
789 | $IFF = 0; |
858 | $IFF = 0; |
790 | } |
859 | } |
791 | } |
860 | } |
|
|
861 | |
|
|
862 | ############################################################################# |
|
|
863 | # roms in the data section + one newline |
|
|
864 | # |
|
|
865 | # vt100 @ 0x0000+0x0800 23-032E2 |
|
|
866 | # vt100 @ 0x0800+0x0800 23-061E2 |
|
|
867 | # vt100 @ 0x1000+0x0800 23-033E2 |
|
|
868 | # vt100 @ 0x1800+0x0800 23-034E2 |
|
|
869 | # |
|
|
870 | # vt102 @ 0x0000+0x2000 23-226E4 |
|
|
871 | # vt102 @ 0x8000+0x2000 23-225E4 |
|
|
872 | # |
|
|
873 | # vt131 @ 0xa000+0x0800 23-280E2 |
|
|
874 | # |
792 | |
875 | |
793 | __DATA__ |
876 | __DATA__ |
794 | 1N ; 0 >b/BWog<Gӂ,O $
O [ xI,ڥ # yOt ͤ[ zW>/2!b>>g$>%
!h w-!h >-4!j pO:{ y:! u:x!_yA[>y
>yA[>?y@
:x!yA[P>>O[>>[Î:!ʵyA>>OlyAPÇ!:!S!h ~ ~ : O͓: Ô!20!2!!!yAG~"&=w< w:!/!!A:!Ey2!~1N ! ~eBi<2!͢:P =2S!~6ʘ!!6 |
877 | 1N ; 0 >b/BWog<Gӂ,O $
O [ xI,ڥ # yOt ͤ[ zW>/2!b>>g$>%
!h w-!h >-4!j pO:{ y:! u:x!_yA[>y
>yA[>?y@
:x!yA[P>>O[>>[Î:!ʵyA>>OlyAPÇ!:!S!h ~ ~ : O͓: Ô!20!2!!!yAG~"&=w< w:!/!!A:!Ey2!~1N ! ~eBi<2!͢:P =2S!~6ʘ!!6 |
795 | 2!0* w4ʘ> 2! ~î!N ̓/2!! "R !"" |
878 | 2!0* w4ʘ> 2! ~î!N ̓/2!! "R !"" |
796 | ! ͋!2[ 2v!!"I!>2s >2 B>2y >2!2!&l" >@:X!:!͔>2!b:!K>G:| !p ^!p" :!x:! u> |
879 | ! ͋!2[ 2v!!"I!>2s >2 B>2y >2!2!&l" >@:X!:!͔>2!b:!K>G:| !p ^!p" :!x:! u> |
… | |
… | |
900 | |