Minor optimizations to the font example

This commit is contained in:
neauoire 2021-07-03 09:51:03 -07:00
parent b8d06b7e6e
commit ab4a731300
1 changed files with 14 additions and 28 deletions

View File

@ -7,33 +7,25 @@
%RTN { JMP2r } %RTN { JMP2r }
%TOS { #00 SWP } %TOS { #00 SWP }
%INCR { SWP #01 ADD SWP }
%GET-ITERATORS { SWP2k POP SWP POP }
( devices ) ( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ] |20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|a0 @File [ &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ] |a0 @File [ &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]
( variables ) ( variables )
|0000 |0000
@position
&x $2
&y $2
( init ) ( init )
|0100 ( -> ) |0100 ( -> )
( theme ) ( theme )
#0f73 .System/r DEO2 #0f7f .System/r DEO2
#0fe3 .System/g DEO2 #0fe0 .System/g DEO2
#0fc3 .System/b DEO2 #0fc0 .System/b DEO2
( load font ) ( load font )
#4000 .File/length DEO2 #4000 .File/length DEO2
@ -66,34 +58,28 @@ BRK
&sprite ( char color -- ) &sprite ( char color -- )
STH STH
( get addr ) STHk TOS #0020 ** ;font-data #0100 ++ ++ .Screen/addr DEO2 ( get addr ) STHk TOS #0020 ** ;font-data #0100 ++ ++ .Screen/addr DEO2
( get width ) STHkr TOS ;font-data ++ LDA TOS
SWPr SWPr
( top-left ) STHkr .Screen/color DEO ( left-top ) STHkr .Screen/color DEO
.Screen/y DEI2 #0008 ++ .Screen/y DEO2 .Screen/y DEI2 #0008 ++ .Screen/y DEO2
.Screen/addr DEI2 #0010 ++ .Screen/addr DEO2 .Screen/addr DEI2 #0010 ++ .Screen/addr DEO2
( bottom-left ) STHkr .Screen/color DEO ( left-bottom ) STHkr .Screen/color DEO
.Screen/x DEI2 #0008 ++ .Screen/x DEO2 .Screen/x DEI2 #0008 ++ .Screen/x DEO2
.Screen/addr DEI2 #0008 ++ .Screen/addr DEO2
( bottom-right ) STHkr .Screen/color DEO
.Screen/y DEI2 #0008 -- .Screen/y DEO2 .Screen/y DEI2 #0008 -- .Screen/y DEO2
.Screen/addr DEI2 #0010 -- .Screen/addr DEO2 DUP #09 < ,&thin JCN
( top-right ) STHkr .Screen/color DEO .Screen/addr DEI2 #0008 -- .Screen/addr DEO2
( right-top ) STHkr .Screen/color DEO
.Screen/addr DEI2 #0010 ++ .Screen/addr DEO2
.Screen/y DEI2 #0008 ++ .Screen/y DEO2
( right-bottom ) STHkr .Screen/color DEO
.Screen/y DEI2 #0008 -- .Screen/y DEO2 &thin
SWPr SWPr
( get width ) STHkr TOS ;font-data ++ LDA TOS .Screen/x DEI2 ++ #0008 -- .Screen/x DEO2 ( use width ) .Screen/x DEI2 ++ #0008 -- .Screen/x DEO2
POPr POPr POPr POPr
RTN RTN
RTN RTN
@font-hex
003c 464a 5262 3c00 0018 0808 0808 1c00
003c 4202 3c40 7e00 003c 421c 0242 3c00
000c 1424 447e 0400 007e 407c 0242 3c00
003c 407c 4242 3c00 007e 0204 0810 1000
003c 423c 4242 3c00 003c 4242 3e02 3c00
003c 4242 7e42 4200 007c 427c 4242 7c00
003c 4240 4042 3c00 007c 4242 4242 7c00
007e 4078 4040 7e00 007e 4078 4040 4000
@body @body
4927 6c6c 206d 616b 6520 6120 736f 756e 4927 6c6c 206d 616b 6520 6120 736f 756e
6420 7468 6174 2773 2073 6f20 616c 6f6e 6420 7468 6174 2773 2073 6f20 616c 6f6e