Browse code

Ported asma to new assembler syntax

Andrew Alderwick authored on 24/04/2021 09:50:21
Showing 2 changed files
... ...
@@ -64,9 +64,11 @@ grammar = P {
64 64
     labeldef: C P'@' * V'label'
65 65
     relative: (P'^' / -> ',') * (C(V'label') / (s) -> (s\gsub '%$', '&'))
66 66
     sublabel: (P'$' / -> '&') * (C(V'label') / (s) -> (s\gsub '%$', '&'))
67
-    data: C P'[' * (1-P']') ^ 0 * P']'
67
+    data: C(P'[') * V'ws' * (V'data_item' * V'ws') ^ 0 * C(P']')
68 68
     macro: C(P'%' * V'name' * V'ws' * P'{') * V'ws' * (V'atom' * V'ows') ^ 0 * C P'}'
69 69
     macroref: C V'name'
70
+    data_item: C(V'hex' * #V'ws') + V'data_string'
71
+    data_string: C((1 - S' \n\t') ^ 1 - P']') / (s) -> '"', s
70 72
 }
71 73
 
72 74
 translate = (_filename) ->
... ...
@@ -81,7 +83,7 @@ translate = (_filename) ->
81 83
         error 'no match'
82 84
     filename = filename\gsub 'attic', 'auto'
83 85
     f = assert io.open filename, 'w'
84
-    f\write (table.concat(t)\gsub(' +\n', '\n')\gsub('  +', ' '))
86
+    f\write table.concat(t)
85 87
     f\close!
86 88
     f = assert io.popen 'bin/assembler %s bin/boot.rom'\format filename
87 89
     for l in f\lines!
... ...
@@ -91,10 +93,9 @@ translate = (_filename) ->
91 93
     f\close!
92 94
     os.exit 0
93 95
 
94
-translate 'attic/software/left.usm'
96
+translate 'attic/software/assembler.usm'
95 97
 os.exit 0
96 98
 
97
-translate 'attic/software/assembler.usm'
98 99
 translate 'attic/tests/opcodes.usm'
99 100
 translate 'attic/tests/basics.usm'
100 101
 
... ...
@@ -1,5 +1,4 @@
1
-;tree { search-key 2 max-key-len 1 }
2
-;assembler { pass 1 state 1 token 2 scope-len 1 scope 80 heap 2 addr 2 subtree 2 field_size 2 var_size 2 field 2 }
1
+( asma: in-Uxn assembler (not working yet, in progress) )
3 2
 
4 3
 %HCF { #0000 DIV }
5 4
 %SHORT_FLAG { #20 }
... ...
@@ -7,43 +6,50 @@
7 6
 
8 7
 ( devices )
9 8
 
10
-|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
11
-|0110 ;Console { vector 2 pad 6 char 1 byte 1 short 2 string 2 }
12
-|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
13
-|0130 ;Audio { wave 2 envelope 2 pad 4 volume 1 pitch 1 play 1 value 2 delay 2 finish 1 }
14
-|0140 ;Controller { vector 2 button 1 key 1 }
15
-|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 }
16
-|0170 ;File { vector 2 success 2 offset 2 pad 2 name 2 length 2 load 2 save 2 }
17
-|01a0 ;DateTime { year 2 month 1 day 1 hour 1 minute 1 second 1 dotw 1 doty 2 isdst 1 refresh 1 }
9
+|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
10
+|10 @Console [ &vector $2 &pad $6 &char $1 &byte $1 &short $2 &string $2 ]
11
+|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ]
12
+|30 @Audio [ &wave $2 &envelope $2 &pad $4 &volume $1 &pitch $1 &play $1 &value $2 &delay $2 &finish $1 ]
13
+|40 @Controller [ &vector $2 &button $1 &key $1 ]
14
+|60 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &chord $1 ]
15
+|70 @File [ &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]
16
+|a0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 &refresh $1 ]
17
+
18
+( variables )
19
+
20
+|0000
21
+
22
+@tree [ &search-key $2 &max-key-len $1 ]
23
+@assembler [ &pass $1 &state $1 &token $2 &scope-len $1 &scope $80 &heap $2 &addr $2 &subtree $2 &field_size $2 &var_size $2 &field $2 ]
18 24
 
19 25
 ( vectors )
20 26
 
21
-|0200 ^RESET JMP
27
+|0100 ,RESET JMP
22 28
 
23 29
 @RESET
24
-	,assembler-heap-start =assembler.heap
30
+	;assembler-heap-start .assembler/heap POK2
25 31
 
26
-	,$read-filename ^assemble-file JSR
32
+	;&read-filename ,assemble-file JSR
27 33
 	HCF
28 34
 
29 35
 	HCF
30 36
 
