function luaP.DecodeInst(A,V)local T=string.byte local F={}local n=T(V,1)local j=n%64 F.OP=j n=T(V,2)*4+(n-j)/64 local s=n%256 F.A=s n=T(V,3)*4+(n-s)/256 local y=n%512 F.C=y F.B=T(V,4)*2+(n-y)/512 local x=A.OpMode[tonumber(string.sub(A.opmodes[j+1],7,7))]if x~="\105\065\066\067"then F.Bx=F.B*512+F.C end return F end

function luaP:DecodeInst(x)
  local byte = string.byte
  local i = {}
  local I = byte(x, 1)
  local op = I % 64
  i.OP = op
  I = byte(x, 2) * 4 + (I - op) / 64  -- 2 bits of c0 left
  local a = I % 256
  i.A = a
  I = byte(x, 3) * 4 + (I - a) / 256  -- 2 bits of c1 left
  local c = I % 512
  i.C = c
  i.B = byte(x, 4) * 2 + (I - c) / 512 -- 1 bits of c2 left
  local opmode = self.OpMode[tonumber(string.sub(self.opmodes[op + 1], 7, 7))]
  if opmode ~= "iABC" then
    i.Bx = i.B * 512 + i.C
  end
  return i
end
