Browse code

Bring etc/asma.moon up to date.

Andrew Alderwick authored on 29/12/2021 11:58:34
Showing 3 changed files
... ...
@@ -79,7 +79,8 @@ do
79 79
     ['['] = 'asma-ignore',
80 80
     [']'] = 'asma-ignore',
81 81
     ['('] = 'asma-comment-start',
82
-    [')'] = 'asma-comment-end'
82
+    [')'] = 'asma-comment-end',
83
+    ['~'] = 'asma-include'
83 84
   })
84 85
   process('asma-first-char-macro', {
85 86
     ['('] = 'asma-comment-start',
... ...
@@ -147,8 +148,8 @@ fmt = function(...)
147 148
   return (('\t%-11s %-10s %-12s %-14s %s '):format(...):gsub(' +$', '\n'))
148 149
 end
149 150
 do
150
-  local _with_0 = assert(io.open('projects/software/asma.tal.tmp', 'w'))
151
-  for l in assert(io.lines('projects/software/asma.tal')) do
151
+  local _with_0 = assert(io.open('projects/library/asma.tal.tmp', 'w'))
152
+  for l in assert(io.lines('projects/library/asma.tal')) do
152 153
     if l:match('--- cut here ---') then
153 154
       break
154 155
     end
... ...
@@ -189,43 +190,6 @@ do
189 190
     end
190 191
     _with_0:write('\n')
191 192
   end
192
-  _with_0:write([[(
193
-	Heap, a large temporary area for keeping track of labels. More complex
194
-	programs need more of this space. If there's insufficient space then the
195
-	assembly process will fail, but having extra space above what the most
196
-	complex program needs provides no benefit.
197
-
198
-	This heap, and the buffers below, are free to be used to hold temporary
199
-	data between assembly runs, and do not need to be initialized with any
200
-	particular contents to use the assembler.
201
-)
202
-
203
-@asma-heap
204
-
205
-|e000 &end
206
-
207
-(
208
-	Buffer for use with loading source code.
209
-	The minimum size is the length of the longest token plus one, which is
210
-	0x21 to keep the same capability of the C assembler.
211
-	Larger sizes are more efficient, provided there is enough
212
-	heap space to keep track of all the labels.
213
-)
214
-
215
-@asma-read-buffer
216
-
217
-|f800 &end
218
-
219
-(
220
-	Buffer for use with writing output.
221
-	The minimum size is 1, and larger sizes are more efficient.
222
-)
223
-
224
-@asma-write-buffer
225
-
226
-|ffff &end
227
-
228
-]])
229 193
   _with_0:close()
230 194
 end
231
-return os.execute('mv projects/software/asma.tal.tmp projects/software/asma.tal')
195
+return os.execute('mv projects/library/asma.tal.tmp projects/library/asma.tal')
... ...
@@ -1,7 +1,7 @@
1 1
 --
2 2
 -- Asma tree helper script
3 3
 --
4
+-- This script updates the trees at the end of projects/library/asma.tal when
4 5
 -- Uxn's opcode set changes or new runes (first character of tokens) are
5 6
 -- created, so that new changes in the C assembler can be incorporated rapidly
6 7
 -- into asma.
... ...
@@ -80,6 +80,7 @@ do -- first characters
80 80
 		']': 'asma-ignore'
81 81
 		'(': 'asma-comment-start'
82 82
 		')': 'asma-comment-end'
83
+		'~': 'asma-include'
83 84
 	process 'asma-first-char-macro',
84 85
 		'(': 'asma-comment-start'
85 86
 		')': 'asma-comment-end'
... ...
@@ -122,8 +123,8 @@ printout = true
122 123
 fmt = (...) ->
123 124
 	('\t%-11s %-10s %-12s %-14s %s '\format(...)\gsub ' +$', '\n')
124 125
 
125
-with assert io.open 'projects/software/asma.tal.tmp', 'w'
126
-	for l in assert io.lines 'projects/software/asma.tal'
126
+with assert io.open 'projects/library/asma.tal.tmp', 'w'
127
+	for l in assert io.lines 'projects/library/asma.tal'
127 128
 		if l\match '--- cut here ---'
128 129
 			break
129 130
 		\write l
... ...
@@ -155,43 +156,6 @@ with assert io.open 'projects/software/asma.tal.tmp', 'w'
155 156
 				''
156 157
 			\write fmt label, lefts[k] or ' $2', rights[k] or ' $2', unpack v
157 158
 		\write '\n'
158
-	\write [[(
159
-	Heap, a large temporary area for keeping track of labels. More complex
160
-	programs need more of this space. If there's insufficient space then the
161
-	assembly process will fail, but having extra space above what the most
162
-	complex program needs provides no benefit.
163
-
164
-	This heap, and the buffers below, are free to be used to hold temporary
165
-	data between assembly runs, and do not need to be initialized with any
166
-	particular contents to use the assembler.
167
-)
168
-
169
-@asma-heap
170
-
171
-|e000 &end
172
-
173
-(
174
-	Buffer for use with loading source code.
175
-	The minimum size is the length of the longest token plus one, which is
176
-	0x21 to keep the same capability of the C assembler.
177
-	Larger sizes are more efficient, provided there is enough
178
-	heap space to keep track of all the labels.
179
-)
180
-
181
-@asma-read-buffer
182
-
183
-|f800 &end
184
-
185
-(
186
-	Buffer for use with writing output.
187
-	The minimum size is 1, and larger sizes are more efficient.
188
-)
189
-
190
-@asma-write-buffer
191
-
192
-|ffff &end
193
-
194
-]]
195 159
 	\close!
196
-os.execute 'mv projects/software/asma.tal.tmp projects/software/asma.tal'
160
+os.execute 'mv projects/library/asma.tal.tmp projects/library/asma.tal'
197 161
 
... ...
@@ -931,10 +931,10 @@
931 931
 	&3b         :&3a        $2          '; 00          :asma-literal-abs-addr
932 932
 	&40         :&3b       :&5b         '@ 00          :asma-label-define
933 933
 	&5b          $2         $2          '[ 00          :asma-ignore
934
-	&5d         :&40       :&7c         '] 00          :asma-ignore
934
+	&5d         :&40       :&7d         '] 00          :asma-ignore
935 935
 	&7b          $2         $2          '{ 00          :asma-ignore
936
-	&7c         :&7b       :&7d         '| 00          :asma-pad-absolute
937
-	&7d          $2        :&7e         '} 00          :asma-ignore
936
+	&7c         :&7b        $2          '| 00          :asma-pad-absolute
937
+	&7d         :&7c       :&7e         '} 00          :asma-ignore
938 938
 	&7e          $2         $2          '~ 00          :asma-include
939 939
 
940 940
 @asma-opcodes