Browse code

Templated examples

neauoire authored on 23/04/2021 02:57:47
Showing 10 changed files
... ...
@@ -32,7 +32,7 @@ else
32 32
 fi
33 33
 
34 34
 echo "Assembling.."
35
-./bin/assembler projects/examples/dev.mouse.usm bin/boot.rom
35
+./bin/assembler projects/examples/gui.animation.usm bin/boot.rom
36 36
 
37 37
 echo "Running.."
38 38
 if [ "${2}" = '--cli' ]; 
... ...
@@ -10,52 +10,35 @@ scope: source.usm
10 10
 
11 11
 contexts:
12 12
   main:
13
-    # pointer
13
+    # label
14 14
     - match: '\@(\S+)\s?'
15 15
       scope: string.control
16 16
       pop: true
17
-      
17
+    # sublabel
18 18
     - match: '\&(\S+)\s?'
19 19
       scope: string.control
20 20
       pop: true
21
+
21 22
     # jump
22 23
     - match: '\|(\S+)\s?'
23
-      scope: variable.control
24
+      scope: entity.name.tag.structure.any
24 25
       pop: true
26
+    # pad
25 27
     - match: '\$(\S+)\s?'
26
-      scope: variable.control
27
-      pop: true
28
-    # constants
29
-
30
-    # templated
31
-    - match: '(\S+)\^\s?'
32
-      scope: storage.type
33
-      pop: true
34
-    - match: '(\S+)\=\s?'
35
-      scope:  constant.numeric
36
-      pop: true
37
-    - match: '(\S+)\?\s?'
38
-      scope: storage.type
39
-      pop: true
40
-    - match: '(\S+)\!\s?'
41
-      scope: constant.numeric
28
+      scope: entity.name.tag.structure.any
42 29
       pop: true
43 30
 
44 31
     # Pushing to stack
45
-
46
-    - match: '\#(\S+)\s?'
47
-      scope: keyword.control
48
-      pop: true
49 32
     - match: '\"(\S+)\s?'
50
-      scope: entity.control
33
+      scope: variable.parameter.option
51 34
       pop: true
52 35
     
53 36
     # Addressing
54 37
     - match: '\.(\S+)\s?'     # zero-page
55
-      scope: variable.control
38
+      scope: variable.function.shell
56 39
       pop: true
57 40
     - match: '\,(\S+)\s?'     # relative
58
-      scope: entity.name.type
41
+      scope: entity.name.tag.yaml
59 42
       pop: true
60 43
     - match: '\;(\S+)\s?'     # absolute
61 44
       scope: keyword.control
... ...
@@ -64,6 +47,7 @@ contexts:
64 47
       scope: keyword.control
65 48
       pop: true
66 49
 
50
+      # Blocks
67 51
     - match: '\[\s?'
68 52
       scope: comment
69 53
       pop: true
... ...
@@ -71,9 +55,6 @@ contexts:
71 55
       scope: comment
72 56
       pop: true
73 57
 
74
-
75
-      # Blocks
76
-
77 58
     - match: '\{'
78 59
       scope: variable.control
79 60
       push:
... ...
@@ -87,3 +68,39 @@ contexts:
87 68
         - meta_scope: comment.line
88 69
         - match: '\)'
89 70
           pop: true
71
+
72
+    # templated
73
+
74
+    - match: '(\S+)\^\!\s?'
75
+      scope: entity.name.type.typedef
76
+      pop: true
77
+    - match: '(\S+)\~\!\s?'
78
+      scope:  constant.numeric
79
+      pop: true
80
+    - match: '(\S+)\*\!\s?'
81
+      scope: entity.name.type.typedef
82
+      pop: true
83
+    - match: '(\S+)\=\!\s?'
84
+      scope:  constant.numeric
85
+      pop: true
86
+
87
+    - match: '(\S+)\^\s?'
88
+      scope: entity.name.type.typedef
89
+      pop: true
90
+    - match: '(\S+)\~\s?'
91
+      scope:  constant.numeric
92
+      pop: true
93
+    - match: '(\S+)\*\s?'
94
+      scope: entity.name.type.typedef
95
+      pop: true
96
+    - match: '(\S+)\=\s?'
97
+      scope:  constant.numeric
98
+      pop: true
99
+
100
+
101
+    - match: '(\S+)\?\s?'
102
+      scope: storage.type
103
+      pop: true
104
+    - match: '(\S+)\!\s?'
105
+      scope: constant.numeric
106
+      pop: true
90 107
\ No newline at end of file
... ...
@@ -2,14 +2,14 @@
2 2
 
3 3
 ( devices )
4 4
 
