allow decimals to define imm16
This commit is contained in:
parent
40ce1c9ce9
commit
4bc3828d43
@ -34,14 +34,17 @@ local function mnemFromLine(line, instrs, validWords)
|
|||||||
local function addNum(n)
|
local function addNum(n)
|
||||||
n = trim(n)
|
n = trim(n)
|
||||||
local val, len = decodeNumber(n)
|
local val, len = decodeNumber(n)
|
||||||
|
local linei8 = line:gsub(n, "imm8", 1, true)
|
||||||
|
local linei16 = line:gsub(n, "imm16", 1, true)
|
||||||
|
if len==1 and (not instrs[linei8]) and instrs[linei16] then len = 2 end
|
||||||
table.insert(imms, { val = val, len = len } )
|
table.insert(imms, { val = val, len = len } )
|
||||||
return " imm"..(len*8).." "
|
return " imm"..(len*8).." "
|
||||||
end
|
end
|
||||||
local function addLabel(n)
|
local function addLabel(n)
|
||||||
local len = 2
|
|
||||||
local linei8 = line:gsub(trim(n), "imm8", 1, true)
|
|
||||||
if instrs[linei8] then len = 1 end
|
|
||||||
n = trim(n)
|
n = trim(n)
|
||||||
|
local len = 2
|
||||||
|
local linei8 = line:gsub(n, "imm8", 1, true)
|
||||||
|
if instrs[linei8] then len = 1 end
|
||||||
table.insert(imms, { label = n, len = len } )
|
table.insert(imms, { label = n, len = len } )
|
||||||
return " imm"..(len*8).." "
|
return " imm"..(len*8).." "
|
||||||
end
|
end
|
||||||
@ -424,7 +427,10 @@ local function printMemory(mem)
|
|||||||
local nonempty = false
|
local nonempty = false
|
||||||
for addr = base, base+15 do
|
for addr = base, base+15 do
|
||||||
if addr%4==0 then table.insert(line, " ") end
|
if addr%4==0 then table.insert(line, " ") end
|
||||||
if mem[addr] then
|
if mem[addr]==false then
|
||||||
|
nonempty = true
|
||||||
|
table.insert(line, "XX ")
|
||||||
|
elseif mem[addr] then
|
||||||
nonempty = true
|
nonempty = true
|
||||||
table.insert(line, string.format("%02X", mem[addr]).." ")
|
table.insert(line, string.format("%02X", mem[addr]).." ")
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user