(sixels) Added RLE rune

This commit is contained in:
neauoire 2023-10-28 15:47:42 -07:00
parent a7f873ec11
commit 12ef82bdf8
1 changed files with 37 additions and 8 deletions

View File

@ -19,11 +19,30 @@
[ LIT2 02 -Screen/auto ] DEO [ LIT2 02 -Screen/auto ] DEO
.Screen/x DEI2 ,&anchor STR2 .Screen/x DEI2 ,&anchor STR2
&w ( -- ) &w ( -- )
LDAk [ LIT "- ] NEQ ?{ LDAk [ LIT "$ ] EQU ?&op-over
[ LIT2 &anchor $2 ] .Screen/x DEO2 LDAk [ LIT "- ] EQU ?&op-line
LDAk [ LIT "! ] EQU ?&op-rle
LDAk [ LIT "? ] SUB <draw-sixels>/op-col
& INC2 LDAk ?&w
POP2 JMP2r
&op-line ( -- )
.Screen/y DEI2k #0006 ADD2 ROT DEO2 .Screen/y DEI2k #0006 ADD2 ROT DEO2
!& } &op-over ( -- )
LDAk [ LIT "? ] SUB ,&t STR [ LIT2 &anchor $2 ] .Screen/x DEO2
!&
@<draw-sixels>/op-rle ( addr* -- addr* )
( rune ) INC2
( length ) sdec
( target ) OVR2 LDA ,&t STR
#0000
&l ( -- )
[ LIT &t $1 ] <draw-sixels>/op-col
INC2 GTH2k ?&l
POP2 POP2 INC2 !<draw-sixels>/
@<draw-sixels>/op-col ( byte -- )
,&t STR
#0600 #0600
&l ( -- ) &l ( -- )
[ LIT &t $1 ] OVR SFT #01 AND .Screen/pixel DEO [ LIT &t $1 ] OVR SFT #01 AND .Screen/pixel DEO
@ -32,8 +51,18 @@
( | advance ) ( | advance )
.Screen/x DEI2k INC2 ROT DEO2 .Screen/x DEI2k INC2 ROT DEO2
.Screen/y DEI2k #0006 SUB2 ROT DEO2 .Screen/y DEI2k #0006 SUB2 ROT DEO2
& INC2 LDAk ?&w JMP2r
POP2 JMP2r
@sdec ( str* -- str* val* )
[ LIT2r 0000 ]
&w ( -- )
( validate ) LDAk [ LIT "0 ] SUB #09 GTH ?&end
( accumulate ) [ LIT2r 000a ] MUL2r
( combine ) LDAk [ LIT "0 ] SUB [ LITr 00 ] STH ADD2r
( continue ) INC2 LDAk ?&w
&end STH2r JMP2r
@sample [ "???owYn||~ywo??-?IRJaVNn^NVbJRI $1 ] @sample [ "???owYn||~ywo??-?IRJaVNn^NVbJRI $1 ]
@sample-rle [ "||||!12w $1 ]