commit a4bed43880bda2cc5ea44d699082de0109b95e06
parent 1574e5dcce85c1e4f745c757b54b1146d7dcd212
Author: DeltaF1 <delyaerricson@gmail.com>
Date:   Sun, 28 Nov 2021 23:58:15 -0500
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.
Diffstat:
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/projects/software/boot.tal b/projects/software/boot.tal
@@ -5,8 +5,10 @@
 %++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
 %<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
 
+%8// { #03 SFT2 }
 %10** { #40 SFT2 } %10// { #04 SFT2 }
 
+%MIN2 { LTH2k JMP SWP2 POP2 }
 %MOD { DIVk MUL SUB }
 %DEC { #01 - }
 %RTN { JMP2r }
@@ -61,6 +63,10 @@
 	#0100 .Audio0/length DEO2
 	#dd .Audio0/volume DEO ( TODO: turn ON )
 
+	( determine max visible file length )
+	.Screen/width DEI2 8// #00ff MIN2 NIP
+	;draw-browser/clear-length STA
+
 	( place )
 	#0088 .browser/x STZ2
 	#0010 .browser/y STZ2
@@ -290,7 +296,10 @@ RTN
 
 	&clear ( -- )
 	.Screen/x DEI2k ( Stash the current x pos )
-	#ff00
+
+	( Clear the screen )
+	( Clear length gets set in init )
+	LIT2 &clear-length 00 00
 	&clear-loop
 		#00 .Screen/sprite DEO
 		.Screen/y DEI2k #0008 ++ ROT DEO2