(tgachr) Optimizations

This commit is contained in:
neauoire 2023-12-18 13:05:36 -08:00
parent beeb94a5cd
commit e9207fae7c
1 changed files with 16 additions and 17 deletions

View File

@ -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 |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 |80 @Controller &vector $2 &button $1 &key $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $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 |b0 @File2 &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|0000 |0000
@ -33,8 +33,8 @@
( name ) "Tgachr 0a ( name ) "Tgachr 0a
( desc ) "TGA 20 "to 20 "CHR 20 "Converter 0a ( desc ) "TGA 20 "to 20 "CHR 20 "Converter 0a
( auth ) "By 20 "Devine 20 "Lu 20 "Linvega 0a ( auth ) "By 20 "Devine 20 "Lu 20 "Linvega 0a
( date ) "27 20 "Nov 20 "2023 $1 ( date ) "18 20 "Dec 20 "2023 $1
( exts ) $1 ( exts ) 00
( (
@|vectors ) @|vectors )
@ -66,9 +66,9 @@
@<file-open-tga> ( path* -- ) @<file-open-tga> ( path* -- )
( | header ) ( | header )
DUP2 .File1/name DEO2 DUP2 .File/name DEO2
#0012 .File1/length DEO2 #0012 .File/length DEO2
;image .File1/read DEO2 ;image .File/read DEO2
( | flip endianness ) ( | flip endianness )
;image/w STH2k LDA2 SWP STH2r STA2 ;image/w STH2k LDA2 SWP STH2r STA2
;image/h STH2k LDA2 SWP STH2r STA2 ;image/h STH2k LDA2 SWP STH2r STA2
@ -104,7 +104,7 @@
@<draw-row> ( -- ) @<draw-row> ( -- )
#2000 #2000
&l ( -- ) &l ( -- )
#81 .Screen/sprite DEO [ LIT2 81 -Screen/sprite ] DEO
INC GTHk ?&l INC GTHk ?&l
POP2 POP2
( | move down ) ( | move down )
@ -115,31 +115,30 @@
@<parse-tga> ( filter* length* -- ) @<parse-tga> ( filter* length* -- )
#0020 .Screen/x DEO2 #0020 .Screen/x DEO2
#0020 .Screen/y DEO2 #0020 .Screen/y DEO2
#05 .Screen/auto DEO [ LIT2 05 -Screen/auto ] DEO
.File1/length DEO2 .File/length DEO2
,&filter STR2 ,&filter STR2
#0000 ,&x STR2 #0000 ,&x STR2
#0000 ,&y STR2 #0000 ,&y STR2
&stream ( -- ) &stream ( -- )
;&pixel STH2k .File1/read DEO2 ;&pixel STH2k .File/read DEO2
[ LIT2 &x $2 ] [ LIT2 &y $2 ] #0007 AND2 STH2r [ LIT2 &filter $2 ] JSR2 .File/success-lb DEI ?{ JMP2r }
( chr ) set-pixel [ LIT2 &x $2 ] [ LIT2 &y $2 ] #0007 AND2 STH2r [ LIT2 &filter $2 ] JSR2 <set-pixel>
( on linebreak ) ,&x LDR2 INC2 DUP2 ,&x STR2 ( on linebreak ) ,&x LDR2 INC2 DUP2 ,&x STR2
;image/w LDA2 NEQ2 ?&no-line ;image/w LDA2 NEQ2 ?&stream
#0000 ,&x STR2 #0000 ,&x STR2
,&y LDR2 INC2 ,&y 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 ;buffer DUP2 .Screen/addr DEO2
.File2/write DEO2 .File2/write DEO2
<draw-row> <draw-row>
&no-line .File1/success DEI2 ORA ?&stream !&stream
JMP2r
&pixel $4 &pixel $4
( (
@|tools ) @|tools )
@set-pixel ( x* y* color -- ) @<set-pixel> ( x* y* color -- )
STH STH
OVR2 SWP2 OVR2 SWP2
( | get addr ) ( | get addr )