(sixels) Partial RLE support

This commit is contained in:
neauoire 2023-10-29 11:09:44 -07:00
parent 611d65e08d
commit f98285b05a
3 changed files with 70 additions and 9 deletions

View File

@ -1 +1 @@
?????????????????????????????????????????___ooowww{w{{{{{{{{{{w{wwwooo__????????????????????????????????????????????????????????-???????????????????????????????_oow{{}}~^^nnnvvvzz~x~D||||||||~|z|zzzzzvvvvmmm[[[{w{wwoooo__????????????????????????????????????-???????????????????????__wo{{^^nfvzz||}}~~~~~~~~~~~~~?v~~~~~~~~~~~~~~~~~~~~~~~~~~~}~}}~}|~|~~}}w????????????????????????????????-????????????????_ow[}]^nvzx|}}~~~~~~~~~~~~~~~~~~~~~~~y?~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~D????????????????????????????????-??????????Cw{{{|}}}}}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Ov~~~^~~^~~^~~^~~~~~~~~~~~~~~~~~~~~~~~~V??????????????????????????????????-???????????N~~~~~~~~~~~~~~~~~~~~~^^N~nvvvzzz|z||}|}}}N]BEM~~}~~~}~~}~~}}}}}}~{|||~z~z~~~~~~N@???????????????????????????????????-?????????????BN~~~~~~~~~^nnvz~x}|}~~~~~~~~~~~~~~~~~~~~{}]|^~^^^^~^~^^~^~^~^^~~^~~~~~~~~~~~~g????????????????????????????????????-????????????????@BN~zz{}~~~~~~~^^^nnvnvvzzzxz|||tc`o_OOWOwoyyz~vzv~z~~z~r~~u~}}}~{~||~~b^vNy????????????????????????????????????-????????????????????~~~N~vzz|}|}~~~~~~~~~~~~~~~~n~J??????JLZ~f~~~~~~~~~~~~~~~~~~~~~~nVH|~~~Z????????????????????????????????????-???????????????????NuwVw|~~~~~^~~^~~~^~^~n~n~n^nin_gOGGGCG{gz~~z^Z\^l^^^nNnVNVFLJX]PQ@AA]~RG?GGO????????????????????????????????-???????????????????A?HPbF^~zjRRfRfbvJFRfjbjbjbj`J@joRop@X@WDCGEGE@NEB_poWwwwwWwowOOG????hG???TA?????????????????????????????????-????????????????????@?b_HEd^s???@?B{@?kBCAAe?Ae@Ug@?DY??K????????OQeBDGDADDABAA@@??????_]?`CY???????????????????????????????????-????????????????????????AHO?tg????_ZgWaLGW_[G[cWLe?_{RKOg_W_QOO_O__?_?_?_???_??????????Y@KA?????????????????????????????????????-????????????????????????????GRiokQDA@??@@?@?@??@?????????????@?@A?A@AA?B?B@AC@CB?@AD@Dr?????????????????????????????????????????-????????????????????????????_WRRag???????????????????????_?_????_O_?????????????????o}{ok_gOOO__?_??????????????????????????????-??????????????????c?Ooo[gkq|}]z_M~~}w_?????????????????_?opwpxqxwwwoo_?????????_?o{NpF~~~~~~}}}{{|xxpq`AAccCCCGGGOGOO_O___?_?O??-??????__OGOK_uwz{~[NFrw}~~~~~@}~{R~~~~~}{woc???????????VZzqufimeIRix^B??????@_o{}Fw~~S~~~~~~~~~~~~~~NFpw}~~~~]Ebqx{{{{}{{{|{|xyq-GCaappo_O}~~~~~~~d?}~~~~~~~~n?~~~~~|n~~~~~~~~}}wwop_?????@@BBAEArBp_O????oo{}~Nvw~~~~~~~~~~~~~~~~^Fp{~~~~~Nbw{~~~~~~~~~~~~~~^NFB-}~~~~~~~wF~~~~~~~S?n~~~~~~~~vG~~~~~~~~}~z~n~N~~~~~~~~~}}{{{wwww~?z_BMw{]~^^^^^^N^N^~~~~~~~~~~~^Foy~~~~~^Bw~~~~~~~~~~~~~~^FB@?_ow-~~~~~~~~~}`N~~~~~~?i~~~~~~~~}@~~~~~~~~~~~~~~~~}||ZZFNFFBB@@@?`?p@}BEgD[ww{w{{{{~}~~~~~~~~~~~~Bx}~~~~~~V@}~~~~~~~~~~~^FB?_o{}~~~~-fN^~~~~~~~~{B~~~~~QS~~~~~~~~~Wb~~^NNFNFBFBB@@@??????????????A@LGWC^o?DYfNNNNN^N^N^^^^^~~~~~~~}~~~~~~~~Cx~~~~~~~~^FB?_o{}~~~~~~~~-@???@@@@@@@@?@@@@@@?@@@@@@@@@@??????????????????????????????????@??@???@?????????????@@@@@@@@@@@@@@@@@?@@@@@@@@@???@@@@@@@@@@@@?- !41??___ooowww{w!10?{w{wwwooo__!56{?-!31??_oow{{}}~^^nnnvvvzz~x~D!8?|~|z|!5?zvvvvmmm[[[{w{wwoooo__!36{?-!23??__wo{{^^nfvzz||}}!13?~?v!27o~}~}}~}|~|~~}}w!32n?-!16??_ow[}]^nvzx|}}!23^~y?!40~~D!32~?-!10??Cw{{{|!5?}!33~~Ov~~~^~~^~~^~~^!24~~V!34~?-!11??N!21~~^^N~nvvvzzz|z||}|}}}N]BEM~~}~~~}~~}~~!6?}~{|||~z~z!6?~N@!35^?-!13??BN!9?~^nnvz~x}|}!20~~{}]|^~^^^^~^~^^~^~^~^^~~^!12?~g!36~?-!16??@BN~zz{}!7?~^^^nnvnvvzzzxz|||tc`o_OOWOwoyyz~vzv~z~~z~r~~u~}}}~{~||~~b^vNy!36n?-!20??~~~N~vzz|}|}!16?~n~J!6??JLZ~f!22~~nVH|~~~Z!36~?-!19??NuwVw|!5?~^~~^~~~^~^~n~n~n^nin_gOGGGCG{gz~~z^Z\^l^^^nNnVNVFLJX]PQ@AA]~RG?GGO!32~?-!19??A?HPbF^~zjRRfRfbvJFRfjbjbjbj`J@joRop@X@WDCGEGE@NEB_poWwwwwWwowOOG????hG???TA!33R?-!20??@?b_HEd^s???@?B{@?kBCAAe?Ae@Ug@?DY??K!8??OQeBDGDADDABAA@@!6??_]?`CY!35B?-!24??AHO?tg????_ZgWaLGW_[G[cWLe?_{RKOg_W_QOO_O__?_?_?_???_!10??Y@KA!37g?-!28??GRiokQDA@??@@?@?@??@!13??@?@A?A@AA?B?B@AC@CB?@AD@Dr!41@?-!28??_WRRag!23??_?_????_O_!17??o}{ok_gOOO__?_!30W?-!18??c?Ooo[gkq|}]z_M~~}w_!17??_?opwpxqxwwwoo_!9??_?o{NpF!6?~}}}{{|xxpq`AAccCCCGGGOGOO_O___?_?O??-!6??__OGOK_uwz{~[NFrw}!5?~@}~{R!5?~}{woc!11O?VZzqufimeIRix^B!6??@_o{}Fw~~S!14u~NFpw}~~~~]Ebqx{{{{}{{{|{|xyq-GCaappo_O}!7o~d?}!8_~n?!5p~|n!8_~}}wwop_!5p?@@BBAEArBp_O????oo{}~Nvw!16~~^Fp{!5p~Nbw{!14~~^NFB-}!7~~wF!7~~S?n!8~~vG!8~~}~z~n~N!9w~}}{{{wwww~?z_BMw{]~!6~^N^N^!11~~^Foy!5~~^Bw!14~~^FB@?_ow-!9~~}`N!6~~?i!8~~}@!16~~}||ZZFNFFBB@@@?`?p@}BEgD[ww{w{{{{~}!12N~Bx}!6~~V@}!11`~^FB?_o{}~~~~-fN^!8~~{B!5~~QS!9~~Wb~~^NNFNFBFBB@@@!14~?A@LGWC^o?DYf!5~N^N^N!5~^!7~~}!8~~Cx!8~~^FB?_o{}!8~~-@???!8@@?!6@@?!10@@!34??@??@???@!13??!17@@?!9@@???!12@@?-

View File

@ -44,15 +44,24 @@
&v ( -- ) &v ( -- )
STH2k #00 ;img/width LDA #30 SFT2 #0000 STH2k #00 ;img/width LDA #30 SFT2 #0000
&w ( -- ) &w ( -- )
( rle )
DUP2 STH2kr get-rle DUP2 #0004 LTH2 ?{
[ LIT2 "! 18 ] DEO
DUP2 INC2 pdec
DUP2 STH2kr get-sixel #18 DEO
ADD2 !&
} POP2
DUP2 STH2kr get-sixel #18 DEO DUP2 STH2kr get-sixel #18 DEO
INC2 GTH2k ?&w INC2 & GTH2k ?&w
POP2 POP2 POP2r [ LIT "- ] #18 DEO POP2 POP2 POP2r [ LIT2 "- 18 ] DEO
#0006 ADD2 GTH2k ?&v #0006 ADD2 GTH2k ?&v
POP2 POP2 JMP2r POP2 POP2 JMP2r
@get-sixel ( x* y* -- byte ) @get-sixel ( x* y* -- byte )
SWP2 ,&x STR2 ( x* y* -- byte )
[ LITr 00 ] DUP2 #0006 ADD2 SWP2 ,&x STR2
[ LITr 00 ] DUP2 #0006 ADD2
&l ( -- ) &l ( -- )
[ LITr 10 ] SFTr [ LIT2 &x $2 ] OVR2 get-pixel STH ORAr #0001 SUB2 LTH2k ?&l [ LITr 10 ] SFTr [ LIT2 &x $2 ] OVR2 get-pixel STH ORAr #0001 SUB2 LTH2k ?&l
POP2 POP2 STHr [ LIT "? ] ADD JMP2r POP2 POP2 STHr [ LIT "? ] ADD JMP2r
@ -70,6 +79,17 @@
( get byte ) get-row LDA ( get byte ) get-row LDA
( flag ) #07 STHr SUB SFT #01 AND JMP2r ( flag ) #07 STHr SUB SFT #01 AND JMP2r
@get-rle ( x* y* -- count* )
( acc ) [ LIT2r 0000 ]
( target ) OVR2 OVR2 get-sixel ,&t STR
,&y STR2
INC2 #00 ;img/width LDA #30 SFT2 SWP2
&l ( -- )
DUP2 [ LIT2 &y $2 ] get-sixel [ LIT &t $1 ] NEQ ?&end
INC2r INC2 GTH2k ?&l
&end ( -- )
POP2 POP2 STH2r JMP2r
( (
@|stdlib ) @|stdlib )
@ -89,6 +109,23 @@
LDAk #00 NEQ [ JMP JMP2r ] &w INC2 LDAk ?&w LDAk #00 NEQ [ JMP JMP2r ] &w INC2 LDAk ?&w
JMP2r JMP2r
@pdec ( short* -- )
#2710 [ LIT2r 00fb ]
&w ( -- )
DIV2k #000a DIV2k MUL2 SUB2 SWPr EQUk OVR STHkr EQU AND ?{
DUP [ LIT "0 ] ADD #18 DEO
INCr }
POP2 #000a DIV2 SWPr INCr STHkr ?&w
POP2r POP2 POP2 JMP2r
@phex ( short* -- )
SWP phex/b
&b ( -- )
DUP #04 SFT phex/c
&c ( -- )
#0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #19 DEO
JMP2r
( (
@|memory ) @|memory )

View File

@ -50,20 +50,27 @@
!& !&
@<draw-sixels>/op-rle ( addr* -- addr* ) @<draw-sixels>/op-rle ( addr* -- addr* )
LDAk #19 DEO
INC2k sdec pdec #2019 DEO
LDA #19 DEO
#0a19 DEO
( rune ) INC2 ( rune ) INC2
( length ) sdec ( length ) sdec
( target ) OVR2 LDA ,&t STR
( target ) OVR2 LDA [ LIT "? ] SUB ,&t STR
#0000 #0000
&l ( -- ) &l ( -- )
[ LIT &t $1 ] <draw-sixels>/op-col [ LIT &t $1 ] DUP #19 DEO <draw-sixels>/op-col
INC2 GTH2k ?&l INC2 GTH2k ?&l #0a19 DEO
POP2 POP2 INC2 !<draw-sixels>/ POP2 POP2 INC2 !<draw-sixels>/
@<draw-sixels>/op-col ( byte -- ) @<draw-sixels>/op-col ( byte -- )
,&t STR ,&t STR
#0600 #0600
&l ( -- ) &l ( -- )
[ LIT &t $1 ] OVR SFT #01 AND #02 ADD .Screen/pixel DEO [ LIT &t $1 ] OVR SFT #01 AND .Screen/pixel DEO
INC GTHk ?&l INC GTHk ?&l
POP2 POP2
( | advance ) ( | advance )
@ -87,6 +94,23 @@
LDAk #00 NEQ [ JMP JMP2r ] &w INC2 LDAk ?&w LDAk #00 NEQ [ JMP JMP2r ] &w INC2 LDAk ?&w
JMP2r JMP2r
@phex ( short* -- )
SWP phex/b
&b ( -- )
DUP #04 SFT phex/c
&c ( -- )
#0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #18 DEO
JMP2r
@pdec ( short* -- )
#2710 [ LIT2r 00fb ]
&w ( -- )
DIV2k #000a DIV2k MUL2 SUB2 SWPr EQUk OVR STHkr EQU AND ?{
DUP [ LIT "0 ] ADD #19 DEO
INCr }
POP2 #000a DIV2 SWPr INCr STHkr ?&w
POP2r POP2 POP2 JMP2r
( (
@|memory ) @|memory )