Bring etc/asma.moon up to date.

This commit is contained in:
Andrew Alderwick 2021-12-29 11:58:34 +00:00
parent abd6a3a5da
commit 86674da93e
3 changed files with 13 additions and 85 deletions

View File

@ -79,7 +79,8 @@ do
['['] = 'asma-ignore',
[']'] = 'asma-ignore',
['('] = 'asma-comment-start',
[')'] = 'asma-comment-end'
[')'] = 'asma-comment-end',
['~'] = 'asma-include'
})
process('asma-first-char-macro', {
['('] = 'asma-comment-start',
@ -147,8 +148,8 @@ fmt = function(...)
return (('\t%-11s %-10s %-12s %-14s %s '):format(...):gsub(' +$', '\n'))
end
do
local _with_0 = assert(io.open('projects/software/asma.tal.tmp', 'w'))
for l in assert(io.lines('projects/software/asma.tal')) do
local _with_0 = assert(io.open('projects/library/asma.tal.tmp', 'w'))
for l in assert(io.lines('projects/library/asma.tal')) do
if l:match('--- cut here ---') then
break
end
@ -189,43 +190,6 @@ do
end
_with_0:write('\n')
end
_with_0:write([[(
Heap, a large temporary area for keeping track of labels. More complex
programs need more of this space. If there's insufficient space then the
assembly process will fail, but having extra space above what the most
complex program needs provides no benefit.
This heap, and the buffers below, are free to be used to hold temporary
data between assembly runs, and do not need to be initialized with any
particular contents to use the assembler.
)
@asma-heap
|e000 &end
(
Buffer for use with loading source code.
The minimum size is the length of the longest token plus one, which is
0x21 to keep the same capability of the C assembler.
Larger sizes are more efficient, provided there is enough
heap space to keep track of all the labels.
)
@asma-read-buffer
|f800 &end
(
Buffer for use with writing output.
The minimum size is 1, and larger sizes are more efficient.
)
@asma-write-buffer
|ffff &end
]])
_with_0:close()
end
return os.execute('mv projects/software/asma.tal.tmp projects/software/asma.tal')
return os.execute('mv projects/library/asma.tal.tmp projects/library/asma.tal')

View File

@ -1,7 +1,7 @@
--
-- Asma tree helper script
--
-- This script updates the trees at the end of projects/software/asma.tal when
-- This script updates the trees at the end of projects/library/asma.tal when
-- Uxn's opcode set changes or new runes (first character of tokens) are
-- created, so that new changes in the C assembler can be incorporated rapidly
-- into asma.
@ -80,6 +80,7 @@ do -- first characters
']': 'asma-ignore'
'(': 'asma-comment-start'
')': 'asma-comment-end'
'~': 'asma-include'
process 'asma-first-char-macro',
'(': 'asma-comment-start'
')': 'asma-comment-end'
@ -122,8 +123,8 @@ printout = true
fmt = (...) ->
('\t%-11s %-10s %-12s %-14s %s '\format(...)\gsub ' +$', '\n')
with assert io.open 'projects/software/asma.tal.tmp', 'w'
for l in assert io.lines 'projects/software/asma.tal'
with assert io.open 'projects/library/asma.tal.tmp', 'w'
for l in assert io.lines 'projects/library/asma.tal'
if l\match '--- cut here ---'
break
\write l
@ -155,43 +156,6 @@ with assert io.open 'projects/software/asma.tal.tmp', 'w'
''
\write fmt label, lefts[k] or ' $2', rights[k] or ' $2', unpack v
\write '\n'
\write [[(
Heap, a large temporary area for keeping track of labels. More complex
programs need more of this space. If there's insufficient space then the
assembly process will fail, but having extra space above what the most
complex program needs provides no benefit.
This heap, and the buffers below, are free to be used to hold temporary
data between assembly runs, and do not need to be initialized with any
particular contents to use the assembler.
)
@asma-heap
|e000 &end
(
Buffer for use with loading source code.
The minimum size is the length of the longest token plus one, which is
0x21 to keep the same capability of the C assembler.
Larger sizes are more efficient, provided there is enough
heap space to keep track of all the labels.
)
@asma-read-buffer
|f800 &end
(
Buffer for use with writing output.
The minimum size is 1, and larger sizes are more efficient.
)
@asma-write-buffer
|ffff &end
]]
\close!
os.execute 'mv projects/software/asma.tal.tmp projects/software/asma.tal'
os.execute 'mv projects/library/asma.tal.tmp projects/library/asma.tal'

View File

@ -931,10 +931,10 @@
&3b :&3a $2 '; 00 :asma-literal-abs-addr
&40 :&3b :&5b '@ 00 :asma-label-define
&5b $2 $2 '[ 00 :asma-ignore
&5d :&40 :&7c '] 00 :asma-ignore
&5d :&40 :&7d '] 00 :asma-ignore
&7b $2 $2 '{ 00 :asma-ignore
&7c :&7b :&7d '| 00 :asma-pad-absolute
&7d $2 :&7e '} 00 :asma-ignore
&7c :&7b $2 '| 00 :asma-pad-absolute
&7d :&7c :&7e '} 00 :asma-ignore
&7e $2 $2 '~ 00 :asma-include
@asma-opcodes