Skip to content

Instantly share code, notes, and snippets.

@ekipan
Last active April 28, 2023 13:27
Show Gist options
  • Save ekipan/e592bf34c314a260112da08adcff980a to your computer and use it in GitHub Desktop.
Save ekipan/e592bf34c314a260112da08adcff980a to your computer and use it in GitHub Desktop.
( ttiny line editor 10 )
: 00. 0 <# # # #> type space ;
: in- source >in ! drop ;
: in/ source >in @ /string 32 min ;
create scr 10 ,
: edit dup scr ! block drop ;
: line 32 * scr @ block + ;
: wipe 0 line 1024 bl fill ;
: run 0 line 1024 evaluate ;
: scrub 0 line dup 1024 + swap DO
i c@ bl max 'Z' min i c! LOOP ;
: tt dup 00. ." rr " line 32 type cr ;
: ttt DO i tt LOOP ;
: aa 8 0 ttt ; : bb 16 8 ttt ;
: cc 24 16 ttt ; : dd 32 24 ttt ;
: ll aa bb key drop cc dd ;
: ww in- line 32 bl fill ;
: rr in/ rot dup ww line swap move ;
: xx >r r@ 1+ line r@ line
992 r> 32 * - move 31 ww ;
: ii >r r@ line r@ 1+ line
992 r@ 32 * - move r> rr ;
( ttiny line editor 11
edits blocks in screens of 32x32.
small code, for small screens.
[var] scr [-a] loaded block
edit [u-] load block u
line [u-a] address of line u
wipe [-] blank the buffer
run [-] evaluate buffer
scrub [-] remove [some] ctl codes
tt [u-] type line u
ttt [uu-] type lines u2->u1
aa bb [-] type groups of 8 lines
cc dd [-]
ll [-] type all 32 lines
ww p[u-] whiteout line u
rr p[u-] replace line u
xx p[u-] delete line u
ii p[u-] insert before line u
ww and xx parse and ignore the
rest of the line, for convenience. )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment