~maddie/STT-TIL

STT-TIL/interpreter -rw-r--r-- 4.8 KiB
7aee439c — kn0000 initial commit, not finished, just for backup 2 months ago
                                                                                
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
0010000000 imm
0000000000
0010000000
0000000000 placeholder addr, will be address of initialisation code
0100000000 jump
0000000000; DENEST
0000000111 seven, addr of next instruction
1110000000 immediate on rs
0010000000 
1110000000
0000000001 address of lower half of i
1110000101 pop to mem
1110000000
0010000000
1110000000
0000000000 address of upper half of i
1110000101 pop to mem, pop rs to i
0110000000 immediate; NEXT
0010000000
0110000000
0000000000 address of upper i
0110000100 push from mem
0110000000 imm
0010000000
0110000000
0000000001 low i
0110000100 push; fetch i
0110000111
0110000111 dup addr
0110000000 imm
0000000010 two
0110001000 clear carry
0010101100 add
0110000000 imm
0010000000
0110000000
0000000001 low i
0110000101 pop
0110000000 imm
0000000000 zero
0010101100 add
0110000000 imm
0010000000
0110000000
0000000000 high i
0110000101 pop; increment i by two
0110000111
0110000111 dup addr
0110000000 imm
0000000001 one
0110001000 clc
0010101100 add
0110000011 move stack
0110000000 imm
0000000000 zero
0010101100 add
1110000011 move stack; increment addr
0110000100 push
0110000011 mvstack
0110000100 push
1110000011 mvstack; deref both addrs, fetches wa
0110000000 imm
0010000000
0110000000
0010000011 low wa
0110000101 pop
0110000000 imm
0010000000
0110000000
0000000010 high wa
0110000101 pop
0110000000 imm; RUN
0010000000
0110000000
0000000010 high wa
0110000100 push
0110000000 imm
0010000000
0110000000
0000000011 low wa
0110000100 push; fetch wa
0110000111
0110000111 dup addr
0110000000 imm
0000000010 two
0110001000 clear carry
0010101100 add
0110000011 move stack
0110000000 imm
0000000000 zero
0010101100 add
1110000011 move stack
0110000000 imm
0010000000
0110000000
0000000011 low wa
0110000101 pop
0110000000 imm
0010000000
0110000000
0000000010 high wa
0110000101 pop; increment wa by two
0110000111
0110000111 dup addr
0110001000 clear carry
0110000000 imm
0000000001 one
0010101100 add
0110000011 mov stack
0110000000 imm
0000000000 zero
0010101100 add
1110000011 mov stack
0110000100 push
0110000011 mov stack
0110000100 push; deref wa
0100000000 unconditional jump; end of RUN
1110000000 imm; start of NEST
0010000000 
1110000000
0000000000 high i
1110000100 push
1110000000 imm
0010000000
1110000000
0000000001 low i
1110000100 push; push i to return stack
0110000000 imm
0010000000
0110000000
0000000010 high wa
0110000100 push
0110000000 imm
0010000000
0110000000
0000000000 high i
0110000101 pop
0110000000 imm
0010000000
0110000000
0000000011 low wa
0110000100 push
0110000000 imm
0010000000
0110000000
0000000001 low i
0110000101 pop; move wa to i
0110000000 imm
0000000000
0110000000
0000010001 seventeen, addr of NEXT
0100000000 unconditional jump; end of NEST
0000000111 start of EXECUTE, string
0000001110 E
0000100001 X
0000001110 E
0000001100 C
0000011110 U
0000011101 T
0000001110 E
0000000000
0000000000 link address; zero to indicate end of dictionary
0000000000
0010100100 code addr; address of next instruction
0110000000 imm
0010000000
0110000000
0000000011 low wa
0110000101 pop
0110000000 imm
0010000000
0110000000
0000000010 high wa
0110000101 pop; move address from data stack to wa
0110000000 imm
0000000000
0110000000
0001000111 addr of RUN
0100000000 unconditional jump
0110000111 over; start of LONG-DEREF internal subroutine
0110000111 dup addr
0110000000 imm
0000000001 one
0110001000 clr carry
0010101100 add
0110000011 mov stack
0110000000 imm
0000000000 zero
0010101100 add
1110000011 mov stack
0110000100 push
0110000011 mov stack
0110000100 push
1110000011 mov stack
1100000000 jump from return stack; end of LONG-DEREF internal
0000001010 ten; string, start of LONG-DEREF dictionary entry
0000010101 L
0000011000 O
0000010111 N
0000010000 G
0000111101 -
0000001101 D
0000001110 E
0000011011 R
0000001110 E
0000001111 F
0000000000
0010011000 link addr; links to EXECUTE
0000000000
0011010010 code addr; next instruction
1110000000 imm
0000000000
1110000000
0000010001 addr of NEXT on rs
0110000000 imm
0000000000
0110000000
0010110011 addr of LONG-DEREF internal
0100000000 unconditional jump; end of LONG-DEREF
0000001110 fourteen, string; start of REFRESH-SCREEN
0000011011 R
0000001110 E
0000001111 F
0000011011 R
0000001110 E
0000011100 S
0000010001 H
0000111101 -
0000011100 S
0000001100 C
0000011011 R
0000001110 E
0000001110 E
0000010111 N
0000000000
0011000011 link to LONG-DEREF
0000000000
0011101110 code address, next instruction
0110000000 imm
0000000001 one
0110000000 imm
0111111111
0110000000
1111111111 screen update addr
0110000101 pop; updates screen
0110000000 imm
0000000000
0110000000
0000010001 addr of NEXT
0100000000 unconditional jump; end of REFRESH-SCREEN
0000001011 start of MOVE-BUFFER (length from to -- )
0000010110 M
0000011000 O
0000011111 V
0000001110 E
0000111101 -
0000001011 B
0000011110 U
0000001111 F
0000001111 F
0000001110 E
0000011011 R
0000000000
0011011011 link to REFRESH-SCREEN
0000000000
0100001010 code addr