0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-24 23:05:12 +00:00

(uxncli) Cleanup

This commit is contained in:
Devine Lu Linvega 2024-11-11 12:56:32 -08:00
parent 06ef423f58
commit ca42e1209d
3 changed files with 13 additions and 24 deletions

View file

@ -16,10 +16,9 @@ WITH REGARD TO THIS SOFTWARE.
/* clang-format on */
#define STEP_LIMIT 0x800000
#define PAGE_PROGRAM 0x0100
#define STEP_LIMIT 0x100000
typedef unsigned char Uint8;
typedef signed char Sint8;
typedef unsigned short Uint16;

View file

@ -8,7 +8,7 @@
#include "devices/datetime.h"
/*
Copyright (c) 2021-2023 Devine Lu Linvega, Andrew Alderwick
Copyright (c) 2021-2024 Devine Lu Linvega, Andrew Alderwick
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@ -19,6 +19,7 @@ WITH REGARD TO THIS SOFTWARE.
*/
Uxn uxn;
Uint8 ram[0x10000 * RAM_PAGES];
Uint8
emu_dei(Uint8 addr)
@ -55,28 +56,17 @@ emu_run(void)
}
}
static int
emu_end(void)
{
free(uxn.ram);
return uxn.dev[0x0f] & 0x7f;
}
int
main(int argc, char **argv)
{
int i = 1;
char *rom;
if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') {
fprintf(stdout, "Uxncli - Console Varvara Emulator, 19 Oct 2024.\n");
i++;
}
rom = i == argc ? "boot.rom" : argv[i++];
if(!system_boot((Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), rom))
if(argc > 1 && argv[1][0] == '-' && argv[1][1] == 'v')
fprintf(stdout, "Uxncli - Varvara Emulator, 11 Nov 2024.\n");
else if(argc == 1 || !system_boot(ram, argv[1]))
return !fprintf(stdout, "usage: %s [-v] file.rom [args..]\n", argv[0]);
/* Event Loop */
uxn.dev[0x17] = argc - i;
if(uxn_eval(PAGE_PROGRAM) && PEEK2(uxn.dev + 0x10))
console_listen(i, argc, argv), emu_run();
return emu_end();
else {
uxn.dev[0x17] = argc - 2;
if(uxn_eval(PAGE_PROGRAM) && PEEK2(uxn.dev + 0x10))
console_listen(2, argc, argv), emu_run();
}
return uxn.dev[0x0f] & 0x7f;
}

View file

@ -466,7 +466,7 @@ main(int argc, char **argv)
/* flags */
if(argc > 1 && argv[i][0] == '-') {
if(!strcmp(argv[i], "-v"))
return system_error("Uxnemu - Varvara Emulator(GUI)", "19 Oct 2024.");
return system_error("Uxnemu - Varvara Emulator", "11 Nov 2024.");
else if(!strcmp(argv[i], "-2x"))
set_zoom(2, 0);
else if(!strcmp(argv[i], "-3x"))