Removed drop and mul, because they aren't neccesary and I wanted only 8 instructions.

This commit is contained in:
Izaya 2016-12-11 11:19:08 +11:00
parent ec2ca17af5
commit 0626863c57
1 changed files with 7 additions and 25 deletions

View File

@ -112,55 +112,37 @@ minetest.register_abm({
local skipnext = false
print("Attempting to run T400 node at "..pos2string(pos))
local ci = meta:get_int("ci")
--[[
4095 = drop
4094 = dup
4093 = swap
4092 = read
4091 = write
4090 = add
4089 = sup
4088 = multiply
4087 = jmp
4086 = skip if zero
]]--
if ci == 4095 then
print("Dropped "..tostring(pop(pos)).." from "..tostring(pos.x)..","..tostring(pos.y)..","..tostring(pos.z))
elseif ci == 4094 then
local dat = pop(pos)
push(pos,dat)
push(pos,dat)
print("Duplicated "..tostring(dat).." at "..tostring(pos.x)..","..tostring(pos.y)..","..tostring(pos.z))
elseif ci == 4093 then
elseif ci == 4094 then
local a = pop(pos)
local b = pop(pos)
push(pos,b)
push(pos,a)
--[[ I'll write the stuff for reading and writing memory eventually(TM)
]]--
elseif ci == 4092 then
elseif ci == 4093 then
skipnext = true
meta:set_string("state","waitingdat")
meta:set_string("waitingfor",meta:get_string("channel")..string.format("%X",addr))
local addr = pop(pos)
digiline:receptor_send(pos,digiline.rules.default,meta:get_string("channel")..string.format("%X",addr),"get")
elseif ci == 4091 then
elseif ci == 4092 then
local addr = pop(pos)
local dat = pop(pos)
print("Writing "..tostring(dat).." to address "..addr)
digiline:receptor_send(pos,digiline.rules.default,meta:get_string("channel")..string.format("%X",addr),dat)
elseif ci == 4090 then
elseif ci == 4091 then
print("Adding stuff")
push(pos,pop(pos)+pop(pos))
elseif ci == 4089 then
elseif ci == 4090 then
push(pos,pop(pos)-pop(pos))
elseif ci == 4088 then
push(pos,pop(pos)*pop(pos))
elseif ci == 4087 then
elseif ci == 4089 then
local npc = pop(pos)
print("Jumping to "..tostring(npc))
meta:set_int("pc",npc)
elseif ci == 4086 then
elseif ci == 4088 then
if pop(pos) == 0 then
meta:set_int("pc",meta:get_int("pc")+1)
end