commit 3307991

Devine Lu Linvega  ·  2024-11-26 23:50:40 +0000 UTC
parent 4792b31
Moved bios at page-1
4 files changed,  +24, -25
+3, -3
 1@@ -15,9 +15,9 @@ unsigned char bios_rom[] = {
 2 	0x00, 0x4f, 0x80, 0x03, 0x1a, 0x38, 0x24, 0x94, 0x80, 0x83, 0x08, 0x20, 0x00, 0x0b, 0xa0, 0x00, 
 3 	0x03, 0x38, 0xaa, 0x20, 0xff, 0xf1, 0x22, 0x22, 0x6c, 0x21, 0x34, 0xa0, 0x02, 0x1f, 0x35, 0xa0, 
 4 	0x02, 0x1a, 0x80, 0x02, 0x37, 0xa0, 0x09, 0x7d, 0xa0, 0x01, 0x71, 0x35, 0x22, 0x6c, 0x00, 0x00, 
 5-	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x01, 0xfe, 0x01, 
 6-	0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0a, 0x0d, 0x01, 0x00, 0x90, 0x00, 0x00, 0x00, 
 7-	0x00, 0x00, 0x10, 0x09, 0x7d, 0x60, 0x00, 0x91, 0x80, 0x28, 0xb6, 0xa0, 0x00, 0x08, 0x38, 0x05, 
 8+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0xfe, 0x01, 
 9+	0x00, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0d, 0x01, 0x00, 0x90, 0x00, 0x01, 0x00, 
10+	0x00, 0x00, 0x00, 0x09, 0x7d, 0x60, 0x00, 0x91, 0x80, 0x28, 0xb6, 0xa0, 0x00, 0x08, 0x38, 0x05, 
11 	0x37, 0x80, 0x03, 0xa0, 0x03, 0x0e, 0x15, 0x06, 0x60, 0x00, 0xac, 0x80, 0x28, 0xb6, 0xa0, 0x00, 
12 	0x08, 0x38, 0x05, 0x37, 0x80, 0x01, 0xa0, 0x03, 0x0e, 0x15, 0x80, 0x08, 0x19, 0x80, 0x00, 0x04, 
13 	0x38, 0x26, 0xa0, 0x00, 0x08, 0x38, 0x24, 0x8f, 0xcf, 0x80, 0x80, 0x0b, 0x80, 0x02, 0x04, 0x19, 
+18, -18
 1@@ -81,7 +81,7 @@ int
 2 system_boot(Uint8 *ram, char *boot)
 3 {
 4 	/* Load rom(bios) */
 5-	bios.ram = ram + BIOS_PAGE;
 6+	bios.ram = ram;
 7 	bios.dev = bios.ram + 0x8300;
 8 	bios.wst.dat = bios.ram + 0x8400;
 9 	bios.rst.dat = bios.ram + 0x8500;
10@@ -92,7 +92,7 @@ system_boot(Uint8 *ram, char *boot)
11 			bios.ram[PAGE_PROGRAM + i] = bios_rom[i];
12 	}
13 	/* Load rom(main) */
14-	uxn.ram = ram;
15+	uxn.ram = ram + 0x10000;
16 	uxn.dev = bios.ram + 0x8000;
17 	uxn.wst.dat = bios.ram + 0x8100;
18 	uxn.rst.dat = bios.ram + 0x8200;
19@@ -119,26 +119,26 @@ system_deo(Uxn *u, Uint8 port)
20 	case 0x3: {
21 		Uint16 addr = PEEK2(u->dev + 2);
22 		if(u->ram[addr] == 0x0) {
23-			Uint8 value = u->ram[addr + 7];
24-			Uint16 i, length = PEEK2(u->ram + addr + 1);
25-			Uint16 dst_page = PEEK2(u->ram + addr + 3), dst_addr = PEEK2(u->ram + addr + 5);
26-			int dst = (dst_page % (RAM_PAGES + 1)) * 0x10000;
27+			int i, value = u->ram[addr + 7];
28+			int length = PEEK2(u->ram + addr + 1);
29+			int dst_page = PEEK2(u->ram + addr + 3), dst_addr = PEEK2(u->ram + addr + 5);
30+			int dst = dst_page * 0x10000;
31 			for(i = 0; i < length; i++)
32-				uxn.ram[dst + (Uint16)(dst_addr + i)] = value;
33+				u->ram[dst + (Uint16)(dst_addr + i)] = value;
34 		} else if(u->ram[addr] == 0x1) {
35-			Uint16 i, length = PEEK2(u->ram + addr + 1);
36-			Uint16 a_page = PEEK2(u->ram + addr + 3), a_addr = PEEK2(u->ram + addr + 5);
37-			Uint16 b_page = PEEK2(u->ram + addr + 7), b_addr = PEEK2(u->ram + addr + 9);
38-			int src = (a_page % (RAM_PAGES + 1)) * 0x10000, dst = (b_page % (RAM_PAGES + 1)) * 0x10000;
39-			for(i = 0; i < length; i++)
40-				uxn.ram[dst + (Uint16)(b_addr + i)] = uxn.ram[src + (Uint16)(a_addr + i)];
41+			int i, j, length = PEEK2(u->ram + addr + 1);
42+			int a_page = PEEK2(u->ram + addr + 3), a_addr = PEEK2(u->ram + addr + 5);
43+			int b_page = PEEK2(u->ram + addr + 7), b_addr = PEEK2(u->ram + addr + 9);
44+			int src = a_page * 0x10000, dst = b_page * 0x10000;
45+			for(i = src + a_addr, j = dst + b_addr; i < src + a_addr + length; i++, j++)
46+				u->ram[j] = u->ram[i];
47 		} else if(u->ram[addr] == 0x2) {
48-			Uint16 i, length = PEEK2(u->ram + addr + 1);
49-			Uint16 a_page = PEEK2(u->ram + addr + 3), a_addr = PEEK2(u->ram + addr + 5);
50-			Uint16 b_page = PEEK2(u->ram + addr + 7), b_addr = PEEK2(u->ram + addr + 9);
51-			int src = (a_page % (RAM_PAGES + 1)) * 0x10000, dst = (b_page % (RAM_PAGES + 1)) * 0x10000;
52+			int i, length = PEEK2(u->ram + addr + 1);
53+			int a_page = PEEK2(u->ram + addr + 3), a_addr = PEEK2(u->ram + addr + 5);
54+			int b_page = PEEK2(u->ram + addr + 7), b_addr = PEEK2(u->ram + addr + 9);
55+			int src = a_page * 0x10000, dst = b_page * 0x10000;
56 			for(i = length - 1; i != 0xffff; i--)
57-				uxn.ram[dst + (Uint16)(b_addr + i)] = uxn.ram[src + (Uint16)(a_addr + i)];
58+				u->ram[dst + (Uint16)(b_addr + i)] = u->ram[src + (Uint16)(a_addr + i)];
59 		} else
60 			fprintf(stderr, "Unknown Expansion Command 0x%02x\n", u->ram[addr]);
61 		break;
+0, -1
1@@ -10,7 +10,6 @@ WITH REGARD TO THIS SOFTWARE.
2 */
3 
4 #define RAM_PAGES 0x10
5-#define BIOS_PAGE 0x10 * 0x10000
6 
7 void system_reboot(char *rom, int soft);
8 void system_inspect(void);
+3, -3
 1@@ -65,11 +65,11 @@
 2 
 3 @metaloc $1 &addr $2 &litport $2 &opc $1
 4 
 5-@metainit-cmd [ 01 0006 0000 0100 0010 =metaloc ]
 6+@metainit-cmd [ 01 0006 0001 0100 0000 =metaloc ]
 7 
 8-@metaload-cmd [ 01 0080 0000 &src $2 0010 =metadata ]
 9+@metaload-cmd [ 01 0080 0001 &src $2 0000 =metadata ]
10 
11-@iconload-cmd [ 01 0090 0000 &src $2 0010 =icon ]
12+@iconload-cmd [ 01 0090 0001 &src $2 0000 =icon ]
13 
14 (
15 @|drawing )