Browse code

Porter more examples to the new vectors

neauoire authored on 05/04/2021 20:27:43
Showing 13 changed files
... ...
@@ -28,7 +28,7 @@ else
28 28
 fi
29 29
 
30 30
 echo "Assembling.."
31
-./bin/assembler projects/examples/dev.screen.usm bin/boot.rom
31
+./bin/assembler projects/software/noodle.usm bin/boot.rom
32 32
 
33 33
 echo "Running.."
34 34
 if [ "${2}" = '--cli' ]; 
... ...
@@ -16,7 +16,7 @@
16 16
 
17 17
 ( program )
18 18
 
19
-|0200 @RESET
19
+|0200
20 20
 
21 21
 	( theme ) #0f73 =System.r #0fe3 =System.g #0fc3 =System.b
22 22
 	( vectors ) ,KEY =Keys.vector
... ...
@@ -20,7 +20,7 @@
20 20
 
21 21
 ( program )
22 22
 
23
-|0200 @RESET
23
+|0200
24 24
 
25 25
 	( theme ) #03fd =System.r #0ef3 =System.g #0bf2 =System.b
26 26
 	( vectors ) ,on-mouse =Mouse.vector
... ...
@@ -14,16 +14,19 @@
14 14
 
15 15
 ( devices )
16 16
 
17
-|0100 ;Console { pad 8 char 1 byte 1 short 2 }
18
-|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
19
-|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
20
-|0170 ;Audio { ch1adsr 2 ch2adsr 2 ch3adsr 2 ch4adsr 2 ch1vol 1 ch1pitch 1 ch2vol 1 ch2pitch 1 ch3vol 1 ch3pitch 1 ch4vol 1 ch4pitch 1 }
21
-|0190 ;Time { year 2 month 1 day 1 hour 1 minute 1 second 1 dow 1 doy 2 isdst 1 get 1 }
22
-|01F0 ;System { pad 8 r 2 g 2 b 2 }
17
+|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
18
+|0110 ;Console { pad 8 char 1 byte 1 short 2 }
19
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
20
+|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
21
+|0140 ;Controller { vector 2 button 1 }
22
+|0150 ;Keys { vector 2 key 1 }
23
+|0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
24
+|0180 ;Audio { ch1adsr 2 ch2adsr 2 ch3adsr 2 ch4adsr 2 ch1vol 1 ch1pitch 1 ch2vol 1 ch2pitch 1 ch3vol 1 ch3pitch 1 ch4vol 1 ch4pitch 1 }
25
+|01a0 ;Time { year 2 month 1 day 1 hour 1 minute 1 second 1 dow 1 doy 2 isdst 1 get 1 }
23 26
 
24 27
 ( program )
25 28
 
26
-|0200 @RESET
29
+|0200
27 30
 	
28 31
 	( theme ) #0ff8 =System.r #0f08 =System.g #0f08 =System.b
29 32
 	( vectors ) ,FRAME =Screen.vector
... ...
@@ -134,8 +137,6 @@ BRK
134 137
 
135 138
 RTN
136 139
 
137
-@ERROR BRK
138
-
139 140
 @table ( 60 positions on a circle in bytes )
