Fix bugs, add LOADPKG.

This commit is contained in:
Novatux 2013-08-20 15:58:16 +02:00
parent 6c06a553b6
commit 440475d7c4
3 changed files with 13 additions and 5 deletions

View File

@ -240,4 +240,5 @@ FORTH
: ON SET-CHANNEL S" on" SEND ;
: OFF SET-CHANNEL S" off" SEND ;
: IO@ RECEIVE 3 < ;
: LOADPKG 0 0x11e C! 0x11a 2! BEGIN 0x11a 2@ SET-CHANNEL 0x11e 1 SEND 0x11e C@ 1+ 0x11e C! 0x11a 2@ 16 RECEIVE-AT 16 C@ WHILE 16 SWAP EVALUATE REPEAT DROP ;
: COLD 82 EMIT 101 EMIT 97 EMIT 100 EMIT 121 EMIT QUIT ;

File diff suppressed because one or more lines are too long

View File

@ -195,6 +195,8 @@ end
local function send_message(pos, cptr, maddr, mlen)
local msg = string_at(cptr, maddr, mlen)
cptr.digiline_events[cptr.channel] = msg
--print(cptr.channel)
--print(msg)
digiline:receptor_send(pos, digiline.rules.default, cptr.channel, msg)
end
@ -413,6 +415,7 @@ minetest.register_node("forth_computer:computer",{
cptrs[hashpos(pos)] = {pos=pos, cptr=create_cptr()}
end,
on_destruct = function(pos)
if cptrs[hashpos(pos)] == nil then return end
if cptrs[hashpos(pos)].swapping then
cptrs[hashpos(pos)].swapping = nil
return
@ -420,9 +423,10 @@ minetest.register_node("forth_computer:computer",{
cptrs[hashpos(pos)] = nil
end,
on_punch = function(pos, node, puncher)
if cptrs[hashpos(pos)] == nil then return end
local cptr = cptrs[hashpos(pos)].cptr
cptr.stopped = true
cptr.swapping = true
cptrs[hashpos(pos)].swapping = true
hacky_swap_node(pos, "forth_computer:computer_off")
end,
})
@ -443,6 +447,7 @@ minetest.register_node("forth_computer:computer_off",{
cptrs[hashpos(pos)] = {pos=pos, cptr=create_cptr()}
end,
on_destruct = function(pos)
if cptrs[hashpos(pos)] == nil then return end
if cptrs[hashpos(pos)].swapping then
cptrs[hashpos(pos)].swapping = nil
return
@ -450,9 +455,10 @@ minetest.register_node("forth_computer:computer_off",{
cptrs[hashpos(pos)] = nil
end,
on_punch = function(pos, node, puncher)
if cptrs[hashpos(pos)] == nil then return end
local cptr = cptrs[hashpos(pos)].cptr
cptr.stopped = false
cptr.swapping = true
cptrs[hashpos(pos)].swapping = true
hacky_swap_node(pos, "forth_computer:computer")
end,
})
@ -570,7 +576,8 @@ minetest.register_node("forth_computer:disk",{
end,
})
local progs = {["Empty"] = string.rep(string.char(0), 16536), ["Forth Boot Disk"] = create_forth_floppy()}
local progs = {["Empty"] = string.rep(string.char(0), 16536),
["Forth Boot Disk"] = create_forth_floppy(),}
minetest.register_node("forth_computer:floppy_programmator",{
description = "Floppy disk programmator",
tiles = {"programmator.png"},