Browse code

Fix slowdown in draw-browser/clear

Make the clear routine only clear lines up to the screen width.
This fixes slowdown on wasted clearing of off-screen tiles.

TODO: Only clear/draw lines that will be on the screen.

DeltaF1 authored on 29/11/2021 04:58:15 • neauoire committed on 29/11/2021 17:24:19
Showing 1 changed files
... ...
@@ -5,8 +5,10 @@
5 5
 %++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
6 6
 %<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
7 7
 
8
+%8// { #03 SFT2 }
8 9
 %10** { #40 SFT2 } %10// { #04 SFT2 }
9 10
 
11
+%MIN2 { LTH2k JMP SWP2 POP2 }
10 12
 %MOD { DIVk MUL SUB }
11 13
 %DEC { #01 - }
12 14
 %RTN { JMP2r }
... ...
@@ -61,6 +63,10 @@
61 63
 	#0100 .Audio0/length DEO2
62 64
 	#dd .Audio0/volume DEO ( TODO: turn ON )
63 65
 
66
+	( determine max visible file length )
67
+	.Screen/width DEI2 8// #00ff MIN2 NIP
68
+	;draw-browser/clear-length STA
69
+
64 70
 	( place )
65 71
 	#0088 .browser/x STZ2
66 72
 	#0010 .browser/y STZ2
... ...
@@ -290,7 +296,10 @@ RTN
290 296
 
291 297
 	&clear ( -- )
292 298
 	.Screen/x DEI2k ( Stash the current x pos )
293
-	#ff00
299
+
300
+	( Clear the screen )
301
+	( Clear length gets set in init )
302
+	LIT2 &clear-length 00 00
294 303
 	&clear-loop
295 304
 		#00 .Screen/sprite DEO
296 305
 		.Screen/y DEI2k #0008 ++ ROT DEO2