commit b3c68a1

neauoire  ·  2023-08-19 14:59:18 +0000 UTC
parent 2e2f8df
Zero ram on reboot
1 files changed,  +8, -2
+8, -2
 1@@ -89,8 +89,7 @@ system_version(Uxn *u, char *name, char *date)
 2 }
 3 
 4 void
 5-system_reboot(Uxn *u, char *rom, int soft)
 6-{
 7+system_boot(Uxn *u, int soft){
 8 	int i;
 9 	for(i = 0x100 * soft; i < 0x10000; i++)
10 		u->ram[i] = 0;
11@@ -98,6 +97,12 @@ system_reboot(Uxn *u, char *rom, int soft)
12 		u->dev[i] = 0;
13 	u->wst.ptr = 0;
14 	u->rst.ptr = 0;
15+}
16+
17+void
18+system_reboot(Uxn *u, char *rom, int soft)
19+{
20+	system_boot(u, soft);
21 	if(system_load(u, boot_rom))
22 		if(uxn_eval(u, PAGE_PROGRAM))
23 			boot_rom = rom;
24@@ -107,6 +112,7 @@ int
25 system_init(Uxn *u, Uint8 *ram, char *rom)
26 {
27 	u->ram = ram;
28+	system_boot(u, 0);
29 	if(!system_load(u, rom))
30 		if(!system_load(u, "boot.rom"))
31 			return system_error("Init", "Failed to load rom.");