commit dad540651eb2a76671ad7876f43f0f0537c078da
parent c2a5c8cac27755fe0bc7b5e55c81c6d02243e7a8
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date: Sun, 28 Mar 2021 18:19:06 +0100
Hard-code vectors.
Diffstat:
8 files changed, 27 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
@@ -464,7 +464,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);
@@ -489,7 +489,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];