From 9d889340ea73e1896043c68b8c292753d6292156 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 2 Feb 2023 08:45:03 -0800 Subject: [PATCH] Simplified system loading --- oquonie.rom | Bin 0 -> 114064 bytes src/devices/datetime.c | 2 +- src/devices/file.c | 36 ++++++++--------- src/devices/file.h | 1 - src/devices/system.c | 90 ++++++++++++++++++++++------------------- src/devices/system.h | 11 ++--- src/uxn11.c | 5 +-- src/uxncli.c | 9 ++--- 8 files changed, 76 insertions(+), 78 deletions(-) create mode 100644 oquonie.rom diff --git a/oquonie.rom b/oquonie.rom new file mode 100644 index 0000000000000000000000000000000000000000..411c572751716e52f34986ceccb420bcca7b959c GIT binary patch literal 114064 zcmeHw3t&{mx&PTmc0)+A;h`+gT_{z`wGu>0l#pHDy=`y73Zh`m0V`@o={JZF&9=9dbImX0U5!p5OG0JSfjEMC8G^3jQUgt3}5N zzo}GoeBsY<_L2vUluaJlI$R!19>3tumux{ zSLqGOv)cJz}S zUF3`V$Qe%A*~|2E`SYwnQ+&dhhaM@OcKa5 z58v}s_m3w}nR5S(=^5XjJk5PY-evA9a<3R62x3-9kQZERlXJSb1&e6@jZJoQ--|Zc z%YA;EEOXy~nJKX>q*GekZb9~n_J`$Pjg*Dq@^d3)^KgIn-STC5@^$iWkgAJQw2vd7 zDNCT+7LUay_d#BVP3{XP-zN8iGg%OA2hHH(7o4LkHZj}hH>oUJdZyLvw2GOfvLOGa zm+Z)uGjm1Lb4b6oZTf%jn0`{b^gl)V`EAo*(lPz0cImG~`degMZoXd_d$pV~T(*+e zf3=)GT+9fHw%_L-JS&GHLfc=~0n>CN&r{^7%Udb8~B77&GHt?4!XkG4;Lv&Ns&|3wt;*VD@;|H8HY zjIsW1)uM1KLccWmO@hB$y(rump4<~<6zp=YC!8+|>87XLY6Q(@#g%@+nt$cxK7Y4Y z<&}BnE^J|w_h**-!R7P*D4C=8MjrxSyG{+&Ci z$KZ+{gDZMWP8M3bC=9+tb_^Glzasf1qV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}LJ5b@1|d~vQQLNDfuLZK*5gGj;)*`^8wq`tF2 zD71l)4|z(Emv91=3Gde_|9JoX_l2pCmX#qR=?f}g@{oXqAN7r7VTdI81;hs+5|JDb zlZR|h0lfa9)PWxY;6?XI1&#~k6|j0K5Q0>Cn?)#K^;3Wuh41}TJqU^*;64u**b2d) z!He<>gtSrCC<2y_(B^n0bG#p6!IY+^$74mB>>My<c6yl@uS`HVJ8@_d)0lJ)E;S zzh3u)pDsV$ekVX|Fj651Xb>`q$~faD2Ac{on(Adi|5~ zY3Xz9ztrRtZfQ`Ia3Iwgj#eu7S|*R@vupXfYjTk?&D2_MmI+xcBKo7`I>CNQoeW$g)dsBIlzE3w^PSzLO=!+bva-G`b`$Wt4 z?``nW`-fRePgQPb_0F1#894Q(e3|Lii|>a$(AiQFM!e$97p1+{dm!-7wEu<0;Bqp1 zq2DuH0|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g8 z0|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g8 z0|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g8 z0|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g8 z0|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g8 z0|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g8 z0|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g8 z0|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g8 z0|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5g80|5hp{~-w2`b{TIY%VFl zHIl2CD_6yM_{^`xcl(NoLTUq}n4)?r8WO6a62+5(0H%junobVlPAiWw!-aEeXkct` zQ8bRl(=~bFlgd-Lyw4uirO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~i(f2TyJG&2ZoPGq zRC?>(I-Y1JjPx+K_a@dq)CsSSXS}$JCi~7fRXG6-1N{3c<<+xwSvbN__cFI2K>JMs z0R&K`_z*RJ`CI0yar(V0B4#VNx8=m~_lAyB6r2Ga+17Kx0@*A>she+3vzx8DcBgiS zUgTz}bQg!KbfeU|yZq)?1Tyo7rl^j`L5_|JN0!G>cl5pCs1i~&OY9BDnoQlvg zwr-JBwFP0iRZ~;5_stn^F8)+G@cU^>S*aw=l1BezP#*4YR@HeDnlKVt*lBf;7(NzN zr7c^N=#H@PYFyp$$Cdp)tBM_&Fz?a24WE6{nD27*>Vk7FaQc*|S8s>SfrEb%2qXP! zRn4-+OE+v7l@uu~sYmyVjde9u_ucLl>h`yMmS|ib6eO{z=&qkkk^;0NG^z-ypjb5R zlTbiVt;crEd^^ZacG~h_Ku~NO7R+gB!r5u~MbqeCCrtoNnlyeGN)8#STCuvk;aD~I zBl!Nly@zUR4%Mn#q9Jvk8p^oh!#CcT`o{0@`$uZ=-f+?Q|Mv; zRUL(qfq+nJ?tajB=-8+4#aZqXfrsDt-NSFJn)remF2Y|xoiu6EokgM~c#ywN4M;oC zvFs=W@`7J7xfIrL5eqMGmefGt=+9o*Fvq3{fq*KlLyfd6KQKnprtdC&Qo>OPH=s(8XavSn9%&L#oMB|#Zzy`JGgUiz5 z_{rjhI6W^~fkdm`K<*D8ZlSywrJ}dpHeu3FP<|D^C4}>pB{V%0O2t0gaA-6F^OB~< zS}H$U&_3j+9}%JQH&&O=e3_U3CwJa*+XN|qo4ov^a0|Cn4LiJA!P{jWSYZzxA literal 0 HcmV?d00001 diff --git a/src/devices/datetime.c b/src/devices/datetime.c index e7a9f86..41b0f7d 100644 --- a/src/devices/datetime.c +++ b/src/devices/datetime.c @@ -4,7 +4,7 @@ #include "datetime.h" /* -Copyright (c) 2021 Devine Lu Linvega, Andrew Alderwick +Copyright (c) 2021-2023 Devine Lu Linvega, Andrew Alderwick Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/src/devices/file.c b/src/devices/file.c index 18a518a..c5f3fbc 100644 --- a/src/devices/file.c +++ b/src/devices/file.c @@ -8,6 +8,11 @@ #include #include +#ifdef _WIN32 +#include +#define realpath(s, dummy) lrealpath(s) +#endif + #ifndef PATH_MAX #define PATH_MAX 4096 #endif @@ -16,7 +21,7 @@ #include "file.h" /* -Copyright (c) 2021 Devine Lu Linvega, Andrew Alderwick +Copyright (c) 2021-2023 Devine Lu Linvega, Andrew Alderwick Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -84,14 +89,17 @@ file_read_dir(UxnFile *c, char *dest, Uint16 len) continue; if(strcmp(c->de->d_name, "..") == 0) { /* hide "sandbox/.." */ - char cwd[PATH_MAX] = {'\0'}, t[PATH_MAX] = {'\0'}; + char cwd[PATH_MAX] = {'\0'}, *t; /* Note there's [currently] no way of chdir()ing from uxn, so $PWD * is always the sandbox top level. */ getcwd(cwd, sizeof(cwd)); /* We already checked that c->current_filename exists so don't need a wrapper. */ - realpath(c->current_filename, t); - if(strcmp(cwd, t) == 0) + t = realpath(c->current_filename, NULL); + if(strcmp(cwd, t) == 0) { + free(t); continue; + } + free(t); } if(strlen(c->current_filename) + 1 + strlen(c->de->d_name) < sizeof(pathname)) sprintf(pathname, "%s/%s", c->current_filename, c->de->d_name); @@ -108,7 +116,7 @@ file_read_dir(UxnFile *c, char *dest, Uint16 len) static char * retry_realpath(const char *file_name) { - char r[PATH_MAX] = {'\0'}, p[PATH_MAX] = {'\0'}, *x; + char *r, p[PATH_MAX] = {'\0'}, *x; if(file_name == NULL) { errno = EINVAL; return NULL; @@ -123,7 +131,7 @@ retry_realpath(const char *file_name) strcat(p, "/"); /* TODO: use a macro instead of '/' for the path delimiter */ } strcat(p, file_name); - while(realpath(p, r) == NULL) { + while((r = realpath(p, NULL)) == NULL) { if(errno != ENOENT) return NULL; x = strrchr(p, '/'); /* TODO: path delimiter macro */ @@ -132,7 +140,7 @@ retry_realpath(const char *file_name) else return NULL; } - return strdup(r); + return r; } static void @@ -168,7 +176,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) { @@ -278,15 +286,3 @@ file_dei(Uint8 id, Uint8 *d, Uint8 port) } return d[port]; } - -/* Boot */ - -int -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); - reset(uxn_file); - return ret; -} diff --git a/src/devices/file.h b/src/devices/file.h index 5edb9f5..2a6fa13 100644 --- a/src/devices/file.h +++ b/src/devices/file.h @@ -14,4 +14,3 @@ WITH REGARD TO THIS SOFTWARE. void file_deo(Uint8 id, Uint8 *ram, Uint8 *d, Uint8 port); Uint8 file_dei(Uint8 id, Uint8 *d, Uint8 port); -int load_rom(Uxn *u, char *filename); diff --git a/src/devices/system.c b/src/devices/system.c index 5339c41..214a1c7 100644 --- a/src/devices/system.c +++ b/src/devices/system.c @@ -39,6 +39,55 @@ system_inspect(Uxn *u) system_print(u->rst, "rst"); } +/* RAM */ + +void +system_cmd(Uint8 *ram, Uint16 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]; + for(i = 0; i < length; i++) + ram[dst_page * 0x10000 + dst_addr + i] = ram[src_page * 0x10000 + src_addr + i]; + } +} + +int +system_load(Uxn *u, char *filename) +{ + int l, i = 0; + FILE *f = fopen(filename, "rb"); + if(!f) + return 0; + l = fread(&u->ram[PAGE_PROGRAM], 1, 0x10000 - PAGE_PROGRAM, f); + while(l && ++i < RAM_PAGES) + l = fread(u->ram + 0x10000 * i, 1, 0x10000, f); + fclose(f); + return 1; +} + +/* IO */ + +void +system_deo(Uxn *u, Uint8 *d, Uint8 port) +{ + Uint16 a; + switch(port) { + case 0x3: + PEKDEV(a, 0x2); + system_cmd(u->ram, a); + break; + case 0xe: + if(u->wst->ptr || u->rst->ptr) system_inspect(u); + break; + } +} + +/* Error */ + int uxn_halt(Uxn *u, Uint8 instr, Uint8 err, Uint16 addr) { @@ -57,44 +106,3 @@ uxn_halt(Uxn *u, Uint8 instr, Uint8 err, Uint16 addr) } return 0; } - -/* MMU */ - -Uint8 * -mmu_init(Mmu *m, Uint16 pages) -{ - m->length = pages; - m->pages = (Uint8 *)calloc(0x10000 * pages, sizeof(Uint8)); - return m->pages; -} - -void -mmu_eval(Uint8 *ram, Uint16 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]; - for(i = 0; i < length; i++) - ram[dst_page * 0x10000 + dst_addr + i] = ram[src_page * 0x10000 + src_addr + i]; - } -} - -/* IO */ - -void -system_deo(Uxn *u, Uint8 *d, Uint8 port) -{ - Uint16 a; - switch(port) { - case 0x3: - PEKDEV(a, 0x2); - mmu_eval(u->ram, a); - break; - case 0xe: - if(u->wst->ptr || u->rst->ptr) system_inspect(u); - break; - } -} diff --git a/src/devices/system.h b/src/devices/system.h index 6be1005..87923e0 100644 --- a/src/devices/system.h +++ b/src/devices/system.h @@ -9,11 +9,8 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. */ -void system_inspect(Uxn *u); +#define RAM_PAGES 0x10 + +int system_load(Uxn *u, char *filename); void system_deo(Uxn *u, Uint8 *d, Uint8 port); - -typedef struct { - Uint8 length, *pages; -} Mmu; - -Uint8 *mmu_init(Mmu *m, Uint16 pages); +void system_inspect(Uxn *u); diff --git a/src/uxn11.c b/src/uxn11.c index 01dafa1..6b247b3 100644 --- a/src/uxn11.c +++ b/src/uxn11.c @@ -108,7 +108,7 @@ emu_draw(void) static int emu_start(Uxn *u, char *rom) { - if(!load_rom(u, rom)) + if(!system_load(u, rom)) return 0; if(!uxn_screen.width || !uxn_screen.height) screen_resize(&uxn_screen, WIDTH, HEIGHT); @@ -225,7 +225,6 @@ int main(int argc, char **argv) { Uxn u; - Mmu m; int i; char expirations[8]; struct pollfd fds[2]; @@ -233,7 +232,7 @@ main(int argc, char **argv) if(argc < 2) return emu_error("Usage", "uxn11 game.rom args"); rom_path = argv[1]; - if(!uxn_boot(&u, mmu_init(&m, 16), emu_dei, emu_deo)) + if(!uxn_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), emu_dei, emu_deo)) return emu_error("Boot", "Failed"); /* start sequence */ if(!emu_start(&u, rom_path)) diff --git a/src/uxncli.c b/src/uxncli.c index 94d7935..4d4b249 100644 --- a/src/uxncli.c +++ b/src/uxncli.c @@ -37,8 +37,8 @@ console_input(Uxn *u, char c) static void console_deo(Uint8 *d, Uint8 port) { - FILE *fd = port == 0x8 ? stdout : port == 0x9 ? stderr - : 0; + FILE *fd = port == 0x8 ? stdout : port == 0x9 ? stderr : + 0; if(fd) { fputc(d[port], fd); fflush(fd); @@ -78,12 +78,11 @@ main(int argc, char **argv) { Uxn u; int i; - Mmu mmu; if(argc < 2) return emu_error("Usage", "uxncli game.rom args"); - if(!uxn_boot(&u, mmu_init(&mmu, 16), emu_dei, emu_deo)) + if(!uxn_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), emu_dei, emu_deo)) return emu_error("Boot", "Failed"); - if(!load_rom(&u, argv[1])) + if(!system_load(&u, argv[1])) return emu_error("Load", "Failed"); if(!uxn_eval(&u, PAGE_PROGRAM)) return emu_error("Init", "Failed");