140 141
 [
141 142
 	8000 8d00 9a02 a706 b40b c011 cb18 d520 
... ...
@@ -10,17 +10,20 @@
10 10
 ;r2 { x1 2 y1 2 x2 2 y2 2 }
11 11
 ;r3 { x1 2 y1 2 x2 2 y2 2 }
12 12
 
13
-|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
14
-|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
15
-|0150 ;Mouse  { x 2 y 2 state 1 chord 1 }
16
-|01F0 ;System { pad 8 r 2 g 2 b 2 }
13
+|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
14
+|0110 ;Console { pad 8 char 1 byte 1 short 2 }
15
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
16
+|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
17
+|0140 ;Controller { vector 2 button 1 }
18
+|0150 ;Keys { vector 2 key 1 }
19
+|0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
17 20
 
18 21
 ( program )
19 22
 
20
-|0200 @RESET
23
+|0200
21 24
 
22 25
 	( theme ) #0f0f =System.r #0fff =System.g #0ff0 =System.b
23
-	( vectors ) ,FRAME =Screen.vector
26
+	( vectors ) ,on-mouse =Mouse.vector
24 27
 	
25 28
 	#0020 #0030 #0060 #0060 =r1.y2 =r1.x2 =r1.y1 =r1.x1
26 29
 	#0058 #0050 #0090 #0080 =r2.y2 =r2.x2 =r2.y1 =r2.x1
... ...
@@ -28,7 +31,7 @@
28 31
 
29 32
 BRK
30 33
 
31
-@FRAME 
34
+@on-mouse 
32 35
 
33 36
 	,pointer_icn =pointer.sprite
34 37
 
... ...
@@ -98,5 +101,3 @@ RTN
98 101
 @clear_icn   [ 0000 0000 0000 0000 ]
99 102
 @pointer_icn [ 80c0 e0f0 f8e0 1000 ]
100 103
 @hand_icn    [ 4040 4070 f8f8 f870 ]
101
-
102
-@ERROR BRK 
... ...
@@ -3,20 +3,21 @@
3 3
 %RTN { JMP2r }
4 4
 
5 5
 ;label { x 2 y 2 color 1 addr 2 }
6
-;rect { x1 2 y1 2 x2 2 y2 2 }
7 6
 ;center { x 2 y 2 }
8
-;i { short 2 }
9 7
 
10
-|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
11
-|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
12
-|01F0 ;System { pad 8 r 2 g 2 b 2 }
8
+|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
9
+|0110 ;Console { pad 8 char 1 byte 1 short 2 }
10
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
11
+|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
12
+|0140 ;Controller { vector 2 button 1 }
13
+|0150 ;Keys { vector 2 key 1 }
14
+|0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
13 15
 
14 16
 ( program )
15 17
 
16 18
 |0200 @RESET
17 19
 	
18 20
 	( theme ) #0f0f =System.r #0fff =System.g #0ff0 =System.b
19
-	( vectors ) ,FRAME =Screen.vector
20 21
 	
21 22
 	( find screen center )
22 23
 	~Screen.width #0002 DIV2 =center.x
... ...
@@ -128,7 +129,4 @@ RTN
128 129
 @text2 [ Middle 20 Aligned 00 ]
129 130
 @text3 [ Right 20 Aligned 00 ]
130 131
 @text4 [ even 00 ]
131
-@text5 [ odd 00 ]
132
-
133
-@FRAME BRK 
134
-@ERROR BRK 
132
+@text5 [ odd 00 ]
135 133
\ No newline at end of file
... ...
@@ -4,15 +4,19 @@
4 4
 
5 5
 ;pict { x 2 y 2 width 2 height 2 color 1 addr 2 }
6 6
 
7
-|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
8
-|01F0 ;System { pad 8 r 2 g 2 b 2 }
7
+|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
8
+|0110 ;Console { pad 8 char 1 byte 1 short 2 }
9
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
10
+|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
11
+|0140 ;Controller { vector 2 button 1 }
12
+|0150 ;Keys { vector 2 key 1 }
13
+|0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
9 14
 
10 15
 ( program )
11 16
 
12
-|0200 @RESET
17
+|0200
13 18
 
14 19
 	( theme ) #0ffc =System.r #0f0b =System.g #0f03 =System.b
15
-	( vectors ) ,FRAME =Screen.vector
16 20
 	
17 21
 	#0000 #0000 #0100 #0100 #01 ,pict_large ,draw-picture JSR2
18 22
 	#0098 #0060 #0080 #0080 #01 ,pict_medium ,draw-picture JSR2
... ...
@@ -309,6 +313,3 @@ RTN
309 313
 	1081 4182 0500 0000 aa25 512a 44aa 0000 0254 0992 4984 0000 9452 4925 5289 0000
310 314
 
311 315
 ]
312
-
313
-@FRAME BRK 
314
-@ERROR BRK 
... ...
@@ -10,16 +10,19 @@
10 10
 ;rect { x1 2 y1 2 x2 2 y2 2 }
11 11
 ;line { x0 2 y0 2 x 2 y 2 sx 2 sy 2 dx 2 dy 2 e1 2 e2 2 }
12 12
 ;color { byte 1 }
