... | ... |
@@ -23,7 +23,7 @@ static const char *errors[] = { |
23 | 23 |
"Return-stack division by zero"}; |
24 | 24 |
|
25 | 25 |
static void |
26 |
-inspect(Stack *s, char *name) |
|
26 |
+print_stack(Stack *s, char *name) |
|
27 | 27 |
{ |
28 | 28 |
Uint8 x, y; |
29 | 29 |
fprintf(stderr, "\n%s\n", name); |
... | ... |
@@ -57,6 +57,12 @@ uxn_halt(Uxn *u, Uint8 error, Uint16 addr) |
57 | 57 |
return 0; |
58 | 58 |
} |
59 | 59 |
|
60 |
+void |
|
61 |
+system_inspect(Uxn *u){ |
|
62 |
+ print_stack(&u->wst, "Working-stack"); |
|
63 |
+ print_stack(&u->rst, "Return-stack"); |
|
64 |
+} |
|
65 |
+ |
|
60 | 66 |
/* IO */ |
61 | 67 |
|
62 | 68 |
Uint8 |
... | ... |
@@ -75,10 +81,7 @@ system_deo(Device *d, Uint8 port) |
75 | 81 |
switch(port) { |
76 | 82 |
case 0x2: d->u->wst.ptr = d->dat[port]; break; |
77 | 83 |
case 0x3: d->u->rst.ptr = d->dat[port]; break; |
78 |
- case 0xe: |
|
79 |
- inspect(&d->u->wst, "Working-stack"); |
|
80 |
- inspect(&d->u->rst, "Return-stack"); |
|
81 |
- break; |
|
84 |
+ case 0xe: system_inspect(d->u); break; |
|
82 | 85 |
default: system_deo_special(d, port); |
83 | 86 |
} |
84 | 87 |
} |
... | ... |
@@ -31,29 +31,10 @@ error(char *msg, const char *err) |
31 | 31 |
return 0; |
32 | 32 |
} |
33 | 33 |
|
34 |
-static void |
|
35 |
-inspect(Stack *s, char *name) |
|
36 |
-{ |
|
37 |
- Uint8 x, y; |
|
38 |
- fprintf(stderr, "\n%s\n", name); |
|
39 |
- for(y = 0; y < 0x04; y++) { |
|
40 |
- for(x = 0; x < 0x08; x++) { |
|
41 |
- Uint8 p = y * 0x08 + x; |
|
42 |
- fprintf(stderr, |
|
43 |
- p == s->ptr ? "[%02x]" : " %02x ", |
|
44 |
- s->dat[p]); |
|
45 |
- } |
|
46 |
- fprintf(stderr, "\n"); |
|
47 |
- } |
|
48 |
-} |
|
49 |
- |
|
50 | 34 |
void |
51 | 35 |
system_deo_special(Device *d, Uint8 port) |
52 | 36 |
{ |
53 |
- if(port == 0xe) { |
|
54 |
- inspect(&d->u->wst, "Working-stack"); |
|
55 |
- inspect(&d->u->rst, "Return-stack"); |
|
56 |
- } |
|
37 |
+ |
|
57 | 38 |
} |
58 | 39 |
|
59 | 40 |
static void |
... | ... |
@@ -372,7 +372,7 @@ do_shortcut(Uxn *u, SDL_Event *event) |
372 | 372 |
if(event->key.keysym.sym == SDLK_F1) |
373 | 373 |
set_zoom(zoom > 2 ? 1 : zoom + 1); |
374 | 374 |
else if(event->key.keysym.sym == SDLK_F2) |
375 |
- toggle_debugger(); |
|
375 |
+ system_inspect(u); |
|
376 | 376 |
else if(event->key.keysym.sym == SDLK_F3) |
377 | 377 |
capture_screen(); |
378 | 378 |
else if(event->key.keysym.sym == SDLK_F4) |