commit d3081fd93d6841a04d229129ecd9294bb699a45f
parent 15d09cf15b4d6f7bb811227fb45bd6825d3de244
Author: neauoire <aliceffekt@gmail.com>
Date: Sat, 19 Aug 2023 07:58:44 -0700
Zero ram on reboot
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/devices/system.c b/src/devices/system.c
@@ -89,8 +89,7 @@ system_version(Uxn *u, char *name, char *date)
}
void
-system_reboot(Uxn *u, char *rom, int soft)
-{
+system_boot(Uxn *u, int soft){
int i;
for(i = 0x100 * soft; i < 0x10000; i++)
u->ram[i] = 0;
@@ -98,6 +97,12 @@ system_reboot(Uxn *u, char *rom, int soft)
u->dev[i] = 0;
u->wst.ptr = 0;
u->rst.ptr = 0;
+}
+
+void
+system_reboot(Uxn *u, char *rom, int soft)
+{
+ system_boot(u, soft);
if(system_load(u, boot_rom))
if(uxn_eval(u, PAGE_PROGRAM))
boot_rom = rom;
@@ -107,6 +112,7 @@ int
system_init(Uxn *u, Uint8 *ram, char *rom)
{
u->ram = ram;
+ system_boot(u, 0);
if(!system_load(u, rom))
if(!system_load(u, "boot.rom"))
return system_error("Init", "Failed to load rom.");