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