diff --git a/src/devices/file.c b/src/devices/file.c index 08b39e9..549b963 100644 --- a/src/devices/file.c +++ b/src/devices/file.c @@ -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; } diff --git a/src/devices/system.c b/src/devices/system.c index 8488056..5339c41 100644 --- a/src/devices/system.c +++ b/src/devices/system.c @@ -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]; } } diff --git a/src/uxnemu.c b/src/uxnemu.c index c4bc7a4..4811138 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -455,7 +455,6 @@ run(Uxn *u) SDL_WaitEvent(NULL); } return error("SDL_WaitEvent", SDL_GetError()); - ; } int