uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit b522da962e663a7aaf2809e83ac4028481b4470c
parent ebdb079cae3b90e4ad9b70535d19e44ecf80508c
Author: neauoire <aliceffekt@gmail.com>
Date:   Sun, 28 Mar 2021 10:20:34 -0700

Merge branch 'master' of git.sr.ht:~rabbits/uxn

Diffstat:
Mprojects/software/left.usm | 7+++++--
Mprojects/software/nasu.usm | 7+++++--
Mprojects/software/neralie.usm | 7+++++--
Mprojects/software/noodle.usm | 7+++++--
Msrc/debugger.c | 4++--
Msrc/emulator.c | 5+++--
Msrc/uxn.c | 9+--------
Msrc/uxn.h | 3++-
8 files changed, 28 insertions(+), 21 deletions(-)

diff --git a/projects/software/left.usm b/projects/software/left.usm @@ -48,12 +48,15 @@ |0140 ;Keys { key 1 } |0150 ;Mouse { x 2 y 2 state 1 chord 1 } |0160 ;File { pad 8 name 2 length 2 load 2 save 2 } -|01F0 .RESET .FRAME .ERROR ( vectors ) |01F8 [ ed0f 3d0f 3d0f ] ( palette ) +|0200 ,RESET JMP2 +|0204 ,ERROR JMP2 +|0208 ,FRAME JMP2 + ( program ) -|0200 @RESET +@RESET ( load file ) ,filepath ,load-file JSR2 diff --git a/projects/software/nasu.usm b/projects/software/nasu.usm @@ -37,12 +37,15 @@ |0140 ;Keys { key 1 } |0150 ;Mouse { x 2 y 2 state 1 chord 1 change 1 } |0160 ;File { pad 8 name 2 length 2 load 2 save 2 } -|01F0 .RESET .FRAME .ERROR ( vectors ) |01F8 [ e0fc 30cc 30ac ] ( palette ) +|0200 ,RESET JMP2 +|0204 ,ERROR JMP2 +|0208 ,FRAME JMP2 + ( program ) -|0200 @RESET +@RESET ~Screen.width 2/ #008a SUB2 =bankview.x ~Screen.height 2/ #003f SUB2 =bankview.y diff --git a/projects/software/neralie.usm b/projects/software/neralie.usm @@ -15,10 +15,13 @@ |0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 } |0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 } |0190 ;DateTime { year 2 month 1 day 1 hour 1 minute 1 second 1 dow 1 doy 2 isdst 1 pad 4 get 1 } -|01F0 .RESET .FRAME .ERROR ( vectors ) |01F8 [ 13fd 1ef3 1bf2 ] ( palette ) -|0200 @RESET +|0200 ,RESET JMP2 +|0204 ,ERROR JMP2 +|0208 ,FRAME JMP2 + +@RESET #01 =fps.current #000c diff --git a/projects/software/noodle.usm b/projects/software/noodle.usm @@ -56,12 +56,15 @@ |0140 ;Keys { key 1 } |0150 ;Mouse { x 2 y 2 state 1 chord 1 } |0160 ;File { pad 8 name 2 length 2 load 2 save 2 } -|01F0 .RESET .FRAME .ERROR ( vectors ) |01F8 [ e0fd 30fd 30fd ] ( palette ) +|0200 ,RESET JMP2 +|0204 ,ERROR JMP2 +|0208 ,FRAME JMP2 + ( program ) -|0200 @RESET +@RESET ( default canvas ) #002a =canvas.w #001a =canvas.h diff --git a/src/debugger.c b/src/debugger.c @@ -93,11 +93,11 @@ int start(Uxn *u) { printf("RESET --------\n"); - if(!evaluxn(u, u->vreset)) + if(!evaluxn(u, PAGE_VECTORS)) return error("Reset", "Failed"); printstack(&u->wst); printf("FRAME --------\n"); - if(!evaluxn(u, u->vframe)) + if(!evaluxn(u, PAGE_VECTORS + 0x08)) return error("Frame", "Failed"); printstack(&u->wst); return 1; diff --git a/src/emulator.c b/src/emulator.c @@ -424,6 +424,7 @@ datetime_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1) Uint8 *m = u->ram.dat; time_t seconds = time(NULL); struct tm *t = localtime(&seconds); + (void)b0; t->tm_year += 1900; m[ptr + 0] = (t->tm_year & 0xff00) >> 8; m[ptr + 1] = t->tm_year & 0xff; @@ -465,7 +466,7 @@ int start(Uxn *u) { int ticknext = 0; - evaluxn(u, u->vreset); + evaluxn(u, PAGE_VECTORS); loadtheme(u->ram.dat + PAGE_DEVICE + 0x00f8); if(screen.reqdraw) redraw(pixels, u); @@ -490,7 +491,7 @@ start(Uxn *u) break; } } - evaluxn(u, u->vframe); + evaluxn(u, PAGE_VECTORS + 0x08); if(screen.reqdraw) redraw(pixels, u); } diff --git a/src/uxn.c b/src/uxn.c @@ -188,14 +188,7 @@ loaduxn(Uxn *u, char *filepath) if(!(f = fopen(filepath, "rb"))) return haltuxn(u, "Missing input rom.", 0); fread(u->ram.dat, sizeof(u->ram.dat), 1, f); - u->vreset = mempeek16(u, PAGE_DEVICE + 0x00f0); - u->vframe = mempeek16(u, PAGE_DEVICE + 0x00f2); - u->verror = mempeek16(u, PAGE_DEVICE + 0x00f4); - printf("Uxn loaded[%s] vrst:%04x vfrm:%04x verr:%04x.\n", - filepath, - u->vreset, - u->vframe, - u->verror); + printf("Uxn loaded[%s].\n", filepath); return 1; } diff --git a/src/uxn.h b/src/uxn.h @@ -19,6 +19,7 @@ typedef signed short Sint16; #define FLAG_HALT 0x01 #define FLAG_RETURN 0x04 #define PAGE_DEVICE 0x0100 +#define PAGE_VECTORS 0x0200 typedef struct { Uint8 ptr, error; @@ -39,7 +40,7 @@ typedef struct Device { typedef struct Uxn { Uint8 literal, status, devices; - Uint16 counter, vreset, vframe, verror; + Uint16 counter; Stack wst, rst, *src, *dst; Memory ram; Device dev[16];