Browse code

Examples cleanup

neauoire authored on 18/08/2021 02:40:07
Showing 7 changed files
... ...
@@ -9,7 +9,6 @@
9 9
 %RTN  { JMP2r }
10 10
 %TOS  { #00 SWP }
11 11
 %MOD  { DUP2 / * - }
12
-%LTS2 { #8000 ++ SWP2 #8000 ++ >> }
13 12
 %GTS2 { #8000 ++ SWP2 #8000 ++ << }
14 13
 %2/  { #01 SFT }
15 14
 %2//  { #01 SFT2 }
... ...
@@ -268,13 +267,13 @@ RTN
268 267
 	
269 268
 	.octave-view/x1 LDZ2 .octave-view/y1 LDZ2
270 269
 
271
-	OVR2 OVR2 ;keys-left-icns #01 .last-note LDZ #00 = + ;draw-key JSR2
272
-	OVR2 #0008 ++ OVR2 ;keys-middle-icns #01 .last-note LDZ #02 = + ;draw-key JSR2
273
-	OVR2 #0010 ++ OVR2 ;keys-right-icns #01 .last-note LDZ #04 = + ;draw-key JSR2
274
-	OVR2 #0018 ++ OVR2 ;keys-left-icns #01 .last-note LDZ #05 = + ;draw-key JSR2
275
-	OVR2 #0020 ++ OVR2 ;keys-middle-icns #01 .last-note LDZ #07 = + ;draw-key JSR2
276
-	OVR2 #0028 ++ OVR2 ;keys-middle-icns #01 .last-note LDZ #09 = + ;draw-key JSR2
277
-	SWP2 #0030 ++ SWP2 ;keys-right-icns #01 .last-note LDZ #0b = + ;draw-key JSR2
270
+	OVR2 OVR2 ;keys-left-icns .last-note LDZ #00 = INC ;draw-key JSR2
271
+	OVR2 #0008 ++ OVR2 ;keys-middle-icns .last-note LDZ #02 = INC ;draw-key JSR2
272
+	OVR2 #0010 ++ OVR2 ;keys-right-icns .last-note LDZ #04 = INC ;draw-key JSR2
273
+	OVR2 #0018 ++ OVR2 ;keys-left-icns .last-note LDZ #05 = INC ;draw-key JSR2
274
+	OVR2 #0020 ++ OVR2 ;keys-middle-icns .last-note LDZ #07 = INC ;draw-key JSR2
275
+	OVR2 #0028 ++ OVR2 ;keys-middle-icns .last-note LDZ #09 = INC ;draw-key JSR2
276
+	SWP2 #0030 ++ SWP2 ;keys-right-icns .last-note LDZ #0b = INC ;draw-key JSR2
278 277
 
279 278
 	.octave-view/x1 LDZ2 #0048 ++ .Screen/x DEO2
280 279
 
... ...
@@ -60,7 +60,7 @@ BRK
60 60
 	.counter LDZ #18 MOD #30 ADD 
61 61
 		.Audio0/pitch .counter LDZ #03 AND #40 SFT ADD DEO
62 62
 
63
-	.counter LDZ #01 ADD .counter STZ
63
+	.counter LDZ INC .counter STZ
64 64
 	#00 .timer STZ
65 65
 
66 66
 BRK
... ...
@@ -10,8 +10,7 @@
10 10
 	;hello-word 
11 11
 	&while
12 12
 		( send ) LDAk .Console/write DEO
13
-		( incr ) #0001 ADD2
14
-		( loop ) LDAk ,&while JCN
13
+		INC2 LDAk ,&while JCN
15 14
 	POP2
16 15
 	( show debugger ) #01 .System/debug DEO
17 16
 
... ...
@@ -146,21 +146,21 @@ RTN
146 146
 @line-rect ( x1* y1* x2* y2* color -- )
147 147
 
148 148
 	( load ) .color STZ DUP2 STH2 .rect/y2 STZ2 .rect/x2 STZ2 DUP2 STH2 .rect/y1 STZ2 .rect/x1 STZ2
149
-	STH2r #0001 ++ STH2r
149
+	STH2r INC2 STH2r
150 150
 	&ver
151 151
 		( save ) OVR2 .Screen/y DEO2
152 152
 		( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/pixel DEO
153 153
 		( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/pixel DEO
154
-		( incr ) SWP2 #0001 ++ SWP2
154
+		( incr ) SWP2 INC2 SWP2
155 155
 		OVR2 OVR2 LTS2 ,&ver JCN
156 156
 	POP2 POP2
157
-	.rect/x1 LDZ2 #0001 ++ .rect/x2 LDZ2 #0001 --
157
+	.rect/x1 LDZ2 INC2 .rect/x2 LDZ2 #0001 --
158 158
 	&hor
159 159
 		( save ) OVR2 .Screen/x DEO2
160 160
 		( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/pixel DEO
161 161
 		( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/pixel DEO
162
-		( incr ) SWP2 #0001 ++ SWP2
163
-		OVR2 OVR2 #0001 ++ LTS2 ,&hor JCN
162
+		( incr ) SWP2 INC2 SWP2
163
+		OVR2 OVR2 INC2 LTS2 ,&hor JCN
164 164
 	POP2 POP2
165 165
 
166 166
 RTN
... ...
@@ -71,14 +71,13 @@ BRK
71 71
 	#0080 SCALEX #0080 SCALEY .needles/hx LDZ2 .needles/hy LDZ2 #03 ;draw-line JSR2
72 72
 
73 73
 	( circle )
74
-	#00 #3c
74
+	#3c #00 
75 75
 	&loop
76
-		( load ) OVR #00 SWP 2** ;table ADD2 LDA2
76
+		( load ) DUP #00 SWP 2** ;table ADD2 LDA2
77 77
 		#00 SWP SCALEY .Screen/y DEO2
78 78
 		#00 SWP SCALEX .Screen/x DEO2
79
-		OVR #0f MOD #00 EQU #01 ADD .Screen/pixel DEO
80
-		( incr ) SWP #01 ADD SWP
81
-		LTHk ,&loop JCN
79
+		DUP #0f MOD #00 EQU INC .Screen/pixel DEO
80
+		INC GTHk ,&loop JCN
82 81
 	POP2
83 82
 
84 83
 	;draw-display JSR2
... ...
@@ -1,6 +1,8 @@
1 1
 ( dev/screen )
2 2
 
3 3
 %RTN { JMP2r }
4
+%2/  { #01 SFT }
5
+%4/  { #02 SFT }
4 6
 
5 7
 ( devices )
6 8
 
... ...
@@ -42,7 +44,7 @@ BRK
42 44
 
43 45
 @on-frame ( -> )
44 46
 
45
-	.count LDZ2 #0001 ADD2 [ DUP2 ] .count STZ2
47
+	.count LDZ2 INC2 [ DUP2 ] .count STZ2
46 48
 	
47 49
 	.center/x LDZ2 #0048 ADD2 .Screen/x DEO2
48 50
 	.center/y LDZ2 #0050 SUB2 .Screen/y DEO2
... ...
@@ -79,7 +81,7 @@ BRK
79 81
 		.center/y LDZ2 #0040 SUB2 ADD2 .Screen/y DEO2
80 82
 		.center/x LDZ2 #0050 SUB2 .Screen/x DEO2
81 83
 		( draw ) #01 .Screen/sprite DEO
82
-		#01 ADD GTHk ,&loop JCN
84
+		INC GTHk ,&loop JCN
83 85
 	POP2
84 86
 
85 87
 RTN
... ...
@@ -89,12 +91,12 @@ RTN
89 91
 	;preview_icn .Screen/addr DEO2
90 92
 	#00 #00
91 93
 	&loop
92
-		( move ) DUP #0f AND #40 SFT #02 DIV #00 SWP 
94
+		( move ) DUP #0f AND #40 SFT 2/ #00 SWP 
93 95
 			.center/x LDZ2 #0040 SUB2 ADD2 .Screen/x DEO2
94
-		( move ) DUP #f0 AND #02 DIV #00 SWP 
96
+		( move ) DUP #f0 AND 2/ #00 SWP 
95 97
 			.center/y LDZ2 #0040 SUB2 ADD2 .Screen/y DEO2
96 98
 		( draw ) DUP .Screen/sprite DEO
97
-		#01 ADD NEQk ,&loop JCN
99
+		INC NEQk ,&loop JCN
98 100
 	POP2
99 101
 	
100 102
 RTN
... ...
@@ -104,12 +106,12 @@ RTN
104 106
 	#10 #00
105 107
 	&loop
106 108
 		( color ) STHk
107
-		( y ) DUP #04 DIV [ #00 SWP ] #40 SFT2
109
+		( y ) DUP 4/ [ #00 SWP ] #40 SFT2
108 110
 			[ .center/y LDZ2 #0040 SUB2 ADD2 ] STH2
109 111
 		( x ) DUP #03 AND [ #00 SWP ] #40 SFT2 #0040 ADD2 
110 112
 			[ .center/x LDZ2 #0008 ADD2 ADD2 ]
111 113
 		STH2r STHr #00 ;draw-circle JSR2
112
-		#01 ADD GTHk ,&loop JCN
114
+		INC GTHk ,&loop JCN
113 115
 	POP2
114 116
 	
115 117
 RTN
... ...
@@ -119,12 +121,12 @@ RTN
119 121
 	#10 #00
120 122
 	&loop
121 123
 		( color ) STHk
122
-		( y ) DUP #04 DIV [ #00 SWP ] #40 SFT2
124
+		( y ) DUP 4/ [ #00 SWP ] #40 SFT2
123 125
 			[ .center/y LDZ2 ADD2 ] STH2
124 126
 		( x ) DUP #03 AND [ #00 SWP ] #40 SFT2 #0040 ADD2 
125 127
 			[ .center/x LDZ2 #0008 ADD2 ADD2 ]
126 128
 		STH2r STHr #80 ;draw-circle JSR2
127
-		#01 ADD GTHk ,&loop JCN
129
+		INC GTHk ,&loop JCN
128 130
 	POP2
129 131
 	
130 132
 RTN
... ...
@@ -53,7 +53,7 @@ RTN
53 53
 	.label/addr LDZ2
54 54
 	&loop
55 55
 		( draw ) LDAk #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO
56
-		( incr ) #0001 ADD2
56
+		( incr ) INC2
57 57
 		( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
58 58
 		LDAk ,&loop JCN
59 59
 	POP2
... ...
@@ -67,7 +67,7 @@ RTN
67 67
 	.label/addr LDZ2
68 68
 	&loop
69 69
 		( draw ) LDAk #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO
70
-		( incr ) #0001 ADD2
70
+		( incr ) INC2
71 71
 		( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
72 72
 		LDAk ,&loop JCN
73 73
 	POP2
... ...
@@ -81,7 +81,7 @@ RTN
81 81
 	.label/addr LDZ2
82 82
 	&loop
83 83
 		( draw ) LDAk #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO
84
-		( incr ) #0001 ADD2
84
+		( incr ) INC2
85 85
 		( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
86 86
 		LDAk ,&loop JCN
87 87
 	POP2
... ...
@@ -92,7 +92,7 @@ RTN
92 92
 	
93 93
 	#0000 ( counter )
94 94
 	&loop
95
-		( incr ) #0001 ADD2 OVR2 OVR2 ADD2
95
+		( incr ) INC2 OVR2 OVR2 ADD2
96 96
 		LDA ,&loop JCN
97 97
 	NIP2
98 98