-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathday16.tal
57 lines (42 loc) · 831 Bytes
/
day16.tal
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
~library/macros.tal
~library/devices.tal
( variables )
|0000
( init )
|0100 @program
;on-arg-char .Console/vector DEO2
BRK !
@on-arg-char
.Console/read DEI ( char )
DUP #0a EQU ,&complete JCN
;argv #00 ,&argptr LDR ADD2 STA
,&argptr LDR INC ,&argptr STR
BRK !
&complete
POP
;arg-received JMP2
&argptr $1
@argv $20
( arg is in @argv )
@arg-received
LIT ': EMIT
;argv ;print JSR2
LF
;open-file JSR2
;read-byte ;decoder/set-input JSR2
;decoder/compute JSR2
(
;decoder/print-tree JSR2
)
BRK
@open-file
;argv .File/name DEO2
#0001 .File/length DEO2
RTN
( -- next-byte )
@read-byte
#00 ;&byte STA ( clear byte so that EOF reads as zero )
;&byte .File/read DEO2
LIT &byte 00 ( <- this byte is patched by the two previous instructions! )
RTN
~day16_lib.tal