Tightened screen debugger redraw

This commit is contained in:
neauoire 2023-08-16 14:31:40 -07:00
parent 68e4d82df5
commit e1b2f8f14b
3 changed files with 12 additions and 14 deletions

View File

@ -85,6 +85,7 @@ 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 >> 4 << 3, x, y, color, 0, 0, 0);
screen_blit(uxn_screen.fg, icons, (v & 0xf) << 3, x + 8, y, color, 0, 0, 0); screen_blit(uxn_screen.fg, icons, (v & 0xf) << 3, x + 8, y, color, 0, 0, 0);
screen_change(x, y, x + 0x10, y + 0x8);
} }
static void static void
@ -147,27 +148,22 @@ screen_resize(Uint16 width, Uint16 height)
void void
screen_redraw(Uxn *u) screen_redraw(Uxn *u)
{ {
int i, j, o, y;
Uint8 *fg = uxn_screen.fg, *bg = uxn_screen.bg; Uint8 *fg = uxn_screen.fg, *bg = uxn_screen.bg;
Uint16 w = uxn_screen.width, h = uxn_screen.height;
Uint16 x1 = uxn_screen.x1, y1 = uxn_screen.y1;
Uint16 x2 = uxn_screen.x2 > w ? w : uxn_screen.x2, y2 = uxn_screen.y2 > h ? h : uxn_screen.y2;
Uint32 palette[16], *pixels = uxn_screen.pixels; Uint32 palette[16], *pixels = uxn_screen.pixels;
int i, x, y, w = uxn_screen.width, h = uxn_screen.height, x1, y1, x2, y2;
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;
uxn_screen.x1 = uxn_screen.y1 = 0xffff; uxn_screen.x1 = uxn_screen.y1 = 0xffff;
uxn_screen.x2 = uxn_screen.y2 = 0; uxn_screen.x2 = uxn_screen.y2 = 0;
if(u->dev[0x0e]) { if(u->dev[0x0e])
screen_change(0, 0, w, h);
screen_debugger(u); screen_debugger(u);
}
for(i = 0; i < 16; i++) for(i = 0; i < 16; i++)
palette[i] = uxn_screen.palette[(i >> 2) ? (i >> 2) : (i & 3)]; palette[i] = uxn_screen.palette[(i >> 2) ? (i >> 2) : (i & 3)];
for(y = y1; y < y2; y++) for(y = y1; y < y2; y++)
for(x = x1; x < x2; x++) { for(o = y * w, i = x1 + o, j = x2 + o; i < j; i++)
i = x + y * w;
pixels[i] = palette[fg[i] << 2 | bg[i]]; pixels[i] = palette[fg[i] << 2 | bg[i]];
} }
}
Uint8 Uint8
screen_dei(Uxn *u, Uint8 addr) screen_dei(Uxn *u, Uint8 addr)

View File

@ -114,10 +114,12 @@ system_init(Uxn *u, Uint8 *ram, char *rom)
void void
system_deo(Uxn *u, Uint8 *d, Uint8 port) system_deo(Uxn *u, Uint8 *d, Uint8 port)
{ {
Uint8 *ram;
Uint16 addr;
switch(port) { switch(port) {
case 0x3: case 0x3:
Uint8 *ram = u->ram; ram = u->ram;
Uint16 addr = PEEK2(d + 2); addr = PEEK2(d + 2);
if(ram[addr] == 0x1) { if(ram[addr] == 0x1) {
Uint16 i, length = PEEK2(ram + addr + 1); Uint16 i, length = PEEK2(ram + addr + 1);
Uint16 a_page = PEEK2(ram + addr + 1 + 2), a_addr = PEEK2(ram + addr + 1 + 4); Uint16 a_page = PEEK2(ram + addr + 1 + 2), a_addr = PEEK2(ram + addr + 1 + 4);

View File

@ -46,7 +46,7 @@ uxn_eval(Uxn *u, Uint16 pc)
switch(!(ins & 0x1f) ? (0 - (ins >> 5)) & 0xff : ins & 0x3f) { switch(!(ins & 0x1f) ? (0 - (ins >> 5)) & 0xff : ins & 0x3f) {
/* IMM */ /* IMM */
case 0x00: /* BRK */ return 1; case 0x00: /* BRK */ return 1;
case 0xff: /* JCI */ if(!s->dat[--s->ptr]) { pc += 2; break; } case 0xff: /* JCI */ if(!s->dat[--s->ptr]) { pc += 2; break; } /* else fallthrough */
case 0xfe: /* JMI */ pc += PEEK2(ram + pc) + 2; break; case 0xfe: /* JMI */ pc += PEEK2(ram + pc) + 2; break;
case 0xfd: /* JSI */ SET(0, 2) PUT2(pc + 2) pc += PEEK2(ram + pc) + 2; break; case 0xfd: /* JSI */ SET(0, 2) PUT2(pc + 2) pc += PEEK2(ram + pc) + 2; break;
case 0xfc: /* LITr */ case 0xfa: SET(0, 1) PUT1(ram[pc++]) break; case 0xfc: /* LITr */ case 0xfa: SET(0, 1) PUT1(ram[pc++]) break;