uxn

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

commit dcfb6fb5bf374f360d2f40c98943c943db424efa
parent 739b13c1e3ef481ee75a304fbae5e97454653a1a
Author: neauoire <aliceffekt@gmail.com>
Date:   Sat,  3 Apr 2021 20:29:00 -0700

Do not trigger on asdr change

Diffstat:
Mprojects/examples/dev.audio.usm | 12++++++------
Msrc/emulator.c | 30++++++++++++------------------
2 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/projects/examples/dev.audio.usm b/projects/examples/dev.audio.usm @@ -133,13 +133,13 @@ BRK DUP #f0 AND STH #01 ~Mouse.state #10 EQU #0e MUL ADD ADD #0f AND STHr ADD ,Audio #00 ~track.active #02 MUL ADD2 ++ POK2 $no-r DUP #05 NEQ ^$no-left JNZ - ,Audio #0009 ADD2 #00 ~track.active #02 MUL ADD2 PEK2 + ,Audio 8+ #00 ~track.active #02 MUL ADD2 PEK2 #10 ~Mouse.state #10 EQU #e0 MUL ADD ADD - ,Audio #0009 ADD2 #00 ~track.active #02 MUL ADD2 POK2 $no-left + ,Audio 8+ #00 ~track.active #02 MUL ADD2 POK2 $no-left DUP #06 NEQ ^$no-right JNZ - ,Audio #0009 ADD2 #00 ~track.active #02 MUL ADD2 PEK2 + ,Audio 8+ #00 ~track.active #02 MUL ADD2 PEK2 DUP #f0 AND STH #01 ~Mouse.state #10 EQU #0e MUL ADD ADD #0f AND STHr ADD - ,Audio #0009 ADD2 #00 ~track.active #02 MUL ADD2 POK2 $no-right + ,Audio 8+ #00 ~track.active #02 MUL ADD2 POK2 $no-right POP ( release ) #00 =Mouse.state ,draw-controls JSR2 @@ -336,10 +336,10 @@ RTN ( vol ) ~ctlframe.x1 #0058 ADD2 ~ctlframe.y1 8+ #02 ,vol_txt ,draw-label JSR2 ~ctlframe.x1 #0058 ADD2 ~ctlframe.y1 #0010 ADD2 - ,Audio #0009 ADD2 #00 ~track.active #02 MUL ADD2 PEK2 #04 SFT + ,Audio 8+ #00 ~track.active #02 MUL ADD2 PEK2 #04 SFT ,draw-knob JSR2 ~ctlframe.x1 #0068 ADD2 ~ctlframe.y1 #0010 ADD2 - ,Audio #0009 ADD2 #00 ~track.active #02 MUL ADD2 PEK2 #0f AND + ,Audio 8+ #00 ~track.active #02 MUL ADD2 PEK2 #0f AND ,draw-knob JSR2 RTN diff --git a/src/emulator.c b/src/emulator.c @@ -108,19 +108,6 @@ paintpixel(Uint8 *dst, Uint16 x, Uint16 y, Uint8 color) dst[row + 8] |= 1UL << col; } -void -painticn(Uint8 *dst, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 blend) -{ - Uint16 v, h; - for(v = 0; v < 8; v++) - for(h = 0; h < 8; h++) { - Uint8 ch1 = ((sprite[v] >> (7 - h)) & 0x1); - if(ch1 == 0 && (blend == 0x05 || blend == 0x0a || blend == 0x0f)) - continue; - paintpixel(dst, x + h, y + v, ch1 ? blend % 4 : blend / 4); - } -} - #pragma mark - Helpers void @@ -459,12 +446,19 @@ sprite_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1) Uint8 *m = u->ram.dat; ptr += 8; if(b0 == 0x0e) { + Uint16 v, h; Uint16 x = (m[ptr] << 8) + m[ptr + 1]; Uint16 y = (m[ptr + 2] << 8) + m[ptr + 3]; - Uint16 a = (m[ptr + 4] << 8) + m[ptr + 5]; - Uint8 source = (b1 >> 4) & 0xf; - Uint8 *layer = source % 2 ? screen.fg : screen.bg; - painticn(layer, x, y, &m[a], b1 & 0xf); + Uint8 blend = b1 & 0xf; + Uint8 *layer = ((b1 >> 4) & 0xf) % 2 ? screen.fg : screen.bg; + Uint8 *sprite = &m[(m[ptr + 4] << 8) + m[ptr + 5]]; + for(v = 0; v < 8; v++) + for(h = 0; h < 8; h++) { + Uint8 ch1 = ((sprite[v] >> (7 - h)) & 0x1); + if(ch1 == 0 && (blend == 0x05 || blend == 0x0a || blend == 0x0f)) + continue; + paintpixel(layer, x + h, y + v, ch1 ? blend % 4 : blend / 4); + } screen.reqdraw = 1; } return b1; @@ -500,7 +494,7 @@ audio_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1) { Uint8 *m = u->ram.dat; m[PAGE_DEVICE + 0x0070 + b0] = b1; - if(b0 & 1) { + if(b0 > 0x08 && b0 & 1) { Uint16 addr = ptr + (b0 & 0x6); Channel *c = &channels[(b0 & 0x6) >> 1]; SDL_LockAudioDevice(audio_id);