commit 5ceffe2

Devine Lu Linvega  ·  2023-02-02 18:18:53 +0000 UTC
parent db4e07f
Protected system_cmd
3 files changed,  +19, -16
+3, -0
 1@@ -38,7 +38,10 @@
 2 	#05 .Screen/auto DEO
 3 	draw-polycat
 4 
 5+	;&mmu #02 DEO2
 6+
 7 BRK
 8+	&mmu 01 0001 0002 89ab 0003 3333
 9 
10 @draw-polycat ( -- )
11 
+15, -16
 1@@ -32,27 +32,26 @@ system_print(Stack *s, char *name)
 2 	fprintf(stderr, "\n");
 3 }
 4 
 5-void
 6-system_inspect(Uxn *u)
 7+static void
 8+system_cmd(Uint8 *ram, Uint16 addr)
 9 {
10-	system_print(u->wst, "wst");
11-	system_print(u->rst, "rst");
12+	if(ram[addr] == 0x01) {
13+		int src, dst;
14+		Uint16 i, args[5]; /* length, a_page, a_addr, b_page, b_addr */
15+		for(i = 0; i < 5; i++)
16+			args[i] = PEEK16(ram + addr + 1 + i * 2);
17+		src = (args[1] % RAM_PAGES) * 0x10000;
18+		dst = (args[3] % RAM_PAGES) * 0x10000;
19+		for(i = 0; i < args[0]; i++)
20+			ram[dst + (Uint16)(args[4] + i)] = ram[src + (Uint16)(args[2] + i)];
21+	}
22 }
23 
24-/* RAM */
25-
26 void
27-system_cmd(Uint8 *ram, Uint16 addr)
28+system_inspect(Uxn *u)
29 {
30-	Uint16 a = addr, i = 0;
31-	Uint8 o = ram[a++];
32-	if(o == 1) {
33-		Uint16 length = (ram[a++] << 8) + ram[a++];
34-		Uint16 src_page = ((ram[a++] << 8) + ram[a++]) % 16, src_addr = (ram[a++] << 8) + ram[a++];
35-		Uint16 dst_page = ((ram[a++] << 8) + ram[a++]) % 16, dst_addr = (ram[a++] << 8) + ram[a];
36-		for(i = 0; i < length; i++)
37-			ram[dst_page * 0x10000 + dst_addr + i] = ram[src_page * 0x10000 + src_addr + i];
38-	}
39+	system_print(u->wst, "wst");
40+	system_print(u->rst, "rst");
41 }
42 
43 int
+1, -0
1@@ -10,6 +10,7 @@ WITH REGARD TO THIS SOFTWARE.
2 */
3 
4 #define RAM_PAGES 0x10
5+#define PEEK16(d) ((d)[0] << 8 | (d)[1])
6 
7 int system_load(Uxn *u, char *filename);
8 void system_deo(Uxn *u, Uint8 *d, Uint8 port);