From 0ca5b39456994da6c33030d85835392bd340ac85 Mon Sep 17 00:00:00 2001 From: neauoire Date: Sun, 29 Oct 2023 11:50:06 -0700 Subject: [PATCH] (sixel) Better compression --- gui/sixels/build.sh | 4 +++- gui/sixels/dafu.sixels | 2 +- gui/sixels/icnsix.tal | 32 ++++++++++++++++++-------------- gui/sixels/test02x02.icn | Bin 0 -> 32 bytes 4 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 gui/sixels/test02x02.icn diff --git a/gui/sixels/build.sh b/gui/sixels/build.sh index 4ed61db..325c81c 100755 --- a/gui/sixels/build.sh +++ b/gui/sixels/build.sh @@ -26,7 +26,9 @@ fi # convert an image to sixels $ASM icnsix.tal icnsix.rom -uxncli icnsix.rom dafu10x10.icn > dafu.sixels +# uxncli icnsix.rom dafu10x10.icn > dafu.sixels + +uxncli icnsix.rom test02x02.icn > dafu.sixels $EMU $DST $ARG diff --git a/gui/sixels/dafu.sixels b/gui/sixels/dafu.sixels index af74c38..f192a43 100644 --- a/gui/sixels/dafu.sixels +++ b/gui/sixels/dafu.sixels @@ -1 +1 @@ -!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@@?- \ No newline at end of file +!4~!4F!8_-!16?-!16?- \ No newline at end of file diff --git a/gui/sixels/icnsix.tal b/gui/sixels/icnsix.tal index 25f0050..add5899 100644 --- a/gui/sixels/icnsix.tal +++ b/gui/sixels/icnsix.tal @@ -25,6 +25,7 @@ #00 ;img/width LDA #00 ;img/height LDA #30 SFT2 MUL2 .File/length DEO2 ;img/data .File/read DEO2 + #010e DEO #800f DEO BRK @@ -40,30 +41,33 @@ @| core ) @ ( -- ) + #0000 #0000 get-sixel #19 DEO + #0a19 DEO #00 ;img/height LDA #30 SFT2 #0000 &v ( -- ) STH2k #00 ;img/width LDA #30 SFT2 #0000 &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 + ( | rle ) + DUP2 STH2kr get-rle DUP2 #0003 LTH2 ?{ + ( rune ) [ LIT2 "! 18 ] DEO + ( dec ) DUP2 pdec + ( sixel ) OVR2 STH2kr get-sixel #18 DEO + ADD2 !& } + POP2 DUP2 STH2kr get-sixel #18 DEO INC2 & GTH2k ?&w POP2 POP2 POP2r [ LIT2 "- 18 ] DEO #0006 ADD2 GTH2k ?&v POP2 POP2 JMP2r @get-sixel ( x* y* -- byte ) - ( x* y* -- byte ) - SWP2 ,&x STR2 - [ LITr 00 ] DUP2 #0006 ADD2 + ( acc ) [ LITr 00 ] ,&y STR2 + ,&x STR2 + #0006 #0000 &l ( -- ) - [ LITr 10 ] SFTr [ LIT2 &x $2 ] OVR2 get-pixel STH ORAr #0001 SUB2 LTH2k ?&l + ( acc ) [ LITr 10 ] SFTr + ( get ) [ LIT2 &x $2 ] OVR2 #0005 SWP2 SUB2 [ LIT2 &y $2 ] ADD2 + ( res ) get-pixel STH ORAr + ( ) INC2 GTH2k ?&l POP2 POP2 STHr [ LIT "? ] ADD JMP2r @get-row ( x* y* -- row* ) @@ -80,7 +84,7 @@ ( flag ) #07 STHr SUB SFT #01 AND JMP2r @get-rle ( x* y* -- count* ) - ( acc ) [ LIT2r 0000 ] + ( acc ) [ LIT2r 0001 ] ( target ) OVR2 OVR2 get-sixel ,&t STR ,&y STR2 INC2 #00 ;img/width LDA #30 SFT2 SWP2 diff --git a/gui/sixels/test02x02.icn b/gui/sixels/test02x02.icn new file mode 100644 index 0000000000000000000000000000000000000000..fdad636d509b0ee0376137aaf5415c8e0b54ba41 GIT binary patch literal 32 UcmezW|Nn;%9~dCuKa@tI0KRYr%>V!Z literal 0 HcmV?d00001