function luaP.Instruction(N,x)if x.Bx then x.C=x.Bx%512 x.B=(x.Bx-x.C)/512 end local J=x.A*64+x.OP local T=J%256 J=x.C*64+(J-T)/256 local X=J%256 J=x.B*128+(J-X)/256 local h=J%256 local g=(J-h)/256 return string.char(T,X,h,g)end

function luaP:Instruction(i)
  if i.Bx then
    -- change to OP/A/B/C format
    i.C = i.Bx % 512
    i.B = (i.Bx - i.C) / 512
  end
  local I = i.A * 64 + i.OP
  local c0 = I % 256
  I = i.C * 64 + (I - c0) / 256  -- 6 bits of A left
  local c1 = I % 256
  I = i.B * 128 + (I - c1) / 256  -- 7 bits of C left
  local c2 = I % 256
  local c3 = (I - c2) / 256
  return string.char(c0, c1, c2, c3)
end
