(sixels) Housekeeping

This commit is contained in:
Devine Lu Linvega 2024-06-12 09:29:37 -08:00
parent 4ae460d508
commit 2336fee881
1 changed files with 31 additions and 36 deletions

View File

@ -2,47 +2,45 @@
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $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 |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|000
|0000
@src $40 @src $40
|0100 |100
@on-reset ( -> ) @on-reset ( -> )
#f0ef .System/r DEO2 #f0ef .System/r DEO2
#f0e6 .System/g DEO2 #f0e6 .System/g DEO2
#f0e2 .System/b DEO2 #f0e2 .System/b DEO2
#0010 DUP2 .Screen/x DEO2
.Screen/y DEO2
#00a0 .Screen/width DEO2 #00a0 .Screen/width DEO2
#00b0 .Screen/height DEO2 #00b0 .Screen/height DEO2
( | begin ) ( | begin )
#0010 DUP2 .Screen/x DEO2
.Screen/y DEO2
;on-console .Console/vector DEO2 ;on-console .Console/vector DEO2
BRK BRK
@on-console ( -> ) @on-console ( -> )
.Console/read DEI DUP #20 LTH OVR #7f GTH ORA ?{ .Console/read DEI DUP #20 GTH ?{
;src scap STA POP ;src .File/name DEO2
BRK }
POP
( | load )
;src .File/name DEO2
#8000 .File/length DEO2 #8000 .File/length DEO2
;img/data .File/read DEO2 ;img .File/read DEO2
;img/data <draw-sixels> ;img <draw-sixels>
;sample <draw-sixels> ;sample <draw-sixels>
BRK }
[ LIT &ptr -src ] INCk ,&ptr STR
STZ
BRK BRK
@<draw-sixels> ( data* -- ) @<draw-sixels> ( data* -- )
[ LIT2 02 -Screen/auto ] DEO [ LIT2 02 -Screen/auto ] DEO
.Screen/x DEI2 ,&anchor STR2 .Screen/x DEI2 ,&anchor STR2
&w ( -- ) &>w ( -- )
LDAk [ LIT "$ ] EQU ?&op-over LDAk [ LIT "$ ] EQU ?&op-over
LDAk [ LIT "- ] EQU ?&op-line LDAk [ LIT "- ] EQU ?&op-line
LDAk [ LIT "! ] EQU ?&op-rle LDAk [ LIT "! ] EQU ?&op-rle
LDAk <draw-sixels>/op-col LDAk <draw-sixels>/op-col
& INC2 LDAk ?&w & INC2 LDAk ?&>w
POP2 JMP2r POP2 JMP2r
&op-line ( -- ) &op-line ( -- )
.Screen/y DEI2k #0006 ADD2 ROT DEO2 .Screen/y DEI2k #0006 ADD2 ROT DEO2
@ -51,19 +49,19 @@
!& !&
@<draw-sixels>/op-rle ( addr* -- addr* ) @<draw-sixels>/op-rle ( addr* -- addr* )
INC2 sdec OVR2 LDA ,&t STR INC2 sdec OVR2 LDA ,&trle STR
#0000 #0000
&l ( -- ) &>lrle ( -- )
[ LIT &t $1 ] <draw-sixels>/op-col [ LIT &trle $1 ] <draw-sixels>/op-col
INC2 GTH2k ?&l INC2 GTH2k ?&>lrle
POP2 POP2 !<draw-sixels>/ POP2 POP2 !<draw-sixels>/
@<draw-sixels>/op-col ( char -- ) @<draw-sixels>/op-col ( char -- )
[ LIT "? ] SUB ,&t STR [ LIT "? ] SUB ,&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
INC GTHk ?&l INC GTHk ?&>l
POP2 POP2
( | advance ) ( | advance )
.Screen/x DEI2k INC2 ROT DEO2 .Screen/x DEI2k INC2 ROT DEO2
@ -75,21 +73,18 @@
@sdec ( str* -- str* val* ) @sdec ( str* -- str* val* )
[ LIT2r 0000 ] [ LIT2r 0000 ]
&w ( -- ) &>w ( -- )
( validate ) LDAk [ LIT "0 ] SUB #09 GTH ?&end ( validate ) LDAk [ LIT "0 ] SUB #09 GTH ?{
( accumulate ) [ LIT2r 000a ] MUL2r ( accumulate ) [ LIT2r 000a ] MUL2r
( combine ) LDAk [ LIT "0 ] SUB [ LITr 00 ] STH ADD2r ( combine ) LDAk [ LIT "0 ] SUB [ LITr 00 ] STH
( continue ) INC2 LDAk ?&w ADD2r
&end STH2r JMP2r ( continue ) INC2 LDAk ?&>w }
STH2r JMP2r
@scap ( str* -- end* )
LDAk #00 NEQ [ JMP JMP2r ] &w INC2 LDAk ?&w
JMP2r
( (
@|memory ) @|memory )
@sample [ "???owYn||~ywo??-?IRJaVNn^NVbJRI $1 ] @sample [ "???owYn||~ywo??-?IRJaVNn^NVbJRI $1 ]
@img &data @img