uxn

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

commit 7b7f4fd0f7c4f4f7128cab94fdc68474799f0698
parent 41eb23e2c2e9f7952f33725df091ee1471640dc6
Author: neauoire <aliceffekt@gmail.com>
Date:   Wed, 28 Jul 2021 10:29:09 -0700

System now carries the debug flag, System/0xf is now stopping eval

Diffstat:
Metc/mkuxn-fast.lua | 2++
Metc/mkuxn-fast.moon | 2++
Mprojects/examples/demos/piano.tal | 5+++++
Msrc/uxn-fast.c | 2++
Msrc/uxn.c | 2++
Msrc/uxnemu.c | 14+++++++-------
6 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/etc/mkuxn-fast.lua b/etc/mkuxn-fast.lua @@ -323,6 +323,8 @@ int evaluxn(Uxn *u, Uint16 vec) { Uint8 instr; + if(u->dev[0].dat[0xf]) + return 0; u->ram.ptr = vec; if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8; while(u->ram.ptr) { diff --git a/etc/mkuxn-fast.moon b/etc/mkuxn-fast.moon @@ -231,6 +231,8 @@ int evaluxn(Uxn *u, Uint16 vec) { Uint8 instr; + if(u->dev[0].dat[0xf]) + return 0; u->ram.ptr = vec; if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8; while(u->ram.ptr) { diff --git a/projects/examples/demos/piano.tal b/projects/examples/demos/piano.tal @@ -16,6 +16,8 @@ %8// { #03 SFT2 } %8** { #30 SFT2 } +%BREAKPOINT { #0101 #0e DEO2 } + ( devices ) |00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] @@ -132,6 +134,9 @@ BRK #3b .octave LDZ #0c * + ;play JSR2 &no-b DUP #6b ! ,&no-c2 JCN #3c .octave LDZ #0c * + ;play JSR2 &no-c2 + DUP #1b ! ,&no-esc JCN + BREAKPOINT + &no-esc POP ( release ) diff --git a/src/uxn-fast.c b/src/uxn-fast.c @@ -55,6 +55,8 @@ int evaluxn(Uxn *u, Uint16 vec) { Uint8 instr; + if(u->dev[0].dat[0xf]) + return 0; u->ram.ptr = vec; if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8; while(u->ram.ptr) { diff --git a/src/uxn.c b/src/uxn.c @@ -156,6 +156,8 @@ stepuxn(Uxn *u, Uint8 instr) int evaluxn(Uxn *u, Uint16 vec) { + if(u->dev[0].dat[0xf]) + return 0; u->ram.ptr = vec; u->wst.error = 0; u->rst.error = 0; diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -33,7 +33,7 @@ static Uint32 stdin_event; #define PAD 4 -static Uint8 zoom = 0, debug = 0, reqdraw = 0, bench = 0; +static Uint8 zoom = 0, reqdraw = 0, bench = 0; static int clamp(int val, int min, int max) @@ -64,7 +64,7 @@ audio_callback(void *u, Uint8 *stream, int len) static void redraw(Uxn *u) { - if(debug) + if(u->dev[0].dat[0xe]) inspect(&ppu, u->wst.dat, u->wst.ptr, u->rst.ptr, u->ram.dat); SDL_UpdateTexture(bgTexture, &gRect, ppu.bg.pixels, ppu.width * sizeof(Uint32)); SDL_UpdateTexture(fgTexture, &gRect, ppu.fg.pixels, ppu.width * sizeof(Uint32)); @@ -78,7 +78,7 @@ redraw(Uxn *u) static void toggledebug(Uxn *u) { - debug = !debug; + u->dev[0].dat[0xe] = !u->dev[0].dat[0xe]; redraw(u); } @@ -229,11 +229,11 @@ system_talk(Device *d, Uint8 b0, Uint8 w) if(!w) { d->dat[0x2] = d->u->wst.ptr; d->dat[0x3] = d->u->rst.ptr; - } else { + } else if(b0 > 0x7 && b0 < 0xe) { putcolors(&ppu, &d->dat[0x8]); reqdraw = 1; - } - (void)b0; + } else if(b0 == 0xf) + d->u->ram.ptr = 0x0000; } static void @@ -390,7 +390,7 @@ run(Uxn *u) } } evaluxn(u, mempeek16(devscreen->dat, 0)); - if(reqdraw) + if(reqdraw || u->dev[0].dat[0xe]) redraw(u); if(!bench) { elapsed = (SDL_GetPerformanceCounter() - start) / (double)SDL_GetPerformanceFrequency() * 1000.0f;