uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit dcdf618087427e1189826f36067d321c287aea5e
parent 358a902c16d0fb26ac9f8fd1db8aeeadc0c627a6
Author: neauoire <aliceffekt@gmail.com>
Date:   Fri,  9 Jul 2021 11:38:45 -0700

Improved piano example

Diffstat:
Mprojects/examples/demos/bifurcan.tal | 7++-----
Mprojects/examples/demos/drum-rack.tal | 7++-----
Mprojects/examples/demos/life.tal | 8++------
Mprojects/examples/demos/piano.tal | 18++++++++++--------
Mprojects/examples/demos/polycat.tal | 8++------
Mprojects/examples/demos/theme.tal | 7++-----
Msrc/devices/ppu.c | 4++--
7 files changed, 22 insertions(+), 37 deletions(-)

diff --git a/projects/examples/demos/bifurcan.tal b/projects/examples/demos/bifurcan.tal @@ -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 diff --git a/projects/examples/demos/drum-rack.tal b/projects/examples/demos/drum-rack.tal @@ -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 diff --git a/projects/examples/demos/life.tal b/projects/examples/demos/life.tal @@ -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 diff --git a/projects/examples/demos/piano.tal b/projects/examples/demos/piano.tal @@ -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 diff --git a/projects/examples/demos/polycat.tal b/projects/examples/demos/polycat.tal @@ -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 diff --git a/projects/examples/demos/theme.tal b/projects/examples/demos/theme.tal @@ -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 diff --git a/src/devices/ppu.c b/src/devices/ppu.c @@ -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); }