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)
{
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) {

View File

@ -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) {

View File

@ -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 )

View File

@ -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) {

View File

@ -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;

View File

@ -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;