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

View File

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