Browse code

(calc.tal) Minor cleanup

Devine Lu Linvega authored on 17/11/2021 19:35:59
Showing 1 changed files
... ...
@@ -16,7 +16,7 @@
16 16
 %10** { #40 SFT2 } %10// { #04 SFT2 }
17 17
 %20** { #50 SFT2 }
18 18
 
19
-%4MOD { #03 AND }
19
+%4MOD { #03 AND } %4MOD2 { #0003 AND2 }
20 20
 
21 21
 %DEBUG  { ;print-hex/byte JSR2 #0a .Console/write DEO }
22 22
 %DEBUG2 { ;print-hex/short JSR2 #0a .Console/write DEO }
... ...
@@ -161,18 +161,15 @@ BRK
161 161
 @on-mouse ( -> )
162 162
 
163 163
 	;pointer-icn .Screen/addr DEO2
164
+
164 165
 	( clear last cursor )
165 166
 	.pointer/x LDZ2 .Screen/x DEO2
166 167
 	.pointer/y LDZ2 .Screen/y DEO2
167 168
 	#40 .Screen/sprite DEO
168 169
 
169
-	( record pointer positions )
170
-	.Mouse/x DEI2 .pointer/x STZ2 
171
-	.Mouse/y DEI2 .pointer/y STZ2
172
-
173 170
 	( draw new cursor )
174
-	.pointer/x LDZ2 .Screen/x DEO2
175
-	.pointer/y LDZ2 .Screen/y DEO2
171
+	.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
172
+	.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
176 173
 	#41 .Mouse/state DEI #01 = + .Screen/sprite DEO
177 174
 
178 175
 	( handle events )
... ...
@@ -204,9 +201,10 @@ BRK
204 201
 @click-keypad ( x* y* -> )
205 202
 
206 203
 	( get key )
207
-	.keypad-frame/y LDZ2 -- 10// 4**
208
-	SWP2 .keypad-frame/x LDZ2 -- 10// #0003 AND2
209
-	++ ;keypad/layout ++ LDA ;push-input JSR2
204
+	( y ) .keypad-frame/y LDZ2 -- #24 SFT2
205
+	( x ) SWP2 .keypad-frame/x LDZ2 -- 10// 4MOD2
206
+	( value ) ++ ;keypad/layout ++ LDA 
207
+		;push-input JSR2
210 208
 
211 209
 	( release mouse ) #00 .Mouse/state DEO
212 210
 
... ...
@@ -214,8 +212,8 @@ BRK
214 212
 
215 213
 @click-modpad ( x* y* -> )
216 214
 
217
-	.modpad-frame/y LDZ2 -- 10// 4**
218
-	SWP2 .modpad-frame/x LDZ2 -- 10// #0003 AND2 ++ NIP
215
+	( y ) .modpad-frame/y LDZ2 -- #24 SFT2 NIP STH
216
+	( x ) .modpad-frame/x LDZ2 -- 10// NIP STHr +
219 217
 	DUP #00 ! ,&no-add JCN ;do-add JSR2 &no-add
220 218
 	DUP #01 ! ,&no-sub JCN ;do-sub JSR2 &no-sub
221 219
 	DUP #02 ! ,&no-mul JCN ;do-mul JSR2 &no-mul