etherforth_logo

Node 410

This node receives stream of characters of a command, searches for the command in 510 and if found, performs actions related to the given command.

Source code

editor node 510 node 409 node 310 node 410
410 execute
name 00 -s dup or begin @b -if drop ;
then over 2* 2* 2* 2* 2* 2* or end
e 06 10028 e
ex0 08 i 5727 ex0 !b !b ;
wipe 0A 10039 wipe ex0 ;
edit 0C 10023 num@ !b 5726 edit
ex1 0F i 572B ex1 !b !b ;
copy 11 10023 num@ !b 5737 copy ex1 ;
gate 15 ii @p !b !b . @p .. 573C gate !b !b ;
save 19 5636 gt0 1202D save gate ;
blk 1D a up a! @p @p !b @b !p ! 10011 blk ! @ push a! pop ;
gt1 24 i-ii 12039 par !b
gt1a 26 5639 gt1 over gate ;
gt1b 29 i-i blk 563A par' !b !b gt1a ;
match 2D name ! @ ..
if -if - gt1 match ; then push ex match ;
then 10007 err !b match ;
back 38 5621 back gt1b ;
keep 3A 5625 keep gt1b ;
work 3A 5636 gt0 12029 work gate ; 40

init down a! left b! match ; 44

2 r 1 d 0 ether

Definitions

name
Push zero to stack as an empty string, then read characters from 409 and shift them in the string from right until eow received. The string keeps the last three characters received only.
e
Display last edited block (its number is kept in Ębk' variable in 211). Jumps to ex0 in 409.
ex0
.
wipe
Erase the last edited block. Jumps to ex0 in 409.
edit
Edit block whose number is on editor stack. First call num@ in 409, then jump to ex1.
ex1
.
copy
Copy content of the last edited block to the one whose number has been pushed to editor stack. Call num@ in 409, then jump to ex1.
gate
This is a common factor of commands executed in 508. It expects two instruction words on stack. It pushes the top word to stack in 409, then jumps to gate in 409 and passes it the second instruction word.
save
Call save in 508. First set call to gt0 and save on stack and jump to gate.
blk
.
gt1
It is a common factor for words executed in 508 which need a parameter. It calls par in 409 and sets call to gt1 on stack. Then it jumps to gate.
kf1a
.
gt1b
.
match
Call name, send the string to 510 and await a reply. If zero, word not found so we jump to err in 409 and jump back to match. Else we test if negative, which means gt1 type word. In such a case we invert the instruction word provided by 510, call gt1 and jump back to match. Else we call word at address returned. Returning from the word called we jump back to match.
back
.
keep
.
work
.
init
Set registers A and B, and jump to match.

Description