mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-19 04:15:10 +00:00
Merge branch 'master' of git.sr.ht:~rabbits/uxn
This commit is contained in:
commit
b522da962e
8 changed files with 28 additions and 21 deletions
|
@ -48,12 +48,15 @@
|
||||||
|0140 ;Keys { key 1 }
|
|0140 ;Keys { key 1 }
|
||||||
|0150 ;Mouse { x 2 y 2 state 1 chord 1 }
|
|0150 ;Mouse { x 2 y 2 state 1 chord 1 }
|
||||||
|0160 ;File { pad 8 name 2 length 2 load 2 save 2 }
|
|0160 ;File { pad 8 name 2 length 2 load 2 save 2 }
|
||||||
|01F0 .RESET .FRAME .ERROR ( vectors )
|
|
||||||
|01F8 [ ed0f 3d0f 3d0f ] ( palette )
|
|01F8 [ ed0f 3d0f 3d0f ] ( palette )
|
||||||
|
|
||||||
|
|0200 ,RESET JMP2
|
||||||
|
|0204 ,ERROR JMP2
|
||||||
|
|0208 ,FRAME JMP2
|
||||||
|
|
||||||
( program )
|
( program )
|
||||||
|
|
||||||
|0200 @RESET
|
@RESET
|
||||||
|
|
||||||
( load file )
|
( load file )
|
||||||
,filepath ,load-file JSR2
|
,filepath ,load-file JSR2
|
||||||
|
|
|
@ -37,12 +37,15 @@
|
||||||
|0140 ;Keys { key 1 }
|
|0140 ;Keys { key 1 }
|
||||||
|0150 ;Mouse { x 2 y 2 state 1 chord 1 change 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 }
|
|0160 ;File { pad 8 name 2 length 2 load 2 save 2 }
|
||||||
|01F0 .RESET .FRAME .ERROR ( vectors )
|
|
||||||
|01F8 [ e0fc 30cc 30ac ] ( palette )
|
|01F8 [ e0fc 30cc 30ac ] ( palette )
|
||||||
|
|
||||||
|
|0200 ,RESET JMP2
|
||||||
|
|0204 ,ERROR JMP2
|
||||||
|
|0208 ,FRAME JMP2
|
||||||
|
|
||||||
( program )
|
( program )
|
||||||
|
|
||||||
|0200 @RESET
|
@RESET
|
||||||
|
|
||||||
~Screen.width 2/ #008a SUB2 =bankview.x
|
~Screen.width 2/ #008a SUB2 =bankview.x
|
||||||
~Screen.height 2/ #003f SUB2 =bankview.y
|
~Screen.height 2/ #003f SUB2 =bankview.y
|
||||||
|
|
|
@ -15,10 +15,13 @@
|
||||||
|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|
|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 }
|
|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 }
|
|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 )
|
|01F8 [ 13fd 1ef3 1bf2 ] ( palette )
|
||||||
|
|
||||||
|0200 @RESET
|
|0200 ,RESET JMP2
|
||||||
|
|0204 ,ERROR JMP2
|
||||||
|
|0208 ,FRAME JMP2
|
||||||
|
|
||||||
|
@RESET
|
||||||
#01 =fps.current
|
#01 =fps.current
|
||||||
|
|
||||||
#000c
|
#000c
|
||||||
|
|
|
@ -56,12 +56,15 @@
|
||||||
|0140 ;Keys { key 1 }
|
|0140 ;Keys { key 1 }
|
||||||
|0150 ;Mouse { x 2 y 2 state 1 chord 1 }
|
|0150 ;Mouse { x 2 y 2 state 1 chord 1 }
|
||||||
|0160 ;File { pad 8 name 2 length 2 load 2 save 2 }
|
|0160 ;File { pad 8 name 2 length 2 load 2 save 2 }
|
||||||
|01F0 .RESET .FRAME .ERROR ( vectors )
|
|
||||||
|01F8 [ e0fd 30fd 30fd ] ( palette )
|
|01F8 [ e0fd 30fd 30fd ] ( palette )
|
||||||
|
|
||||||
|
|0200 ,RESET JMP2
|
||||||
|
|0204 ,ERROR JMP2
|
||||||
|
|0208 ,FRAME JMP2
|
||||||
|
|
||||||
( program )
|
( program )
|
||||||
|
|
||||||
|0200 @RESET
|
@RESET
|
||||||
|
|
||||||
( default canvas )
|
( default canvas )
|
||||||
#002a =canvas.w #001a =canvas.h
|
#002a =canvas.w #001a =canvas.h
|
||||||
|
|
|
@ -93,11 +93,11 @@ int
|
||||||
start(Uxn *u)
|
start(Uxn *u)
|
||||||
{
|
{
|
||||||
printf("RESET --------\n");
|
printf("RESET --------\n");
|
||||||
if(!evaluxn(u, u->vreset))
|
if(!evaluxn(u, PAGE_VECTORS))
|
||||||
return error("Reset", "Failed");
|
return error("Reset", "Failed");
|
||||||
printstack(&u->wst);
|
printstack(&u->wst);
|
||||||
printf("FRAME --------\n");
|
printf("FRAME --------\n");
|
||||||
if(!evaluxn(u, u->vframe))
|
if(!evaluxn(u, PAGE_VECTORS + 0x08))
|
||||||
return error("Frame", "Failed");
|
return error("Frame", "Failed");
|
||||||
printstack(&u->wst);
|
printstack(&u->wst);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -424,6 +424,7 @@ datetime_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1)
|
||||||
Uint8 *m = u->ram.dat;
|
Uint8 *m = u->ram.dat;
|
||||||
time_t seconds = time(NULL);
|
time_t seconds = time(NULL);
|
||||||
struct tm *t = localtime(&seconds);
|
struct tm *t = localtime(&seconds);
|
||||||
|
(void)b0;
|
||||||
t->tm_year += 1900;
|
t->tm_year += 1900;
|
||||||
m[ptr + 0] = (t->tm_year & 0xff00) >> 8;
|
m[ptr + 0] = (t->tm_year & 0xff00) >> 8;
|
||||||
m[ptr + 1] = t->tm_year & 0xff;
|
m[ptr + 1] = t->tm_year & 0xff;
|
||||||
|
@ -465,7 +466,7 @@ int
|
||||||
start(Uxn *u)
|
start(Uxn *u)
|
||||||
{
|
{
|
||||||
int ticknext = 0;
|
int ticknext = 0;
|
||||||
evaluxn(u, u->vreset);
|
evaluxn(u, PAGE_VECTORS);
|
||||||
loadtheme(u->ram.dat + PAGE_DEVICE + 0x00f8);
|
loadtheme(u->ram.dat + PAGE_DEVICE + 0x00f8);
|
||||||
if(screen.reqdraw)
|
if(screen.reqdraw)
|
||||||
redraw(pixels, u);
|
redraw(pixels, u);
|
||||||
|
@ -490,7 +491,7 @@ start(Uxn *u)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
evaluxn(u, u->vframe);
|
evaluxn(u, PAGE_VECTORS + 0x08);
|
||||||
if(screen.reqdraw)
|
if(screen.reqdraw)
|
||||||
redraw(pixels, u);
|
redraw(pixels, u);
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,14 +188,7 @@ loaduxn(Uxn *u, char *filepath)
|
||||||
if(!(f = fopen(filepath, "rb")))
|
if(!(f = fopen(filepath, "rb")))
|
||||||
return haltuxn(u, "Missing input rom.", 0);
|
return haltuxn(u, "Missing input rom.", 0);
|
||||||
fread(u->ram.dat, sizeof(u->ram.dat), 1, f);
|
fread(u->ram.dat, sizeof(u->ram.dat), 1, f);
|
||||||
u->vreset = mempeek16(u, PAGE_DEVICE + 0x00f0);
|
printf("Uxn loaded[%s].\n", filepath);
|
||||||
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);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ typedef signed short Sint16;
|
||||||
#define FLAG_HALT 0x01
|
#define FLAG_HALT 0x01
|
||||||
#define FLAG_RETURN 0x04
|
#define FLAG_RETURN 0x04
|
||||||
#define PAGE_DEVICE 0x0100
|
#define PAGE_DEVICE 0x0100
|
||||||
|
#define PAGE_VECTORS 0x0200
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Uint8 ptr, error;
|
Uint8 ptr, error;
|
||||||
|
@ -39,7 +40,7 @@ typedef struct Device {
|
||||||
|
|
||||||
typedef struct Uxn {
|
typedef struct Uxn {
|
||||||
Uint8 literal, status, devices;
|
Uint8 literal, status, devices;
|
||||||
Uint16 counter, vreset, vframe, verror;
|
Uint16 counter;
|
||||||
Stack wst, rst, *src, *dst;
|
Stack wst, rst, *src, *dst;
|
||||||
Memory ram;
|
Memory ram;
|
||||||
Device dev[16];
|
Device dev[16];
|
||||||
|
|
Loading…
Reference in a new issue