commit e1b2f8f
neauoire
·
2023-08-16 21:31:40 +0000 UTC
parent 68e4d82
Tightened screen debugger redraw
3 files changed,
+12,
-14
+7,
-11
1@@ -85,6 +85,7 @@ draw_byte(Uint8 v, Uint16 x, Uint16 y, Uint8 color)
2 {
3 screen_blit(uxn_screen.fg, icons, v >> 4 << 3, x, y, color, 0, 0, 0);
4 screen_blit(uxn_screen.fg, icons, (v & 0xf) << 3, x + 8, y, color, 0, 0, 0);
5+ screen_change(x, y, x + 0x10, y + 0x8);
6 }
7
8 static void
9@@ -147,26 +148,21 @@ screen_resize(Uint16 width, Uint16 height)
10 void
11 screen_redraw(Uxn *u)
12 {
13+ int i, j, o, y;
14 Uint8 *fg = uxn_screen.fg, *bg = uxn_screen.bg;
15+ Uint16 w = uxn_screen.width, h = uxn_screen.height;
16+ Uint16 x1 = uxn_screen.x1, y1 = uxn_screen.y1;
17+ Uint16 x2 = uxn_screen.x2 > w ? w : uxn_screen.x2, y2 = uxn_screen.y2 > h ? h : uxn_screen.y2;
18 Uint32 palette[16], *pixels = uxn_screen.pixels;
19- int i, x, y, w = uxn_screen.width, h = uxn_screen.height, x1, y1, x2, y2;
20- x1 = uxn_screen.x1;
21- y1 = uxn_screen.y1;
22- x2 = uxn_screen.x2 > w ? w : uxn_screen.x2;
23- y2 = uxn_screen.y2 > h ? h : uxn_screen.y2;
24 uxn_screen.x1 = uxn_screen.y1 = 0xffff;
25 uxn_screen.x2 = uxn_screen.y2 = 0;
26- if(u->dev[0x0e]) {
27- screen_change(0, 0, w, h);
28+ if(u->dev[0x0e])
29 screen_debugger(u);
30- }
31 for(i = 0; i < 16; i++)
32 palette[i] = uxn_screen.palette[(i >> 2) ? (i >> 2) : (i & 3)];
33 for(y = y1; y < y2; y++)
34- for(x = x1; x < x2; x++) {
35- i = x + y * w;
36+ for(o = y * w, i = x1 + o, j = x2 + o; i < j; i++)
37 pixels[i] = palette[fg[i] << 2 | bg[i]];
38- }
39 }
40
41 Uint8
+4,
-2
1@@ -114,10 +114,12 @@ system_init(Uxn *u, Uint8 *ram, char *rom)
2 void
3 system_deo(Uxn *u, Uint8 *d, Uint8 port)
4 {
5+ Uint8 *ram;
6+ Uint16 addr;
7 switch(port) {
8 case 0x3:
9- Uint8 *ram = u->ram;
10- Uint16 addr = PEEK2(d + 2);
11+ ram = u->ram;
12+ addr = PEEK2(d + 2);
13 if(ram[addr] == 0x1) {
14 Uint16 i, length = PEEK2(ram + addr + 1);
15 Uint16 a_page = PEEK2(ram + addr + 1 + 2), a_addr = PEEK2(ram + addr + 1 + 4);
+1,
-1
1@@ -46,7 +46,7 @@ uxn_eval(Uxn *u, Uint16 pc)
2 switch(!(ins & 0x1f) ? (0 - (ins >> 5)) & 0xff : ins & 0x3f) {
3 /* IMM */
4 case 0x00: /* BRK */ return 1;
5- case 0xff: /* JCI */ if(!s->dat[--s->ptr]) { pc += 2; break; }
6+ case 0xff: /* JCI */ if(!s->dat[--s->ptr]) { pc += 2; break; } /* else fallthrough */
7 case 0xfe: /* JMI */ pc += PEEK2(ram + pc) + 2; break;
8 case 0xfd: /* JSI */ SET(0, 2) PUT2(pc + 2) pc += PEEK2(ram + pc) + 2; break;
9 case 0xfc: /* LITr */ case 0xfa: SET(0, 1) PUT1(ram[pc++]) break;