mirror of
https://github.com/notwa/mm
synced 2024-11-04 22:49:03 -08:00
misc
This commit is contained in:
parent
108c4189ef
commit
fa082d3a1d
2 changed files with 6 additions and 4 deletions
|
@ -70,7 +70,7 @@ function inject(fn)
|
|||
|
||||
local inject_bytes = {}
|
||||
local length = 0
|
||||
local function add_word(pos, line)
|
||||
local function write(pos, line)
|
||||
length = length + #line/2
|
||||
dprint(("%08X"):format(pos), line)
|
||||
pos = pos % 0x80000000
|
||||
|
@ -79,11 +79,11 @@ function inject(fn)
|
|||
|
||||
-- offset assembly labels so they work properly, and assemble!
|
||||
local true_offset = 0x80000000 + inject_addr
|
||||
assemble(header, add_word, {unsafe=true, offset=true_offset})
|
||||
assemble(asm_path, add_word, {unsafe=true, offset=true_offset + length})
|
||||
assemble(header, write, {unsafe=true, offset=true_offset})
|
||||
assemble(asm_path, write, {unsafe=true, offset=true_offset + length})
|
||||
|
||||
printf("length: %i words", length/4)
|
||||
if #inject_bytes > inject_maxlen then
|
||||
if length > inject_maxlen then
|
||||
print("Assembly too large!")
|
||||
return
|
||||
end
|
||||
|
|
|
@ -1015,6 +1015,8 @@ function Parser:instruction()
|
|||
local h = instructions[name]
|
||||
self:advance()
|
||||
|
||||
-- FIXME: errors thrown here probably have the wrong line number (+1)
|
||||
|
||||
if h == nil then
|
||||
self:error('undefined instruction')
|
||||
elseif h == 'LI' then
|
||||
|
|
Loading…
Reference in a new issue