Browse code

Minor optimizations to the font example

neauoire authored on 03/07/2021 16:51:03
Showing 1 changed files
... ...
@@ -7,33 +7,25 @@
7 7
 
8 8
 %RTN { JMP2r }
9 9
 %TOS { #00 SWP }
10
-%INCR { SWP #01 ADD SWP }
11
-%GET-ITERATORS { SWP2k POP SWP POP }
12 10
 
13 11
 ( devices )
14 12
 
15 13
 |00 @System     [ &vector $2 &pad    $6 &r      $2 &g     $2 &b      $2 ]
16
-|10 @Console    [ &vector $2 &read     $1 &pad    $5 &write $1 ]
17 14
 |20 @Screen     [ &vector $2 &width  $2 &height $2 &pad   $2 &x      $2 &y $2 &addr $2 &color $1 ]
18
-|80 @Controller [ &vector $2 &button $1 &key    $1 ]
19 15
 |a0 @File       [ &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]
20 16
 
21 17
 ( variables )
22 18
 
23 19
 |0000
24 20
 
25
-@position
26
-	&x $2
27
-	&y $2
28
-
29 21
 ( init )
30 22
 
31 23
 |0100 ( -> )
32 24
 
33 25
 	( theme ) 
34
-	#0f73 .System/r DEO2 
35
-	#0fe3 .System/g DEO2 
36
-	#0fc3 .System/b DEO2
26
+	#0f7f .System/r DEO2 
27
+	#0fe0 .System/g DEO2 
28
+	#0fc0 .System/b DEO2
37 29
 
38 30
 	( load font )
39 31
 	#4000 .File/length DEO2
... ...
@@ -66,34 +58,28 @@ BRK
66 58
 	&sprite ( char color -- )
67 59
 		STH
68 60
 		( get addr ) STHk TOS #0020 ** ;font-data #0100 ++ ++ .Screen/addr DEO2
61
+		( get width ) STHkr TOS ;font-data ++ LDA TOS
69 62
 		SWPr
70
-			( top-left ) STHkr .Screen/color DEO
63
+			( left-top ) STHkr .Screen/color DEO
71 64
 			.Screen/y DEI2 #0008 ++ .Screen/y DEO2
72 65
 			.Screen/addr DEI2 #0010 ++ .Screen/addr DEO2
73
-			( bottom-left ) STHkr .Screen/color DEO
66
+			( left-bottom ) STHkr .Screen/color DEO
74 67
 			.Screen/x DEI2 #0008 ++ .Screen/x DEO2
75
-			.Screen/addr DEI2 #0008 ++ .Screen/addr DEO2
76
-			( bottom-right ) STHkr .Screen/color DEO
77 68
 			.Screen/y DEI2 #0008 -- .Screen/y DEO2
78
-			.Screen/addr DEI2 #0010 -- .Screen/addr DEO2
79
-			( top-right ) STHkr .Screen/color DEO
69
+			DUP #09 < ,&thin JCN
70
+			.Screen/addr DEI2 #0008 -- .Screen/addr DEO2
71
+			( right-top )  STHkr .Screen/color DEO
72
+			.Screen/addr DEI2 #0010 ++ .Screen/addr DEO2
73
+			.Screen/y DEI2 #0008 ++ .Screen/y DEO2
74
+			( right-bottom ) STHkr .Screen/color DEO
75
+			.Screen/y DEI2 #0008 -- .Screen/y DEO2 &thin
80 76
 		SWPr
81
-		( get width ) STHkr TOS ;font-data ++ LDA TOS .Screen/x DEI2 ++ #0008 -- .Screen/x DEO2
77
+		( use width ) .Screen/x DEI2 ++ #0008 -- .Screen/x DEO2
82 78
 		POPr POPr
83 79
 	RTN
84 80
 
85 81
 RTN
86 82
 
87
-@font-hex 
88
-	003c 464a 5262 3c00 0018 0808 0808 1c00
89
-	003c 4202 3c40 7e00 003c 421c 0242 3c00
90
-	000c 1424 447e 0400 007e 407c 0242 3c00
91
-	003c 407c 4242 3c00 007e 0204 0810 1000
92
-	003c 423c 4242 3c00 003c 4242 3e02 3c00
93
-	003c 4242 7e42 4200 007c 427c 4242 7c00
94
-	003c 4240 4042 3c00 007c 4242 4242 7c00
95
-	007e 4078 4040 7e00 007e 4078 4040 4000 
96
-
97 83
 @body 
98 84
 	4927 6c6c 206d 616b 6520 6120 736f 756e
99 85
 	6420 7468 6174 2773 2073 6f20 616c 6f6e