commit 9574807
Devine Lu Linvega
·
2026-01-09 21:08:07 +0000 UTC
parent 9f201b1
Made some new consts
2 files changed,
+23,
-25
M
makefile
M
makefile
+2,
-2
1@@ -61,8 +61,8 @@ bin/system.rom: bin/uxn11 bin/drifblim.rom etc/tests/system.tal
2 @ bin/uxn11 bin/drifblim.rom etc/tests/system.tal bin/system.rom
3 bin/console.rom: bin/uxn11 bin/drifblim.rom etc/tests/console.tal
4 @ bin/uxn11 bin/drifblim.rom etc/tests/console.tal bin/console.rom
5-bin/screen.rom: bin/uxn11 bin/drifblim.rom etc/tests/screen.tal
6- @ bin/uxn11 bin/drifblim.rom etc/tests/screen.tal bin/screen.rom
7+bin/screen.rom: bin/uxn11 bin/drifblim.rom etc/tests/screen.bounds.tal
8+ @ bin/uxn11 bin/drifblim.rom etc/tests/screen.bounds.tal bin/screen.rom
9 bin/perifs.rom: bin/uxn11 bin/drifblim.rom etc/tests/perifs.tal
10 @ bin/uxn11 bin/drifblim.rom etc/tests/perifs.tal bin/perifs.rom
11 bin/file.rom: bin/uxn11 bin/drifblim.rom etc/tests/file.tal
+21,
-23
1@@ -420,9 +420,8 @@ static void console_deo_lb(void) { fprintf(stderr, "%02x", dev[0x1b]); }
2 /*
3 @|Screen ------------------------------------------------------------ */
4
5-static int screen_zoom = 1;
6+static int screen_zoom = 1, screen_reqsize, screen_reqdraw;
7 static int screen_width, screen_height, screen_wmar2, screen_hmar2;
8-static int screen_reqsize, screen_reqdraw;
9 static int screen_x1, screen_y1, screen_x2, screen_y2;
10 static int screen_vector, *screen_pixels, screen_palette[16];
11 static int rX, rY, rA, rMX, rMY, rMA, rML, rDX, rDY;
12@@ -559,36 +558,35 @@ static void
13 screen_deo_pixel(void)
14 {
15 const int ctrl = dev[0x2e];
16- const int layer_mask = (ctrl & 0x40) ? 0x3 : 0xc;
17- const int color = (ctrl & 0x40) ? ((ctrl & 0x3) << 2) : (ctrl & 0x3);
18+ const int hi = ctrl & 0x40;
19+ const Uint8 mask = hi ? 0x3 : 0xc;
20+ const Uint8 color = hi ? ((ctrl & 0x3) << 2) : (ctrl & 0x3);
21 /* fill mode */
22 if(ctrl & 0x80) {
23- int x1, y1, x2, y2, ay, by, px;
24- if(ctrl & 0x10)
25- x1 = 0, x2 = rX;
26- else
27- x1 = rX, x2 = screen_width;
28- if(ctrl & 0x20)
29- y1 = 0, y2 = rY;
30- else
31- y1 = rY, y2 = screen_height;
32- screen_reqdraw = 1;
33- x1 = x1 + 8, y1 = y1 + 8;
34- const int hor = (x2 + 8) - x1, ver = (y2 + 8) - y1;
35- for(ay = y1 * screen_wmar2, by = ay + ver * screen_wmar2; ay < by; ay += screen_wmar2) {
36- Uint8 *dst = &screen_layers[ay + x1];
37+ int px;
38+ const int x1 = (ctrl & 0x10) ? 8 : rX + 8;
39+ const int x2 = (ctrl & 0x10) ? rX : screen_width;
40+ const int y1 = (ctrl & 0x20) ? 8 : rY + 8;
41+ const int y2 = (ctrl & 0x20) ? rY : screen_height;
42+ const int hor = (x2 + 8) - x1;
43+ const int ver = (y2 + 8) - y1;
44+ Uint8 *row = &screen_layers[y1 * screen_wmar2 + x1];
45+ Uint8 *end = row + ver * screen_wmar2;
46+ for(; row < end; row += screen_wmar2) {
47+ Uint8 *dst = row;
48 for(px = 0; px < hor; px++)
49- dst[px] = (dst[px] & layer_mask) | color;
50+ dst[px] = (dst[px] & mask) | color;
51 }
52+ screen_reqdraw = 1;
53 }
54 /* pixel mode */
55 else {
56- const unsigned int x = rX, y = rY;
57+ const Uint16 x = rX, y = rY;
58 if(x < screen_width && y < screen_height) {
59- Uint8 *dst = &screen_layers[(x + 8) + (y + 8) * screen_wmar2];
60- *dst = (*dst & layer_mask) | color;
61+ Uint8 *dst = &screen_layers[(y + 8) * screen_wmar2 + (x + 8)];
62+ *dst = (*dst & mask) | color;
63+ screen_reqdraw = 1;
64 }
65- screen_reqdraw = 1;
66 if(rMX) rX++;
67 if(rMY) rY++;
68 }