Made debugger private to screen
This commit is contained in:
parent
cfe02013fd
commit
13bd3ce2d8
|
@ -65,6 +65,40 @@ screen_blit(Uint8 *layer, Uint8 *ram, Uint16 addr, int x1, int y1, int color, in
|
|||
}
|
||||
}
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
static Uint8 icons[] = {
|
||||
0x00, 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x00, 0x7c, 0x82, 0x02, 0x7c, 0x80, 0x80, 0xfe, 0x00, 0x7c, 0x82, 0x02, 0x1c, 0x02,
|
||||
0x82, 0x7c, 0x00, 0x0c, 0x14, 0x24, 0x44, 0x84, 0xfe, 0x04, 0x00, 0xfe, 0x80, 0x80, 0x7c,
|
||||
0x02, 0x82, 0x7c, 0x00, 0x7c, 0x82, 0x80, 0xfc, 0x82, 0x82, 0x7c, 0x00, 0x7c, 0x82, 0x02,
|
||||
0x1e, 0x02, 0x02, 0x02, 0x00, 0x7c, 0x82, 0x82, 0x7c, 0x82, 0x82, 0x7c, 0x00, 0x7c, 0x82,
|
||||
0x82, 0x7e, 0x02, 0x82, 0x7c, 0x00, 0x7c, 0x82, 0x02, 0x7e, 0x82, 0x82, 0x7e, 0x00, 0xfc,
|
||||
0x82, 0x82, 0xfc, 0x82, 0x82, 0xfc, 0x00, 0x7c, 0x82, 0x80, 0x80, 0x80, 0x82, 0x7c, 0x00,
|
||||
0xfc, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x7c, 0x82, 0x80, 0xf0, 0x80, 0x82, 0x7c,
|
||||
0x00, 0x7c, 0x82, 0x80, 0xf0, 0x80, 0x80, 0x80};
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
static void
|
||||
draw_byte(Uint8 v, Uint16 x, Uint16 y, Uint8 color)
|
||||
{
|
||||
screen_blit(uxn_screen.fg, icons, v >> 4 << 3, x, y, color, 0, 0, 0);
|
||||
screen_blit(uxn_screen.fg, icons, (v & 0xf) << 3, x + 8, y, color, 0, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
screen_debugger(Uxn *u)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < u->wst.ptr; i++)
|
||||
draw_byte(u->wst.dat[i], i * 0x18 + 0x8, uxn_screen.height - 0x18, 0x2);
|
||||
for(i = 0; i < u->rst.ptr; i++)
|
||||
draw_byte(u->rst.dat[i], i * 0x18 + 0x8, uxn_screen.height - 0x10, 0x3);
|
||||
for(i = 0; i < 0x40; i++)
|
||||
draw_byte(u->ram[i], (i & 0x7) * 0x18 + 0x8, ((i >> 3) << 3) + 0x8, 1 + !!u->ram[i]);
|
||||
}
|
||||
|
||||
void
|
||||
screen_palette(Uint8 *addr)
|
||||
{
|
||||
|
@ -111,15 +145,19 @@ screen_resize(Uint16 width, Uint16 height)
|
|||
}
|
||||
|
||||
void
|
||||
screen_redraw(void)
|
||||
screen_redraw(Uxn *u)
|
||||
{
|
||||
Uint8 *fg = uxn_screen.fg, *bg = uxn_screen.bg;
|
||||
Uint32 palette[16], *pixels = uxn_screen.pixels;
|
||||
int i, x, y, w = uxn_screen.width, h = uxn_screen.height;
|
||||
int x1 = uxn_screen.x1;
|
||||
int y1 = uxn_screen.y1;
|
||||
int x2 = uxn_screen.x2 > w ? w : uxn_screen.x2;
|
||||
int y2 = uxn_screen.y2 > h ? h : uxn_screen.y2;
|
||||
int i, x, y, w = uxn_screen.width, h = uxn_screen.height, x1, y1, x2, y2;
|
||||
if(u->dev[0x0e]) {
|
||||
screen_change(0, 0, w, h);
|
||||
screen_debugger(u);
|
||||
}
|
||||
x1 = uxn_screen.x1;
|
||||
y1 = uxn_screen.y1;
|
||||
x2 = uxn_screen.x2 > w ? w : uxn_screen.x2;
|
||||
y2 = uxn_screen.y2 > h ? h : uxn_screen.y2;
|
||||
for(i = 0; i < 16; i++)
|
||||
palette[i] = uxn_screen.palette[(i >> 2) ? (i >> 2) : (i & 3)];
|
||||
for(y = y1; y < y2; y++)
|
||||
|
@ -131,40 +169,6 @@ screen_redraw(void)
|
|||
uxn_screen.x2 = uxn_screen.y2 = 0;
|
||||
}
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
Uint8 icons[] = {
|
||||
0x00, 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x00, 0x7c, 0x82, 0x02, 0x7c, 0x80, 0x80, 0xfe, 0x00, 0x7c, 0x82, 0x02, 0x1c, 0x02,
|
||||
0x82, 0x7c, 0x00, 0x0c, 0x14, 0x24, 0x44, 0x84, 0xfe, 0x04, 0x00, 0xfe, 0x80, 0x80, 0x7c,
|
||||
0x02, 0x82, 0x7c, 0x00, 0x7c, 0x82, 0x80, 0xfc, 0x82, 0x82, 0x7c, 0x00, 0x7c, 0x82, 0x02,
|
||||
0x1e, 0x02, 0x02, 0x02, 0x00, 0x7c, 0x82, 0x82, 0x7c, 0x82, 0x82, 0x7c, 0x00, 0x7c, 0x82,
|
||||
0x82, 0x7e, 0x02, 0x82, 0x7c, 0x00, 0x7c, 0x82, 0x02, 0x7e, 0x82, 0x82, 0x7e, 0x00, 0xfc,
|
||||
0x82, 0x82, 0xfc, 0x82, 0x82, 0xfc, 0x00, 0x7c, 0x82, 0x80, 0x80, 0x80, 0x82, 0x7c, 0x00,
|
||||
0xfc, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x7c, 0x82, 0x80, 0xf0, 0x80, 0x82, 0x7c,
|
||||
0x00, 0x7c, 0x82, 0x80, 0xf0, 0x80, 0x80, 0x80};
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
void
|
||||
draw_byte(Uint8 v, Uint16 x, Uint16 y, Uint8 color)
|
||||
{
|
||||
screen_blit(uxn_screen.fg, icons, v >> 4 << 3, x, y, color, 0, 0, 0);
|
||||
screen_blit(uxn_screen.fg, icons, (v & 0xf) << 3, x + 8, y, color, 0, 0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
screen_debugger(Uxn *u)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < u->wst.ptr; i++)
|
||||
draw_byte(u->wst.dat[i], i * 0x18 + 0x8, uxn_screen.height - 0x18, 0x2);
|
||||
for(i = 0; i < u->rst.ptr; i++)
|
||||
draw_byte(u->rst.dat[i], i * 0x18 + 0x8, uxn_screen.height - 0x10, 0x3);
|
||||
for(i = 0; i < 0x40; i++)
|
||||
draw_byte(u->ram[i], (i & 0x7) * 0x18 + 0x8, ((i >> 3) << 3) + 0x8, 1 + !!u->ram[i]);
|
||||
}
|
||||
|
||||
Uint8
|
||||
screen_dei(Uxn *u, Uint8 addr)
|
||||
{
|
||||
|
|
|
@ -26,8 +26,7 @@ void screen_fill(Uint8 *layer, int x1, int y1, int x2, int y2, int color);
|
|||
void screen_palette(Uint8 *addr);
|
||||
void screen_resize(Uint16 width, Uint16 height);
|
||||
void screen_change(Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2);
|
||||
void screen_redraw(void);
|
||||
void screen_debugger(Uxn *u);
|
||||
void screen_redraw(Uxn *u);
|
||||
|
||||
Uint8 screen_dei(Uxn *u, Uint8 addr);
|
||||
void screen_deo(Uint8 *ram, Uint8 *d, Uint8 port);
|
||||
|
|
|
@ -209,12 +209,7 @@ emu_resize(int width, int height)
|
|||
static void
|
||||
emu_redraw(Uxn *u)
|
||||
{
|
||||
if(u->dev[0x0e]) {
|
||||
screen_change(0, 0, uxn_screen.width, uxn_screen.height);
|
||||
screen_redraw();
|
||||
screen_debugger(u);
|
||||
} else
|
||||
screen_redraw();
|
||||
screen_redraw(u);
|
||||
if(SDL_UpdateTexture(emu_texture, NULL, uxn_screen.pixels, uxn_screen.width * sizeof(Uint32)) != 0)
|
||||
system_error("SDL_UpdateTexture", SDL_GetError());
|
||||
SDL_RenderClear(emu_renderer);
|
||||
|
|
Loading…
Reference in New Issue