mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-22 22:05:11 +00:00
Implement System/vector for debugging.
This commit is contained in:
parent
0fd288de79
commit
4cbb661f48
2 changed files with 13 additions and 2 deletions
|
@ -22,7 +22,7 @@
|
|||
|
||||
( devices )
|
||||
|
||||
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1
|
||||
|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1
|
||||
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1
|
||||
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|
||||
|30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1
|
||||
|
|
|
@ -25,6 +25,16 @@ static const char *errors[] = {
|
|||
int
|
||||
uxn_halt(Uxn *u, Uint8 error, Uint16 addr)
|
||||
{
|
||||
Device *d = &u->dev[0];
|
||||
Uint16 vec = d->vector;
|
||||
if(vec) {
|
||||
d->vector = 0; /* need to rearm to run System/vector again */
|
||||
DEVPOKE16(0x4, addr);
|
||||
d->dat[0x6] = error;
|
||||
if(error != 2) /* working stack overflow has special treatment */
|
||||
vec += 0x0004;
|
||||
return uxn_eval(u, vec);
|
||||
}
|
||||
fprintf(stderr, "Halted: %s#%04x, at 0x%04x\n", errors[error], u->ram[addr], addr);
|
||||
return 0;
|
||||
}
|
||||
|
@ -45,6 +55,7 @@ void
|
|||
system_deo(Device *d, Uint8 port)
|
||||
{
|
||||
switch(port) {
|
||||
case 0x1: DEVPEEK16(d->vector, 0x0); break;
|
||||
case 0x2: d->u->wst.ptr = d->dat[port]; break;
|
||||
case 0x3: d->u->rst.ptr = d->dat[port]; break;
|
||||
default: system_deo_special(d, port);
|
||||
|
|
Loading…
Reference in a new issue