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

This commit is contained in:
neauoire 2021-07-28 10:29:09 -07:00
parent 41eb23e2c2
commit 7b7f4fd0f7
6 changed files with 20 additions and 7 deletions

View File

@ -323,6 +323,8 @@ int
evaluxn(Uxn *u, Uint16 vec) evaluxn(Uxn *u, Uint16 vec)
{ {
Uint8 instr; Uint8 instr;
if(u->dev[0].dat[0xf])
return 0;
u->ram.ptr = vec; u->ram.ptr = vec;
if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8; if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;
while(u->ram.ptr) { while(u->ram.ptr) {

View File

@ -231,6 +231,8 @@ int
evaluxn(Uxn *u, Uint16 vec) evaluxn(Uxn *u, Uint16 vec)
{ {
Uint8 instr; Uint8 instr;
if(u->dev[0].dat[0xf])
return 0;
u->ram.ptr = vec; u->ram.ptr = vec;
if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8; if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;
while(u->ram.ptr) { while(u->ram.ptr) {

View File

@ -16,6 +16,8 @@
%8// { #03 SFT2 } %8// { #03 SFT2 }
%8** { #30 SFT2 } %8** { #30 SFT2 }
%BREAKPOINT { #0101 #0e DEO2 }
( devices ) ( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |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 #3b .octave LDZ #0c * + ;play JSR2 &no-b
DUP #6b ! ,&no-c2 JCN DUP #6b ! ,&no-c2 JCN
#3c .octave LDZ #0c * + ;play JSR2 &no-c2 #3c .octave LDZ #0c * + ;play JSR2 &no-c2
DUP #1b ! ,&no-esc JCN
BREAKPOINT
&no-esc
POP POP
( release ) ( release )

View File

@ -55,6 +55,8 @@ int
evaluxn(Uxn *u, Uint16 vec) evaluxn(Uxn *u, Uint16 vec)
{ {
Uint8 instr; Uint8 instr;
if(u->dev[0].dat[0xf])
return 0;
u->ram.ptr = vec; u->ram.ptr = vec;
if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8; if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;
while(u->ram.ptr) { while(u->ram.ptr) {

View File

@ -156,6 +156,8 @@ stepuxn(Uxn *u, Uint8 instr)
int int
evaluxn(Uxn *u, Uint16 vec) evaluxn(Uxn *u, Uint16 vec)
{ {
if(u->dev[0].dat[0xf])
return 0;
u->ram.ptr = vec; u->ram.ptr = vec;
u->wst.error = 0; u->wst.error = 0;
u->rst.error = 0; u->rst.error = 0;

View File

@ -33,7 +33,7 @@ static Uint32 stdin_event;
#define PAD 4 #define PAD 4
static Uint8 zoom = 0, debug = 0, reqdraw = 0, bench = 0; static Uint8 zoom = 0, reqdraw = 0, bench = 0;
static int static int
clamp(int val, int min, int max) clamp(int val, int min, int max)
@ -64,7 +64,7 @@ audio_callback(void *u, Uint8 *stream, int len)
static void static void
redraw(Uxn *u) 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); 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(bgTexture, &gRect, ppu.bg.pixels, ppu.width * sizeof(Uint32));
SDL_UpdateTexture(fgTexture, &gRect, ppu.fg.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 static void
toggledebug(Uxn *u) toggledebug(Uxn *u)
{ {
debug = !debug; u->dev[0].dat[0xe] = !u->dev[0].dat[0xe];
redraw(u); redraw(u);
} }
@ -229,11 +229,11 @@ system_talk(Device *d, Uint8 b0, Uint8 w)
if(!w) { if(!w) {
d->dat[0x2] = d->u->wst.ptr; d->dat[0x2] = d->u->wst.ptr;
d->dat[0x3] = d->u->rst.ptr; d->dat[0x3] = d->u->rst.ptr;
} else { } else if(b0 > 0x7 && b0 < 0xe) {
putcolors(&ppu, &d->dat[0x8]); putcolors(&ppu, &d->dat[0x8]);
reqdraw = 1; reqdraw = 1;
} } else if(b0 == 0xf)
(void)b0; d->u->ram.ptr = 0x0000;
} }
static void static void
@ -390,7 +390,7 @@ run(Uxn *u)
} }
} }
evaluxn(u, mempeek16(devscreen->dat, 0)); evaluxn(u, mempeek16(devscreen->dat, 0));
if(reqdraw) if(reqdraw || u->dev[0].dat[0xe])
redraw(u); redraw(u);
if(!bench) { if(!bench) {
elapsed = (SDL_GetPerformanceCounter() - start) / (double)SDL_GetPerformanceFrequency() * 1000.0f; elapsed = (SDL_GetPerformanceCounter() - start) / (double)SDL_GetPerformanceFrequency() * 1000.0f;