41 lines
645 B
Lua
41 lines
645 B
Lua
tArgs = {...}
|
|
|
|
insd = {[4095] = "ppc",
|
|
[4094] = "swp",
|
|
[4093] = "read",
|
|
[4092] = "write",
|
|
[4091] = "add",
|
|
[4090] = "sub",
|
|
[4089] = "jmp",
|
|
[4088] = "sez"}
|
|
insc = {}
|
|
insc.ppc = 4095
|
|
insc.swp = 4094
|
|
insc.read = 4093
|
|
insc.write = 4092
|
|
insc.add = 4091
|
|
insc.sub = 4090
|
|
insc.jmp = 4089
|
|
insc.sez = 4088
|
|
|
|
f = io.open(tArgs[2],"rb")
|
|
if not f then error("file inaccessable") end
|
|
c = f:read("*a")
|
|
f:close()
|
|
|
|
for w in c:gmatch("%S+") do
|
|
if tArgs[1] == "-c" then
|
|
if insc[w] ~= nil then
|
|
print(insc[w])
|
|
else
|
|
print(w)
|
|
end
|
|
elseif tArgs[1] == "-d" then
|
|
if insd[tonumber(w)] ~= nil then
|
|
print(insd[tonumber(w)])
|
|
else
|
|
print(w)
|
|
end
|
|
end
|
|
end
|