etherforth_logo

Node 510

This node contains a list of supported interpreter commands. Code adapted from Chuck's etherforth compiler. Each item has two words; first is three-character string (last three chars of a word), second is address of executable code in 410 (positive number) or sent to 408 (inverted instruction word @p call).

Source code

editor node 410 node 510
510 search
e 16 o, 6 ,
wipe 223116 o, A ,
edit 152235 o, C ,
copy 303142 o, 11 ,
save 123716 o, 19 ,
hook 303024 o, 3A9E7 5618 ,
run 333627 o, 3A9E5 561A ,
disk 223424 o, 3A9E2 561D ,
back 121424 o, 38 ,
keep 161631 o, 3A ,
work 303324 o, 3C ,
peer 161633 o, 3A9CE 5631 ,
code 301516 o, 3A9CA 5635 ,
load 301215 o, 3A9C6 5639 , 1C

30 org
match 30 a dup a! @+ drop @b
loop 32 as begin a -3 . + -if dup or !b drop match ;
then a! @+ over or while drop end
then drop drop @ !b match ; 3C

init down b! 1C match ; 40

2 r 0 d 0 ether

Definitions

match
Expect the first free address in the list (1C) on stack. Set A to this address, advances it and fetch string from 410. Then fall through to loop.
loop
Decrement A content by 3 (thus we point to the last dictionary item) and if negative we send this back to 410 as unknown word flag, drop the string and jump back to match. Else we update A, fetch string from dictionary and compare with the one on stack. If not equal, we drop flag and repeat loop. Else we drop flag and string, fetch address from the dictionary, send it back to 410 and jump back to match.
init
Set register B, set T to the first free address past the dictionary, and jump to match.

Description