Node 010
Here we select tags, enter words, process non-printable characters. Code starts with tags table. Each word holds one tag, address corresponds to function key number less one.
Source code
010 enter
tags
36 yd , 38 gd , 33 yh , 34 gh , 30 yt , 31 gt ,
32 yw , 37 rw , 35 gw , 3D ww , 3E sw , 3F aw ,
tag 0C @p drpp @p ; tag! 0D !p ; 0 ,
sett 0F ft a! @ tag! if 12000 upd !b then dup or 12002 aim !b ;
tag? 17 10000 over and if drop sett r--- then drop ;
nprt? 1D n -if push ; then ;
ch, 20 c 5606 ins !b !b ;
ins 22 fc over if drop ch, ; then drop tag ch, ch, - ;
go 28 n 20000 esc over or if * drop tag? nprt? ins r---
bs 2F -f 12004 del !b r---
ent 32 39 ch, ahead *
tab 35 3A ch,
sp 37 then then * 12000 upd !b dup or r---
start 3B @b ! r--- ; 3D
init down b! right a! dup or start ; 42
6 d 1 r 0 ether
tags
36 yd , 38 gd , 33 yh , 34 gh , 30 yt , 31 gt ,
32 yw , 37 rw , 35 gw , 3D ww , 3E sw , 3F aw ,
tag 0C @p drpp @p ; tag! 0D !p ; 0 ,
sett 0F ft a! @ tag! if 12000 upd !b then dup or 12002 aim !b ;
tag? 17 10000 over and if drop sett r--- then drop ;
nprt? 1D n -if push ; then ;
ch, 20 c 5606 ins !b !b ;
ins 22 fc over if drop ch, ; then drop tag ch, ch, - ;
go 28 n 20000 esc over or if * drop tag? nprt? ins r---
bs 2F -f 12004 del !b r---
ent 32 39 ch, ahead *
tab 35 3A ch,
sp 37 then then * 12000 upd !b dup or r---
start 3B @b ! r--- ; 3D
init down b! right a! dup or start ; 42
6 d 1 r 0 ether
Definitions
- tag, tag!
- This variable keeps the last tag selected.
- sett
- Fetch a tag from word in T in tags table and if flag f in S is true call upd in 110, clear flag f and call aim in 110; this ends entering a word, moves cursor forward, and gets ready for entering another word startign with tag in T. If flag f is false, only call aim to get ready for entering a word.
- tag?
- Check if keycode n is function key. If so call sett and jump to RIGHT, else return.
- nprt?
- Check if keycode n is one of non-printables and if so jump to its execution vector, else return.
- ch,
- Call ins in 110 and sends a character c to it.<
- ins
- If flag f set, send the character c to 110 because we've already set a tag in a word being entered. Else call tag and send both tag and character to 110. Then invert flag f and return.
- go
- Get a character n from node 11. If esc, jump ahead to sp. Else call tag?, nprt?, ins, and if you return jump back to RIGHT.
- bs
- Call bsp in 110 and jump to RIGHT.
- ent
- Send character 39 (eol) to 110 and call ins there, then jump ahead to sp.
- tab
- Send character 3A (space) to 110 and call ins there, then fall through to
- sp
- Call upd in 110, set zero flag and jump to RIGHT.
- start
- Wait for signal from 110, sends it to 11, and jump to RIGHT.
- init
- Init registers A and B, prepare a zero flag on stack, and jump to start.