commit c73712b
Devine Lu Linvega
·
2025-05-16 15:43:32 +0000 UTC
parent e5df4de
(uxncli) Print correct error when cycle count bust
1 files changed,
+8,
-6
+8,
-6
1@@ -158,13 +158,13 @@ system_load(Uint8 *ram, char *rom_path)
2 }
3
4 static int
5-system_boot(Uint8 *ram, char *rom_path, int has_args)
6+system_boot(char *rom_path, int has_args)
7 {
8- uxn.ram = ram;
9+ uxn.ram = (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8));
10 system_boot_path = rom_path;
11 uxn.dev[0x17] = has_args;
12- if(ram && system_load(uxn.ram + PAGE_PROGRAM, rom_path))
13- return uxn_eval(PAGE_PROGRAM);
14+ if(system_load(uxn.ram + PAGE_PROGRAM, rom_path))
15+ return 1;
16 return 0;
17 }
18
19@@ -703,11 +703,13 @@ main(int argc, char **argv)
20 {
21 int i = 1;
22 if(argc == 2 && argv[1][0] == '-' && argv[1][1] == 'v')
23- return !fprintf(stdout, "Uxn11 - Varvara Emulator(cli), 13 May 2025.\n");
24+ return !fprintf(stdout, "Uxn11 - Varvara Emulator(cli), 16 May 2025.\n");
25 else if(argc == 1)
26 return !fprintf(stdout, "usage: %s [-v] file.rom [args..]\n", argv[0]);
27- else if(!system_boot((Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++], argc > 2))
28+ else if(!system_boot(argv[i++], argc > 2))
29 return !fprintf(stdout, "Could not load %s.\n", argv[i - 1]);
30+ if(!uxn_eval(PAGE_PROGRAM))
31+ return !fprintf(stdout, "Exhausted cycles.\n");
32 if(console_vector) {
33 for(; i < argc; i++) {
34 char *p = argv[i];