etherforth_logo

Node 409

This node receives symbols from command line buffer in 308, skips spaces (tags) and scans whole words, which are sent symbolwise to 409 for processing.

Source code

editor node 508 node 409 node 308 node 408
408 scan
15 org scan 0 org
in 00 @p drop @p ; in! 01 !p ; 0 ,
1+ 03 1 . + ;
accept 05 47 push dup or - dup in!
skip 09 begin @b dup - 30 and
if drop ! dup in! 1+ zif then scan ;
then drop drop +1 next - eol ! ;
scan 15 begin @b 30 over over and or
if drop ! 1+ swap next - eol ! ;
then - eow ! drop r--- 1+ zif then skip ;
sink 22 pop zif then begin @b unext ;
cmds 24 12028 +buf !b accept r--- ;
ok 28 12015 ers @p !b . @p !b . . !b ;
err 2C in 5637 err !b !b ;
gt? 2F @ right a! if 1200A com ! ; then 12007 err ! ;
gt0 36 i down a! ! gt? ;
gt1 39 ni down a! ! ! gt? ; 3C

init up b! right a! r--- ; 41

1 d 0 0 ether

Definitions

in, in!
This variable stores sequence number of the last tag encountered.
1+
Increment T.
accept
Read 48 symbols from command line buffer, keep last tag position in in, skip tags and send symbols to 409. Send end-of-word (negative flag) after each word scanned.
skip, scan
These words read symbols from command line buffer and analyze them. Word skip ignores spaces, scan sends symbols to 409. After end-of-word scan waits for reply by jumping to RIGHT. It eiter receives return instruction if the word has been processed correctly, or jump to sink and then return to RIGHT. When all symbols are exhausted, there's 47 on stack, so we invert it and send this negative signal to 409 informing we have reached end-of-line in command line buffer.
sink
Remove the rest of unprocessed symbols from the queue so that 308 may leave word +buf.
cmds
Call +buf in 308 and call accept to read symbols from 308. Upon return from accept jump to RIGHT.
ok
Erase command line buffer in 308 and return.
err
Initiate error processing in 308 and return.
gt?
It is a factor of the two following words. Wait for a reply from 508, restore A register, and call in 409 either com if reply true or err if false.
gt0
Send execution vector to 508 and jump to gt?.
gt1
Send execution vector and one data word to 508 and jump to gt?.
init
Set registers A and B, and jump to RIGHT.

Description