Improved piano example

This commit is contained in:
neauoire 2021-07-09 11:38:45 -07:00
parent 358a902c16
commit dcdf618087
7 changed files with 22 additions and 37 deletions

View File

@ -148,11 +148,8 @@ RTN
.pointer/y LDZ2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
#30 .Screen/color DEO #30 .Screen/color DEO
( record pointer positions ) ( record pointer positions )
.Mouse/x DEI2 .pointer/x STZ2 .Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
.Mouse/y DEI2 .pointer/y STZ2 .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
( colorize on state ) ( colorize on state )
#31 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/color DEO #31 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/color DEO

View File

@ -497,11 +497,8 @@ RTN
.pointer/y LDZ2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
#30 .Screen/color DEO #30 .Screen/color DEO
( record pointer positions ) ( record pointer positions )
.Mouse/x DEI2 .pointer/x STZ2 .Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
.Mouse/y DEI2 .pointer/y STZ2 .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
( colorize on state ) ( colorize on state )
#33 [ .Mouse/state DEI #00 ! ] - .Screen/color DEO #33 [ .Mouse/state DEI #00 ! ] - .Screen/color DEO

View File

@ -114,12 +114,8 @@ BRK
#30 .Screen/color DEO #30 .Screen/color DEO
( record pointer positions ) ( record pointer positions )
.Mouse/x DEI2 .pointer/x STZ2 .Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
.Mouse/y DEI2 .pointer/y STZ2 .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
( colorize on state ) ( colorize on state )
#32 [ .Mouse/state DEI #00 ! ] + .Screen/color DEO #32 [ .Mouse/state DEI #00 ! ] + .Screen/color DEO

View File

@ -6,7 +6,7 @@
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 } %<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%RTN { JMP2r } %RTN { JMP2r }
%TOS { #00 SWP } %TOS { #00 SWP } %TOB { SWP POP }
%MOD { DUP2 / * - } %MOD { DUP2 / * - }
%LTS2 { #8000 ++ SWP2 #8000 ++ >> } %LTS2 { #8000 ++ SWP2 #8000 ++ >> }
%GTS2 { #8000 ++ SWP2 #8000 ++ << } %GTS2 { #8000 ++ SWP2 #8000 ++ << }
@ -80,8 +80,8 @@
( default settings ) ( default settings )
#ff .last-note STZ #ff .last-note STZ
#041c .Audio0/adsr DEO2 #041c .Audio0/adsr DEO2
#88 .Audio0/volume DEO #dd .Audio0/volume DEO
;piano-pcm .Audio0/addr DEO2 ;sin-pcm .Audio0/addr DEO2
#0100 .Audio0/length DEO2 #0100 .Audio0/length DEO2
( inital drawing ) ( inital drawing )
@ -185,8 +185,8 @@ BRK
@on-touch-octave-view ( -> ) @on-touch-octave-view ( -> )
.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// SWP POP #09 ! ,&no-mod JCN .Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// TOB #09 ! ,&no-mod JCN
.Mouse/y DEI2 .octave-view/y1 LDZ2 -- 8// SWP POP .Mouse/y DEI2 .octave-view/y1 LDZ2 -- 8// TOB
DUP #00 ! ,&no-incr JCN DUP #00 ! ,&no-incr JCN
.octave LDZ #03 = ,&no-incr JCN .octave LDZ #03 = ,&no-incr JCN
.octave LDZ #01 + .octave STZ &no-incr .octave LDZ #01 + .octave STZ &no-incr
@ -199,7 +199,7 @@ BRK
BRK BRK
&no-mod &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 .Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// ;notes ++ LDA .octave LDZ #0c * + ;play JSR2
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
;draw-octave JSR2 ;draw-octave JSR2
@ -209,7 +209,7 @@ BRK
@on-touch-adsr-view ( -> ) @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 DUP #00 ! ,&no-a JCN
.Audio0/adsr DEI .Audio0/adsr DEI
#10 .Mouse/state DEI #10 = #e0 * + + #10 .Mouse/state DEI #10 = #e0 * + +
@ -359,7 +359,9 @@ RTN
#02 / #02 /
TOS 4// .wave-view/y1 LDZ2 ++ .Screen/y DEO2 TOS 4// .wave-view/y1 LDZ2 ++ .Screen/y DEO2
.Screen/x DEI2 #0001 ++ .Screen/x 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 ( incr ) INCR
LTHk ,&loop JCN LTHk ,&loop JCN
POP2 POP2

View File

@ -111,12 +111,8 @@ RTN
#30 .Screen/color DEO #30 .Screen/color DEO
( record pointer positions ) ( record pointer positions )
.Mouse/x DEI2 .pointer/x STZ2 .Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
.Mouse/y DEI2 .pointer/y STZ2 .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
( colorize on state ) ( colorize on state )
#31 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/color DEO #31 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/color DEO

View File

@ -250,12 +250,9 @@ RTN
#30 .Screen/color DEO #30 .Screen/color DEO
( record pointer positions ) ( record pointer positions )
.Mouse/x DEI2 .pointer/x STZ2 .Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
.Mouse/y DEI2 .pointer/y STZ2 .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 #33 .Mouse/state DEI #00 NEQ #02 MUL SUB .Screen/color DEO
RTN RTN

View File

@ -110,8 +110,8 @@ inspect(Ppu *p, Uint8 *stack, Uint8 wptr, Uint8 rptr, Uint8 *memory)
/* return pointer */ /* return pointer */
puticn(p, &p->fg, 0x8, y + 0x10, font[(rptr >> 4) & 0xf], 0x2, 0, 0); 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); puticn(p, &p->fg, 0x10, y + 0x10, font[rptr & 0xf], 0x2, 0, 0);
for(i = 0; i < 0x40; ++i) { /* memory */ for(i = 0; i < 0x20; ++i) { /* memory */
x = ((i % 8) * 3 + 1) * 8, y = (i / 8 + 1) * 8 + p->height - 0x50, b = memory[i]; 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, y, font[(b >> 4) & 0xf], 3, 0, 0);
puticn(p, &p->fg, x + 8, y, font[b & 0xf], 3, 0, 0); puticn(p, &p->fg, x + 8, y, font[b & 0xf], 3, 0, 0);
} }