commit 7126a9d
Devine Lu Linvega
·
2025-12-30 19:25:18 +0000 UTC
parent da8aed3
Faster drawing
3 files changed,
+33,
-16
+7,
-6
1@@ -1,10 +1,11 @@
2 ( cat a.txt | uxncli xh.rom > b.rom )
3-
4 @on-reset ( -> )
5 ;on-console #10 DEO2 BRK
6 @on-console ( -> )
7- #12 DEI
8- LIT "0 SUB DUP #0a LTH ?{
9- #27 SUB DUP #10 LTH ?{ POP BRK } }
10- LITr 40 EORr STHkr ?{ ORA #18 DEO BRK }
11- STHkr SFT BRK
12+ #0417 DEI EQU ?{
13+ #12 DEI
14+ LIT "0 SUB DUP #0a LTH ?{
15+ #27 SUB DUP #10 LTH ?{ POP BRK } }
16+ LITr 40 EORr STHkr ?{ ORA #18 DEO BRK }
17+ STHkr SFT BRK }
18+ #800f DEO
M
makefile
+5,
-1
1@@ -4,6 +4,8 @@ PREFIX=${HOME}/.local
2
3 run: bin/uxn11 bin/perifs.rom
4 bin/uxn11 bin/perifs.rom
5+gui: bin/uxn11 bin/screen.rom
6+ bin/uxn11 bin/screen.rom
7 test: bin/uxn11-debug tests
8 @ -bin/uxn11-debug
9 @ -bin/uxn11-debug -v
10@@ -51,7 +53,7 @@ bin/drifblim.rom: bin/uxn11 etc/utils/drifblim.rom.txt
11
12 # Tests
13
14-tests: bin/opctest.rom bin/system.rom bin/console.rom bin/perifs.rom bin/file.rom bin/datetime.rom
15+tests: bin/opctest.rom bin/system.rom bin/console.rom bin/screen.rom bin/perifs.rom bin/file.rom bin/datetime.rom
16
17 bin/opctest.rom: bin/uxn11 bin/drifblim.rom etc/tests/opctest.tal
18 @ bin/uxn11 bin/drifblim.rom etc/tests/opctest.tal bin/opctest.rom
19@@ -59,6 +61,8 @@ bin/system.rom: bin/uxn11 bin/drifblim.rom etc/tests/system.tal
20 @ bin/uxn11 bin/drifblim.rom etc/tests/system.tal bin/system.rom
21 bin/console.rom: bin/uxn11 bin/drifblim.rom etc/tests/console.tal
22 @ bin/uxn11 bin/drifblim.rom etc/tests/console.tal bin/console.rom
23+bin/screen.rom: bin/uxn11 bin/drifblim.rom etc/tests/screen.tal
24+ @ bin/uxn11 bin/drifblim.rom etc/tests/screen.tal bin/screen.rom
25 bin/perifs.rom: bin/uxn11 bin/drifblim.rom etc/tests/perifs.tal
26 @ bin/uxn11 bin/drifblim.rom etc/tests/perifs.tal bin/perifs.rom
27 bin/file.rom: bin/uxn11 bin/drifblim.rom etc/tests/file.tal
+21,
-9
1@@ -478,15 +478,27 @@ screen_resize(int width, int height)
2 static void
3 screen_redraw(void)
4 {
5- int i, x, y, k, l;
6- for(y = screen_y1; y < screen_y2; y++) {
7- const int ys = y * screen_zoom;
8- for(x = screen_x1, i = MAR(x) + MAR(y) * screen_wmar2; x < screen_x2; x++, i++) {
9- const int c = screen_palette[screen_layers[i]];
10- for(k = 0; k < screen_zoom; k++) {
11- const int oo = ((ys + k) * screen_width + x) * screen_zoom;
12- for(l = 0; l < screen_zoom; l++)
13- screen_pixels[oo + l] = c;
14+ int x, y;
15+ if(screen_zoom == 1) {
16+ int colmar = MAR(screen_y1) * screen_wmar2;
17+ int *dst = &screen_pixels[screen_y1 * screen_width + screen_x1];
18+ for(y = screen_y1; y < screen_y2; y++, dst += screen_width, colmar += screen_wmar2) {
19+ int i = MAR(screen_x1) + colmar;
20+ int *a = dst, *b = a + (screen_x2 - screen_x1);
21+ while(a < b)
22+ *a++ = screen_palette[screen_layers[i++]];
23+ }
24+ } else {
25+ int i, k, l;
26+ for(y = screen_y1; y < screen_y2; y++) {
27+ const int ys = y * screen_zoom;
28+ for(x = screen_x1, i = MAR(x) + MAR(y) * screen_wmar2; x < screen_x2; x++, i++) {
29+ const int c = screen_palette[screen_layers[i]];
30+ for(k = 0; k < screen_zoom; k++) {
31+ const int oo = (ys + k) * screen_width * screen_zoom + x * screen_zoom;
32+ for(l = 0; l < screen_zoom; l++)
33+ screen_pixels[oo + l] = c;
34+ }
35 }
36 }
37 }