... | ... |
@@ -12,24 +12,6 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
12 | 12 |
WITH REGARD TO THIS SOFTWARE. |
13 | 13 |
*/ |
14 | 14 |
|
15 |
-static Uint8 font[][8] = { |
|
16 |
- {0x00, 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c}, |
|
17 |
- {0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10}, |
|
18 |
- {0x00, 0x7c, 0x82, 0x02, 0x7c, 0x80, 0x80, 0xfe}, |
|
19 |
- {0x00, 0x7c, 0x82, 0x02, 0x1c, 0x02, 0x82, 0x7c}, |
|
20 |
- {0x00, 0x0c, 0x14, 0x24, 0x44, 0x84, 0xfe, 0x04}, |
|
21 |
- {0x00, 0xfe, 0x80, 0x80, 0x7c, 0x02, 0x82, 0x7c}, |
|
22 |
- {0x00, 0x7c, 0x82, 0x80, 0xfc, 0x82, 0x82, 0x7c}, |
|
23 |
- {0x00, 0x7c, 0x82, 0x02, 0x1e, 0x02, 0x02, 0x02}, |
|
24 |
- {0x00, 0x7c, 0x82, 0x82, 0x7c, 0x82, 0x82, 0x7c}, |
|
25 |
- {0x00, 0x7c, 0x82, 0x82, 0x7e, 0x02, 0x82, 0x7c}, |
|
26 |
- {0x00, 0x7c, 0x82, 0x02, 0x7e, 0x82, 0x82, 0x7e}, |
|
27 |
- {0x00, 0xfc, 0x82, 0x82, 0xfc, 0x82, 0x82, 0xfc}, |
|
28 |
- {0x00, 0x7c, 0x82, 0x80, 0x80, 0x80, 0x82, 0x7c}, |
|
29 |
- {0x00, 0xfc, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfc}, |
|
30 |
- {0x00, 0x7c, 0x82, 0x80, 0xf0, 0x80, 0x82, 0x7c}, |
|
31 |
- {0x00, 0x7c, 0x82, 0x80, 0xf0, 0x80, 0x80, 0x80}}; |
|
32 |
- |
|
33 | 15 |
void |
34 | 16 |
clear(Ppu *p) |
35 | 17 |
{ |
... | ... |
@@ -98,33 +80,6 @@ putchr(Ppu *p, Layer *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uin |
98 | 80 |
|
99 | 81 |
/* output */ |
100 | 82 |
|
101 |
-void |
|
102 |
-inspect(Ppu *p, Uint8 *stack, Uint8 wptr, Uint8 rptr, Uint8 *memory) |
|
103 |
-{ |
|
104 |
- Uint8 i, x, y, b; |
|
105 |
- for(i = 0; i < 0x20; ++i) { /* stack */ |
|
106 |
- x = ((i % 8) * 3 + 1) * 8, y = (i / 8 + 1) * 8, b = stack[i]; |
|
107 |
- puticn(p, &p->fg, x, y, font[(b >> 4) & 0xf], 1 + (wptr == i) * 0x7, 0, 0); |
|
108 |
- puticn(p, &p->fg, x + 8, y, font[b & 0xf], 1 + (wptr == i) * 0x7, 0, 0); |
|
109 |
- } |
|
110 |
- /* return pointer */ |
|
111 |
- puticn(p, &p->fg, 0x8, y + 0x10, font[(rptr >> 4) & 0xf], 0x2, 0, 0); |
|
112 |
- puticn(p, &p->fg, 0x10, y + 0x10, font[rptr & 0xf], 0x2, 0, 0); |
|
113 |
- for(i = 0; i < 0x20; ++i) { /* memory */ |
|
114 |
- x = ((i % 8) * 3 + 1) * 8, y = 0x38 + (i / 8 + 1) * 8, b = memory[i]; |
|
115 |
- puticn(p, &p->fg, x, y, font[(b >> 4) & 0xf], 3, 0, 0); |
|
116 |
- puticn(p, &p->fg, x + 8, y, font[b & 0xf], 3, 0, 0); |
|
117 |
- } |
|
118 |
- for(x = 0; x < 0x10; ++x) { /* guides */ |
|
119 |
- putpixel(p, &p->fg, x, p->height / 2, 2); |
|
120 |
- putpixel(p, &p->fg, p->width - x, p->height / 2, 2); |
|
121 |
- putpixel(p, &p->fg, p->width / 2, p->height - x, 2); |
|
122 |
- putpixel(p, &p->fg, p->width / 2, x, 2); |
|
123 |
- putpixel(p, &p->fg, p->width / 2 - 0x10 / 2 + x, p->height / 2, 2); |
|
124 |
- putpixel(p, &p->fg, p->width / 2, p->height / 2 - 0x10 / 2 + x, 2); |
|
125 |
- } |
|
126 |
-} |
|
127 |
- |
|
128 | 83 |
int |
129 | 84 |
initppu(Ppu *p, Uint8 hor, Uint8 ver) |
130 | 85 |
{ |
... | ... |
@@ -31,4 +31,3 @@ void putcolors(Ppu *p, Uint8 *addr); |
31 | 31 |
void putpixel(Ppu *p, Layer *layer, Uint16 x, Uint16 y, Uint8 color); |
32 | 32 |
void puticn(Ppu *p, Layer *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint8 flipx, Uint8 flipy); |
33 | 33 |
void putchr(Ppu *p, Layer *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint8 flipx, Uint8 flipy); |
34 |
-void inspect(Ppu *p, Uint8 *stack, Uint8 wptr, Uint8 rptr, Uint8 *memory); |
... | ... |
@@ -35,6 +35,24 @@ static Uint32 stdin_event; |
35 | 35 |
|
36 | 36 |
static Uint8 zoom = 0, reqdraw = 0, bench = 0; |
37 | 37 |
|
38 |
+static Uint8 font[][8] = { |
|
39 |
+ {0x00, 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c}, |
|
40 |
+ {0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10}, |
|
41 |
+ {0x00, 0x7c, 0x82, 0x02, 0x7c, 0x80, 0x80, 0xfe}, |
|
42 |
+ {0x00, 0x7c, 0x82, 0x02, 0x1c, 0x02, 0x82, 0x7c}, |
|
43 |
+ {0x00, 0x0c, 0x14, 0x24, 0x44, 0x84, 0xfe, 0x04}, |
|
44 |
+ {0x00, 0xfe, 0x80, 0x80, 0x7c, 0x02, 0x82, 0x7c}, |
|
45 |
+ {0x00, 0x7c, 0x82, 0x80, 0xfc, 0x82, 0x82, 0x7c}, |
|
46 |
+ {0x00, 0x7c, 0x82, 0x02, 0x1e, 0x02, 0x02, 0x02}, |
|
47 |
+ {0x00, 0x7c, 0x82, 0x82, 0x7c, 0x82, 0x82, 0x7c}, |
|
48 |
+ {0x00, 0x7c, 0x82, 0x82, 0x7e, 0x02, 0x82, 0x7c}, |
|
49 |
+ {0x00, 0x7c, 0x82, 0x02, 0x7e, 0x82, 0x82, 0x7e}, |
|
50 |
+ {0x00, 0xfc, 0x82, 0x82, 0xfc, 0x82, 0x82, 0xfc}, |
|
51 |
+ {0x00, 0x7c, 0x82, 0x80, 0x80, 0x80, 0x82, 0x7c}, |
|
52 |
+ {0x00, 0xfc, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfc}, |
|
53 |
+ {0x00, 0x7c, 0x82, 0x80, 0xf0, 0x80, 0x82, 0x7c}, |
|
54 |
+ {0x00, 0x7c, 0x82, 0x80, 0xf0, 0x80, 0x80, 0x80}}; |
|
55 |
+ |
|
38 | 56 |
static int |
39 | 57 |
clamp(int val, int min, int max) |
40 | 58 |
{ |
... | ... |
@@ -61,6 +79,33 @@ audio_callback(void *u, Uint8 *stream, int len) |
61 | 79 |
(void)u; |
62 | 80 |
} |
63 | 81 |
|
82 |
+static void |
|
83 |
+inspect(Ppu *p, Uint8 *stack, Uint8 wptr, Uint8 rptr, Uint8 *memory) |
|
84 |
+{ |
|
85 |
+ Uint8 i, x, y, b; |
|
86 |
+ for(i = 0; i < 0x20; ++i) { /* stack */ |
|
87 |
+ x = ((i % 8) * 3 + 1) * 8, y = (i / 8 + 1) * 8, b = stack[i]; |
|
88 |
+ puticn(p, &p->fg, x, y, font[(b >> 4) & 0xf], 1 + (wptr == i) * 0x7, 0, 0); |
|
89 |
+ puticn(p, &p->fg, x + 8, y, font[b & 0xf], 1 + (wptr == i) * 0x7, 0, 0); |
|
90 |
+ } |
|
91 |
+ /* return pointer */ |
|
92 |
+ puticn(p, &p->fg, 0x8, y + 0x10, font[(rptr >> 4) & 0xf], 0x2, 0, 0); |
|
93 |
+ puticn(p, &p->fg, 0x10, y + 0x10, font[rptr & 0xf], 0x2, 0, 0); |
|
94 |
+ for(i = 0; i < 0x20; ++i) { /* memory */ |
|
95 |
+ x = ((i % 8) * 3 + 1) * 8, y = 0x38 + (i / 8 + 1) * 8, b = memory[i]; |
|
96 |
+ puticn(p, &p->fg, x, y, font[(b >> 4) & 0xf], 3, 0, 0); |
|
97 |
+ puticn(p, &p->fg, x + 8, y, font[b & 0xf], 3, 0, 0); |
|
98 |
+ } |
|
99 |
+ for(x = 0; x < 0x10; ++x) { /* guides */ |
|
100 |
+ putpixel(p, &p->fg, x, p->height / 2, 2); |
|
101 |
+ putpixel(p, &p->fg, p->width - x, p->height / 2, 2); |
|
102 |
+ putpixel(p, &p->fg, p->width / 2, p->height - x, 2); |
|
103 |
+ putpixel(p, &p->fg, p->width / 2, x, 2); |
|
104 |
+ putpixel(p, &p->fg, p->width / 2 - 0x10 / 2 + x, p->height / 2, 2); |
|
105 |
+ putpixel(p, &p->fg, p->width / 2, p->height / 2 - 0x10 / 2 + x, 2); |
|
106 |
+ } |
|
107 |
+} |
|
108 |
+ |
|
64 | 109 |
static void |
65 | 110 |
redraw(Uxn *u) |
66 | 111 |
{ |