5
-|00 @System     [ &vector $2 &pad     $6 &r      $2 &g     $2 &b      $2 ]
6
-|10 @Console    [ &pad    $8 &char    $1 &byte   $1 &short $2 &string $2 ]
7
-|20 @Screen     [ &vector $2 &width   $2 &height $2 &pad   $2 &x      $2 &y     $2 &addr $2 &color $1 ]
8
-|30 @Audio      [ &wave $2 &envelope $2 &pad $4 &volume $1 &pitch $1 &play $1 &value $2 &delay $2 &finish $1 ]
9
-|40 @Controller [ &vector $2 &button  $1 &key    $1 ]
10
-|60 @Mouse      [ &vector $2 &x       $2 &y      $2 &state $1 &chord $1 ]
11
-|70 @File       [ &vector $2 &success $2 &offset $2 &pad   $2 &name  $2 &length $2 &load $2 &save $2 ]
12
-|a0 @DateTime   [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 &refresh $1 ]
5
+|00 @System     [ &vector $2 &pad      $6 &r      $2 &g     $2 &b      $2 ]
6
+|10 @Console    [ &pad    $8 &char     $1 &byte   $1 &short $2 &string $2 ]
7
+|20 @Screen     [ &vector $2 &width    $2 &height $2 &pad   $2 &x      $2 &y     $2 &addr $2 &color $1 ]
8
+|30 @Audio      [ &wave   $2 &envelope $2 &pad    $4 &volume $1 &pitch $1 &play $1 &value $2 &delay $2 &finish $1 ]
9
+|40 @Controller [ &vector $2 &button   $1 &key    $1 ]
10
+|60 @Mouse      [ &vector $2 &x        $2 &y      $2 &state $1 &chord $1 ]
11
+|70 @File       [ &vector $2 &success  $2 &offset $2 &pad   $2 &name  $2 &length $2 &load $2 &save $2 ]
12
+|a0 @DateTime   [ &year   $2 &month    $1 &day    $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 &refresh $1 ]
13 13
 
14 14
 ( variables )
15 15
 
... ...
@@ -19,3 +19,16 @@
19 19
 
20 20
 |0100 ( -> )
21 21
 
22
+	;deferred
23
+	,relative
24
+	.zero-page
25
+	:immediate
26
+
27
+	|goto
28
+	$padding
29
+
30
+	@label
31
+	&sublabel
32
+
33
+	#value
34
+	"string
22 35
\ No newline at end of file
... ...
@@ -2,13 +2,12 @@
2 2
 
3 3
 %MOD { DUP2 DIV MUL SUB }
4 4
 
5
-(
6
-	position in track, 
7
-	frame: counter for current frame, 
8
-	only playing every few frames 
9
-)
5
+%%^! { .% DEI }  %%~! { .% DEO }
6
+%%*! { .% DEI2 } %%=! { .% DEO2 }
7
+%%^  { .% PEK }  %%~  { .% POK }
8
+%%*  { .% PEK2 } %%=  { .% POK2 }
10 9
 
11
-@timer $1
10
+@timer    $1
12 11
 @progress $1
13 12
 
14 13
 ( devices )
... ...
@@ -20,41 +19,41 @@
20 19
 |0100 ( -> )
21 20
 	
22 21
 	( set color pallete )
23
-	#00ff .System/r DEO2 
24
-	#0f0f .System/g DEO2 
25
-	#0ff0 .System/b DEO2 
22
+	#00ff System/r=! 
23
+	#0f0f System/g=! 
24
+	#0ff0 System/b=! 
26 25
 
27
-	;on-frame .Screen/vector DEO2 ( run on-frame every 1/60th of a second )
28
-	#ff .Audio/vol DEO            ( set volume to max )
29
-	;saw .Audio/wave DEO2         ( set waveform to saw for audio engine )
30
-	;env .Audio/env DEO2          ( set envelope for audio engine )
26
+	;on-frame Screen/vector=! ( run on-frame every 1/60th of a second )
27
+	#ff Audio/vol~!            ( set volume to max )
28
+	;saw Audio/wave=!         ( set waveform to saw for audio engine )
29
+	;env Audio/env=!          ( set envelope for audio engine )
31 30
 
32 31
 BRK
33 32
 
34 33
 @on-frame ( -> )
35 34
 
36
-	( incr ) .timer PEK #01 ADD .timer POK 
37
-	( skip ) .timer PEK #10 EQU ,&play-note JNZ BRK &play-note
35
+	( incr ) timer^ #01 ADD timer~ 
36
+	( skip ) timer^ #10 EQU ,&play-note JNZ BRK &play-note
38 37
 
39 38
 	( get note )
40
-	;melody #00 .progress PEK ADD2 GET ( -- note )
39
+	;melody #00 progress^ ADD2 GET 
41 40
 
42 41
 	( play note )
43
-	DUP #80 ORA .Audio/pitch DEO ( -- note ) ( OR note with #80 and set the audio pitch to it. )
44
-	#01 .Audio/play DEO ( play the note )
42
+	DUP #80 ORA Audio/pitch~!
43
+	#01 Audio/play~!
45 44
 
46 45
 	( erase last note )
47
-	#20  .Screen/color DEO ( draw a dot )
46
+	#20  Screen/color~!
48 47
 
49 48
 	( draw note )
