Node 111
This node converts character codes into navigation actions.
Source code
111 navigate
host *, ca 40 * or , ; target
act 00 13 j 3B -w *, 2A ; 39 +w *,
14 k 20 -l *, 5 l 2F +l *,
20016 m 27 -blk *, 20025 / 2A +blk *,
2000F f 37 othr *, 20019 p 3C shdw *,
30017 n del ,
ptr 09 -p 1203D ptr ! @p @p !p . . . @p !b @b !p ! ! @ ;
del 0E left a! ptr 1203B -w ! ptr
right a! 5613 del ! ! ! -d-- ;
mask 19 cm-cmf over over 3F and or ;
act? 1C cm-c mask if drop drop ;
then drop 2/ 2/ 2/ 2/ 2/ 2/
-if dup 400 and if del ;
then drop 3FF and 12000 or !b F
then 12000 or left a! ! -d-- ;
nav 30 n dup dup or a! 8 for @+ act next ;
cl 36 bk'! blk !b @p !b . dup !b . . @b
if drop !b then 5601 blk! !b 12028 home
dup dup or !b 1200D rd !b !b ; 40
init up b! -d-- ; 43
5 d 2 r 0 ether
host *, ca 40 * or , ; target
act 00 13 j 3B -w *, 2A ; 39 +w *,
14 k 20 -l *, 5 l 2F +l *,
20016 m 27 -blk *, 20025 / 2A +blk *,
2000F f 37 othr *, 20019 p 3C shdw *,
30017 n del ,
ptr 09 -p 1203D ptr ! @p @p !p . . . @p !b @b !p ! ! @ ;
del 0E left a! ptr 1203B -w ! ptr
right a! 5613 del ! ! ! -d-- ;
mask 19 cm-cmf over over 3F and or ;
act? 1C cm-c mask if drop drop ;
then drop 2/ 2/ 2/ 2/ 2/ 2/
-if dup 400 and if del ;
then drop 3FF and 12000 or !b F
then 12000 or left a! ! -d-- ;
nav 30 n dup dup or a! 8 for @+ act next ;
cl 36 bk'! blk !b @p !b . dup !b . . @b
if drop !b then 5601 blk! !b 12028 home
dup dup or !b 1200D rd !b !b ; 40
init up b! -d-- ; 43
5 d 2 r 0 ether
Definitions
- *,
- This word is defined in colorForth host dictionary. It takes character code c and address a, shifts a 6 bits left, combines the two together, and compiles the result into image.
- act
- This defines a table with masks: char code in bits 5-0, address in bits 15-6, bit 17 is a flag for block commands. We use host word *, to assemble masks. An exception is word for delete command which has both bits 17 and 16 set and holds no address.
- ptr
- Get current pointer from node 212 by calling ptr in 112 and getting the value p via port execution.
- del
- Call ptr, -w (in 212), and ptr again. Send both pointers (before and after moving cursor one word left) to 110 and call del there.
- mask
- Return zero if c found in m.
- act?
- Test mask, return if no match, else shift address to bits 9-0, if block command (bit 17 high), first check bit 10 and jump to del if set. Else make it call instruction, set A to UP and send the command. Then prepare address of home in 112 on stack and continue to non-block command processing, where we assemble call instruction and send it to 112.
- nav
- Set address register A to zero, fetch a char code, go through act table and look for match. If found, execute, else ignore the char and return to DOWN port execution.
- cl
- no description yet
- init
- Init register B, and jump to DOWN.