Improving the font example

This commit is contained in:
neauoire 2021-07-03 10:24:23 -07:00
parent ab4a731300
commit 2a95c710b9
1 changed files with 85 additions and 6 deletions

View File

@ -7,17 +7,23 @@
%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
|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
|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 ( -> )
@ -29,14 +35,75 @@
( load font ) ( load font )
#4000 .File/length DEO2 #4000 .File/length DEO2
;font-path .File/name DEO2 ;font-path-large .File/name DEO2
;font-data .File/load DEO2 ;font-data .File/load DEO2
( draw label ) ( draw label )
#0000 #0030 ;body #21 ;draw-uf2 JSR2 #0000 #0020 ;title #21 ;draw-uf3 JSR2
( load font )
#4000 .File/length DEO2
;font-path-medium .File/name DEO2
;font-data .File/load DEO2
( draw label )
#0000 #0048 ;body #21 ;draw-uf2 JSR2
( load font )
#4000 .File/length DEO2
;font-path-small .File/name DEO2
;font-data .File/load DEO2
( draw label )
#0010 #00b8 ;footer #21 ;draw-uf2 JSR2
BRK BRK
@draw-uf3 ( x* y* text* color -- )
STH
STH2
.Screen/y DEO2
.Screen/x DEO2
STH2r
&loop
LDAk #0a ! ,&no-linebreak JCN
#0000 .Screen/x DEO2
.Screen/y DEI2 #0018 ++ .Screen/y DEO2
&no-linebreak
LDAk STHkr ,&sprite JSR
#0001 ++
LDAk ,&loop JCN
POP2 POPr
RTN
&sprite ( char color -- )
POP
DUP TOS #0048 ** ;font-data #0100 ++ ++ .Screen/addr DEO2
.Screen/x DEI2 .position/x STZ2
.Screen/y DEI2 .position/y STZ2
#00 #03
&ver
#00 #03
&hor
GET-ITERATORS
TOS #0008 ** .position/y LDZ2 ++ .Screen/y DEO2
TOS #0008 ** .position/x LDZ2 ++ .Screen/x DEO2
#21 .Screen/color DEO
.Screen/addr DEI2 #0008 ++ .Screen/addr DEO2
INCR
LTHk ,&hor JCN
POP2
INCR
LTHk ,&ver JCN
POP2
TOS ;font-data ++ LDA TOS .position/x LDZ2 ++ .Screen/x DEO2
.position/y LDZ2 .Screen/y DEO2
RTN
RTN
@draw-uf2 ( x* y* text* color -- ) @draw-uf2 ( x* y* text* color -- )
STH STH
@ -80,6 +147,9 @@ BRK
RTN RTN
@title
5468 6520 466f 6720 486f 726e $1
@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
@ -96,6 +166,15 @@ RTN
6974 2069 6e20 7468 6520 6469 7374 616e 6974 2069 6e20 7468 6520 6469 7374 616e
7420 746f 776e 732e 20 $1 7420 746f 776e 732e 20 $1
@font-path "projects/fonts/venice14.uf2 @footer
2d20 4279 2052 6179 2042 7261 6462 7572
79 $1
@font-path-large
"projects/fonts/newyork24.uf3 $1
@font-path-medium
"projects/fonts/venice14.uf2 $1
@font-path-small
"projects/fonts/geneva12.uf2 $1
@font-data @font-data