50
-	#00 SWP #0004 MUL2 #0100 SUB2 .Screen/y DEO2 ( calculate the y position of a dot. TODO make this not upside down )
51
-	#00 .progress PEK #0008 MUL2 .Screen/x DEO2 ( calculate the x position of a dot )
52
-	;dot .Screen/addr DEO2 ( set the sprite for a dot )
53
-	#21  .Screen/color DEO ( draw a dot )
49
+	#00 SWP #0004 MUL2 #0100 SUB2 Screen/y=!
50
+	#00 progress^ #0008 MUL2 Screen/x=!
51
+	;dot Screen/addr=!
52
+	#21 Screen/color~!
54 53
 
55
-	( incr ) .progress PEK #01 ADD #20 MOD .progress POK
54
+	( incr ) progress^ #01 ADD #20 MOD progress~
56 55
 
57
-	#00 .timer POK
56
+	#00 timer~
58 57
 
59 58
 BRK
60 59
 
... ...
@@ -66,10 +65,10 @@ BRK
66 65
 
67 66
 @saw ( -> )
68 67
 
69
-	#6000 .Audio/value DEO2
70
-	#0000 .Audio/delay DEO2 ( move to volume #600 after 0 delay )
71
-	#0000 .Audio/value DEO2
72
-	#ffff .Audio/delay DEO2 ( reach volume 0 after the whole note. Interpolated linearly )
68
+	#6000 Audio/value=!
69
+	#0000 Audio/delay=! ( move to volume #600 after 0 delay )
70
+	#0000 Audio/value=!
71
+	#ffff Audio/delay=! ( reach volume 0 after the whole note. Interpolated linearly )
73 72
 
74 73
 BRK
75 74
 
... ...
@@ -77,11 +76,11 @@ BRK
77 76
 
78 77
 @env ( -> )
79 78
 
80
-	#ffff .Audio/value DEO2
81
-	#1000 .Audio/delay DEO2 ( move pretty quickly to volume #ffff (maximum) ) 
82
-	#0000 .Audio/value DEO2
83
-	#4000 .Audio/delay DEO2 ( interpolating linearly, move to #0000 after a delay of #4000 where #8000 is half a second )
84
-	#00   .Audio/finish DEO ( end the envelope )
79
+	#ffff Audio/value=!
80
+	#1000 Audio/delay=! ( move pretty quickly to volume #ffff (maximum) ) 
81
+	#0000 Audio/value=!
82
+	#4000 Audio/delay=! ( interpolating linearly, move to #0000 after a delay of #4000 where #8000 is half a second )
83
+	#00   Audio/finish~! ( end the envelope )
85 84
 
86 85
 BRK
87 86
 
... ...
@@ -1,11 +1,14 @@
1 1
 ( dev/controller/buttons )
2 2
 
