(sixels) Improved implementation

This commit is contained in:
neauoire 2023-10-19 15:36:00 -04:00
parent f05d7c43c2
commit 1e91ea41eb
2 changed files with 61 additions and 26 deletions

27
gui/sixels/build.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh -e
ASM="uxncli $HOME/roms/drifblim.rom"
EMU="uxnemu"
LIN="uxncli $HOME/roms/uxnlin.rom"
ID="sixels"
SRC="${ID}.tal"
DST="${ID}.rom"
CPY="$HOME/roms"
ARG=""
if [[ "$*" == *"--lint"* ]]
then
$LIN $SRC
fi
$ASM $SRC $DST
if [[ "$*" == *"--save"* ]]
then
cp $DST $CPY
fi
$EMU $DST $ARG

View File

@ -1,29 +1,37 @@
@draw-sixel ( str* -- str* )
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
[ LITr -Screen/y ] DEI2r
.Screen/x DEI2 ,&x STR2
INC2
&w
LDAk #21 LTH ?&end
( line feed )
LDAk LIT "- NEQ ?&no-lf
[ LIT2 &x $2 ] .Screen/x DEO2
.Screen/y DEI2k #0006 ADD2 ROT DEO2
INC2 !&w
&no-lf
( pixel )
LDAk LIT "? SUB ,&t STR
is-selected ,&sel STR
.Screen/y DEI2
#0600
&col
DUP #05 NEQ INC .Screen/auto DEO
[ LIT &t $1 ] OVR SFT #01 AND [ LIT &sel $1 ] ADD .Screen/pixel DEO
INC GTHk ?&col
POP2
|0100
@on-reset ( -> )
#f07f .System/r DEO2
#f0d6 .System/g DEO2
#f0b2 .System/b DEO2
#0020 DUP2 .Screen/x DEO2
.Screen/y DEO2
INC2 !&w &end
STH2r .Screen/y DEO2
#15 .Screen/auto DEO
;sample <draw-sixel>
BRK
@<draw-sixel> ( data* -- )
[ LIT2 02 -Screen/auto ] DEO
.Screen/x DEI2 ,&anchor STR2
&w ( -- )
LDAk [ LIT "- ] EQU ?&line-feed
LDAk [ LIT "? ] SUB ,&t STR
#0600
&l ( -- )
[ LIT &t $1 ] OVR SFT #01 AND .Screen/pixel DEO
INC GTHk ?&l
POP2
( | advance )
.Screen/x DEI2k INC2 ROT DEO2
.Screen/y DEI2k #0006 SUB2 ROT DEO2
& INC2 LDAk ?&w
POP2 JMP2r
&line-feed ( data* -- next-data* )
[ LIT2 &anchor $2 ] .Screen/x DEO2
.Screen/y DEI2k #0006 ADD2 ROT DEO2
!&
@sample [ "???owYn||~ywo??-?IRJaVNn^NVbJRI $1 ]
JMP2r