commit 390ae8138aa2363620a469207adda38a920e6b53
parent f14f7628931e2798dfefddfc08d956d554ffcd99
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date: Sat, 28 Jan 2023 15:05:24 -0800
Extend loaded rom size
Diffstat:
3 files changed, 5 insertions(+), 14 deletions(-)
diff --git 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
@@ -69,24 +69,16 @@ mmu_init(Mmu *m, Uint16 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
@@ -455,7 +455,6 @@ run(Uxn *u)
SDL_WaitEvent(NULL);
}
return error("SDL_WaitEvent", SDL_GetError());
- ;
}
int