Removed loading routine

This commit is contained in:
Devine Lu Linvega 2024-01-10 12:54:52 -08:00
parent 12c3a8eecd
commit 46d7ca5cd9
1 changed files with 5 additions and 11 deletions

View File

@ -23,16 +23,6 @@ typedef struct Uxn {
int uxn_eval(Uxn *u, Uint16 pc);
int
system_load(Uxn *u, char *filename)
{
FILE *f = fopen(filename, "rb");
if(!f) return 0;
fread(&u->ram[0x0100], 0xff00, 1, f);
fclose(f);
return 1;
}
int
console_input(Uxn *u, char c, int type)
{
@ -161,14 +151,18 @@ main(int argc, char **argv)
{
int i = 1;
Uxn u = {0};
FILE *f;
if(i == argc) {
fprintf(stdout, "usage: %s file.rom [args..]\n", argv[0]);
return 0;
}
if(!system_load(&u, argv[i++])) {
f = fopen(argv[i++], "rb");
if(!f) {
fprintf(stderr, "Failed to initialize %s\n", argv[1]);
return 0;
}
fread(&u.ram[0x0100], 0xff00, 1, f);
fclose(f);
/* eval */
u.dev[0x17] = argc - i;
if(uxn_eval(&u, 0x0100)) {