3
-%=>SC/ADDR { .Screen/addr DEO2 } 
4
-%->SC/COLR { .Screen/color DEO }
5 3
 %++ { #0001 ADD2 } 
6 4
 %-- { #0001 SUB2 }
7 5
 %2/ { #0002 DIV2 }
8 6
 
7
+%%^! { .% DEI }  %%~! { .% DEO }
8
+%%*! { .% DEI2 } %%=! { .% DEO2 }
9
+%%^  { .% PEK }  %%~  { .% POK }
10
+%%*  { .% PEK2 } %%=  { .% POK2 }
11
+
9 12
 ( devices )
10 13
 
11 14
 |00 @System     [ &vector $2 &pad    $6 &r      $2 &g     $2 &b      $2 ]
... ...
@@ -23,62 +26,62 @@
23 26
 |0100 ( -> )
24 27
 	
25 28
 	( theme ) 
26
-	#0daf .System/r DEO2 
27
-	#02ff .System/g DEO2 
28
-	#035f .System/b DEO2
29
+	#0daf System/r=! 
30
+	#02ff System/g=! 
31
+	#035f System/b=!
29 32
 
30 33
 	( vectors ) 
31
-	;on-frame .Screen/vector DEO2
34
+	;on-frame Screen/vector=!
32 35
 	
33 36
 	( set origin )
34
-	.Screen/width DEI2 2/ .Screen/x DEO2
35
-	.Screen/height DEI2 2/ .Screen/y DEO2
37
+	Screen/width*! 2/ Screen/x=!
38
+	Screen/height*! 2/ Screen/y=!
36 39
 
37
-	;default_icn =>SC/ADDR
38
-	#31 ->SC/COLR
39
-	#2a .slime POK
40
+	;default_icn Screen/addr=!
41
+	#31 Screen/color~!
42
+	#2a slime~
40 43
 
41 44
 BRK
42 45
 
43 46
 @on-frame ( -> )
44 47
 
45
-	#2a .slime POK
46
-	;default_icn =>SC/ADDR
48
+	#2a slime~
49
+	;default_icn Screen/addr=!
47 50
 
48 51
 	( hold ctrl key to change slime color )
49
-	.Controller/button DEI #0f AND
50
-		DUP #01 NEQ ,&no-ctrl JNZ #25 .slime POK &no-ctrl
51
-		DUP #02 NEQ ,&no-alt JNZ #2f .slime POK &no-alt
52
+	Controller/button^! #0f AND
53
+		DUP #01 NEQ ,&no-ctrl JNZ #25 slime~ &no-ctrl
54
+		DUP #02 NEQ ,&no-alt JNZ #2f slime~ &no-alt
52 55
 	POP
53 56
 
54
-	( clear ) #30 ->SC/COLR
57
+	( clear ) #30 Screen/color~!
55 58
 
56 59
 	( detect movement )
57
-	.Controller/button DEI #f0 AND
60
+	Controller/button^! #f0 AND
58 61
 		DUP #04 SFT #01 AND #01 NEQ ,&no-up JNZ 
59 62
 			( move ) 
60
-			.Screen/y DEI2 -- .Screen/y DEO2 
61
-			;up_icn =>SC/ADDR &no-up
63
+			Screen/y*! -- Screen/y=! 
64
+			;up_icn Screen/addr=! &no-up
62 65
 		DUP #05 SFT #01 AND #01 NEQ ,&no-down JNZ 
63 66
 			( move ) 
64
-			.Screen/y DEI2 ++ .Screen/y DEO2 
65
-			;down_icn =>SC/ADDR &no-down
67
+			Screen/y*! ++ Screen/y=! 
68
+			;down_icn Screen/addr=! &no-down
66 69
 		DUP #06 SFT #01 AND #01 NEQ ,&no-left JNZ 
67 70
 			( move ) 
68
-			.Screen/x DEI2 -- .Screen/x DEO2 
69
-			;left_icn =>SC/ADDR &no-left
71
+			Screen/x*! -- Screen/x=! 
72
+			;left_icn Screen/addr=! &no-left
70 73
 		DUP #07 SFT #01 AND #01 NEQ ,&no-right JNZ 
71 74
 			( move ) 
72
-			.Screen/x DEI2 ++ .Screen/x DEO2 
73
-			;right_icn =>SC/ADDR &no-right
75
+			Screen/x*! ++ Screen/x=! 
76
+			;right_icn Screen/addr=! &no-right
74 77
 	POP
75 78
 
76 79
 	( draw face )
77
-	#31 ->SC/COLR
80
+	#31 Screen/color~!
78 81
 
79 82
 	( draw slime )
80
-	;slime_icn =>SC/ADDR
81
-	.slime PEK ->SC/COLR
83
+	;slime_icn Screen/addr=!
84
+	slime^ Screen/color~!
82 85
 
83 86
 BRK
84 87
 
... ...
@@ -4,6 +4,11 @@
4 4
 %8+  { #0008 ADD2 }
5 5
 %8*  { #0030 SFT2 }
6 6
 
7
+%%^! { .% DEI }  %%~! { .% DEO }
8
+%%*! { .% DEI2 } %%=! { .% DEO2 }
9
+%%^  { .% PEK }  %%~  { .% POK }
10
+%%*  { .% PEK2 } %%=  { .% POK2 }
11
+
7 12
 ( devices )
8 13
 
9 14
 |00 @System     [ &vector $2 &pad    $6 &r      $2 &g     $2 &b      $2 ]
... ...
@@ -15,39 +20,36 @@
15 20
 |0100 ( -> )
16 21
 
17 22
 	( theme ) 
18
-	#0f73 .System/r DEO2 
19
-	#0fe3 .System/g DEO2 
20
-	#0fc3 .System/b DEO2
21
-
22
-	( vectors ) ;on-button .Controller/vector DEO2
23
-
23
+	#0f73 System/r=! 
24
+	#0fe3 System/g=! 
25
+	#0fc3 System/b=!
26
+	( vectors ) 
27
+	;on-button Controller/vector=!
24 28
 	;draw-cursor JSR2
25 29
 	
26 30
 BRK
27 31
 
28 32
 @on-button ( -> )
29 33
 	
30
-	.Controller/key DEI #00 NEQ ,&skip JNZ BRK &skip  
31
-
32
-	.Controller/key DEI #0d NEQ ,&no-return JNZ 
33
-		( draw ) #20 .Screen/color DEO
34
-		( reset ) #0000 .Screen/x DEO2
35
-		( incr ) .Screen/y DEI2 8+ .Screen/y DEO2
34
+	Controller/key^! #00 NEQ ,&skip JNZ BRK &skip  
35
+	Controller/key^! #0d NEQ ,&no-return JNZ 
36
+		( draw ) #20 Screen/color~!
37
+		( reset ) #0000 Screen/x=!
38
+		( incr ) Screen/y*! 8+ Screen/y=!
36 39
 		;draw-cursor JSR2
37 40
 		BRK
38 41
 	&no-return
39
-
40
-	;font #00 .Controller/key DEI 8* ADD2 .Screen/addr DEO2
41
-	( draw ) #21 .Screen/color DEO
42
-	( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
43
-
42
+	;font #00 Controller/key^! 8* ADD2 Screen/addr=!
43
+	( draw ) #21 Screen/color~!
44
+	( incr ) Screen/x*! 8+ Screen/x=!
44 45
 	;draw-cursor JSR2
45 46
 
46 47
 BRK
47 48
 
48 49
 @draw-cursor ( -- )
49 50
 	
50
-	;cursor .Screen/addr DEO2 #22 .Screen/color DEO
51
+	;cursor Screen/addr=! 
52
+	#22 Screen/color~!
51 53
 
52 54
 RTN
53 55
 
... ...
@@ -3,6 +3,11 @@
3 3
 %8+ { #0008 ADD2 }
4 4
 %MEMORY { #1000 }
5 5
 
6
+%%^! { .% DEI }  %%~! { .% DEO }
7
+%%*! { .% DEI2 } %%=! { .% DEO2 }
8
+%%^  { .% PEK }  %%~  { .% POK }
9
+%%*  { .% PEK2 } %%=  { .% POK2 }
10
+
6 11
 ( devices )
7 12
 
8 13
 |00 @System     [ &vector $2 &pad    $6 &r      $2 &g     $2 &b      $2 ]
... ...
@@ -19,35 +24,35 @@
19 24
 |0100 ( -> )
20 25
 
21 26
 	( theme )
22
-	#0efc .System/r DEO2
23
-	#03cc .System/g DEO2
24
-	#03ac .System/b DEO2
27
+	#0efc System/r=!
28
+	#03cc System/g=!
29
+	#03ac System/b=!
25 30
 
26 31
 	( load file )
27
-	#1000    .File/length DEO2
28
-	;srcpath   .File/name DEO2
29
-	MEMORY     .File/load DEO2
32
+	#1000    File/length=!
33
+	;srcpath File/name=!
34
+	MEMORY   File/load=!
30 35
 
31
-	.File/success DEI2 #0000 NEQ2 ;on-success JNZ2
36
+	File/success*! #0000 NEQ2 ;on-success JNZ2
32 37
 
33
-	;failedtxt .Console/string DEO2
38
+	;failedtxt Console/string=!
34 39
 
35 40
 BRK
36 41
 
37 42
 @on-success ( -> )
38 43
 	
39
-	;successtxt .Console/string DEO2
44
+	;successtxt Console/string=!
40 45
 
41 46
 	( draw image )
42
-	MEMORY .Screen/addr DEO2
47
+	MEMORY Screen/addr=!
43 48
 	#0000 #0080
44 49
 	&ver
45
-		( save ) OVR2 .Screen/y DEO2
50
+		( save ) OVR2 Screen/y=!
46 51
 		#0000 #0080
47 52
 		&hor
48
-			( save ) OVR2 .Screen/x DEO2
49
-			( draw ) #41 .Screen/color DEO
50
-			( incr ) .Screen/addr DEI2 #0010 ADD2 .Screen/addr DEO2
53
+			( save ) OVR2 Screen/x=!
54
+			( draw ) #41 Screen/color~!
55
+			( incr ) Screen/addr*! #0010 ADD2 Screen/addr=!
51 56
 			( incr ) SWP2 8+ SWP2
52 57
 			OVR2 OVR2 LTH2 ,&hor JNZ
53 58
 		POP2 POP2
... ...
@@ -56,9 +61,9 @@ BRK
56 61
 	POP2 POP2
57 62
 
58 63
 	( save file )
59
-	#1000    .File/length DEO2
60
-	;dstpath   .File/name DEO2
61
-	MEMORY     .File/save DEO2
64
+	#1000    File/length=!
65
+	;dstpath File/name=!
66
+	MEMORY   File/save=!
62 67
 
63 68
 BRK
64 69
 
... ...
@@ -1,31 +1,23 @@
1 1
 ( dev/mouse )
2 2
 
3 3
 %RTN { JMP2r }
4
-%8+ { #0008 ADD2 }
5
-%++ { #0001 ADD2 }
6
-%-- { #0001 SUB2 }
7 4
 %ABS2 { DUP2 #000f SFT2 EQU #04 JNZ #ffff MUL2 }
8 5
 
9
-(
10
-%%^ { .% PEK } %%= { .% POK }
11
-%%? { .% DEI } %%! { .% DEO }
12
-)
13
-
14
-%%^ { .% PEK2 } %%= { .% POK2 }
15
-%%? { .% DEI2 } %%! { .% DEO2 }
6
+%%^! { .% DEI }  %%~! { .% DEO }
7
+%%*! { .% DEI2 } %%=! { .% DEO2 }
8
+%%^  { .% PEK }  %%~  { .% POK }
9
+%%*  { .% PEK2 } %%=  { .% POK2 }
16 10
 
17 11
 ( devices )
18 12
 
19 13
 |00 @System     [ &vector $2 &pad     $6 &r      $2 &g     $2 &b      $2 ]
20
-|10 @Console    [ &pad    $8 &char    $1 &byte   $1 &short $2 &string $2 ]
21 14
 |20 @Screen     [ &vector $2 &width   $2 &height $2 &pad   $2 &x      $2 &y     $2 &addr $2 &color $1 ]
22
-|40 @Controller [ &vector $2 &button  $1 &key    $1 ]
23 15
 |60 @Mouse      [ &vector $2 &x       $2 &y      $2 &state $1 &chord $1 ]
24 16
 
25 17
 |0000
26 18
 
27
-@line    [ &x0 $2 &y0 $2 &x $2 &y $2 &sx $2 &sy $2 &dx $2 &dy $2 &e1 $2 &e2 $2 ]
28
-@pointer [ &x $2 &y $2 &lastx $2 &lasty $2 &state $1 ]
19
+@line    [ &x0 $2 &y0 $2 &x     $2 &y     $2 &sx    $2 &sy $2 &dx $2 &dy $2 &e1 $2 &e2 $2 ]
20
+@pointer [ &x  $2 &y  $2 &lastx $2 &lasty $2 &state $1 ]
29 21
 @color $1
30 22
 
31 23
 ( program )
... ...
@@ -33,108 +25,96 @@
33 25
 |0100 ( -> )
34 26
 
35 27
 	( theme ) 
36
-	#f0f0 System/r! 
37
-	#f00f System/g! 
38
-	#f000 System/b!
39
-
28
+	#f0f0 System/r=! 
29
+	#f00f System/g=! 
30
+	#f000 System/b=!
40 31
 	( vectors ) 
41
-	;on-mouse Mouse/vector!
32
+	;on-mouse Mouse/vector=!
42 33
 
43 34
 BRK
44 35
 
45 36
 @on-mouse ( -> )
46 37
 
47 38
 	;draw-cursor JSR2
48
-
49 39
 	( on down )
50
-	.Mouse/state DEI #00 NEQ .pointer/state PEK #00 EQU #0101 EQU2 ,on-mouse-down JNZ
51
-
40
+	Mouse/state^! #00 NEQ pointer/state^ #00 EQU #0101 EQU2 ,on-mouse-down JNZ
52 41
 	( on drag )
53
-	.Mouse/state DEI #00 NEQ ,on-mouse-drag JNZ
54
-
55
-	.Mouse/state DEI .pointer/state POK
42
+	Mouse/state^! #00 NEQ ,on-mouse-drag JNZ
43
+	Mouse/state^! pointer/state~
56 44
 
57 45
 BRK 
58 46
 
59 47
 @on-mouse-down ( -> )
60 48
 
61 49
 	( record start position )
62
-	Mouse/x? DUP2 pointer/x= pointer/lastx= 
63
-	Mouse/y? DUP2 pointer/y= pointer/lasty=
64
-
65
-	.Mouse/state DEI .pointer/state POK
50
+	Mouse/x*! DUP2 pointer/x= pointer/lastx= 
51
+	Mouse/y*! DUP2 pointer/y= pointer/lasty=
52
+	Mouse/state^! pointer/state~
66 53
 
67 54
 BRK
68 55
 
69 56
 @on-mouse-drag ( -> )
70 57
 	
71 58
 	( draw line )
72
-	pointer/lastx^ 
73
-	pointer/lasty^ 
74
-	pointer/x^ 
75
-	pointer/y^ 
76
-	#01 ( add mouse state ) [ .Mouse/state DEI #10 EQU #02 MUL ADD ] 
59
+	pointer/lastx* 
60
+	pointer/lasty* 
61
+	pointer/x* 
62
+	pointer/y* 
63
+	#01 [ Mouse/state^! #10 EQU #02 MUL ADD ] 
77 64
 	;draw-line JSR2
78
-
79 65
 	( record last position )
80
-	Mouse/x? pointer/lastx= 
81
-	Mouse/y? pointer/lasty=
82
-
83
-	.Mouse/state DEI .pointer/state POK
66
+	Mouse/x*! pointer/lastx= 
67
+	Mouse/y*! pointer/lasty=
68
+	Mouse/state^! pointer/state~
84 69
 
85 70
 BRK
86 71
 
87 72
 @draw-cursor ( -- )
88 73
 	
89 74
 	( clear last cursor )
90
-	;clear Screen/addr! 
91
-	pointer/x^ Screen/x! 
92
-	pointer/y^ Screen/y! 
93
-	#30 .Screen/color DEO
94
-
75
+	;clear Screen/addr=! 
76
+	pointer/x* Screen/x=! 
77
+	pointer/y* Screen/y=! 
78
+	#30 Screen/color~!
95 79
 	( record pointer positions )
96
-	Mouse/x? pointer/x= 
97
-	Mouse/y? pointer/y=
98
-
80
+	Mouse/x*! pointer/x= 
81
+	Mouse/y*! pointer/y=
99 82
 	( draw new cursor )
100
-	;cursor Screen/addr! 
101
-	pointer/x^ Screen/x! 
102
-	pointer/y^ Screen/y! 
103
-
83
+	;cursor Screen/addr=! 
84
+	pointer/x* Screen/x=! 
85
+	pointer/y* Screen/y=! 
104 86
 	( colorize on state )
105
-	.Mouse/state DEI #00 NEQ
106
-	#31 ADD .Screen/color DEO
87
+	#31 [ Mouse/state^! #00 NEQ ] ADD Screen/color~!
107 88
 
108 89
 RTN
109 90
 
110 91
 @draw-line ( x1 y1 x2 y2 color -- )
111 92
 	
112
-	( load ) .color POK line/y0= line/x0= line/y= line/x=
113
-	line/x0^ line/x^ SUB2 ABS2 line/dx=
114
-	line/y0^ line/y^ SUB2 ABS2 #0000 SWP2 SUB2 line/dy=
115
-	#ffff #00 line/x^ line/x0^ LTS2 #0002 MUL2 ADD2 line/sx= 
116
-	#ffff #00 line/y^ line/y0^ LTS2 #0002 MUL2 ADD2 line/sy= 
117
-	line/dx^ line/dy^ ADD2 line/e1=
93
+	( load ) color~ line/y0= line/x0= line/y= line/x=
94
+	line/x0* line/x* SUB2 ABS2 line/dx=
95
+	line/y0* line/y* SUB2 ABS2 #0000 SWP2 SUB2 line/dy=
96
+	#ffff #00 line/x* line/x0* LTS2 #0002 MUL2 ADD2 line/sx= 
97
+	#ffff #00 line/y* line/y0* LTS2 #0002 MUL2 ADD2 line/sy= 
98
+	line/dx* line/dy* ADD2 line/e1=
118 99
 	&loop
119 100
 		( draw ) 
120
-		line/x^ Screen/x! 
121
-		line/y^ Screen/y! 
122
-		.color PEK 
123
-		.Screen/color DEO
124
-		line/x^ line/x0^ EQU2 line/y^ line/y0^ EQU2 #0101 EQU2 ,&end JNZ
125
-		line/e1^ #0002 MUL2 line/e2=
126
-		line/e2^ line/dy^ LTS2 ,&skipy JNZ
127
-			line/e1^ line/dy^ ADD2 line/e1=
128
-			line/x^ line/sx^ ADD2 line/x=
101
+		line/x* Screen/x=! 
102
+		line/y* Screen/y=! 
103
+		color^ Screen/color~!
104
+		line/x* line/x0* EQU2 line/y* line/y0* EQU2 #0101 EQU2 ,&end JNZ
105
+		line/e1* #0002 MUL2 line/e2=
106
+		line/e2* line/dy* LTS2 ,&skipy JNZ
107
+			line/e1* line/dy* ADD2 line/e1=
108
+			line/x* line/sx* ADD2 line/x=
129 109
 		&skipy
130
-		line/e2^ line/dx^ GTS2 ,&skipx JNZ
131
-			line/e1^ line/dx^ ADD2 line/e1=
132
-			line/y^ line/sy^ ADD2 line/y=
110
+		line/e2* line/dx* GTS2 ,&skipx JNZ
111
+			line/e1* line/dx* ADD2 line/e1=
112
+			line/y* line/sy* ADD2 line/y=
133 113
 		&skipx
134 114
 		,&loop JMP
135 115
 	&end
136 116
 
137 117
 RTN
138 118
 
139
-@clear [ 0000 0000 0000 0000 ]
119
+@clear  [ 0000 0000 0000 0000 ]
140 120
 @cursor [ 80c0 e0f0 f8e0 1000 ]
... ...
@@ -1,5 +1,10 @@
1 1
 ( GUI Animation )
2 2
 
3
+%%^! { .% DEI }  %%~! { .% DEO }
4
+%%*! { .% DEI2 } %%=! { .% DEO2 }
5
+%%^  { .% PEK }  %%~  { .% POK }
6
+%%*  { .% PEK2 } %%=  { .% POK2 }
7
+
3 8
 |00 @System     [ &vector $2 &pad    $6 &r      $2 &g     $2 &b      $2 ]
4 9
 |20 @Screen     [ &vector $2 &width  $2 &height $2 &pad   $2 &x      $2 &y $2 &addr $2 &color $1 ]
5 10
 
... ...
@@ -12,17 +17,14 @@
12 17
 |0100 ( -> )
13 18
 	
14 19
 	( theme ) 
15
-	#4cfd .System/r DEO2 
16
-	#4cf3 .System/g DEO2 
17
-	#dcf2 .System/b DEO2
18
-
20
+	#4cfd System/r=! 
21
+	#4cf3 System/g=! 
22
+	#dcf2 System/b=!
19 23
 	( vectors )
20
-	;on-frame .Screen/vector DEO2
21
-
24
+	;on-frame Screen/vector=!
22 25
 	( starting position )
23
-	.Screen/width DEI2 #0002 DIV2 .dvd/x POK2
24
-	.Screen/height DEI2 #0002 DIV2 .dvd/y POK2
25
-
26
+	Screen/width*! #0002 DIV2 dvd/x=
27
+	Screen/height*! #0002 DIV2 dvd/y=
26 28
 	#21 ;draw-dvd JSR2
27 29
 	
28 30
 BRK
... ...
@@ -30,39 +32,39 @@ BRK
30 32
 @on-frame ( -> )
31 33
 
32 34
 	( clear ) #20 ;draw-dvd JSR2
33
-	( hit-right ) .dvd/x PEK2 .Screen/width DEI2 #0020 SUB2 EQU2
34
-	( hit-left ) .dvd/x PEK2 #0000 EQU2 
35
+	( case: hit-right ) dvd/x* Screen/width*! #0020 SUB2 EQU2
36
+	( case: hit-left ) dvd/x* #0000 EQU2 
35 37
 	#0000 EQU2 ,&no-flipx JNZ 
36
-		.dvd/dx PEK #00 EQU .dvd/dx POK &no-flipx
37
-	( hit-bottom ) .dvd/y PEK2 .Screen/height DEI2 #0010 SUB2 EQU2
38
-	( hit-top ) .dvd/y PEK2 #0000 EQU2 
38
+		dvd/dx^ #00 EQU dvd/dx~ &no-flipx
39
+	( case: hit-bottom ) dvd/y* Screen/height*! #0010 SUB2 EQU2
40
+	( case: hit-top ) dvd/y* #0000 EQU2 
39 41
 	#0000 EQU2 ,&no-flipy JNZ 
40
-		.dvd/dy PEK #00 EQU .dvd/dy POK &no-flipy
41
-	( incr ) .dvd/x PEK2 #0001 #00 .dvd/dx PEK #00 EQU #fffe MUL2 ADD2 ADD2 .dvd/x POK2
42
-	( incr ) .dvd/y PEK2 #0001 #00 .dvd/dy PEK #00 EQU #fffe MUL2 ADD2 ADD2 .dvd/y POK2
42
+		dvd/dy^ #00 EQU dvd/dy~ &no-flipy
43
+	( incr ) dvd/x* #0001 #00 dvd/dx^ #00 EQU #fffe MUL2 ADD2 ADD2 dvd/x=
44
+	( incr ) dvd/y* #0001 #00 dvd/dy^ #00 EQU #fffe MUL2 ADD2 ADD2 dvd/y=
43 45
 	( draw ) #21 ;draw-dvd JSR2
44 46
 
45 47
 BRK
46 48
 
47 49
 @draw-dvd ( color -- )
48 50
 	
49
-	( stash color ) STH 
50
-	;dvd_icn .Screen/addr DEO2
51
-	.dvd/y PEK2 .dvd/y PEK2 #0010 ADD2
51
+	( stash ) STH 
52
+	;dvd_icn Screen/addr=!
53
+	dvd/y* [ dvd/y* #0010 ADD2 ]
52 54
 	&ver
53
-		OVR2 .Screen/y DEO2
54
-		.dvd/x PEK2 .dvd/x PEK2 #0020 ADD2
55
+		OVR2 Screen/y=!
56
+		dvd/x* [ dvd/x* #0020 ADD2 ]
55 57
 		&hor
56
-			OVR2 .Screen/x DEO2
57
-			( draw ) DUPr STHr .Screen/color DEO
58
-			( next ) .Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2
58
+			OVR2 Screen/x=!
59
+			( draw ) DUPr STHr Screen/color~!
60
+			( next ) Screen/addr*! #0008 ADD2 Screen/addr=!
59 61
 			( incr ) SWP2 #0008 ADD2 SWP2
60 62
 			OVR2 OVR2 LTH2 ,&hor JNZ
61 63
 		POP2 POP2
62 64
 		( incr ) SWP2 #0008 ADD2 SWP2
63 65
 		OVR2 OVR2 LTH2 ,&ver JNZ
64 66
 	POP2 POP2
65
-	( destroy color ) POPr
67
+	( destroy ) POPr
66 68
 
67 69
 JMP2r
68 70
 
... ...
@@ -92,7 +92,6 @@ findmacro(char *name)
92 92
 	for(i = 0; i < p.mlen; ++i)
93 93
 		if(scmp(p.macros[i].name, name, 64))
94 94
 			return &p.macros[i];
95
-	/* look for templated */
96 95
 	for(i = 0; i < p.mlen; ++i)
97 96
 		if(p.macros[i].name[0] == '%' && ssin(name, p.macros[i].name + 1) != -1)
98 97
 			return &p.macros[i];
... ...
@@ -141,7 +140,6 @@ char *template(char *src, char *dst, char *w, Macro *m)
141 140
 	scpy(src, dst, scin(src, '%') + 1);
142 141
 	scat(dst, input);
143 142
 	scat(dst, src + scin(src, '%') + 1);
144
-	printf("  Templated %s, to %s\n", w, dst);
145 143
 	return dst;
146 144
 }
147 145
 
... ...
@@ -375,7 +373,9 @@ cleanup(char *filename)
375 373
 	int i;
376 374
 	printf("Assembled %s(%d bytes), %d labels, %d macros.\n\n", filename, (p.length - TRIM), p.llen, p.mlen);
377 375
 	for(i = 0; i < p.llen; ++i)
378
-		if(!p.labels[i].refs)
376
+		if(p.labels[i].name[0] >= 'A' && p.labels[i].name[0] <= 'Z')
377
+			continue; /* Ignore capitalized labels(devices) */
378
+		else if(!p.labels[i].refs && scin(p.labels[i].name, '/') > 0)
379 379
 			printf("--- Unused label: %s\n", p.labels[i].name);
380 380
 	for(i = 0; i < p.mlen; ++i)
381 381
 		if(!p.macros[i].refs)