13
-
14 13
 ;circle { xc 2 yc 2 x 2 y 2 r 2 d 2 }
15 14
 
16
-|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
17
-|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
18
-|01F0 ;System { pad 8 r 2 g 2 b 2 }
15
+|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
16
+|0110 ;Console { pad 8 char 1 byte 1 short 2 }
17
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
18
+|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
19
+|0140 ;Controller { vector 2 button 1 }
20
+|0150 ;Keys { vector 2 key 1 }
21
+|0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
19 22
 
20 23
 ( program )
21 24
 
22
-|0200 @RESET
25
+|0200
23 26
 	
24 27
 	( theme ) #13fd =System.r #1ef3 =System.g #1bf2 =System.b
25 28
 	
... ...
@@ -726,7 +726,5 @@ RTN
726 726
 @filepath1     [ projects/examples/gui.hover.usm 00 ]
727 727
 @filepath      [ projects/examples/dev.time.usm 00 ]
728 728
 
729
-@ERROR BRK 
730
-
731 729
 ;clip { len 2 body 256 }
732 730
 ;document { eof 2 body 2 }
733 731
\ No newline at end of file
... ...
@@ -524,6 +524,4 @@ RTN
524 524
 	007c 8280 f080 827c 007c 8280 f080 8080
525 525
 ]
526 526
 
527
-@ERROR BRK 
528
-
529 527
 |2000 @bank [ ]	
... ...
@@ -39,8 +39,6 @@
39 39
 	OVR2 OVR2 ~lines.x1 ,v JSR2
40 40
 	          ~lines.x2 ,v JSR2
41 41
 
42
-	@ERROR BRK
43
-
44 42
 @FRAME
45 43
 	,update-fps JSR2
46 44
 	#00 =neralie.color
... ...
@@ -54,10 +54,10 @@
54 54
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
55 55
 |0110 ;Console { pad 8 char 1 byte 1 short 2 }
56 56
 |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
57
-|0130 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
58
-|0140 ;Controller { p1 1 }
59
-|0150 ;Keys { key 1 }
60
-|0160 ;Mouse { x 2 y 2 state 1 chord 1 }
57
+|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
58
+|0140 ;Controller { vector 2 button 1 }
59
+|0150 ;Keys { vector 2 key 1 }
60
+|0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
61 61
 |0170 ;File { pad 8 name 2 length 2 load 2 save 2 }
62 62
 
63 63
 ( program )
... ...
@@ -134,7 +134,7 @@ BRK
134 134
 	~Mouse.state #00 EQU ,$no-touch JNZ2
135 135
 
136 136
 		( drag )
137
-		~Controller #02 NEQ ,$no-drag JNZ2
137
+		~Controller.button #02 NEQ ,$no-drag JNZ2
138 138
 			~brush.drag #00 NEQ ^$no-drag-start JNZ
139 139
 				~canvas.x1 =origin.x1
140 140
 				~canvas.y1 =origin.y1
... ...
@@ -262,8 +262,8 @@ BRK
262 262
 
263 263
 	$no-touch
264 264
 
265
-	~Controller.p1 #00 EQU ,$no-ctrl JNZ2
266
-		~Controller.p1 #f0 AND
265
+	~Controller.button #00 EQU ,$no-ctrl JNZ2
266
+		~Controller.button #f0 AND
267 267
 			DUP #04 SFT #01 AND #01 NEQ ^$no-up JNZ
268 268
 				( move ) ~zoom.y -- =zoom.y $no-up
269 269
 			DUP #05 SFT #01 AND #01 NEQ ^$no-down JNZ
... ...
@@ -275,8 +275,8 @@ BRK
275 275
 		#00 EQU #04 JNZ ,draw-canvas JSR2
276 276
 	$no-ctrl
277 277
 	
278
-	~Keys #00 EQU ,$no-keys JNZ2
279
-		~Keys 
278
+	~Keys.key #00 EQU ,$no-keys JNZ2
279
+		~Keys.key 
280 280
 		DUP #20 NEQ ^$no-space JNZ
281 281
 			( toggle zoom ) ~zoom.active #00 EQU =zoom.active ,redraw JSR2 $no-space 
