Browse code

(clock.tal) Optimizations

neauoire authored on 24/03/2022 20:15:50
Showing 1 changed files
... ...
@@ -23,8 +23,7 @@
23 23
 @buf
24 24
 	&d $3 &h $2 &s1 $1 &m $2 &s2 $1 &s $3
25 25
 @line
26
-	&x0 $2 &y0 $2 &x $2 &y $2 &sx $2 &sy $2 
27
-	&dx $2 &dy $2 &e1 $2 &e2 $2 &color $1
26
+	&x $2 &y $2 &dx $2 &dy $2 &e1 $2
28 27
 
29 28
 |0100 ( -> )
30 29
 	
... ...
@@ -96,26 +95,27 @@ BRK
96 95
 
97 96
 	STH
98 97
 	.center/x LDZ2 .center/y LDZ2 
99
-		OVR2 OVR2
100
-		.needles/zx LDZ2 .needles/zy LDZ2 #02 STHkr MUL ;draw-line JSR2
101
-		OVR2 OVR2
102
-		.needles/sx LDZ2 .needles/sy LDZ2 #02 STHkr MUL ;draw-line JSR2
103
-		OVR2 OVR2
104
-		.needles/mx LDZ2 .needles/my LDZ2 #01 STHkr MUL ;draw-line JSR2
105
-		OVR2 OVR2
106
-		.needles/hx LDZ2 .needles/hy LDZ2 #01 STHr MUL ;draw-line JSR2
107
-		( middle )
108
-		#0001 SUB2 .Screen/y DEO2 
109
-		#0001 SUB2 .Screen/x DEO2
110
-		;middle-icn .Screen/addr DEO2
111
-		#0a .Screen/sprite DEO
98
+	OVR2 OVR2
99
+	.needles/mx LDZ2 .needles/my LDZ2 #01 STHkr MUL 
100
+		;draw-line JSR2
101
+	OVR2 OVR2
102
+	.needles/hx LDZ2 .needles/hy LDZ2 #01 STHkr MUL 
103
+		;draw-line JSR2
104
+	.needles/sx LDZ2 .needles/sy LDZ2
105
+	.needles/zx LDZ2 .needles/zy LDZ2 #02 STHr MUL 
106
+		;draw-line JSR2
107
+
108
+	( middle )
109
+	#0001 SUB2 .Screen/y DEO2 
110
+	#0001 SUB2 .Screen/x DEO2
111
+	;middle-icn .Screen/addr DEO2
112
+	#0a .Screen/sprite DEO
112 113
 
113 114
 JMP2r
114 115
 
115 116
 @draw-text ( addr* -- )
116 117
 
117
-	( auto addr ) #06 .Screen/auto DEO
118
-	.Screen/y DEI2 ,&anchor-y STR2
118
+	( auto addr ) #15 .Screen/auto DEO
119 119
 	&while
120 120
 		LDAk
121 121
 		DUP ;is-lc JSR2 ,&lc JCN
... ...
@@ -126,13 +126,11 @@ JMP2r
126 126
 		POP ;font/blank
127 127
 		&end
128 128
 		.Screen/addr DEO2
129
-		#03 .Screen/sprite DEOk DEO
130
-		[ LIT2 &anchor-y $2 ] .Screen/y DEO2
131
-		.Screen/x DEI2k #0008 ADD2 ROT DEO2
129
+		#03 .Screen/sprite DEO
132 130
 		INC2 LDAk ,&while JCN
133 131
 	POP2
132
+	#00 .Screen/sprite DEO
134 133
 	( auto none ) #00 .Screen/auto DEO
135
-	.Screen/x DEI2k #0008 ADD2 ROT DEO2
136 134
 
137 135
 JMP2r
138 136
 	&lc #61 SUB #00 SWP #40 SFT2 ;font/lc ADD2 ,&end JMP
... ...
@@ -143,29 +141,29 @@ JMP2r
143 141
 
144 142
 @draw-line ( x1* y1* x2* y2* color -- )
145 143
 	
146
-	( load ) .line/color STZ .line/y0 STZ2 .line/x0 STZ2 .line/y STZ2 .line/x STZ2
147
-	.line/x0 LDZ2 .line/x LDZ2 SUB2 ;abs2 JSR2 .line/dx STZ2
148
-	.line/y0 LDZ2 .line/y LDZ2 SUB2 ;abs2 JSR2 #0000 SWP2 SUB2 .line/dy STZ2
149
-	#ffff #00 .line/x LDZ2 .line/x0 LDZ2 ;lts2 JSR2 #10 SFT2 ADD2 .line/sx STZ2
150
-	#ffff #00 .line/y LDZ2 .line/y0 LDZ2 ;lts2 JSR2 #10 SFT2 ADD2 .line/sy STZ2
144
+	( load ) STH ,&y STR2 ,&x STR2 .line/y STZ2 .line/x STZ2
145
+	,&x LDR2 .line/x LDZ2 SUB2 ;abs2 JSR2 .line/dx STZ2
146
+	#0000 ,&y LDR2 .line/y LDZ2 SUB2 ;abs2 JSR2 SUB2 .line/dy STZ2
147
+	#ffff #00 .line/x LDZ2 ,&x LDR2 ;lts2 JSR2 #10 SFT2 ADD2 ,&sx STR2
148
+	#ffff #00 .line/y LDZ2 ,&y LDR2 ;lts2 JSR2 #10 SFT2 ADD2 ,&sy STR2
151 149
 	.line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
152 150
 	&loop
153
-		.line/x LDZ2 .Screen/x DEO2 
154
-		.line/y LDZ2 .Screen/y DEO2 
155
-		.line/color LDZ .Screen/pixel DEO
156
-		[ .line/x LDZ2 .line/x0 LDZ2 EQU2 ] 
157
-		[ .line/y LDZ2 .line/y0 LDZ2 EQU2 ] AND ,&end JCN
158
-		.line/e1 LDZ2 #10 SFT2 .line/e2 STZ2
159
-		.line/e2 LDZ2 .line/dy LDZ2 ;lts2 JSR2 ,&skipy JCN
151
+		.line/x LDZ2 DUP2 .Screen/x DEO2 [ LIT2 &x $2 ] EQU2 
152
+		.line/y LDZ2 DUP2 .Screen/y DEO2 [ LIT2 &y $2 ] EQU2 
153
+			STHkr .Screen/pixel DEO
154
+			AND ,&end JCN
155
+		.line/e1 LDZ2 #10 SFT2 DUP2
156
+		.line/dy LDZ2 ;lts2 JSR2 ,&skipy JCN
160 157
 			.line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
161
-			.line/x LDZ2 .line/sx LDZ2 ADD2 .line/x STZ2
158
+			.line/x LDZ2 [ LIT2 &sx $2 ] ADD2 .line/x STZ2
162 159
 		&skipy
163
-		.line/e2 LDZ2 .line/dx LDZ2 ;gts2 JSR2 ,&skipx JCN
160
+		.line/dx LDZ2 ;gts2 JSR2 ,&skipx JCN
164 161
 			.line/e1 LDZ2 .line/dx LDZ2 ADD2 .line/e1 STZ2
165
-			.line/y LDZ2 .line/sy LDZ2 ADD2 .line/y STZ2
162
+			.line/y LDZ2 [ LIT2 &sy $2 ] ADD2 .line/y STZ2
166 163
 		&skipx
167
-		;&loop JMP2
164
+		,&loop JMP
168 165
 	&end
166
+	POPr
169 167
 
170 168
 JMP2r
171 169