31
-	$read-filename [ projects/software/noodle.usm 00 ]
37
+	&read-filename [ "projects/software/noodle.usm 00 ]
32 38
 
33 39
 @assemble-file ( filename-ptr* -- )
34 40
 	#0000
35 41
 
36
-	$loop
37
-	OVR2 =File.name
38
-	DUP2 =File.offset
39
-	#0600 =File.length
40
-	#f000 DUP2 DUP2 =File.load
41
-	~File.success DUP2 #0000 EQU2 ^$end JNZ
42
-	^assemble-chunk JSR
42
+	&loop
43
+	OVR2 .File/name DEO2
44
+	DUP2 .File/offset DEO2
45
+	#0600 .File/length DEO2
46
+	#f000 DUP2 DUP2 .File/load DEO2
47
+	.File/success DEI2 DUP2 #0000 EQU2 ,&end JNZ
48
+	,assemble-chunk JSR
43 49
 	SUB2 SUB2
44
-	^$loop JMP
50
+	,&loop JMP
45 51
 
46
-	$end
52
+	&end
47 53
 	POP2 POP2 POP2 POP2 POP2
48 54
 	JMP2r
49 55
 
... ...
@@ -53,162 +59,162 @@
53 59
 	OVR2 ADD2 STH2
54 60
 	#0001 SUB2
55 61
 
56
-	$per-token
62
+	&per-token
57 63
 	DUP2 STH2
58 64
 
59
-	$loop
65
+	&loop
60 66
 	#0001 ADD2
61
-	DUP2 PEK2
62
-	#20 GTH ^$loop JNZ
67
+	DUP2 GET
68
+	#20 GTH ,&loop JNZ
63 69
 
64
-	DUP2 OVR2r STH2r LTS2 ^$valid JNZ
70
+	DUP2 OVR2r STH2r LTS2 ,&valid JNZ
65 71
 	SWP2r POP2r POP2
66 72
 	STH2r #0001 ADD2
67 73
 	JMP2r
68 74
 
69
-	$valid
70
-	DUP2 PEK2 #00 OVR2 POK2
71
-	STH2r #0001 ADD2 ^assemble-token JSR
72
-	^$per-token JNZ
75
+	&valid
76
+	DUP2 GET #00 OVR2 PUT
77
+	STH2r #0001 ADD2 ,assemble-token JSR
78
+	,&per-token JNZ
73 79
 
74 80
 	POP2r JMP2r
75 81
 
76 82
 @assemble-macro ( macro-ptr* -- )
77
-	DUP2 ,strlen JSR2 DUP2 #0000 EQU2 ^$end JNZ
78
-	OVR2 ^assemble-token JSR
83
+	DUP2 ;strlen JSR2 DUP2 #0000 EQU2 ,&end JNZ
84
+	OVR2 ,assemble-token JSR
79 85
 	ADD2 #0001 ADD2
80
-	^assemble-macro JMP
86
+	,assemble-macro JMP
81 87
 
82
-	$end
88
+	&end
83 89
 	POP2 POP2
84 90
 	JMP2r
85 91
 
86 92
 @assemble-token ( string-ptr* -- )
87 93
 	( get location of tree )
88 94
 	DUP2
89
-	,state-machine-pointers #00 ~assembler.state ,highest-bit JSR2 #0004 MUL2 ADD2
95
+	;state-machine-pointers #00 .assembler/state PEK ;highest-bit JSR2 #0004 MUL2 ADD2
90 96
 	DUP2 STH2
91 97
 	( see if first char is recognised )
92
-	SWP2 #01 ,traverse-tree JSR2
93
-	^$not-found JNZ
98
+	SWP2 #01 ;traverse-tree JSR2
99
+	,&not-found JNZ
94 100
 	( skip first character of token )
95
-	SWP2 #0001 ADD2 =assembler.token
101
+	SWP2 #0001 ADD2 .assembler/token POK2
96 102
 	( tail call handling function defined in tree )
97 103
 	POP2r JMP2
98 104
 
99
-	$not-found
105
+	&not-found
100 106
 	( not interested in incoming-ptr )
101 107
 	POP2
102
-	=assembler.token
108
+	.assembler/token POK2
103 109
 	( tail call default handling function defined in state-machine-pointers )
104
-	LIT2r [ 0002 ] ADD2r LDR2r
110
+	LIT2r [ 0002 ] ADD2r GET2r
105 111
 	JMP2r
106 112
 
107 113
 @parse-hex-length ( string-ptr* -- value 01 if one or two hex digits
108 114
                                 OR 00 otherwise )
109
-	DUP2 #0001 ADD2 PEK2 ^parse-hex-string-try-two JNZ
110
-	PEK2 ^parse-hex-digit JSR DUP #04 SFT ^parse-hex-string-fail1 JNZ
115
+	DUP2 #0001 ADD2 GET ,parse-hex-string/try-two JNZ
116
+	GET ,parse-hex-digit JSR DUP #04 SFT ,parse-hex-string/fail1 JNZ
111 117
 	#01 JMP2r
112 118
 
113 119
 @parse-hex-string ( string-ptr* -- value* 02 if four hex digits
114 120
                                 OR value 01 if two hex digits
115 121
                                 OR 00 otherwise )
116
-	DUP2 #0004 ADD2 PEK2 #00 EQU ^$try-four JNZ
117
-	$try-two
118
-	DUP2 #0002 ADD2 PEK2 ^$fail2 JNZ
119
-	$known-two
120
-	DUP2 PEK2 ^parse-hex-digit JSR DUP #04 SFT ^$fail3 JNZ ROT ROT
121
-	#0001 ADD2 PEK2 ^parse-hex-digit JSR DUP #04 SFT ^$fail2 JNZ
122
+	DUP2 #0004 ADD2 GET #00 EQU ,&try-four JNZ
123
+	&try-two
124
+	DUP2 #0002 ADD2 GET ,&fail2 JNZ
125
+	&known-two
126
+	DUP2 GET ,parse-hex-digit JSR DUP #04 SFT ,&fail3 JNZ ROT ROT
127
+	#0001 ADD2 GET ,parse-hex-digit JSR DUP #04 SFT ,&fail2 JNZ
122 128
 	SWP #40 SFT ORA #01 JMP2r
123 129
 
124
-	$fail3 POP
125
-	$fail2 POP
126
-	$fail1 POP #00 JMP2r
130
+	&fail3 POP
131
+	&fail2 POP
132
+	&fail1 POP #00 JMP2r
127 133
 
128
-	$try-four
129
-	DUP2 #0002 ADD2 ^$known-two JSR ^$maybe-four JNZ
130
-	^$try-two JMP
134
+	&try-four
135
+	DUP2 #0002 ADD2 ,&known-two JSR ,&maybe-four JNZ
136
+	,&try-two JMP
131 137
 
132
-	$maybe-four
133
-	ROT ROT ^$known-two JSR ^$four JNZ
134
-	^$fail1 JMP
138
+	&maybe-four
139
+	ROT ROT ,&known-two JSR ,&four JNZ
140
+	,&fail1 JMP
135 141
 
136
-	$four
142
+	&four
137 143
 	SWP #02 JMP2r
138 144
 
139 145
 @parse-hex-digit ( charcode -- 00-0f if valid hex
140 146
                             -- 10-ff otherwise )
141
-	DUP #3a LTH ^$digit JNZ
142
-	DUP #60 GTH ^$lowercase JNZ
143
-	DUP #40 GTH ^$uppercase JNZ
147
+	DUP #3a LTH ,&digit JNZ
148
+	DUP #60 GTH ,&lowercase JNZ
149
+	DUP #40 GTH ,&uppercase JNZ
144 150
 	JMP2r
145 151
 
146
-	$digit ( #30 is #00 )
152
+	&digit ( #30 is #00 )
147 153
 	#30 SUB JMP2r
148 154
 
149
-	$lowercase ( #61 is #0a )
155
+	&lowercase ( #61 is #0a )
150 156
 	#57 SUB JMP2r
151 157
 
152
-	$uppercase ( #41 is #0a )
158
+	&uppercase ( #41 is #0a )
153 159
 	#37 SUB JMP2r
154 160
 
155 161
 @find-opcode ( name* -- byte 00 if valid opcode name
156 162
                      OR 01 if not found )
157
-	,opcodes-tree SWP2 #03 ^traverse-tree JSR
158
-	^$nomatch JNZ
159
-	,opcodes-asm SUB2 #0007 DIV2
163
+	;opcodes/tree SWP2 #03 ,traverse-tree JSR
164
+	,&nomatch JNZ
165
+	;opcodes/asm SUB2 #0007 DIV2
160 166
 	SWP JMP2r
161 167
 
162
-	$nomatch
168
+	&nomatch
163 169
 	DUP2 EQU2 JMP2r
164 170
 
165 171
 @traverse-tree ( tree-ptr* search-key* max-key-len --
166 172
 		binary-ptr* 00 if key matched
167 173
 		OR incoming-ptr* 01 if key not found )
168
-	=tree.max-key-len =tree.search-key
174
+	.tree/max-key-len POK .tree/search-key POK2
169 175
 
170
-	$loop
171
-	DUP2 LDR2 #0000 NEQ2 ^$valid-node JNZ
176
+	&loop
177
+	DUP2 GET2 #0000 NEQ2 ,&valid-node JNZ
172 178
 	#01 JMP2r
173 179
 
174
-	$valid-node
175
-	LDR2 DUP2 STH2 #0004 ADD2 ^strcmp-tree JSR
176
-	DUP ^$nomatch JNZ
180
+	&valid-node
181
+	GET2 DUP2 STH2 #0004 ADD2 ,strcmp-tree JSR
182
+	DUP ,&nomatch JNZ
177 183
 	POP2r JMP2r
178 184
 
179
-	$nomatch
185
+	&nomatch
180 186
 	#07 SFT #02 MUL #00 SWP
181 187
 	STH2r ADD2
182
-	^$loop JMP
188
+	,&loop JMP
183 189
 
184 190
 @strcmp-tree ( node-key* -- order if strings differ
185 191
                          OR after-node-key* 00 if strings match )
186
-	~tree.search-key STH2
187
-	~tree.max-key-len
192
+	.tree/search-key PEK2 STH2
193
+	.tree/max-key-len PEK
188 194
 
189
-	$loop ( node-key* key-len in wst, search-key* in rst )
190
-	DUP ^$keep-going JNZ
195
+	&loop ( node-key* key-len in wst, search-key* in rst )
196
+	DUP ,&keep-going JNZ
191 197
 
192 198
 	( exhausted key-len, match found )
193 199
 	POP2r
194 200
 	JMP2r
195 201
 
196
-	$keep-going
197
-	#01 OVR2 PEK2 DUP2r PEK2r STHr
198
-	DUP2 ORA ^$not-end JNZ
202
+	&keep-going
203
+	#01 OVR2 GET DUP2r GETr STHr
204
+	DUP2 ORA ,&not-end JNZ
199 205
 
200 206
 	( end of C strings, match found )
201 207
 	POP2r POP ROT POP SWP ADD2 #00
202 208
 	JMP2r
203 209
 
204
-	$not-end
205
-	SUB DUP ^$nomatch JNZ
210
+	&not-end
211
+	SUB DUP ,&nomatch JNZ
206 212
 	POP SUB
207 213
 	LIT2r [ 0001 ] ADD2r STH
208 214
 	LIT2  [ 0001 ] ADD2  STHr
209
-	^$loop JMP
215
+	,&loop JMP
210 216
 
211
-	$nomatch
217
+	&nomatch
212 218
 	STH POP2 POP2 STHr POP2r
213 219
 	JMP2r
214 220
 
... ...
@@ -223,126 +229,127 @@
223 229
 	DUP #01 SFT ORA
224 230
 	DUP #02 SFT ORA
225 231
 	DUP #04 SFT ORA
226
-	#1d MUL #05 SFT #00 SWP ,$lookup ADD2 PEK2
232
+	#1d MUL #05 SFT #00 SWP ;&lookup ADD2 GET
227 233
 	JMP2r
228 234
 
229
-	$lookup
235
+	&lookup
230 236
 	[ 01 06 02 07 05 04 03 08 ]
231 237
 
232 238
 @memcpy ( src-ptr* dest-ptr* length* -- after-dest-ptr* )
233 239
 	SWP2 STH2
234 240
 
235
-	$loop
236
-	DUP2 ORA ^$keep-going JNZ
241
+	&loop
242
+	DUP2 ORA ,&keep-going JNZ
237 243
 	POP2 POP2 STH2r
238 244
 	JMP2r
239 245
 
240
-	$keep-going
246
+	&keep-going
241 247
 	#0001 SUB2
242
-	SWP2 DUP2 PEK2 DUP2r STH2r POK2
248
+	SWP2 DUP2 GET DUP2r STH2r PUT
243 249
 	#0001 ADD2 SWP2
244 250
 	LIT2r [ 0001 ] ADD2r
245
-	^$loop JMP
251
+	,&loop JMP
246 252
 
247 253
 @strcpy ( src-ptr* dest-ptr* -- after-dest-ptr* )
248
-	OVR2 ^strlen JSR #0001 ADD2 ^memcpy JMP
254
+	OVR2 ,strlen JSR #0001 ADD2 ,memcpy JMP
249 255
 
250 256
 @strlen ( string-ptr* -- length* )
251 257
 	DUP2 #0001 SUB2
252
-	$loop
258
+	&loop
253 259
 	#0001 ADD2
254
-	DUP2 PEK2 ^$loop JNZ
260
+	DUP2 GET ,&loop JNZ
255 261
 	SWP2 SUB2
256 262
 	JMP2r
257 263
 
258 264
 @append-heap ( string-ptr* -- after-string-ptr* )
259
-	~assembler.heap ,strcpy JSR2
260
-	DUP2 =assembler.heap
265
+	.assembler/heap PEK2 ;strcpy JSR2
266
+	DUP2 .assembler/heap POK2
261 267
 	JMP2r
262 268
 
263 269
 @append-tree ( string-ptr* incoming-ptr* -- binary-data* )
264
-	~assembler.heap SWP2 STR2
265
-	,$zero-pointers ~assembler.heap #0004 ^memcpy JSR =assembler.heap
266
-	^append-heap JSR
270
+	.assembler/heap PEK2 SWP2 PUT2
271
+	;&zero-pointers .assembler/heap PEK2 #0004 ,memcpy JSR .assembler/heap POK2
272
+	,append-heap JSR
267 273
 	JMP2r
268 274
 
269
-	$zero-pointers [ 0000 0000 ]
275
+	&zero-pointers [ 0000 0000 ]
270 276
 
271 277
 @add-label ( label-flags string-ptr* tree-ptr* -- )
272
-	OVR2 #ff ,traverse-tree JSR2
273
-	^$new-label JNZ
278
+	OVR2 #ff ;traverse-tree JSR2
279
+	,&new-label JNZ
274 280
 
275 281
 	( label already exists, check the flags and addr value )
276 282
 	SWP2 POP2
277
-	DUP2 #0001 ADD2 LDR2 ~assembler.addr EQU2 ^$addr-okay JNZ
283
+	DUP2 #0001 ADD2 GET2 .assembler/addr PEK2 EQU2 ,&addr-okay JNZ
278 284
 	( FIXME address is different to previous run, or label defined twice )
279
-	$addr-okay
280
-	PEK2 EQU ^$type-okay JNZ
285
+	&addr-okay
286
+	GET EQU ,&type-okay JNZ
281 287
 	( FIXME node type is different to before )
282
-	$type-okay
288
+	&type-okay
283 289
 	JMP2r
284 290
 
285
-	$new-label
286
-	^append-tree JSR
291
+	&new-label
292
+	,append-tree JSR
287 293
 	(
288 294
 	~assembler.heap SWP2 STR2
289 295
 	,$zero-pointers ~assembler.heap #0004 ^memcpy JSR =assembler.heap
290 296
 	~assembler.heap ,strcpy JSR2
291 297
 	)
292
-	DUP2 STH2 POK2 STH2r
293
-	DUP2 #0001 ADD2 ~assembler.addr SWP2 STR2
294
-	#0003 ADD2 =assembler.heap
298
+	
299
+	DUP2 STH2 PUT STH2r
300
+	DUP2 #0001 ADD2 .assembler/addr PEK2 SWP2 PUT2
301
+	#0003 ADD2 .assembler/heap POK2
295 302
 	JMP2r
296 303
 
297 304
 @lookup-label ( string-ptr* -- address* node-type if found
298 305
                             OR false-address* 00 if not found )
299 306
 	DUP2
300
-	$loop
301
-	DUP2 #0001 ADD2 SWP2 PEK2
302
-	DUP #2e EQU ^$dotted JNZ
303
-	^$loop JNZ
307
+	&loop
308
+	DUP2 #0001 ADD2 SWP2 GET
309
+	DUP #2e EQU ,&dotted JNZ
310
+	,&loop JNZ
304 311
 	DUP2 EOR2 ( faster than POP2 #0000 )
305
-	=assembler.field
312
+	.assembler/field POK2
306 313
 
307
-	$main
308
-	DUP2 ,label-tree SWP2 #ff ,traverse-tree JSR2
309
-	^$not-found JNZ
314
+	&main
315
+	DUP2 ;label-tree SWP2 #ff ;traverse-tree JSR2
316
+	,&not-found JNZ
310 317
 
311 318
 	SWP2 POP2
312
-	~assembler.field #0000 EQU2 ^$end JNZ
313
-	DUP2 PEK2 #80 LTH ^$not-found JNZ
314
-	#0003 ADD2 ~assembler.field #ff ,traverse-tree JSR2
315
-	^$not-found JNZ
319
+	.assembler/field PEK2 #0000 EQU2 ,&end JNZ
320
+	DUP2 GET #80 LTH ,&not-found JNZ
321
+	#0003 ADD2 .assembler/field PEK2 #ff ;traverse-tree JSR2
322
+	,&not-found JNZ
316 323
 
317
-	$end
318
-	DUP2 #0001 ADD2 LDR2 SWP2 PEK2
324
+	&end
325
+	DUP2 #0001 ADD2 GET2 SWP2 GET
319 326
 	JMP2r
320 327
 
321
-	$not-found
328
+	&not-found
322 329
 	POP2
323 330
 	( FIXME complain about missing label )
324 331
 	POP2
325 332
 	( false-address is out of reach for JMP )
326
-	~assembler.addr #8765 ADD2
333
+	.assembler/addr PEK2 #8765 ADD2
327 334
 	#00
328 335
 	JMP2r
329 336
 
330
-	$dotted
331
-	DUP OVR2 =assembler.field
332
-	EOR ROT ROT #0001 SUB2 POK2
333
-	^$main JMP
337
+	&dotted
338
+	DUP OVR2 .assembler/field POK2
339
+	EOR ROT ROT #0001 SUB2 PUT
340
+	,&main JMP
334 341
 
335 342
 @write-byte ( byte -- )
336
-	( FIXME ) =Console.byte
337
-	~assembler.addr #0001 ADD2 =assembler.addr
343
+	( FIXME )  .Console/byte DEO
344
+	.assembler/addr PEK2 #0001 ADD2 .assembler/addr POK2
338 345
 	JMP2r
339 346
 
340 347
 @write-short ( short -- )
341
-	( FIXME ) =Console.short
342
-	~assembler.addr #0002 ADD2 =assembler.addr
348
+	( FIXME )  .Console/short DEO2
349
+	.assembler/addr PEK2 #0002 ADD2 .assembler/addr POK2
343 350
 	JMP2r
344 351
 
345
-@label-tree .l-root
352
+@label-tree :l-root
346 353
 @macro-tree [ 0000 ]
347 354
 
348 355
 @opcodes
... ...
@@ -385,60 +392,61 @@
385 392
 		by seven (the size of each node). By multiplying the byte value by seven
386 393
 		and adding to $disasm, we get the opcode name when disassembling too.
387 394
 	)
388
-	$tree   .$op-lth ( opcode tree )
389
-	$start
390
-	$op-brk .$op-add .$op-dup $disasm [ BRK ] $asm
391
-	$op-nop .$op-mul .$op-ovr         [ NOP ]
392
-	$op-lit [ 0000 ] [ 0000 ]         [ LIT ]
393
-	$op-pop [ 0000 ] [ 0000 ]         [ POP ]
394
-	$op-dup .$op-div .$op-eor         [ DUP ]
395
-	$op-swp [ 0000 ] [ 0000 ]         [ SWP ]
396
-	$op-ovr .$op-ora .$op-pek         [ OVR ]
397
-	$op-rot .$op-pop .$op-sft         [ ROT ]
398
-	$op-equ .$op-brk .$op-jnz         [ EQU ]
399
-	$op-neq [ 0000 ] [ 0000 ]         [ NEQ ]
400
-	$op-gth [ 0000 ] [ 0000 ]         [ GTH ]
401
-	$op-lth .$op-equ .$op-pok         [ LTH ]
402
-	$op-gts .$op-gth .$op-jmp         [ GTS ]
403
-	$op-lts [ 0000 ] [ 0000 ]         [ LTS ]
404
-	        [ 0000 ] [ 0000 ]         [ ??? ]
405
-	        [ 0000 ] [ 0000 ]         [ ??? ]
406
-	$op-pek [ 0000 ] [ 0000 ]         [ PEK ]
407
-	$op-pok .$op-nop .$op-sth         [ POK ]
408
-	$op-ldr .$op-jsr .$op-lit         [ LDR ]
409
-	$op-str [ 0000 ] [ 0000 ]         [ STR ]
410
-	$op-jmp [ 0000 ] [ 0000 ]         [ JMP ]
411
-	$op-jnz .$op-gts .$op-ldr         [ JNZ ]
412
-	$op-jsr [ 0000 ] [ 0000 ]         [ JSR ]
413
-	$op-sth .$op-rot .$op-sub         [ STH ]
414
-	$op-add [ 0000 ] .$op-and         [ ADD ]
415
-	$op-sub .$op-str .$op-swp         [ SUB ]
416
-	$op-mul .$op-lts .$op-neq         [ MUL ]
417
-	$op-div [ 0000 ] [ 0000 ]         [ DIV ]
418
-	$op-and [ 0000 ] [ 0000 ]         [ AND ]
419
-	$op-ora [ 0000 ] [ 0000 ]         [ ORA ]
420
-	$op-eor [ 0000 ] [ 0000 ]         [ EOR ]
421
-	$op-sft [ 0000 ] [ 0000 ]         [ SFT ]
395
+	
396
+	&tree   :&op-lth ( opcode tree )
397
+	&start
398
+	&op-brk :&op-add :&op-dup &disasm [ "BRK ] &asm
399
+	&op-nop :&op-mul :&op-ovr         [ "NOP ]
400
+	&op-lit [ 0000 ] [ 0000 ]         [ "LIT ]
401
+	&op-pop [ 0000 ] [ 0000 ]         [ "POP ]
402
+	&op-dup :&op-div :&op-eor         [ "DUP ]
403
+	&op-swp [ 0000 ] [ 0000 ]         [ "SWP ]
404
+	&op-ovr :&op-ora :&op-pek         [ "OVR ]
405
+	&op-rot :&op-pop :&op-sft         [ "ROT ]
406
+	&op-equ :&op-brk :&op-jnz         [ "EQU ]
407
+	&op-neq [ 0000 ] [ 0000 ]         [ "NEQ ]
408
+	&op-gth [ 0000 ] [ 0000 ]         [ "GTH ]
409
+	&op-lth :&op-equ :&op-pok         [ "LTH ]
410
+	&op-gts :&op-gth :&op-jmp         [ "GTS ]
411
+	&op-lts [ 0000 ] [ 0000 ]         [ "LTS ]
412
+	        [ 0000 ] [ 0000 ]         [ "??? ]
413
+	        [ 0000 ] [ 0000 ]         [ "??? ]
414
+	&op-pek [ 0000 ] [ 0000 ]         [ "PEK ]
415
+	&op-pok :&op-nop :&op-sth         [ "POK ]
416
+	&op-ldr :&op-jsr :&op-lit         [ "LDR ]
417
+	&op-str [ 0000 ] [ 0000 ]         [ "STR ]
418
+	&op-jmp [ 0000 ] [ 0000 ]         [ "JMP ]
419
+	&op-jnz :&op-gts :&op-ldr         [ "JNZ ]
420
+	&op-jsr [ 0000 ] [ 0000 ]         [ "JSR ]
421
+	&op-sth :&op-rot :&op-sub         [ "STH ]
422
+	&op-add [ 0000 ] :&op-and         [ ADD ]
423
+	&op-sub :&op-str :&op-swp         [ "SUB ]
424
+	&op-mul :&op-lts :&op-neq         [ "MUL ]
425
+	&op-div [ 0000 ] [ 0000 ]         [ "DIV ]
426
+	&op-and [ 0000 ] [ 0000 ]         [ "AND ]
427
+	&op-ora [ 0000 ] [ 0000 ]         [ "ORA ]
428
+	&op-eor [ 0000 ] [ 0000 ]         [ "EOR ]
429
+	&op-sft [ 0000 ] [ 0000 ]         [ "SFT ]
422 430
 
423 431
 @state-machine-pointers
424 432
 ( normal mode 00 )
425
-.normal-root   .normal-main
433
+:normal-root   :normal-main
426 434
 ( macro definition 01 )
427
-.macro-root    .macro-main
435
+:macro-root    :macro-main
428 436
 ( macro definition, contents ignored 02 )
429
-.macro-root    .ignore
437
+:macro-root    :ignore
430 438
 ( variable definition, expect field size 04 )
431
-.variable-nul  .variable-size
439
+:variable-nul  :variable-size
432 440
 ( variable definition, expect field name 08 )
433
-.variable-root .variable-name
441
+:variable-root :variable-name
434 442
 ( reserved for future use 10 )
435
-[ 0000 ]       .ignore
443
+[ 0000 ]       :ignore
436 444
 ( literal data 20 )
437
-.normal-]      .data-main
445
+:normal-5d     :data-main
438 446
 ( reserved for future use 40 )
439
-[ 0000 ]       .ignore
447
+[ 0000 ]       :ignore
440 448
 ( comment 80 )
441
-.normal-)      .ignore
449
+:normal-29     :ignore
442 450
 
443 451
 (
444 452
 	Next up, we have the tree of code corresponding to each token's
... ...
@@ -451,18 +459,20 @@
451 459
 	the comment tree.
452 460
 )
453 461
 
462
+
454 463
 (
455 464
 	Left and right parentheses start and end comment sections. They use the
456 465
 	highest bit in assembler state, so they receive highest priority: it
457 466
 	doesn't matter what other bits are set, a comment's a comment.
458 467
 )
459 468
 
460
-@normal-(   [ 0000 ]    .normal-)   [ 28 ]
461
-	~assembler.state #80 ORA =assembler.state
469
+
470
+@normal-28  [ 0000 ]    :normal-29  [ 28 ]
471
+	.assembler/state PEK #80 ORA .assembler/state POK
462 472
 	JMP2r
463 473
 
464
-@normal-)   [ 0000 ]    [ 0000 ]    [ 29 ]
465
-	~assembler.state #7f AND =assembler.state
474
+@normal-29  [ 0000 ]    [ 0000 ]    [ 29 ]
475
+	.assembler/state PEK #7f AND .assembler/state POK
466 476
 	JMP2r
467 477
 
468 478
 (
... ...
@@ -470,12 +480,13 @@
470 480
 	local labels that follow.
471 481
 )
472 482
 
483
+
473 484
 @normal-@   [ 0000 ]    [ 0000 ]    [ 40 ]
474
-	#00 ~assembler.token ,label-tree ,add-label JSR2
485
+	#00 .assembler/token PEK2 ;label-tree ;add-label JSR2
475 486
 
476
-	$scope
477
-	~assembler.token ,assembler.scope ,strcpy JSR2
478
-	DUP2 ,assembler.scope SUB2 =assembler.scope-len POP
487
+	&scope
488
+	.assembler/token PEK2 ;assembler/scope ;strcpy JSR2
489
+	DUP2 ;assembler/scope SUB2 .assembler/scope-len POK POP
479 490
 	#0001 SUB2 #2d SWP POK POP
480 491
 	JMP2r
481 492
 
... ...
@@ -483,91 +494,95 @@
483 494
 	Dollar signs introduce local labels, which use the scope defined above.
484 495
 )
485 496
 
486
-@normal-$   .normal-"   .normal-,   [ 24 ]
487
-	~assembler.token
488
-	,assembler.scope ~assembler.scope-len ADD
489
-	,strcpy JSR2 POP2
490 497
 
491
-	#00 ,assembler.scope ,label-tree ,add-label JMP2 ( tail call )
498
+@normal-24  :normal-"   :normal-,   [ 24 ]
499
+	.assembler/token PEK2
500
+	;assembler/scope .assembler/scope-len PEK ADD
501
+	;strcpy JSR2 POP2
502
+
503
+	#00 ;assembler/scope ;label-tree ;add-label JMP2 ( tail call )
492 504
 
493 505
 (
494 506
 	Hash signs followed by two or four hex digits write a literal.
495 507
 )
496 508
 
509
+
497 510
 @normal-#   [ 0000 ]    [ 0000 ]    [ 23 ]
498
-	~assembler.token ,parse-hex-string JSR2
499
-	DUP ^$valid JNZ
511
+	.assembler/token PEK2 ;parse-hex-string JSR2
512
+	DUP ,&valid JNZ
500 513
 	( FIXME complain about invalid hex literal )
501 514
 	POP
502 515
 	JMP2r
503 516
 	
504
-	$valid
517
+	&valid
505 518
 	DUP #01 SUB SHORT_FLAG MUL ( short flag for opcode )
506
-	,opcodes-op-lit ,opcodes-start SUB2 #07 DIV
507
-	ADD ADD ,write-byte JSR2
519
+	;opcodes/op-lit ;opcodes/start SUB2 #07 DIV
520
+	ADD ADD ;write-byte JSR2
508 521
 
509
-	$value
510
-	#02 EQU ^$short JNZ
511
-	,write-byte JMP2 ( tail call )
522
+	&value
523
+	#02 EQU ,&short JNZ
524
+	;write-byte JMP2 ( tail call )
512 525
 
513
-	$short
514
-	,write-short JMP2 ( tail call )
526
+	&short
527
+	;write-short JMP2 ( tail call )
515 528
 
516 529
 (
517 530
 	Left and right square brackets start and end literal data sections.
518 531
 )
519 532
 
520
-@normal-[   .normal-@   .normal-]   [ 5b ]
521
-	~assembler.state #20 ORA =assembler.state
533
+
534
+@normal-5b  :normal-@   :normal-5d  [ 5b ]
535
+	.assembler/state PEK #20 ORA .assembler/state POK
522 536
 	JMP2r
523 537
 
524
-@normal-]   [ 0000 ]    [ 0000 ]    [ 5d ]
525
-	~assembler.state #df AND =assembler.state
538
+@normal-5d  [ 0000 ]    [ 0000 ]    [ 5d ]
539
+	.assembler/state PEK #df AND .assembler/state POK
526 540
 	JMP2r
527 541
 
528
-@data-]    .normal-(   [ 0000 ]    [ 5d ]
529
-	~assembler.state #df AND =assembler.state
542
+@data-]    :normal-28  [ 0000 ]    [ 5d ]
543
+	.assembler/state PEK #df AND .assembler/state POK
530 544
 	JMP2r
531 545
 
532 546
 @data-root
533
-@data-nul  [ 0000 ]    .data-]    [ 00 ]
547
+@data-nul  [ 0000 ]    :data-]    [ 00 ]
534 548
 	JMP2r
535 549
 
536 550
 @data-main
537
-	~assembler.token ,parse-hex-string JSR2
538
-	DUP ^normal-#-value JNZ
551
+	.assembler/token PEK2 ;parse-hex-string JSR2
552
+	DUP ,normal-#/value JNZ
539 553
 	POP
540 554
 
541
-	~assembler.token
542
-	$loop
543
-	DUP2 PEK2
544
-	DUP ^$keep-going JNZ
555
+	.assembler/token PEK2
556
+	&loop
557
+	DUP2 GET
558
+	DUP ,&keep-going JNZ
545 559
 	POP POP2 JMP2r
546 560
 
547
-	$keep-going
548
-	,write-byte JSR2
561
+	&keep-going
562
+	;write-byte JSR2
549 563
 	#0001 ADD2
550
-	^$loop JMP
564
+	,&loop JMP
551 565
 
552 566
 (
553 567
 	A pipe moves the current address to the hex value given.
554 568
 )
555 569
 
556
-@normal-|   .normal-{   .normal-}   [ 7c ]
557
-	~assembler.token ,parse-hex-string JSR2
558
-	DUP #02 EQU ^$valid JNZ
570
+
571
+@normal-|   :normal-{   :normal-}   [ 7c ]
572
+	.assembler/token PEK2 ;parse-hex-string JSR2
573
+	DUP #02 EQU ,&valid JNZ
559 574
 	#00 EQU JMP POP
560 575
 	( FIXME complain about invalid hex literal )
561 576
 	JMP2r
562 577
 
563
-	$valid
578
+	&valid
564 579
 	POP
565
-	DUP2 ~assembler.addr LTH2 ^$backwards JNZ
580
+	DUP2 .assembler/addr PEK2 LTH2 ,&backwards JNZ
566 581
 	( FIXME add zeroes when writing )
567
-	=assembler.addr
582
+	.assembler/addr POK2
568 583
 	JMP2r
569 584
 
570
-	$backwards
585
+	&backwards
571 586
 	( FIXME complain about going backwards )
572 587
 	POP2
573 588
 	JMP2r
... ...
@@ -577,32 +592,34 @@
577 592
 	with a LIT2 opcode.
578 593
 )
579 594
 
580
-@normal-,   .normal-%   .normal-dot [ 2c ]
581
-	,opcodes-op-lit ,opcodes-start SUB2 #07 DIV SHORT_FLAG ADD ,write-byte JSR2 POP
582
-	^normal-dot-main JMP
583 595
 
584
-@normal-dot [ 0000 ]    .normal-;   [ 2e ]
585
-	$main
586
-	~assembler.token ,lookup-label JSR2
596
+@normal-,   :normal-%   :normal-dot [ 2c ]
597
+	;opcodes/op-lit ;opcodes/start SUB2 #07 DIV SHORT_FLAG ADD ;write-byte JSR2 POP
598
+	,normal-dot/main JMP
599
+
600
+@normal-dot [ 0000 ]    :normal-;   [ 2e ]
601
+	&main
602
+	.assembler/token PEK2 ;lookup-label JSR2
587 603
 	POP ( don't care about node type )
588
-	,write-short JMP2 ( tail call )
604
+	;write-short JMP2 ( tail call )
589 605
 
590 606
 (
591 607
 	Caret writes LIT, followed by the label address as an offset.
592 608
 )
593 609
 
594
-@normal-^   .normal-[   .normal-|   [ 5e ]
595
-	,opcodes-op-lit ,opcodes-start SUB2 #07 DIV ,write-byte JSR2 POP
596
-	~assembler.token ,lookup-label JSR2
610
+
611
+@normal-^   :normal-5b  :normal-|   [ 5e ]
612
+	;opcodes/op-lit ;opcodes/start SUB2 #07 DIV ;write-byte JSR2 POP
613
+	.assembler/token PEK2 ;lookup-label JSR2
597 614
 	POP ( don't care about node type )
598
-	~assembler.addr SUB2
599
-	DUP2 #ff79 GTH2 ^$okay JNZ
600
-	DUP2 #0080 LTH2 ^$okay JNZ
615
+	.assembler/addr PEK2 SUB2
616
+	DUP2 #ff79 GTH2 ,&okay JNZ
617
+	DUP2 #0080 LTH2 ,&okay JNZ
601 618
 
602 619
 	( FIXME complain about jump being too far )
603 620
 
604
-	$okay
605
-	,write-byte JSR2 POP
621
+	&okay
622
+	;write-byte JSR2 POP
606 623
 	JMP2r
607 624
 
608 625
 (
... ...
@@ -610,38 +627,39 @@
610 627
 	If the target is in the zero page, use LDR/PEK or STR/POK opcodes,
611 628
 	otherwise use LDR2/PEK2 or STR2/POK2 opcodes.
612 629
 )
630
+
613 631
 @normal-~   [ 0000 ]    [ 0000 ]    [ 7e ]
614
-	LIT2r .opcodes-op-ldr LIT2r .opcodes-op-pek
615
-	^normal-=-main JMP
632
+	LIT2r :opcodes/op-ldr LIT2r :opcodes/op-pek
633
+	,normal-=/main JMP
616 634
 
617 635
 @normal-root
618
-@normal-=   .normal-$   .normal-^   [ 3d ]
619
-	LIT2r .opcodes-op-str LIT2r .opcodes-op-pok
620
-	$main
621
-	~assembler.token ,lookup-label JSR2
622
-	DUP #03 AND ^$valid JNZ
636
+@normal-=   :normal-24  :normal-^   [ 3d ]
637
+	LIT2r :opcodes/op-str LIT2r :opcodes/op-pok
638
+	&main
639
+	.assembler/token PEK2 ;lookup-label JSR2
640
+	DUP #03 AND ,&valid JNZ
623 641
 
624 642
 	( FIXME complain about helper not being usable )
625 643
 	POP2 JMP2r
626 644
 
627
-	$valid
628
-	#02 AND ^$two-byte JNZ
645
+	&valid
646
+	#02 AND ,&two-byte JNZ
629 647
 	SWP2r
630
-	$two-byte
648
+	&two-byte
631 649
 	POP2r
632
-	LIT2r .opcodes-start SUB2r LITr [ 07 ] DIVr
633
-	OVR #00 EQU ^$byte-mode JNZ
650
+	LIT2r :opcodes/start SUB2r LITr [ 07 ] DIVr
651
+	OVR #00 EQU ,&byte-mode JNZ
634 652
 
635
-	,write-short SHORT_FLAG ^$end JMP
653
+	;write-short SHORT_FLAG ,&end JMP
636 654
 
637
-	$byte-mode
655
+	&byte-mode
638 656
 	SWP POP
639
-	,write-byte #00
657
+	;write-byte #00
640 658
 
641
-	$end
642
-	,opcodes-op-lit ,opcodes-start SUB2 #07 DIV ADD ADD ,write-byte JSR2
659
+	&end
660
+	;opcodes/op-lit ;opcodes/start SUB2 #07 DIV ADD ADD ;write-byte JSR2
643 661
 	JSR2
644
-	STHr ,write-byte JSR2
662
+	STHr ;write-byte JSR2
645 663
 	POPr
646 664
 	JMP2r
647 665
 
... ...
@@ -650,55 +668,56 @@
650 668
 	tree as usual, but all of the subfields are collected into their own tree
651 669
 	pointed to in the variable name's binary data.
652 670
 )
671
+
653 672
 @normal-;   [ 0000 ]    [ 0000 ]    [ 3b ]
654
-	#80 ~assembler.token ,label-tree ,add-label JSR2
655
-	~assembler.heap #0000 OVR2 STR2
656
-	DUP2 #0003 SUB2 =assembler.var_size
657
-	DUP2 =assembler.subtree
658
-	#0002 ADD2 =assembler.heap
673
+	#80 .assembler/token PEK2 ;label-tree ;add-label JSR2
674
+	.assembler/heap PEK2 #0000 OVR2 PUT2
675
+	DUP2 #0003 SUB2 .assembler/var_size POK2
676
+	DUP2 .assembler/subtree POK2
677
+	#0002 ADD2 .assembler/heap POK2
659 678
 
660
-	~assembler.state #0c ORA =assembler.state
679
+	.assembler/state PEK #0c ORA .assembler/state POK
661 680
 	JMP2r
662 681
 
663 682
 @variable-root
664
-@variable-{ .variable-nul .variable-} [ 7b ]
683
+@variable-{ :variable-nul :variable-} [ 7b ]
665 684
 	JMP2r
666 685
 
667
-@variable-nul [ 0000 ]    .normal-(   [ 00 ]
686
+@variable-nul [ 0000 ]    :normal-28  [ 00 ]
668 687
 	JMP2r
669 688
 
670 689
 @variable-} [ 0000 ]    [ 0000 ]    [ 7d ]
671
-	~assembler.state #f3 AND =assembler.state
690
+	.assembler/state PEK #f3 AND .assembler/state POK
672 691
 	JMP2r
673 692
 
674 693
 @variable-name
675
-	#00 ~assembler.token ~assembler.subtree ,add-label JSR2
676
-	~assembler.heap #0003 SUB2 =assembler.field_size
677
-	~assembler.state #f7 AND =assembler.state
694
+	#00 .assembler/token PEK2 .assembler/subtree PEK2 ;add-label JSR2
695
+	.assembler/heap PEK2 #0003 SUB2 .assembler/field_size POK2
696
+	.assembler/state PEK #f7 AND .assembler/state POK
678 697
 	JMP2r
679 698
 
680 699
 @variable-size
681
-	~assembler.token ,parse-hex-length JSR2
682
-	^$valid JNZ
700
+	.assembler/token PEK2 ;parse-hex-length JSR2
701
+	,&valid JNZ
683 702
 	( FIXME complain about invalid size )
684 703
 	JMP2r
685 704
 
686
-	$valid
687
-	$no-var-size
688
-	DUP #02 GTH ^$end JNZ
689
-	DUP ~assembler.field_size POK2
690
-	~assembler.var_size #0000 EQU2 ^$end JNZ
691
-	DUP #80 EOR ~assembler.var_size POK2
692
-	^$end JMP
705
+	&valid
706
+	&no-var-size
707
+	DUP #02 GTH ,&end JNZ
708
+	DUP .assembler/field_size PEK2 PUT
709
+	.assembler/var_size PEK2 #0000 EQU2 ,&end JNZ
710
+	DUP #80 EOR .assembler/var_size PEK2 PUT
711
+	,&end JMP
693 712
 
694
-	$loop
695
-	#00 ,write-byte JSR2
713
+	&loop
714
+	#00 ;write-byte JSR2
696 715
 	#01 SUB
697
-	$end
698
-	DUP ^$loop JNZ
716
+	&end
717
+	DUP ,&loop JNZ
699 718
 	POP
700
-	~assembler.state #0c ORA =assembler.state
701
-	#0000 =assembler.var_size
719
+	.assembler/state PEK #0c ORA .assembler/state POK
720
+	#0000 .assembler/var_size POK2
702 721
 	JMP2r
703 722
 
704 723
 (
... ...
@@ -706,42 +725,43 @@
706 725
 	and all the arguments are collected into a list that follows the label's
707 726
 	binary data.
708 727
 )
709
-@normal-%   [ 0000 ]    .normal-(   [ 25 ]
710
-	,macro-tree ~assembler.token #ff ,traverse-tree JSR2
711
-	^$new-macro JNZ
728
+
729
+@normal-%   [ 0000 ]    :normal-28  [ 25 ]
730
+	;macro-tree .assembler/token PEK2 #ff ;traverse-tree JSR2
731
+	,&new-macro JNZ
712 732
 
713 733
 	( macro already exists, we assume defined in a previous pass
714 734
 	  we totally ignore the contents )
715 735
 	POP2
716
-	~assembler.state #02 ORA =assembler.state
736
+	.assembler/state PEK #02 ORA .assembler/state POK
717 737
 	JMP2r
718 738
 
719
-	$new-macro
720
-	~assembler.token SWP2 ,append-tree JSR2
739
+	&new-macro
740
+	.assembler/token PEK2 SWP2 ;append-tree JSR2
721 741
 	POP2
722
-	~assembler.state #01 ORA =assembler.state
742
+	.assembler/state PEK #01 ORA .assembler/state POK
723 743
 	JMP2r
724 744
 
725 745
 @macro-root
726
-@macro-{   .macro-nul .macro-}   [ 7b ]
746
+@macro-{   :macro-nul :macro-}   [ 7b ]
727 747
 	JMP2r
728 748
 
729 749
 @macro-}   [ 0000 ]    [ 0000 ]    [ 7d ]
730
-	~assembler.heap DUP2 #00 ROT ROT POK2
731
-	#0001 ADD2 =assembler.heap
732
-	~assembler.state #fc AND =assembler.state
750
+	.assembler/heap PEK2 DUP2 #00 ROT ROT PUT
751
+	#0001 ADD2 .assembler/heap POK2
752
+	.assembler/state PEK #fc AND .assembler/state POK
733 753
 	JMP2r
734 754
 
735
-@macro-nul [ 0000 ]    .normal-(   [ 00 ]
755
+@macro-nul [ 0000 ]    :normal-28  [ 00 ]
736 756
 	JMP2r
737 757
 
738 758
 @macro-main
739
-	~assembler.token ,append-heap JSR2
759
+	.assembler/token PEK2 ;append-heap JSR2
740 760
 	POP2
741 761
 	JMP2r
742 762
 
743 763
 
744
-@normal-"   .normal-nul .normal-#   [ 22 ]
764
+@normal-"   :normal-nul :normal-#   [ 22 ]
745 765
 	( FIXME NYI )
746 766
 	JMP2r
747 767
 
... ...
@@ -749,7 +769,7 @@
749 769
 	( these are spurious, but ignore them anyway )
750 770
 	JMP2r
751 771
 
752
-@normal-}   [ 0000 ]    .normal-~   [ 7d ]
772
+@normal-}   [ 0000 ]    :normal-~   [ 7d ]
753 773
 	( these are spurious, but ignore them anyway )
754 774
 	JMP2r
755 775
 
... ...
@@ -758,37 +778,37 @@
758 778
 	JMP2r
759 779
 
760 780
 @normal-main
761
-	~assembler.token
762
-	,opcodes-tree OVR2 #03 ,traverse-tree JSR2
763
-	^$not-opcode JNZ
781
+	.assembler/token PEK2
782
+	;opcodes/tree OVR2 #03 ;traverse-tree JSR2
783
+	,&not-opcode JNZ
764 784
 
765
-	,opcodes-asm SUB2 #0007 DIV2
785
+	;opcodes/asm SUB2 #0007 DIV2
766 786
 	SWP2 #0003 ADD2
767
-	$flags
768
-	DUP2 PEK2
769
-	DUP #00 EQU ^$end-flags JNZ
770
-	DUP #32 NEQ ^$not-two JNZ
771
-	POP SWP2 SHORT_FLAG ORA SWP2 #0001 ADD2 ^$flags JMP
772
-	$not-two
773
-	DUP #72 NEQ ^$not-r JNZ
774
-	POP SWP2 RETURN_FLAG ORA SWP2 #0001 ADD2 ^$flags JMP
775
-	$not-r
776
-	POP POP2 ~assembler.token SWP2
777
-	^$not-opcode JMP
778
-
779
-	$end-flags
787
+	&flags
788
+	DUP2 GET
789
+	DUP #00 EQU ,&end-flags JNZ
790
+	DUP #32 NEQ ,&not-two JNZ
791
+	POP SWP2 SHORT_FLAG ORA SWP2 #0001 ADD2 ,&flags JMP
792
+	&not-two
793
+	DUP #72 NEQ ,&not-r JNZ
794
+	POP SWP2 RETURN_FLAG ORA SWP2 #0001 ADD2 ,&flags JMP
795
+	&not-r
796
+	POP POP2 .assembler/token PEK2 SWP2
797
+	,&not-opcode JMP
798
+
799
+	&end-flags
780 800
 	POP POP2
781
-	,write-byte JSR2
801
+	;write-byte JSR2
782 802
 	POP
783 803
 	JMP2r
784 804
 
785
-	$not-opcode
805
+	&not-opcode
786 806
 	POP2
787
-	,macro-tree SWP2 #ff ,traverse-tree JSR2
788
-	^$not-macro JNZ
789
-	,assemble-macro JMP2 ( tail call )
807
+	;macro-tree SWP2 #ff ;traverse-tree JSR2
808
+	,&not-macro JNZ
809
+	;assemble-macro JMP2 ( tail call )
790 810
 
791
-	$not-macro
811
+	&not-macro
792 812
 	( FIXME complain about bad opcode / nonexistent macro )
793 813
 	POP2
794 814
 	JMP2r
... ...
@@ -818,72 +838,73 @@
818 838
 	If there is a subtree, it is searched when the reference contains a dot.
819 839
 )
820 840
 
821
-@l-Audio           [ 0000 ]          [ 0000 ]         [ Audio 00 ]      [ 80 ] .Audio .l-Audio-root
822
-@l-Audio-delay     [ 0000 ]          [ 0000 ]         [ delay 00 ]      [ 02 ] .Audio.delay
823
-@l-Audio-envelope .l-Audio-delay    .l-Audio-finish   [ envelope 00 ]   [ 02 ] .Audio.envelope
824
-@l-Audio-finish    [ 0000 ]          [ 0000 ]         [ finish 00 ]     [ 01 ] .Audio.finish
841
+
842
+@l-Audio           [ 0000 ]          [ 0000 ]         [ "Audio 00 ]      [ 80 ] :Audio :l-Audio-root
843
+@l-Audio-delay     [ 0000 ]          [ 0000 ]         [ "delay 00 ]      [ 02 ] :Audio/delay
844
+@l-Audio-envelope :l-Audio-delay    :l-Audio-finish   [ "envelope 00 ]   [ 02 ] :Audio/envelope
845
+@l-Audio-finish    [ 0000 ]          [ 0000 ]         [ "finish 00 ]     [ 01 ] :Audio/finish
825 846
 @l-Audio-root
826
-@l-Audio-pitch    .l-Audio-envelope .l-Audio-value    [ pitch 00 ]      [ 01 ] .Audio.pitch
827
-@l-Audio-play      [ 0000 ]          [ 0000 ]         [ play 00 ]       [ 01 ] .Audio.play
828
-@l-Audio-value    .l-Audio-play     .l-Audio-volume   [ value 00 ]      [ 02 ] .Audio.value
829
-@l-Audio-volume    [ 0000 ]         .l-Audio-wave     [ volume 00 ]     [ 01 ] .Audio.volume
830
-@l-Audio-wave      [ 0000 ]          [ 0000 ]         [ wave 00 ]       [ 02 ] .Audio.wave
831
-@l-Console        .l-Audio          .l-Controller     [ Console 00 ]    [ 80 ] .Console .l-Console-root
832
-@l-Console-byte    [ 0000 ]         .l-Console-char   [ byte 00 ]       [ 01 ] .Console.byte
833
-@l-Console-char    [ 0000 ]          [ 0000 ]         [ char 00 ]       [ 01 ] .Console.char
847
+@l-Audio-pitch    :l-Audio-envelope :l-Audio-value    [ "pitch 00 ]      [ 01 ] :Audio/pitch
848
+@l-Audio-play      [ 0000 ]          [ 0000 ]         [ "play 00 ]       [ 01 ] :Audio/play
849
+@l-Audio-value    :l-Audio-play     :l-Audio-volume   [ "value 00 ]      [ 02 ] :Audio/value
850
+@l-Audio-volume    [ 0000 ]         :l-Audio-wave     [ "volume 00 ]     [ 01 ] :Audio/volume
851
+@l-Audio-wave      [ 0000 ]          [ 0000 ]         [ "wave 00 ]       [ 02 ] :Audio/wave
852
+@l-Console        :l-Audio          :l-Controller     [ "Console 00 ]    [ 80 ] :Console :l-Console-root
853
+@l-Console-byte    [ 0000 ]         :l-Console-char   [ "byte 00 ]       [ 01 ] :Console/byte
854
+@l-Console-char    [ 0000 ]          [ 0000 ]         [ "char 00 ]       [ 01 ] :Console/char
834 855
 @l-Console-root
835
-@l-Console-short  .l-Console-byte   .l-Console-string [ short 00 ]      [ 02 ] .Console.short
836
-@l-Console-string  [ 0000 ]         .l-Console-vector [ string 00 ]     [ 02 ] .Console.string
837
-@l-Console-vector  [ 0000 ]          [ 0000 ]         [ vector 00 ]     [ 02 ] .Console.vector
838
-@l-Controller      [ 0000 ]          [ 0000 ]         [ Controller 00 ] [ 80 ] .Controller .l-Controller-root
839
-@l-Controller-button  [ 0000 ]          [ 0000 ]         [ button 00 ]     [ 01 ] .Controller.button
856
+@l-Console-short  :l-Console-byte   :l-Console-string [ "short 00 ]      [ 02 ] :Console/short
857
+@l-Console-string  [ 0000 ]         :l-Console-vector [ "string 00 ]     [ 02 ] :Console/string
858
+@l-Console-vector  [ 0000 ]          [ 0000 ]         [ "vector 00 ]     [ 02 ] :Console/vector
859
+@l-Controller      [ 0000 ]          [ 0000 ]         [ "Controller 00 ] [ 80 ] :Controller :l-Controller-root
860
+@l-Controller-button  [ 0000 ]          [ 0000 ]         [ "button 00 ]     [ 01 ] :Controller/button
840 861
 @l-Controller-root
841
-@l-Controller-key .l-Controller-button .l-Controller-vector [ key 00 ]        [ 01 ] .Controller.key
842
-@l-Controller-vector  [ 0000 ]          [ 0000 ]         [ vector 00 ]     [ 02 ] .Controller.vector
862
+@l-Controller-key :l-Controller-button :l-Controller-vector [ "key 00 ]        [ 01 ] :Controller/key
863
+@l-Controller-vector  [ 0000 ]          [ 0000 ]         [ "vector 00 ]     [ 02 ] :Controller/vector
843 864
 @l-root
844
-@l-DateTime       .l-Console        .l-Mouse          [ DateTime 00 ]   [ 80 ] .DateTime .l-DateTime-root
845
-@l-DateTime-day    [ 0000 ]          [ 0000 ]         [ day 00 ]        [ 01 ] .DateTime.day
846
-@l-DateTime-dotw  .l-DateTime-day   .l-DateTime-doty  [ dotw 00 ]       [ 01 ] .DateTime.dotw
847
-@l-DateTime-doty   [ 0000 ]         .l-DateTime-hour  [ doty 00 ]       [ 02 ] .DateTime.doty
848
-@l-DateTime-hour   [ 0000 ]          [ 0000 ]         [ hour 00 ]       [ 01 ] .DateTime.hour
865
+@l-DateTime       :l-Console        :l-Mouse          [ "DateTime 00 ]   [ 80 ] :DateTime :l-DateTime-root
866
+@l-DateTime-day    [ 0000 ]          [ 0000 ]         [ "day 00 ]        [ 01 ] :DateTime/day
867
+@l-DateTime-dotw  :l-DateTime-day   :l-DateTime-doty  [ "dotw 00 ]       [ 01 ] :DateTime/dotw
868
+@l-DateTime-doty   [ 0000 ]         :l-DateTime-hour  [ "doty 00 ]       [ 02 ] :DateTime/doty
869
+@l-DateTime-hour   [ 0000 ]          [ 0000 ]         [ "hour 00 ]       [ 01 ] :DateTime/hour
849 870
 @l-DateTime-root
850
-@l-DateTime-isdst .l-DateTime-dotw  .l-DateTime-refresh [ isdst 00 ]      [ 01 ] .DateTime.isdst
851
-@l-DateTime-minute  [ 0000 ]         .l-DateTime-month [ minute 00 ]     [ 01 ] .DateTime.minute
852
-@l-DateTime-month  [ 0000 ]          [ 0000 ]         [ month 00 ]      [ 01 ] .DateTime.month
853
-@l-DateTime-refresh .l-DateTime-minute .l-DateTime-second [ refresh 00 ]    [ 01 ] .DateTime.refresh
854
-@l-DateTime-second  [ 0000 ]         .l-DateTime-year  [ second 00 ]     [ 01 ] .DateTime.second
855
-@l-DateTime-year   [ 0000 ]          [ 0000 ]         [ year 00 ]       [ 02 ] .DateTime.year
856
-@l-File            [ 0000 ]          [ 0000 ]         [ File 00 ]       [ 80 ] .File .l-File-root
857
-@l-File-length     [ 0000 ]          [ 0000 ]         [ length 00 ]     [ 02 ] .File.length
858
-@l-File-load      .l-File-length    .l-File-name      [ load 00 ]       [ 02 ] .File.load
859
-@l-File-name       [ 0000 ]          [ 0000 ]         [ name 00 ]       [ 02 ] .File.name
871
+@l-DateTime-isdst :l-DateTime-dotw  :l-DateTime-refresh [ "isdst 00 ]      [ 01 ] :DateTime/isdst
872
+@l-DateTime-minute  [ 0000 ]         :l-DateTime-month [ "minute 00 ]     [ 01 ] :DateTime/minute
873
+@l-DateTime-month  [ 0000 ]          [ 0000 ]         [ "month 00 ]      [ 01 ] :DateTime/month
874
+@l-DateTime-refresh :l-DateTime-minute :l-DateTime-second [ "refresh 00 ]    [ 01 ] :DateTime/refresh
875
+@l-DateTime-second  [ 0000 ]         :l-DateTime-year  [ "second 00 ]     [ 01 ] :DateTime/second
876
+@l-DateTime-year   [ 0000 ]          [ 0000 ]         [ "year 00 ]       [ 02 ] :DateTime/year
877
+@l-File            [ 0000 ]          [ 0000 ]         [ "File 00 ]       [ 80 ] :File :l-File-root
878
+@l-File-length     [ 0000 ]          [ 0000 ]         [ "length 00 ]     [ 02 ] :File/length
879
+@l-File-load      :l-File-length    :l-File-name      [ "load 00 ]       [ 02 ] :File/load
880
+@l-File-name       [ 0000 ]          [ 0000 ]         [ "name 00 ]       [ 02 ] :File/name
860 881
 @l-File-root
861
-@l-File-offset    .l-File-load      .l-File-success   [ offset 00 ]     [ 02 ] .File.offset
862
-@l-File-save       [ 0000 ]          [ 0000 ]         [ save 00 ]       [ 02 ] .File.save
863
-@l-File-success   .l-File-save      .l-File-vector    [ success 00 ]    [ 02 ] .File.success
864
-@l-File-vector     [ 0000 ]          [ 0000 ]         [ vector 00 ]     [ 02 ] .File.vector
865
-@l-Mouse          .l-File           .l-Screen         [ Mouse 00 ]      [ 80 ] .Mouse .l-Mouse-root
866
-@l-Mouse-chord     [ 0000 ]         .l-Mouse-state    [ chord 00 ]      [ 01 ] .Mouse.chord
867
-@l-Mouse-state     [ 0000 ]          [ 0000 ]         [ state 00 ]      [ 01 ] .Mouse.state
882
+@l-File-offset    :l-File-load      :l-File-success   [ "offset 00 ]     [ 02 ] :File/offset
883
+@l-File-save       [ 0000 ]          [ 0000 ]         [ "save 00 ]       [ 02 ] :File/save
884
+@l-File-success   :l-File-save      :l-File-vector    [ "success 00 ]    [ 02 ] :File/success
885
+@l-File-vector     [ 0000 ]          [ 0000 ]         [ "vector 00 ]     [ 02 ] :File/vector
886
+@l-Mouse          :l-File           :l-Screen         [ "Mouse 00 ]      [ 80 ] :Mouse :l-Mouse-root
887
+@l-Mouse-chord     [ 0000 ]         :l-Mouse-state    [ "chord 00 ]      [ 01 ] :Mouse/chord
888
+@l-Mouse-state     [ 0000 ]          [ 0000 ]         [ "state 00 ]      [ 01 ] :Mouse/state
868 889
 @l-Mouse-root
869
-@l-Mouse-vector   .l-Mouse-chord    .l-Mouse-x        [ vector 00 ]     [ 02 ] .Mouse.vector
870
-@l-Mouse-x         [ 0000 ]         .l-Mouse-y        [ x 00 ]          [ 02 ] .Mouse.x
871
-@l-Mouse-y         [ 0000 ]          [ 0000 ]         [ y 00 ]          [ 02 ] .Mouse.y
872
-@l-Screen          [ 0000 ]         .l-System         [ Screen 00 ]     [ 80 ] .Screen .l-Screen-root
873
-@l-Screen-addr     [ 0000 ]          [ 0000 ]         [ addr 00 ]       [ 02 ] .Screen.addr
874
-@l-Screen-color   .l-Screen-addr    .l-Screen-height  [ color 00 ]      [ 01 ] .Screen.color
875
-@l-Screen-height   [ 0000 ]          [ 0000 ]         [ height 00 ]     [ 02 ] .Screen.height
890
+@l-Mouse-vector   :l-Mouse-chord    :l-Mouse-x        [ "vector 00 ]     [ 02 ] :Mouse/vector
891
+@l-Mouse-x         [ 0000 ]         :l-Mouse-y        [ "x 00 ]          [ 02 ] :Mouse/x
892
+@l-Mouse-y         [ 0000 ]          [ 0000 ]         [ "y 00 ]          [ 02 ] :Mouse/y
893
+@l-Screen          [ 0000 ]         :l-System         [ "Screen 00 ]     [ 80 ] :Screen :l-Screen-root
894
+@l-Screen-addr     [ 0000 ]          [ 0000 ]         [ "addr 00 ]       [ 02 ] :Screen/addr
895
+@l-Screen-color   :l-Screen-addr    :l-Screen-height  [ "color 00 ]      [ 01 ] :Screen/color
896
+@l-Screen-height   [ 0000 ]          [ 0000 ]         [ "height 00 ]     [ 02 ] :Screen/height
876 897
 @l-Screen-root
877
-@l-Screen-vector  .l-Screen-color   .l-Screen-x       [ vector 00 ]     [ 02 ] .Screen.vector
878
-@l-Screen-width    [ 0000 ]          [ 0000 ]         [ width 00 ]      [ 02 ] .Screen.width
879
-@l-Screen-x       .l-Screen-width   .l-Screen-y       [ x 00 ]          [ 02 ] .Screen.x
880
-@l-Screen-y        [ 0000 ]          [ 0000 ]         [ y 00 ]          [ 02 ] .Screen.y
881
-@l-System          [ 0000 ]          [ 0000 ]         [ System 00 ]     [ 80 ] .System .l-System-root
882
-@l-System-b        [ 0000 ]          [ 0000 ]         [ b 00 ]          [ 02 ] .System.b
898
+@l-Screen-vector  :l-Screen-color   :l-Screen-x       [ "vector 00 ]     [ 02 ] :Screen/vector
899
+@l-Screen-width    [ 0000 ]          [ 0000 ]         [ "width 00 ]      [ 02 ] :Screen/width
900
+@l-Screen-x       :l-Screen-width   :l-Screen-y       [ "x 00 ]          [ 02 ] :Screen/x
901
+@l-Screen-y        [ 0000 ]          [ 0000 ]         [ "y 00 ]          [ 02 ] :Screen/y
902
+@l-System          [ 0000 ]          [ 0000 ]         [ "System 00 ]     [ 80 ] :System :l-System-root
903
+@l-System-b        [ 0000 ]          [ 0000 ]         [ b 00 ]          [ 02 ] :System/b
883 904
 @l-System-root
884
-@l-System-g       .l-System-b       .l-System-r       [ g 00 ]          [ 02 ] .System.g
885
-@l-System-r        [ 0000 ]         .l-System-vector  [ r 00 ]          [ 02 ] .System.r
886
-@l-System-vector   [ 0000 ]          [ 0000 ]         [ vector 00 ]     [ 02 ] .System.vector
905
+@l-System-g       :l-System-b       :l-System-r       [ "g 00 ]          [ 02 ] :System/g
906
+@l-System-r        [ 0000 ]         :l-System-vector  [ "r 00 ]          [ 02 ] :System/r
907
+@l-System-vector   [ 0000 ]          [ 0000 ]         [ "vector 00 ]     [ 02 ] :System/vector
887 908
 
888 909
 @assembler-heap-start
889 910