Browse code

(launcher.tal) Fixed scrolling issue after assembly

neauoire authored on 16/01/2022 17:22:37
Showing 1 changed files
... ...
@@ -48,6 +48,7 @@
48 48
 @browser
49 49
 	&x $2 &y $2 &x2 $2 &y2 $2 
50 50
 	&sel $1 &last $1 &scroll $1
51
+	&lines $1
51 52
 
52 53
 ( init )
53 54
 
... ...
@@ -119,7 +120,7 @@ BRK
119 120
 		DUP .browser/scroll LDZ + ;scroll-to JSR2
120 121
 		&no-up
121 122
 	DUP #01 ! ,&no-down JCN
122
-		.browser/scroll LDZ ;dir/lines LDA = ,&no-down JCN
123
+		.browser/scroll LDZ .browser/lines LDZ = ,&no-down JCN
123 124
 		DUP .browser/scroll LDZ + ;scroll-to JSR2
124 125
 		&no-down
125 126
 	POP
... ...
@@ -149,7 +150,7 @@ BRK
149 150
 		POP BRK
150 151
 		&no-up
151 152
 	DUP #20 ! ,&no-down JCN
152
-		.browser/sel LDZ INC ;dir/lines LDA = ,&no-down JCN 
153
+		.browser/sel LDZ INC .browser/lines LDZ = ,&no-down JCN 
153 154
 		.browser/sel LDZ INC ;select-file JSR2 
154 155
 		;follow-selection JSR2
155 156
 		POP BRK
... ...
@@ -175,13 +176,14 @@ BRK
175 176
 	#1000 .File/length DEO2
176 177
 	;dir/data .File/read DEO2
177 178
 	.File/success DEI2 ;dir/length STA2
179
+	#00 .browser/lines STZ
178 180
 
179 181
 	( split with null-char )
180 182
 	;dir/data
181 183
 	&while
182 184
 		LDAk #1f > ,&no-lb JCN
183 185
 			( split ) STH2k #00 STH2r STA
184
-			( count lines ) ;dir/lines LDA INC ;dir/lines STA
186
+			( count lines ) .browser/lines LDZk INC SWP STZ
185 187
 			&no-lb
186 188
 		INC2 LDAk ,&while JCN
187 189
 	POP2
... ...
@@ -195,7 +197,7 @@ RTN
195 197
 		POP RTN
196 198
 		&has-changed
197 199
 	( beyond )
198
-	DUP ;dir/lines LDA < ,&valid JCN
200
+	DUP .browser/lines LDZ < ,&valid JCN
199 201
 		POP RTN
200 202
 		&valid
201 203
 
... ...
@@ -216,7 +218,7 @@ RTN
216 218
 	#0080 .Screen/y DEO2
217 219
 	.browser/sel LDZ #02 ;draw-byte JSR2
218 220
 	LIT '/ #02 ;draw-char JSR2
219
-	;dir/lines LDA #01 - #02 ;draw-byte JSR2
221
+	.browser/lines LDZ #01 - #02 ;draw-byte JSR2
220 222
 	AUTO-NONE
221 223
 
222 224
 RTN
... ...
@@ -238,7 +240,7 @@ RTN
238 240
 
239 241
 	STH
240 242
 	( more lines than visible )
241
-	;dir/lines LDA LINES-COUNT 
243
+	.browser/lines LDZ LINES-COUNT 
242 244
 	DUP2 > ,&can-scroll JCN
243 245
 		POPr POP2 RTN
244 246
 		&can-scroll
... ...
@@ -257,10 +259,9 @@ RTN
257 259
 	;get-entry JSR2 #0005 ++
258 260
 	
259 261
 	DUP2 ;check-rom JSR2 ,&valid JCN
260
-
261 262
 		( check if tal file )
262
-
263 263
 		DUP2 ;scap JSR2 #0004 -- ;&tal-ext ;scmp JSR2 #01 ! ,&no-tal JCN
264
+			( assemble tal file )
264 265
 			DUP2 ;&output-path ;scpy JSR2
265 266
 			;&rom-ext ;&output-path ;scat JSR2
266 267
 			;&output-path ;asma-assemble-file JSR2 
... ...
@@ -268,10 +269,8 @@ RTN
268 269
 			;redraw JSR2
269 270
 			RTN
270 271
 			&no-tal
271
-
272 272
 		POP2 RTN
273 273
 		&valid
274
-
275 274
 	;load-rom JSR2 
276 275
 
277 276
 RTN
... ...
@@ -290,7 +289,7 @@ RTN
290 289
 @draw-browser ( mask -- )
291 290
 
292 291
 	( when empty )
293
-	;dir/lines LDA #01 = ;draw-browser-empty JCN2
292
+	.browser/lines LDZ #01 = ;draw-browser-empty JCN2
294 293
 
295 294
 	STH
296 295
 
... ...
@@ -303,7 +302,7 @@ RTN
303 302
 	LINES-COUNT #00
304 303
 	&loop
305 304
 		( reached end )
306
-		DUP INC ;dir/lines LDA > ,&end JCN
305
+		DUP INC .browser/lines LDZ > ,&end JCN
307 306
 		( has file )
308 307
 		.browser/x LDZ2 .Screen/x DEO2
309 308
 		DUP TOS 10** .browser/y LDZ2 ++ .Screen/y DEO2
... ...
@@ -561,7 +560,6 @@ JMP2r
561 560
 
562 561
 @dir
563 562
 	&path ". $1
564
-	&lines $1
565 563
 	&length $2
566 564
 	&data $1000
567 565