From 7b7f4fd0f7c4f4f7128cab94fdc68474799f0698 Mon Sep 17 00:00:00 2001 From: neauoire Date: Wed, 28 Jul 2021 10:29:09 -0700 Subject: [PATCH] System now carries the debug flag, System/0xf is now stopping eval --- etc/mkuxn-fast.lua | 2 ++ etc/mkuxn-fast.moon | 2 ++ projects/examples/demos/piano.tal | 5 +++++ src/uxn-fast.c | 2 ++ src/uxn.c | 2 ++ src/uxnemu.c | 14 +++++++------- 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/etc/mkuxn-fast.lua b/etc/mkuxn-fast.lua index 82fa0ec..1ca73e4 100644 --- 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 index a0ce23d..871e01d 100644 --- 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 index d6ec44a..95a14ff 100644 --- 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 index e04046f..4785286 100644 --- 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 index 1a287ba..2668e3f 100644 --- 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 index 6c58141..38fb10f 100644 --- 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;