Browse code

Use NEQk NIP pattern for piano

neauoire authored on 16/08/2021 01:03:34
Showing 1 changed files
... ...
@@ -4,6 +4,7 @@
4 4
 %<  { LTH } %>   { GTH }  %=  { EQU } %!   { NEQ }
5 5
 %++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
6 6
 %<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
7
+%!~ { NEQk NIP }
7 8
 
8 9
 %RTN  { JMP2r }
9 10
 %TOS  { #00 SWP }
... ...
@@ -114,21 +115,21 @@ BRK
114 115
 	#40 .Screen/sprite DEO
115 116
 
116 117
 	.Controller/key DEI
117
-	DUP #61 ! ,&no-c JCN
118
+	[ LIT 'a ] !~ ,&no-c JCN
118 119
 		#30 .octave LDZ #0c * + ;play JSR2 &no-c
119
-	DUP #73 ! ,&no-d JCN
120
+	[ LIT 's ] !~ ,&no-d JCN
120 121
 		#32 .octave LDZ #0c * + ;play JSR2 &no-d
121
-	DUP #64 ! ,&no-e JCN
122
+	[ LIT 'd ] !~ ,&no-e JCN
122 123
 		#34 .octave LDZ #0c * + ;play JSR2 &no-e
123
-	DUP #66 ! ,&no-f JCN
124
+	[ LIT 'f ] !~ ,&no-f JCN
124 125
 		#35 .octave LDZ #0c * + ;play JSR2 &no-f
125
-	DUP #67 ! ,&no-g JCN
126
+	[ LIT 'g ] !~ ,&no-g JCN
126 127
 		#37 .octave LDZ #0c * + ;play JSR2 &no-g
127
-	DUP #68 ! ,&no-a JCN
128
+	[ LIT 'h ] !~ ,&no-a JCN
128 129
 		#39 .octave LDZ #0c * + ;play JSR2 &no-a
129
-	DUP #6a ! ,&no-b JCN
130
+	[ LIT 'j ] !~ ,&no-b JCN
130 131
 		#3b .octave LDZ #0c * + ;play JSR2 &no-b
131
-	DUP #6b ! ,&no-c2 JCN
132
+	[ LIT 'k ] !~ ,&no-c2 JCN
132 133
 		#3c .octave LDZ #0c * + ;play JSR2 &no-c2
133 134
 	POP
134 135
 
... ...
@@ -185,10 +186,10 @@ BRK
185 186
 
186 187
 	.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// NIP #09 ! ,&no-mod JCN
187 188
 		.Mouse/y DEI2 .octave-view/y1 LDZ2 -- 8// NIP 
188
-		DUP #00 ! ,&no-incr JCN
189
+		[ #00 ] !~ ,&no-incr JCN
189 190
 			.octave LDZ #03 = ,&no-incr JCN
190 191
 			.octave LDZ #01 + .octave STZ &no-incr
191
-		DUP #02 ! ,&no-decr JCN
192
+		[ #02 ] !~ ,&no-decr JCN
192 193
 			.octave LDZ #ff = ,&no-decr JCN
193 194
 			.octave LDZ #01 - .octave STZ &no-decr
194 195
 		POP
... ...
@@ -208,27 +209,27 @@ BRK
208 209
 @on-touch-adsr-view ( -> )
209 210
 
210 211
 	.Mouse/x DEI2 .adsr-view/x1 LDZ2 -- 8// NIP #03 /
211
-	DUP #00 ! ,&no-a JCN
212
+	[ #00 ] !~ ,&no-a JCN
212 213
 		.Audio0/adsr DEI
213 214
 		#10 .Mouse/state DEI #10 = #e0 * + +
214 215
 		.Audio0/adsr DEO &no-a
215
-	DUP #01 ! ,&no-d JCN
216
+	[ #01 ] !~ ,&no-d JCN
216 217
 		.Audio0/adsr DEI
217 218
 		DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
218 219
 		.Audio0/adsr DEO &no-d
219
-	DUP #02 ! ,&no-s JCN
220
+	[ #02 ] !~ ,&no-s JCN
220 221
 		.Audio0/adsr #01 + DEI
221 222
 		#10 .Mouse/state DEI #10 = #e0 * + +
222 223
 		.Audio0/adsr #01 + DEO &no-s
223
-	DUP #03 ! ,&no-r JCN
224
+	[ #03 ] !~ ,&no-r JCN
224 225
 		.Audio0/adsr #01 + DEI
225 226
 		DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
226 227
 		.Audio0/adsr #01 + DEO &no-r
227
-	DUP #05 ! ,&no-left JCN
228
+	[ #05 ] !~ ,&no-left JCN
228 229
 		.Audio0/volume DEI 
229 230
 		#10 .Mouse/state DEI #10 = #e0 * + +
230 231
 		.Audio0/volume DEO &no-left
231
-	DUP #06 ! ,&no-right JCN
232
+	[ #06 ] !~ ,&no-right JCN
232 233
 		.Audio0/volume DEI
233 234
 		DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
234 235
 		.Audio0/volume DEO &no-right