etherforth_logo

Node 211

This node takes care of loading and manipulating blocks.

Source code

editor node 311 node 212 node 111 node 210 node 211
211 block
blk 00 @p drop @p ; blk! 01 !p ; 0 ,
288* 03 n-m 2* 2* 2* 2* 2*
dup dup or 8 for over . + unext ;
+b 09 blk 2 . + blk!
rd 0D blk 288* 5600 fill ! ! dup or a down a! blk ! a! dup or
upd 16 n blk if drop else drop 800 or
then a over left a! 5636 upd ! ! a! ;
-b 20 blk -2 . + if
fresh 24 blk! rd then ;
-blk 27 -b
home 28 @p ! ; dup or dup .
+blk 2A +b home ;
ptr 2C left a! 12000 ptr ! @p ! . !p .. @ right a! ! ;
bk' 34 @p drop @p ; bk'! 35 !p ; 0 ,
othr 37 blk bk' blk! bk'! rd ;
shdw 3C 1 blk or fresh ; 3F

init right a! up b! r--u ; 44

4 d 2 r 0 ether

Definitions

blk, blk!
Keep current block number.
288*
Take block number n and return starting address m in SRAM.
+b
Increment blk by two and fall to
rd
Read block blk into buffer by calling fill in 210. Then send block number to 311 for display in command line, set pointer to zero and fall to
upd
Update pointer position to n. We first test block number and add 800 if in block zero, i.e. in command line. We send the new pointer value to node 212 and call upd there while keeping content of register A intact.
-b
Decrement blk down to 0 by 2, and jump to rd
-blk
Call -b and fall to
home
Set zero pointer and index in 210.
+blk
Call +b and jump to home.
ptr
Get pointer value from 212 and send it to 210.
bk', bk'!
Keep alternate block number. Word bk'! includes jump to rd due to limited space in RAM.
sothr
Switch current and alternate block.
shdw
Switch between source and its shadow block.
init
Set registers A and B, and jump to RIGHT and UP.

Description