Improved piano example
This commit is contained in:
parent
358a902c16
commit
dcdf618087
|
@ -148,11 +148,8 @@ RTN
|
|||
.pointer/y LDZ2 .Screen/y DEO2
|
||||
#30 .Screen/color DEO
|
||||
( record pointer positions )
|
||||
.Mouse/x DEI2 .pointer/x STZ2
|
||||
.Mouse/y DEI2 .pointer/y STZ2
|
||||
( draw new cursor )
|
||||
.pointer/x LDZ2 .Screen/x DEO2
|
||||
.pointer/y LDZ2 .Screen/y DEO2
|
||||
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
|
||||
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
|
||||
( colorize on state )
|
||||
#31 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/color DEO
|
||||
|
||||
|
|
|
@ -497,11 +497,8 @@ RTN
|
|||
.pointer/y LDZ2 .Screen/y DEO2
|
||||
#30 .Screen/color DEO
|
||||
( record pointer positions )
|
||||
.Mouse/x DEI2 .pointer/x STZ2
|
||||
.Mouse/y DEI2 .pointer/y STZ2
|
||||
( draw new cursor )
|
||||
.pointer/x LDZ2 .Screen/x DEO2
|
||||
.pointer/y LDZ2 .Screen/y DEO2
|
||||
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
|
||||
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
|
||||
( colorize on state )
|
||||
#33 [ .Mouse/state DEI #00 ! ] - .Screen/color DEO
|
||||
|
||||
|
|
|
@ -114,12 +114,8 @@ BRK
|
|||
#30 .Screen/color DEO
|
||||
|
||||
( record pointer positions )
|
||||
.Mouse/x DEI2 .pointer/x STZ2
|
||||
.Mouse/y DEI2 .pointer/y STZ2
|
||||
|
||||
( draw new cursor )
|
||||
.pointer/x LDZ2 .Screen/x DEO2
|
||||
.pointer/y LDZ2 .Screen/y DEO2
|
||||
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
|
||||
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
|
||||
|
||||
( colorize on state )
|
||||
#32 [ .Mouse/state DEI #00 ! ] + .Screen/color DEO
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
|
||||
|
||||
%RTN { JMP2r }
|
||||
%TOS { #00 SWP }
|
||||
%TOS { #00 SWP } %TOB { SWP POP }
|
||||
%MOD { DUP2 / * - }
|
||||
%LTS2 { #8000 ++ SWP2 #8000 ++ >> }
|
||||
%GTS2 { #8000 ++ SWP2 #8000 ++ << }
|
||||
|
@ -80,8 +80,8 @@
|
|||
( default settings )
|
||||
#ff .last-note STZ
|
||||
#041c .Audio0/adsr DEO2
|
||||
#88 .Audio0/volume DEO
|
||||
;piano-pcm .Audio0/addr DEO2
|
||||
#dd .Audio0/volume DEO
|
||||
;sin-pcm .Audio0/addr DEO2
|
||||
#0100 .Audio0/length DEO2
|
||||
|
||||
( inital drawing )
|
||||
|
@ -185,8 +185,8 @@ BRK
|
|||
|
||||
@on-touch-octave-view ( -> )
|
||||
|
||||
.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// SWP POP #09 ! ,&no-mod JCN
|
||||
.Mouse/y DEI2 .octave-view/y1 LDZ2 -- 8// SWP POP
|
||||
.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// TOB #09 ! ,&no-mod JCN
|
||||
.Mouse/y DEI2 .octave-view/y1 LDZ2 -- 8// TOB
|
||||
DUP #00 ! ,&no-incr JCN
|
||||
.octave LDZ #03 = ,&no-incr JCN
|
||||
.octave LDZ #01 + .octave STZ &no-incr
|
||||
|
@ -199,7 +199,7 @@ BRK
|
|||
BRK
|
||||
&no-mod
|
||||
|
||||
.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// SWP POP #06 > ,&no-key JCN
|
||||
.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// TOB #06 > ,&no-key JCN
|
||||
.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// ;notes ++ LDA .octave LDZ #0c * + ;play JSR2
|
||||
( release ) #00 .Mouse/state DEO
|
||||
;draw-octave JSR2
|
||||
|
@ -209,7 +209,7 @@ BRK
|
|||
|
||||
@on-touch-adsr-view ( -> )
|
||||
|
||||
.Mouse/x DEI2 .adsr-view/x1 LDZ2 -- 8// SWP POP #03 /
|
||||
.Mouse/x DEI2 .adsr-view/x1 LDZ2 -- 8// TOB #03 /
|
||||
DUP #00 ! ,&no-a JCN
|
||||
.Audio0/adsr DEI
|
||||
#10 .Mouse/state DEI #10 = #e0 * + +
|
||||
|
@ -359,7 +359,9 @@ RTN
|
|||
#02 /
|
||||
TOS 4// .wave-view/y1 LDZ2 ++ .Screen/y DEO2
|
||||
.Screen/x DEI2 #0001 ++ .Screen/x DEO2
|
||||
( draw ) OVR .Audio0/length DEI2 SWP POP > #02 * #01 + .Screen/color DEO
|
||||
( draw ) OVR
|
||||
.Audio0/length DEI2 TOB >
|
||||
.Audio0/length DEI2 #0100 !! #0101 == #02 * #01 + .Screen/color DEO
|
||||
( incr ) INCR
|
||||
LTHk ,&loop JCN
|
||||
POP2
|
||||
|
|
|
@ -111,12 +111,8 @@ RTN
|
|||
#30 .Screen/color DEO
|
||||
|
||||
( record pointer positions )
|
||||
.Mouse/x DEI2 .pointer/x STZ2
|
||||
.Mouse/y DEI2 .pointer/y STZ2
|
||||
|
||||
( draw new cursor )
|
||||
.pointer/x LDZ2 .Screen/x DEO2
|
||||
.pointer/y LDZ2 .Screen/y DEO2
|
||||
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
|
||||
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
|
||||
|
||||
( colorize on state )
|
||||
#31 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/color DEO
|
||||
|
|
|
@ -250,12 +250,9 @@ RTN
|
|||
#30 .Screen/color DEO
|
||||
|
||||
( record pointer positions )
|
||||
.Mouse/x DEI2 .pointer/x STZ2
|
||||
.Mouse/y DEI2 .pointer/y STZ2
|
||||
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
|
||||
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
|
||||
|
||||
( draw new cursor )
|
||||
.pointer/x LDZ2 .Screen/x DEO2
|
||||
.pointer/y LDZ2 .Screen/y DEO2
|
||||
#33 .Mouse/state DEI #00 NEQ #02 MUL SUB .Screen/color DEO
|
||||
|
||||
RTN
|
||||
|
|
|
@ -110,8 +110,8 @@ inspect(Ppu *p, Uint8 *stack, Uint8 wptr, Uint8 rptr, Uint8 *memory)
|
|||
/* return pointer */
|
||||
puticn(p, &p->fg, 0x8, y + 0x10, font[(rptr >> 4) & 0xf], 0x2, 0, 0);
|
||||
puticn(p, &p->fg, 0x10, y + 0x10, font[rptr & 0xf], 0x2, 0, 0);
|
||||
for(i = 0; i < 0x40; ++i) { /* memory */
|
||||
x = ((i % 8) * 3 + 1) * 8, y = (i / 8 + 1) * 8 + p->height - 0x50, b = memory[i];
|
||||
for(i = 0; i < 0x20; ++i) { /* memory */
|
||||
x = ((i % 8) * 3 + 1) * 8, y = 0x38 + (i / 8 + 1) * 8, b = memory[i];
|
||||
puticn(p, &p->fg, x, y, font[(b >> 4) & 0xf], 3, 0, 0);
|
||||
puticn(p, &p->fg, x + 8, y, font[b & 0xf], 3, 0, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue