Browse Source

Use proper memory size

aarch64^2
neauoire 4 years ago
parent
commit
c866b0938a
  1. 6
      src/uxncli.c
  2. 6
      src/uxnemu.c

6
src/uxncli.c

@ -103,7 +103,7 @@ load(Uxn *u, char *filepath)
FILE *f;
int r;
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);
if(r < 1) return 0;
fprintf(stderr, "Loaded %s\n", filepath);
@ -118,8 +118,8 @@ main(int argc, char **argv)
Uxn u;
int i, loaded = 0;
shadow = (Uint8 *)calloc(0xffff, sizeof(Uint8));
memory = (Uint8 *)calloc(0xffff, sizeof(Uint8));
shadow = (Uint8 *)calloc(0x10000, sizeof(Uint8));
memory = (Uint8 *)calloc(0x10000, sizeof(Uint8));
if(!uxn_boot(&u, memory, shadow + PAGE_DEV, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST)))
return error("Boot", "Failed");

6
src/uxnemu.c

@ -238,7 +238,7 @@ load(Uxn *u, char *rom)
SDL_RWops *f;
int r;
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);
if(r < 1) return 0;
fprintf(stderr, "Loaded %s\n", rom);
@ -251,8 +251,8 @@ static Uint8 *shadow, *memory;
static int
start(Uxn *u, char *rom)
{
memory = (Uint8 *)calloc(0xffff, sizeof(Uint8));
shadow = (Uint8 *)calloc(0xffff, sizeof(Uint8));
memory = (Uint8 *)calloc(0x10000, sizeof(Uint8));
shadow = (Uint8 *)calloc(0x10000, sizeof(Uint8));
if(!uxn_boot(&supervisor, shadow, shadow + VISOR_DEV, (Stack *)(shadow + VISOR_WST), (Stack *)(shadow + VISOR_RST)))
return error("Boot", "Failed to start uxn.");

Loading…
Cancel
Save