mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-27 00:03:00 +00:00
Extend loaded rom size
This commit is contained in:
parent
f14f762893
commit
390ae8138a
3 changed files with 5 additions and 14 deletions
|
@ -170,7 +170,7 @@ file_init(UxnFile *c, char *filename, size_t max_len, int override_sandbox)
|
|||
}
|
||||
|
||||
static Uint16
|
||||
file_read(UxnFile *c, void *dest, Uint16 len)
|
||||
file_read(UxnFile *c, void *dest, int len)
|
||||
{
|
||||
if(c->outside_sandbox) return 0;
|
||||
if(c->state != FILE_READ && c->state != DIR_READ) {
|
||||
|
@ -288,7 +288,7 @@ load_rom(Uxn *u, char *filename)
|
|||
{
|
||||
int ret;
|
||||
file_init(uxn_file, filename, strlen(filename) + 1, 1);
|
||||
ret = file_read(uxn_file, &u->ram[PAGE_PROGRAM], 0x10000 - PAGE_PROGRAM);
|
||||
ret = file_read(uxn_file, &u->ram[PAGE_PROGRAM], 0x100000 - PAGE_PROGRAM);
|
||||
reset(uxn_file);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -68,25 +68,17 @@ mmu_init(Mmu *m, Uint16 pages)
|
|||
return m->pages;
|
||||
}
|
||||
|
||||
void
|
||||
mmu_copy(Uint8 *ram, Uint16 length, Uint16 src_page, Uint16 src_addr, Uint16 dst_page, Uint16 dst_addr)
|
||||
{
|
||||
Uint16 i;
|
||||
for(i = 0; i < length; i++) {
|
||||
ram[dst_page * 0x10000 + dst_addr + i] = ram[src_page * 0x10000 + src_addr + i];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mmu_eval(Uint8 *ram, Uint16 addr)
|
||||
{
|
||||
Uint16 a = addr;
|
||||
Uint16 a = addr, i = 0;
|
||||
Uint8 o = ram[a++];
|
||||
if(o == 1) {
|
||||
Uint16 length = (ram[a++] << 8) + ram[a++];
|
||||
Uint16 src_page = ((ram[a++] << 8) + ram[a++]) % 16, src_addr = (ram[a++] << 8) + ram[a++];
|
||||
Uint16 dst_page = ((ram[a++] << 8) + ram[a++]) % 16, dst_addr = (ram[a++] << 8) + ram[a];
|
||||
mmu_copy(ram, length, src_page, src_addr, dst_page, dst_addr);
|
||||
for(i = 0; i < length; i++)
|
||||
ram[dst_page * 0x10000 + dst_addr + i] = ram[src_page * 0x10000 + src_addr + i];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -455,7 +455,6 @@ run(Uxn *u)
|
|||
SDL_WaitEvent(NULL);
|
||||
}
|
||||
return error("SDL_WaitEvent", SDL_GetError());
|
||||
;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Reference in a new issue