Browse code

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

neauoire authored on 28/03/2021 17:20:34
Showing 8 changed files
... ...
@@ -48,12 +48,15 @@
48 48
 |0140 ;Keys { key 1 }
49 49
 |0150 ;Mouse { x 2 y 2 state 1 chord 1 }
50 50
 |0160 ;File { pad 8 name 2 length 2 load 2 save 2 }
51
-|01F0 .RESET .FRAME .ERROR ( vectors )
52 51
 |01F8 [ ed0f 3d0f 3d0f ]   ( palette )
53 52
 
53
+|0200 ,RESET JMP2
54
+|0204 ,ERROR JMP2
55
+|0208 ,FRAME JMP2
56
+
54 57
 ( program )
55 58
 
56
-|0200 @RESET
59
+@RESET
57 60
 	
58 61
 	( load file )
59 62
 	,filepath ,load-file JSR2
... ...
@@ -37,12 +37,15 @@
37 37
 |0140 ;Keys { key 1 }
38 38
 |0150 ;Mouse { x 2 y 2 state 1 chord 1 change 1 }
39 39
 |0160 ;File { pad 8 name 2 length 2 load 2 save 2 }
40
-|01F0 .RESET .FRAME .ERROR ( vectors )
41 40
 |01F8 [ e0fc 30cc 30ac ] ( palette )
42 41
 
42
+|0200 ,RESET JMP2
43
+|0204 ,ERROR JMP2
44
+|0208 ,FRAME JMP2
45
+
43 46
 ( program )
44 47
 
45
-|0200 @RESET
48
+@RESET
46 49
 	
47 50
 	~Screen.width 2/ #008a SUB2 =bankview.x 
48 51
 	~Screen.height 2/ #003f SUB2 =bankview.y 
... ...
@@ -15,10 +15,13 @@
15 15
 |0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
16 16
 |0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
17 17
 |0190 ;DateTime { year 2 month 1 day 1 hour 1 minute 1 second 1 dow 1 doy 2 isdst 1 pad 4 get 1 }
18
-|01F0 .RESET .FRAME .ERROR ( vectors )
19 18
 |01F8 [ 13fd 1ef3 1bf2 ] ( palette )
20 19
 
21
-|0200 @RESET
20
+|0200 ,RESET JMP2
21
+|0204 ,ERROR JMP2
22
+|0208 ,FRAME JMP2
23
+
24
+@RESET
22 25
 	#01 =fps.current
23 26
 
24 27
 	#000c
... ...
@@ -56,12 +56,15 @@
56 56
 |0140 ;Keys { key 1 }
57 57
 |0150 ;Mouse { x 2 y 2 state 1 chord 1 }
58 58
 |0160 ;File { pad 8 name 2 length 2 load 2 save 2 }
59
-|01F0 .RESET .FRAME .ERROR ( vectors )
60 59
 |01F8 [ e0fd 30fd 30fd ]   ( palette )
61 60
 
61
+|0200 ,RESET JMP2
62
+|0204 ,ERROR JMP2
63
+|0208 ,FRAME JMP2
64
+
62 65
 ( program )
63 66
 
64
-|0200 @RESET 
67
+@RESET 
65 68
 	
66 69
 	( default canvas )
67 70
 	#002a =canvas.w #001a =canvas.h
... ...
@@ -93,11 +93,11 @@ int
93 93
 start(Uxn *u)
94 94
 {
95 95
 	printf("RESET --------\n");
96
-	if(!evaluxn(u, u->vreset))
96
+	if(!evaluxn(u, PAGE_VECTORS))
97 97
 		return error("Reset", "Failed");
98 98
 	printstack(&u->wst);
99 99
 	printf("FRAME --------\n");
100
-	if(!evaluxn(u, u->vframe))
100
+	if(!evaluxn(u, PAGE_VECTORS + 0x08))
101 101
 		return error("Frame", "Failed");
102 102
 	printstack(&u->wst);
103 103
 	return 1;
... ...
@@ -424,6 +424,7 @@ datetime_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1)
424 424
 	Uint8 *m = u->ram.dat;
425 425
 	time_t seconds = time(NULL);
426 426
 	struct tm *t = localtime(&seconds);
427
+	(void)b0;
427 428
 	t->tm_year += 1900;
428 429
 	m[ptr + 0] = (t->tm_year & 0xff00) >> 8;
429 430
 	m[ptr + 1] = t->tm_year & 0xff;
... ...
@@ -465,7 +466,7 @@ int
465 466
 start(Uxn *u)
466 467
 {
467 468
 	int ticknext = 0;
468
-	evaluxn(u, u->vreset);
469
+	evaluxn(u, PAGE_VECTORS);
469 470
 	loadtheme(u->ram.dat + PAGE_DEVICE + 0x00f8);
470 471
 	if(screen.reqdraw)
471 472
 		redraw(pixels, u);
... ...
@@ -490,7 +491,7 @@ start(Uxn *u)
490 491
 				break;
491 492
 			}
492 493
 		}
493
-		evaluxn(u, u->vframe);
494
+		evaluxn(u, PAGE_VECTORS + 0x08);
494 495
 		if(screen.reqdraw)
495 496
 			redraw(pixels, u);
496 497
 	}
... ...
@@ -188,14 +188,7 @@ loaduxn(Uxn *u, char *filepath)
188 188
 	if(!(f = fopen(filepath, "rb")))
189 189
 		return haltuxn(u, "Missing input rom.", 0);
190 190
 	fread(u->ram.dat, sizeof(u->ram.dat), 1, f);
191
-	u->vreset = mempeek16(u, PAGE_DEVICE + 0x00f0);
192
-	u->vframe = mempeek16(u, PAGE_DEVICE + 0x00f2);
193
-	u->verror = mempeek16(u, PAGE_DEVICE + 0x00f4);
194
-	printf("Uxn loaded[%s] vrst:%04x vfrm:%04x verr:%04x.\n",
195
-		filepath,
196
-		u->vreset,
197
-		u->vframe,
198
-		u->verror);
191
+	printf("Uxn loaded[%s].\n", filepath);
199 192
 	return 1;
200 193
 }
201 194
 
... ...
@@ -19,6 +19,7 @@ typedef signed short Sint16;
19 19
 #define FLAG_HALT 0x01
20 20
 #define FLAG_RETURN 0x04
21 21
 #define PAGE_DEVICE 0x0100
22
+#define PAGE_VECTORS 0x0200
22 23
 
23 24
 typedef struct {
24 25
 	Uint8 ptr, error;
... ...
@@ -39,7 +40,7 @@ typedef struct Device {
39 40
 
40 41
 typedef struct Uxn {
41 42
 	Uint8 literal, status, devices;
42
-	Uint16 counter, vreset, vframe, verror;
43
+	Uint16 counter;
43 44
 	Stack wst, rst, *src, *dst;
44 45
 	Memory ram;
45 46
 	Device dev[16];