From e9207fae7c54a754a1de1060be6ed5c796ac4883 Mon Sep 17 00:00:00 2001 From: neauoire Date: Mon, 18 Dec 2023 13:05:36 -0800 Subject: [PATCH] (tgachr) Optimizations --- cli/tgachr/tgachr.tal | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/cli/tgachr/tgachr.tal b/cli/tgachr/tgachr.tal index 154bd43..f7d2918 100644 --- a/cli/tgachr/tgachr.tal +++ b/cli/tgachr/tgachr.tal @@ -5,7 +5,7 @@ |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |80 @Controller &vector $2 &button $1 &key $1 |90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1 -|a0 @File1 &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 +|a0 @File &vector $2 &success $1 &success-lb $1 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |b0 @File2 &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |0000 @@ -33,8 +33,8 @@ ( name ) "Tgachr 0a ( desc ) "TGA 20 "to 20 "CHR 20 "Converter 0a ( auth ) "By 20 "Devine 20 "Lu 20 "Linvega 0a - ( date ) "27 20 "Nov 20 "2023 $1 - ( exts ) $1 + ( date ) "18 20 "Dec 20 "2023 $1 + ( exts ) 00 ( @|vectors ) @@ -66,9 +66,9 @@ @ ( path* -- ) ( | header ) - DUP2 .File1/name DEO2 - #0012 .File1/length DEO2 - ;image .File1/read DEO2 + DUP2 .File/name DEO2 + #0012 .File/length DEO2 + ;image .File/read DEO2 ( | flip endianness ) ;image/w STH2k LDA2 SWP STH2r STA2 ;image/h STH2k LDA2 SWP STH2r STA2 @@ -104,7 +104,7 @@ @ ( -- ) #2000 &l ( -- ) - #81 .Screen/sprite DEO + [ LIT2 81 -Screen/sprite ] DEO INC GTHk ?&l POP2 ( | move down ) @@ -115,31 +115,30 @@ @ ( filter* length* -- ) #0020 .Screen/x DEO2 #0020 .Screen/y DEO2 - #05 .Screen/auto DEO - .File1/length DEO2 + [ LIT2 05 -Screen/auto ] DEO + .File/length DEO2 ,&filter STR2 #0000 ,&x STR2 #0000 ,&y STR2 &stream ( -- ) - ;&pixel STH2k .File1/read DEO2 - [ LIT2 &x $2 ] [ LIT2 &y $2 ] #0007 AND2 STH2r [ LIT2 &filter $2 ] JSR2 - ( chr ) set-pixel + ;&pixel STH2k .File/read DEO2 + .File/success-lb DEI ?{ JMP2r } + [ LIT2 &x $2 ] [ LIT2 &y $2 ] #0007 AND2 STH2r [ LIT2 &filter $2 ] JSR2 ( on linebreak ) ,&x LDR2 INC2 DUP2 ,&x STR2 - ;image/w LDA2 NEQ2 ?&no-line + ;image/w LDA2 NEQ2 ?&stream #0000 ,&x STR2 ,&y LDR2 INC2 ,&y STR2 - ( on row ) ,&y LDR2 #0007 AND2 ORA ?&no-line + ( on row ) ,&y LDR2 #0007 AND2 ORA ?&stream ;buffer DUP2 .Screen/addr DEO2 .File2/write DEO2 - &no-line .File1/success DEI2 ORA ?&stream - JMP2r + !&stream &pixel $4 ( @|tools ) -@set-pixel ( x* y* color -- ) +@ ( x* y* color -- ) STH OVR2 SWP2 ( | get addr )