1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2025-02-05 13:23:23 -08:00

use proper instruction type names

This commit is contained in:
Connor Olding 2015-11-22 00:09:54 -08:00
parent 9ec4d0f406
commit 5b35cc2155

View file

@ -813,9 +813,9 @@ end
function Parser:format_out(outformat, first, args, const, formatconst) function Parser:format_out(outformat, first, args, const, formatconst)
local lookup = { local lookup = {
[1]=self.dumper.add_instruction_26, [1]=self.dumper.add_instruction_j,
[3]=self.dumper.add_instruction_5_5_16, [3]=self.dumper.add_instruction_i,
[5]=self.dumper.add_instruction_5_5_5_5_6, [5]=self.dumper.add_instruction_r,
} }
out = {} out = {}
for i=1,#outformat do for i=1,#outformat do
@ -944,16 +944,16 @@ function Dumper:push_instruction(t)
self:advance(4) self:advance(4)
end end
function Dumper:add_instruction_26(i, a) function Dumper:add_instruction_j(o, T)
self:push_instruction{i, a} self:push_instruction{o, T}
end end
function Dumper:add_instruction_5_5_16(i, a, b, c) function Dumper:add_instruction_i(o, s, t, i)
self:push_instruction{i, a, b, c} self:push_instruction{o, s, t, i}
end end
function Dumper:add_instruction_5_5_5_5_6(i, a, b, c, d, e) function Dumper:add_instruction_r(o, s, t, d, f, c)
self:push_instruction{i, a, b, c, d, e} self:push_instruction{o, s, t, d, f, c}
end end
function Dumper:add_define(name, number) function Dumper:add_define(name, number)
@ -1058,7 +1058,6 @@ function Dumper:toval(tok)
end end
if type(tok) == 'table' then if type(tok) == 'table' then
if #tok ~= 2 then if #tok ~= 2 then
--print('toval', tok)
self:error('invalid token') self:error('invalid token')
end end
if tok[1] == 'UPPER' then if tok[1] == 'UPPER' then
@ -1078,7 +1077,6 @@ function Dumper:toval(tok)
return self:desym(tok) return self:desym(tok)
end end
end end
--print('toval', tok)
self:error('invalid value') self:error('invalid value')
end end
@ -1088,7 +1086,6 @@ function Dumper:validate(n, bits)
self:error('value is nil') self:error('value is nil')
end end
if n > max or n < 0 then if n > max or n < 0 then
--print(('n %08X'):format(math.abs(n)))
self:error('value out of range') self:error('value out of range')
end end
end end
@ -1118,8 +1115,8 @@ function Dumper:dump_instruction(t)
local uw = 0 local uw = 0
local lw = 0 local lw = 0
local i = t[1] local o = t[1]
uw = uw + i*0x400 uw = uw + o*0x400
if #t == 2 then if #t == 2 then
local val = self:valvar(t[2], 26) local val = self:valvar(t[2], 26)