Use proper memory size
This commit is contained in:
parent
8fdb039926
commit
c866b0938a
|
@ -103,7 +103,7 @@ load(Uxn *u, char *filepath)
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int r;
|
int r;
|
||||||
if(!(f = fopen(filepath, "rb"))) return 0;
|
if(!(f = fopen(filepath, "rb"))) return 0;
|
||||||
r = fread(u->ram + PAGE_PROGRAM, 1, 0xffff - PAGE_PROGRAM, f);
|
r = fread(u->ram + PAGE_PROGRAM, 1, 0x10000 - PAGE_PROGRAM, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
if(r < 1) return 0;
|
if(r < 1) return 0;
|
||||||
fprintf(stderr, "Loaded %s\n", filepath);
|
fprintf(stderr, "Loaded %s\n", filepath);
|
||||||
|
@ -118,8 +118,8 @@ main(int argc, char **argv)
|
||||||
Uxn u;
|
Uxn u;
|
||||||
int i, loaded = 0;
|
int i, loaded = 0;
|
||||||
|
|
||||||
shadow = (Uint8 *)calloc(0xffff, sizeof(Uint8));
|
shadow = (Uint8 *)calloc(0x10000, sizeof(Uint8));
|
||||||
memory = (Uint8 *)calloc(0xffff, sizeof(Uint8));
|
memory = (Uint8 *)calloc(0x10000, sizeof(Uint8));
|
||||||
if(!uxn_boot(&u, memory, shadow + PAGE_DEV, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST)))
|
if(!uxn_boot(&u, memory, shadow + PAGE_DEV, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST)))
|
||||||
return error("Boot", "Failed");
|
return error("Boot", "Failed");
|
||||||
|
|
||||||
|
|
|
@ -238,7 +238,7 @@ load(Uxn *u, char *rom)
|
||||||
SDL_RWops *f;
|
SDL_RWops *f;
|
||||||
int r;
|
int r;
|
||||||
if(!(f = SDL_RWFromFile(rom, "rb"))) return 0;
|
if(!(f = SDL_RWFromFile(rom, "rb"))) return 0;
|
||||||
r = f->read(f, u->ram + PAGE_PROGRAM, 1, 0xffff - PAGE_PROGRAM);
|
r = f->read(f, u->ram + PAGE_PROGRAM, 1, 0x10000 - PAGE_PROGRAM);
|
||||||
f->close(f);
|
f->close(f);
|
||||||
if(r < 1) return 0;
|
if(r < 1) return 0;
|
||||||
fprintf(stderr, "Loaded %s\n", rom);
|
fprintf(stderr, "Loaded %s\n", rom);
|
||||||
|
@ -251,8 +251,8 @@ static Uint8 *shadow, *memory;
|
||||||
static int
|
static int
|
||||||
start(Uxn *u, char *rom)
|
start(Uxn *u, char *rom)
|
||||||
{
|
{
|
||||||
memory = (Uint8 *)calloc(0xffff, sizeof(Uint8));
|
memory = (Uint8 *)calloc(0x10000, sizeof(Uint8));
|
||||||
shadow = (Uint8 *)calloc(0xffff, sizeof(Uint8));
|
shadow = (Uint8 *)calloc(0x10000, sizeof(Uint8));
|
||||||
|
|
||||||
if(!uxn_boot(&supervisor, shadow, shadow + VISOR_DEV, (Stack *)(shadow + VISOR_WST), (Stack *)(shadow + VISOR_RST)))
|
if(!uxn_boot(&supervisor, shadow, shadow + VISOR_DEV, (Stack *)(shadow + VISOR_WST), (Stack *)(shadow + VISOR_RST)))
|
||||||
return error("Boot", "Failed to start uxn.");
|
return error("Boot", "Failed to start uxn.");
|
||||||
|
|
Loading…
Reference in New Issue