Browse code

Fixed leak in piano

neauoire authored on 12/05/2021 18:44:18
Showing 3 changed files
... ...
@@ -42,7 +42,7 @@ then
42 42
 fi
43 43
 
44 44
 echo "Assembling.."
45
-./bin/uxnasm projects/demos/piano.usm bin/boot.rom
45
+./bin/uxnasm projects/demos/bifurcan.usm bin/boot.rom
46 46
 
47 47
 echo "Running.."
48 48
 if [ "${2}" = '--cli' ]; 
... ...
@@ -4,10 +4,7 @@
4 4
 )
5 5
 
6 6
 %RTN { JMP2r }
7
-%8+ { #0008 ADD2 }
8
-%2/ { #0002 DIV2 }
9 7
 %MOD { DUP2 DIV MUL SUB }
10
-%INC { #01 ADD }
11 8
 %TOS { #00 SWP }
12 9
 
13 10
 ( devices )
... ...
@@ -41,8 +38,8 @@
41 38
 	;on-mouse .Mouse/vector DEO2
42 39
 
43 40
 	( find center )
44
-	.Screen/width DEI2 2/ .center/x STZ2
45
-	.Screen/height DEI2 2/ .center/y STZ2
41
+	.Screen/width DEI2 #0002 DIV2 .center/x STZ2
42
+	.Screen/height DEI2 #0002 DIV2 .center/y STZ2
46 43
 
47 44
 	( background ) 
48 45
 	;tiles ;cover-pattern JSR2
... ...
@@ -66,7 +63,7 @@ BRK
66 63
 	;draw-cursor JSR2
67 64
 
68 65
 	.Mouse/state DEI #00 EQU ,&no-touch JCN
69
-		( incr ) .style LDZ INC #03 MOD .style STZ
66
+		( incr ) .style LDZ #01 ADD #04 MOD .style STZ
70 67
 		( bg ) ;tiles .style LDZ #10 MUL TOS ADD2 ;cover-pattern JSR2
71 68
 		( fg ) ;redraw JSR2
72 69
 		( release ) #00 .Mouse/state DEO
... ...
@@ -102,7 +99,7 @@ BRK
102 99
 
103 100
 RTN
104 101
 
105
-@draw-number ( x y n -- )
102
+@draw-number ( x* y* n -- )
106 103
 	
107 104
 	STH
108 105
 	( save pos ) .anchor/y STZ2 .anchor/x STZ2
... ...
@@ -116,14 +113,14 @@ RTN
116 113
 		( set style ) .style LDZ #10 MUL TOS ADD2
117 114
 		.Screen/addr DEO2
118 115
 		( draw ) #21 .Screen/color DEO
119
-		( incr ) SWP INC SWP 
116
+		( incr ) SWP #01 ADD SWP 
120 117
 		DUP2 LTH ,&loop JCN
121 118
 	POP2
122 119
 	POPr
123 120
 
124 121
 RTN
125 122
 
126
-@cover-pattern ( addr -- )
123
+@cover-pattern ( addr* -- )
127 124
 	
128 125
 	( load ) .Screen/addr DEO2
129 126
 	#0000 .Screen/height DEI2
... ...
@@ -133,11 +130,11 @@ RTN
133 130
 		&hor
134 131
 			( save ) OVR2 .Screen/x DEO2
135 132
 			( draw ) #21 .Screen/color DEO
136
-			( incr ) SWP2 8+ SWP2
137
-			OVR2 OVR2 LTH2 ,&hor JCN
133
+			( incr ) SWP2 #0008 ADD2 SWP2
134
+			LTH2k ,&hor JCN
138 135
 		POP2 POP2
139
-		( incr ) SWP2 8+ SWP2
140
-		OVR2 OVR2 LTH2 ,&ver JCN
136
+		( incr ) SWP2 #0008 ADD2 SWP2
137
+		LTH2k ,&ver JCN
141 138
 	POP2 POP2
142 139
 
143 140
 RTN
... ...
@@ -174,4 +171,6 @@ RTN
174 171
 	0718 2040 4080 8080
175 172
 	0101 0102 0204 18e0
176 173
 	0808 0810 e304 0808
177
-	0808 0804 e310 0808 ]
174
+	0808 0804 e310 0808
175
+	0000 0000 0000 0001
176
+	ffff ffff ffff ffff ]
... ...
@@ -5,11 +5,12 @@
5 5
 %++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 } 
6 6
 %<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }  
7 7
 
8
-%RTN { JMP2r }
9
-%TOS { #00 SWP }
10
-%MOD { DUP2 / * - }
11
-%LTS2  { #8000 ++ SWP2 #8000 ++ >> }
12
-%GTS2  { #8000 ++ SWP2 #8000 ++ << }
8
+%RTN  { JMP2r }
9
+%TOS  { #00 SWP }
10
+%MOD  { DUP2 / * - }
11
+%LTS2 { #8000 ++ SWP2 #8000 ++ >> }
12
+%GTS2 { #8000 ++ SWP2 #8000 ++ << }
13
+%INCR { SWP #01 + SWP }
13 14
 
14 15
 %WAVEFORM { #1000 }
15 16
 
... ...
@@ -107,7 +108,7 @@ BRK
107 108
 		.adsr-view/x2 LDZ2 #003a -- #0002 ++ .Screen/x DEO2
108 109
 		OVR #10 SWP - .Audio0/output DEI #04 SFT < .Screen/color DEO
109 110
 		.Screen/y DEI2 #0002 ++ .Screen/y DEO2
110
-		( incr ) SWP #01 + SWP
111
+		( incr ) INCR
111 112
 		LTHk ,&loop JCN
112 113
 	POP2
113 114
 
... ...
@@ -116,7 +117,6 @@ BRK
116 117
 @on-control ( -> )
117 118
 
118 119
 	( clear last cursor )
119
-	#fff8 .Screen/addr DEO2 
120 120
 	.pointer/x LDZ2 .Screen/x DEO2 
121 121
 	.pointer/y LDZ2 .Screen/y DEO2 
122 122
 	#30 .Screen/color DEO
... ...
@@ -252,7 +252,7 @@ BRK
252 252
 
253 253
 @play ( pitch -- )
254 254
 	
255
-	DUP .octave LDZ #0c * + .Audio0/pitch DEO
255
+	.octave LDZ #0c * + .Audio0/pitch DEO
256 256
 
257 257
 RTN
258 258
 
... ...
@@ -313,7 +313,7 @@ RTN
313 313
 		( draw ) STHrk .Screen/color DEO
314 314
 		( incr ) .Screen/addr DEI2 #0008 ++ .Screen/addr DEO2  
315 315
 		( incr ) SWP2 #0008 ++ SWP2
316
-		OVR2 OVR2 << ,&loop JCN
316
+		LTH2k ,&loop JCN
317 317
 	POP2 POP2 
318 318
 	POPr
319 319
 
... ...
@@ -370,7 +370,7 @@ RTN
370 370
 		TOS #0004 // .wave-view/y1 LDZ2 ++ .Screen/y DEO2
371 371
 		.Screen/x DEI2 #0001 ++ .Screen/x DEO2
372 372
 		( draw ) OVR .Audio0/length DEI2 SWP POP > #02 * #01 + .Screen/color DEO
373
-		( incr ) SWP #01 + SWP
373
+		( incr ) INCR
374 374
 		LTHk ,&loop JCN
375 375
 	POP2
376 376
 
... ...
@@ -392,7 +392,7 @@ RTN
392 392
 		OVR2 .Screen/y DEO2
393 393
 		( draw ) STHrk .Screen/color DEO
394 394
 		( incr ) SWP2 #0001 ++ SWP2
395
-		OVR2 OVR2 << ,&loop JCN
395
+		LTH2k ,&loop JCN
396 396
 	POP2 POP2
397 397
 	POPr
398 398