282 282
 		DUP #08 NEQ ^$no-backspace JNZ
... ...
@@ -293,7 +293,7 @@ BRK
293 293
 			( tool0 ) #04 =brush.tool ,draw-toolpane JSR2 $no-tkey
294 294
 		DUP 
295 295
 			DUP #30 GTH SWP #39 LTH #0101 NEQ2 ^$no-numkey JNZ
296
-			( size ) ~Keys #31 SUB =brush.size ,draw-sizepane JSR2 $no-numkey
296
+			( size ) ~Keys.key #31 SUB =brush.size ,draw-sizepane JSR2 $no-numkey
297 297
 		POP
298 298
 		( release ) #00 =Keys
299 299
 	$no-keys
... ...
@@ -306,21 +306,21 @@ BRK
306 306
 
307 307
 @on-rename ( -- )
308 308
 
309
-	~Keys #00 EQU ,$no-keys JNZ2
309
+	~Keys.key #00 EQU ,$no-keys JNZ2
310 310
 		( enter )
311
-		~Keys #0d NEQ ^$no-enter JNZ
311
+		~Keys.key #0d NEQ ^$no-enter JNZ
312 312
 			#00 =document.edit
313 313
 			,redraw JSR2 BRK
314 314
 			$no-enter
315 315
 		( backspace )
316
-		~Keys #08 NEQ ^$no-backspace JNZ
316
+		~Keys.key #08 NEQ ^$no-backspace JNZ
317 317
 			~path.length #00 EQU ^$end JNZ
318 318
 			~path.length #01 SUB =path.length
319 319
 			^$end JMP
320 320
 			$no-backspace
321 321
 		( default )
322 322
 		~path.length #1f EQU ^$end JNZ
323
-			~Keys ,path.name #00 ~path.length ADD2 POK2
323
+			~Keys.key ,path.name #00 ~path.length ADD2 POK2
324 324
 			~path.length #01 ADD =path.length
325 325
 			$end
326 326
 		#00 ,path.name #00 ~path.length ADD2 POK2
... ...
@@ -659,7 +659,7 @@ RTN
659 659
 	( draw size cursor )
660 660
 	~brush.tool #01 NEQ ,$outside-canvas JNZ2
661 661
 	( do not draw size when holding alt )
662
-	~Controller #02 EQU ,$outside-canvas JNZ2
662
+	~Controller.button #02 EQU ,$outside-canvas JNZ2
663 663
 	~Mouse.x CLN2r ~canvas.x1 GTH2 STH2r ~canvas.x2 LTH2 #0101 NEQ2 ,$outside-canvas JNZ2
664 664
 	~Mouse.y CLN2r ~canvas.y1 GTH2 STH2r ~canvas.y2 LTH2 #0101 NEQ2 ,$outside-canvas JNZ2	
665 665
 	( do not draw size in toolpane )
... ...
@@ -673,7 +673,7 @@ RTN
673 673
 	$outside-canvas
674 674
 	( draw new cursor )
675 675
 	~cursor.x =Sprite.x ~cursor.y =Sprite.y
676
-	,pointers_icn #00 ~Controller #02 EQU 8* ADD2 =Sprite.addr
676
+	,pointers_icn #00 ~Controller.button #02 EQU 8* ADD2 =Sprite.addr
677 677
 	#1f ~Mouse.state #01 EQU #0a MUL SUB =Sprite.color
678 678
 
679 679
 RTN
... ...
@@ -998,6 +998,4 @@ RTN
998 998
 	0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c
999 999
 ]
1000 1000
 
1001
-@ERROR BRK 
1002
-
1003 1001
 |2100 @data
... ...
@@ -189,6 +189,6 @@ portuxn(Uxn *u, Uint8 id, char *name, Uint8 (*pofn)(Uxn *u, Uint16 ptr, Uint8 b0
189 189
 	Device *d = &u->dev[id];
190 190
 	d->addr = PAGE_DEVICE + id * 0x10;
191 191
 	d->poke = pofn;
192
-	printf("Device added #%d: %s, at 0x%04x \n", id, name, d->addr);
192
+	printf("Device added #%02x: %s, at 0x%04x \n", id, name, d->addr);
193 193
 	return d;
194 194
 }