etherforth_logo

Node 011

This node distributes stream of characters from keyboard controller to either navigator or editor. It also sends request to interpreter to process command line content, and recieves an address of code to jump to as a feedback.

Source code

editor node 111 node 012 node 010 node 011
011 dispatch
xqt 00 12008 xqt @p !b . @p !b @b !p !b @b ;
ed 04 @ dup 5628 go !b !b 20000 esc or if ed ;
then down b! .. ahead *
rstr 0D 12037 othr @p !b . @p !b . . !b
nav 11 then * @ -if 10000 over and
if drop right b! 5628 go !b !b ed ;
then drop 20000 esc or if nav ;
then down b! .. ahead ** swap
then 5630 nav !b !b nav ;
com 24 then ** @p !b @p @p @p . . .
12000 blk , 12035 bk'! , !b 5636 cl !b !b right b!
3D ww 560D tag! !b !b begin @ -if dup 20032 ent or
if drop swap then 5628 go !b !b swap end
then 12037 sp !b xqt down b! push ;
start 3C @ left a! com ; 3F

init right a! down b! start ; 43

6 d 2 r 0 ether

Definitions

xqt
Call xqt in 110 via a bridge built in node 10. Wait for a one-word reply which is left on stack here. It is an execution vector xt.
ed
Repeatedly get a key from 12, send it to 10, and call go there. If key received is escape (20000) then set B to DOWN and jump ahead to nav.
rstr
Call othr in 211 via bridge in 111 and fall through to
nav
Repeatedly get a key from 12. If negative then test bit 16; if high (fn key), set B to RIGHT, send the key to 10, call go there, and jump to ed. Else it's a non-printable key. If not esc key, then ignore it and jump back to nav. Else set B to DOWN and jump ahead to com. Printable keys are sent to 111 and processed with nav there.
com
First call cl in 111 which sets block number to zero and loads the content of command line from SRAM. Then set B to RIGHT, set tag to 3D (white color) and start a loop sending keys from 12 to 10 and executing go there, until Enter key is received, which indicates end of command line editing, so we can call sp in 10, call xqt, set B to DOWN and jump to execution vector returned by xqt.
start
Wait for a signal from 10, set A to LEFT and jump to com.
init
Init registers A and B, and jump to start.

Description

Code in this node controls execution in other, even distant nodes using port execution. Moreover, it is highly packed, filling all but one RAM locations. Hence it is more difficult to read.

Editor module works in two modes, command mode and editing mode. This node is responsible for distinguishing the two. Upon boot up, node 011 waits for a signal recieved via RIGHT port (initated by word start in node 707, which is the last node loaded into the host chip) indicating the whole system has been booted up and is operational. Then in jumps to word com, which starts command mode.

In command mode we set block number and alternative block number in node 211 to zero, set cursor position to the beginning of the command line, and load its content (spaces out of reset) from block 000 in SRAM into command line buffer in node 311.

Then we set current tag to white characters (3D) in node 010, and enter an endless loop, where we read codes from keyboard module................, Then we start an endless loop, where

Codes: f1 - f12 30000 - 3000B, esc 20000, ent 20032, bs ent tab sp see addresses in 656