Browse code

Optimized the font routines

neauoire authored on 03/07/2021 19:13:48
Showing 1 changed files
... ...
@@ -8,7 +8,6 @@
8 8
 %RTN { JMP2r }
9 9
 %TOS { #00 SWP }
10 10
 %INCR { SWP #01 ADD SWP }
11
-%GET-ITERATORS { SWP2k POP SWP POP }
12 11
 
13 12
 ( devices )
14 13
 
... ...
@@ -20,10 +19,6 @@
20 19
 
21 20
 |0000
22 21
 
23
-@position
24
-	&x $2
25
-	&y $2
26
-
27 22
 ( init )
28 23
 
29 24
 |0100 ( -> )
... ...
@@ -37,73 +32,25 @@
37 32
 	#4000 .File/length DEO2
38 33
 	;font-path-large .File/name DEO2
39 34
 	;font-data .File/load DEO2
40
-
41
-	( draw label )
42
-	#0000 #0020 ;title #21 ;draw-uf3 JSR2
35
+		( draw label )
36
+		#0000 #0020 ;title #21 ;draw-uf3 JSR2
43 37
 
44 38
 	( load font )
45 39
 	#4000 .File/length DEO2
46 40
 	;font-path-medium .File/name DEO2
47 41
 	;font-data .File/load DEO2
48
-
49
-	( draw label )
50
-	#0000 #0048 ;body #21 ;draw-uf2 JSR2
42
+		( draw label )
43
+		#0000 #0048 ;body #21 ;draw-uf2 JSR2
51 44
 
52 45
 	( load font )
53 46
 	#4000 .File/length DEO2
54 47
 	;font-path-small .File/name DEO2
55 48
 	;font-data .File/load DEO2
56
-
57
-	( draw label )
58
-	#0010 #00b8 ;footer #21 ;draw-uf2 JSR2
49
+		( draw label )
50
+		#0010 #00b8 ;footer #21 ;draw-uf2 JSR2
59 51
 	
60 52
 BRK
61 53
 
62
-@draw-uf3 ( x* y* text* color -- )
63
-		
64
-	STH 
65
-	SWP2 .Screen/y DEO2
66
-	SWP2 DUP2 .Screen/x DEO2 SWP2
67
-	&loop
68
-		LDAk 
69
-		DUP #0a ! ,&no-linebreak JCN
70
-			( move down ) OVR2 .Screen/x DEO2
71
-			( incr y ) .Screen/y DEI2 #0010 ++ .Screen/y DEO2 
72
-			POP ,&continue JMP &no-linebreak
73
-		STHkr ,&sprite JSR
74
-		&continue
75
-		( incr addr ) #0001 ++
76
-		LDAk ,&loop JCN
77
-	POP2 POP2 POPr
78
-	RTN
79
-
80
-	&sprite ( char color -- )
81
-		POP 
82
-		DUP TOS #0048 ** ;font-data #0100 ++ ++ .Screen/addr DEO2
83
-		.Screen/x DEI2 .position/x STZ2
84
-		.Screen/y DEI2 .position/y STZ2
85
-		#00 #03
86
-		&ver
87
-			#00 #03
88
-			&hor
89
-				GET-ITERATORS
90
-				TOS #0008 ** .position/y LDZ2 ++ .Screen/y DEO2
91
-				TOS #0008 ** .position/x LDZ2 ++ .Screen/x DEO2
92
-				#21 .Screen/color DEO
93
-				.Screen/addr DEI2 #0008 ++ .Screen/addr DEO2
94
-				INCR
95
-				LTHk ,&hor JCN
96
-			POP2
97
-
98
-			INCR
99
-			LTHk ,&ver JCN
100
-		POP2
101
-		TOS ;font-data ++ LDA TOS .position/x LDZ2 ++ .Screen/x DEO2
102
-		.position/y LDZ2 .Screen/y DEO2
103
-	RTN
104
-
105
-RTN
106
-
107 54
 @draw-uf2 ( x* y* text* color -- )
108 55
 	
109 56
 	STH 
... ...
@@ -147,6 +94,48 @@ RTN
147 94
 
148 95
 RTN
149 96
 
97
+@draw-uf3 ( x* y* text* color -- )
98
+		
99
+	STH 
100
+	SWP2 .Screen/y DEO2
101
+	SWP2 DUP2 .Screen/x DEO2 SWP2
102
+	&loop
103
+		LDAk 
104
+		DUP #0a ! ,&no-linebreak JCN
105
+			( move down ) OVR2 .Screen/x DEO2
106
+			( incr y ) .Screen/y DEI2 #0010 ++ .Screen/y DEO2 
107
+			POP ,&continue JMP &no-linebreak
108
+		STHkr ,&sprite JSR
109
+		&continue
110
+		( incr addr ) #0001 ++
111
+		LDAk ,&loop JCN
112
+	POP2 POP2 POPr
113
+	RTN
114
+
115
+	&sprite ( char color -- )
116
+		STH 
117
+		( get addr ) DUP TOS #0048 ** ;font-data #0100 ++ ++ .Screen/addr DEO2
118
+		( get width ) TOS ;font-data ++ LDA TOS
119
+		#00 #03
120
+		&ver
121
+			#00 #03
122
+			&hor
123
+				#21 .Screen/color DEO
124
+				.Screen/x DEI2 #0008 ++ .Screen/x DEO2 
125
+				.Screen/addr DEI2 #0008 ++ .Screen/addr DEO2
126
+				INCR LTHk ,&hor JCN
127
+			POP2
128
+			.Screen/y DEI2 #0008 ++ .Screen/y DEO2 
129
+			.Screen/x DEI2 #0018 -- .Screen/x DEO2 
130
+			INCR LTHk ,&ver JCN
131
+		POP2
132
+		.Screen/y DEI2 #0018 -- .Screen/y DEO2 
133
+		( use width ) .Screen/x DEI2 ++ .Screen/x DEO2
134
+		POPr
135
+	RTN
136
+
137
+RTN
138
+
150 139
 @title
151 140
 	5468 6520 466f 6720 486f 726e $1
152 141