From a6893f40fb05171051a16b46efeff9d1c2904c32 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Tue, 6 Feb 2024 10:10:38 -0800 Subject: [PATCH] Detect line types --- gui/shavian/shavian.tal | 53 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/gui/shavian/shavian.tal b/gui/shavian/shavian.tal index 7721c09..bdb5156 100644 --- a/gui/shavian/shavian.tal +++ b/gui/shavian/shavian.tal @@ -1,8 +1,12 @@ - |00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1 |10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1 |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 +|0000 + + @id $2 + @buf $40 + |0100 @on-reset ( -> ) @@ -13,6 +17,51 @@ BRK @on-console ( -> ) - .Console/read DEI #18 DEO + .Console/read DEI + ( linebreak ) DUP #0a NEQ ?{ POP parse-line BRK } + ( append ) #00 ;buf scap/ STA2 BRK +@parse-line ( -- ) + ;buf is-pixels ?new-pixels + ( >> ) + +@new-glyph ( -- ) + .id LDZ2 + #2018 DEO + ;buf + #0a18 DEO + ( clean ) #0000 ;buf STA2 + .id LDZ2 INC2 .id STZ2 + JMP2r + +@new-pixels ( -- ) + ( clean ) #0000 ;buf STA2 + JMP2r + +@is-pixels ( buf* -- f ) + LDA DUP [ LIT "0 ] EQU SWP [ LIT "1 ] EQU ORA JMP2r + +( +@|stdlib ) + +@scap ( str* -- end* ) + INC2 & LDAk ?scap + JMP2r + +@ ( str* -- ) + LDAk #18 DEO + INC2 & LDAk ? + POP2 JMP2r + +@ ( short* -- ) + SWP /b + &b ( -- ) + DUP #04 SFT /c + &c ( -- ) + #0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #18 DEO + JMP2r + +@glyphs + +