Fix SI (tm) action parsing.

This commit is contained in:
Michael Munday 2017-01-10 11:15:26 -05:00
parent a8562b7f34
commit a038a08189

View File

@ -312,6 +312,10 @@ local function is_int8(num)
return -128 <= num and num < 128 return -128 <= num and num < 128
end end
local function is_uint8(num)
return 0 <= num and num < 256
end
-- Split a memory operand of the form d(b) or d(x,b) into d, x and b. -- Split a memory operand of the form d(b) or d(x,b) into d, x and b.
-- If x is not specified then it is 0. -- If x is not specified then it is 0.
local function split_memop(arg) local function split_memop(arg)
@ -510,13 +514,12 @@ end
local function parse_imm8(imm) local function parse_imm8(imm)
local imm_val = tonumber(imm) local imm_val = tonumber(imm)
if imm_val then if imm_val then
if not is_int8(imm_val) then if not is_int8(imm_val) and not is_uint8(imm_val) then
werror("Immediate value out of range: ", imm_val) werror("Immediate value out of range: ", imm_val)
end end
else return imm_val, nil
iact = function() waction("IMM8",nil,imm) end
end end
return imm_val, iact return 0, function() waction("IMM8",nil,imm) end
end end
local function parse_mask(mask) local function parse_mask(mask)