Browse code

(boot.rom) Added mouse selection

Devine Lu Linvega authored on 08/11/2021 18:54:21
Showing 1 changed files
... ...
@@ -1,23 +1,17 @@
1
-( launcher
2
-
3
-	TODO:
4
-		Theme setting
5
-		Window size setting
6
-		Play notes
7
-	)
1
+( launcher )
8 2
 
9 3
 %+  { ADD } %-   { SUB }  %*  { MUL }  %/  { DIV }
10 4
 %<  { LTH } %>   { GTH }  %=  { EQU }  %!  { NEQ }
11 5
 %++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
12 6
 %<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
13 7
 
14
-%10** { #40 SFT2 }
8
+%10** { #40 SFT2 } %10// { #04 SFT2 }
15 9
 
16 10
 %MOD { DIVk MUL SUB }
17 11
 %DEC { #01 - }
18 12
 %RTN { JMP2r }
19 13
 %TOS { #00 SWP }
20
-%SWP? { #01 JCN SWP }
14
+%SWP? { #01 JCN SWP } %SWP2? { #01 JCN SWP2 }
21 15
 %BRK? { #01 JCN BRK }
22 16
 %RTN? { #01 JCN RTN }
23 17
 
... ...
@@ -26,14 +20,14 @@
26 20
 
27 21
 ( devices )
28 22
 
29
-|00 @System     &vector $2 &wst      $1 &rst    $1 &pad   $4 &r      $2 &g      $2 &b    $2 &debug  $1 &halt $1 ]
30
-|10 @Console    &vector $2 &read     $1 &pad    $5 &write $1 &error  $1 ]
31
-|20 @Screen     &vector $2 &width   $2 &height $2 &auto $1 &pad $1 &x      $2 &y      $2 &addr $2 &pixel $1 &sprite $1
32
-|30 @Audio0     [ &vector $2 &position $2 &output $1 &pad   $3 &adsr   $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
33
-|80 @Controller &vector $2 &button $1 &key    $1 ]
34
-|90 @Mouse      &vector $2 &x        $2 &y      $2 &state $1 &wheel  $1 ]
35
-|a0 @File       &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
36
-|b0 @DateTime   &year   $2 &month    $1 &day    $1 &hour  $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
23
+|00 @System     &vector $2 &wst      $1 &rst    $1 &pad    $4 &r      $2 &g      $2 &b    $2 &debug  $1 &halt $1
24
+|10 @Console    &vector $2 &read     $1 &pad    $5 &write  $1 &error  $1
25
+|20 @Screen     &vector $2 &width    $2 &height $2 &auto   $1 &pad $1 &x      $2 &y      $2 &addr $2 &pixel $1 &sprite $1
26
+|30 @Audio0     &vector $2 &position $2 &output $1 &pad    $3 &adsr   $2 &length $2 &addr $2 &volume $1 &pitch $1
27
+|80 @Controller &vector $2 &button   $1 &key    $1
28
+|90 @Mouse      &vector $2 &x        $2 &y      $2 &state  $1 &wheel  $1 
29
+|a0 @File       &vector $2 &success  $2 &stat   $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
30
+|b0 @DateTime   &year   $2 &month    $1 &day    $1 &hour   $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 
37 31
 
38 32
 ( variables )
39 33
 
... ...
@@ -43,7 +37,8 @@
43 37
 @pointer
44 38
 	&x  $2 &y  $2
45 39
 @browser
46
-	&x $2 &y $2 &sel $1
40
+	&x $2 &y $2 
41
+	&sel $1 &last $1
47 42
 
48 43
 ( init )
49 44
 
... ...
@@ -77,6 +72,8 @@
77 72
 	( theme support )
78 73
 	;load-theme JSR2
79 74
 
75
+	( force selection )
76
+	#ff .browser/last STZ
80 77
 	#00 ;select-file JSR2
81 78
 
82 79
 BRK
... ...
@@ -106,6 +103,15 @@ BRK
106 103
 	.pointer/y LDZ2 .Screen/y DEO2
107 104
 	#41 .Mouse/state DEI #01 = + .Screen/sprite DEO
108 105
 
106
+	( select choice )
107
+	.Mouse/y DEI2 
108
+		( clamp ) #0010 GTH2k SWP2? POP2
109
+		10// NIP #01 - ;select-file JSR2
110
+
111
+	.Mouse/state DEI #00 = ,&no-click JCN
112
+		.browser/sel LDZ ;run-file JSR2
113
+		&no-click
114
+
109 115
 BRK
110 116
 
111 117
 @on-button ( -> )
... ...
@@ -145,12 +151,18 @@ RTN
145 151
 
146 152
 @select-file ( id -- )
147 153
 
154
+	DUP .browser/last LDZ ! ,&has-changed JCN
155
+		POP RTN
156
+		&has-changed
157
+
148 158
 	.browser/x LDZ2 #0018 -- .browser/y LDZ2 [ .browser/sel LDZ TOS 10** ++ ] 
149 159
 	#0010 #0010 
150 160
 		;hand-icn #00 ;draw-icn JSR2
151 161
 
152 162
 	DUP 
153 163
 		.browser/sel STZ
164
+	DUP
165
+		.browser/last STZ
154 166
 		#30 + .Audio0/pitch DEO
155 167
 	;draw-browser JSR2
156 168
 
... ...
@@ -343,7 +355,7 @@ RTN
343 355
 ( helpers )
344 356
 
345 357
 @print-hex ( value* -- )
346
-	
358
+
347 359
 	&short ( value* -- )
348 360
 		SWP ,&echo JSR 
349 361
 	&byte ( value -- )
... ...
@@ -359,22 +371,8 @@ RTN
359 371
 
360 372
 RTN
361 373
 
362
-@welcome-txt
363
-	"Welcome 20 "to 20 "your 20 "UXN 20 "Ordinator $1
364
-@today-txt
365
-	"Today 20 "is 20 "0000-00-00 ", 20 "the 20 "time 20 "is 20 "00:00:00 $1
366
-@prompt-txt
367
-	"What 20 "shall 20 "we 20 "do? $1
368
-@do-txt
369
-	"$: $1
370
-
371
-@error-txt
372
-	"Sorry, 20 "ROM 20 "not 20 "found. $1
373
-
374 374
 @pointer-icn
375 375
 	80c0 e0f0 f8e0 1000
376
-@cursor-icn
377
-	ffff ffff ffff ffff
378 376
 @hand-icn
379 377
 	000c 0a0a 1224 4780
380 378
 	0000 0000 0000 fc02
... ...
@@ -402,7 +400,6 @@ RTN
402 400
 include projects/library/check-rom.tal
403 401
 include projects/library/load-rom.tal
404 402
 
405
-include projects/assets/logo05x05.tal
406 403
 include projects/assets/mascot0cx0c.tal
407 404
 include projects/assets/msx01x02.tal
408 405