(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
|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 @@
@<file-open-tga> ( 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 @@
@<draw-row> ( -- )
#2000
&l ( -- )
#81 .Screen/sprite DEO
[ LIT2 81 -Screen/sprite ] DEO
INC GTHk ?&l
POP2
( | move down )
@ -115,31 +115,30 @@
@<parse-tga> ( 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 <set-pixel>
( 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
<draw-row>
&no-line .File1/success DEI2 ORA ?&stream
JMP2r
!&stream
&pixel $4
(
@|tools )
@set-pixel ( x* y* color -- )
@<set-pixel> ( x* y* color -- )
STH
OVR2 SWP2
( | get addr )