(ref) Removed malloc
This commit is contained in:
parent
6e92c7aaae
commit
12c3a8eecd
15
ref/uxn.c
15
ref/uxn.c
|
@ -17,7 +17,7 @@ typedef struct {
|
|||
} Stack;
|
||||
|
||||
typedef struct Uxn {
|
||||
Uint8 *ram, dev[0x100];
|
||||
Uint8 ram[0x10000], dev[0x100];
|
||||
Stack wst, rst;
|
||||
} Uxn;
|
||||
|
||||
|
@ -33,16 +33,6 @@ system_load(Uxn *u, char *filename)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
system_init(Uxn *u, Uint8 *ram, char *rom)
|
||||
{
|
||||
u->ram = ram;
|
||||
if(!system_load(u, rom))
|
||||
if(!system_load(u, "boot.rom"))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
console_input(Uxn *u, char c, int type)
|
||||
{
|
||||
|
@ -175,7 +165,7 @@ main(int argc, char **argv)
|
|||
fprintf(stdout, "usage: %s file.rom [args..]\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
if(!system_init(&u, (Uint8 *)calloc(0x10000, sizeof(Uint8)), argv[i++])) {
|
||||
if(!system_load(&u, argv[i++])) {
|
||||
fprintf(stderr, "Failed to initialize %s\n", argv[1]);
|
||||
return 0;
|
||||
}
|
||||
|
@ -192,6 +182,5 @@ main(int argc, char **argv)
|
|||
console_input(&u, (Uint8)c, 0x1);
|
||||
}
|
||||
}
|
||||
free(u.ram);
|
||||
return u.dev[0x0f] & 0x7f;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue