Hard-code vectors.

This commit is contained in:
Andrew Alderwick 2021-03-28 18:19:06 +01:00
parent c2a5c8cac2
commit dad540651e
8 changed files with 27 additions and 21 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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];