Browse code

Hard-code vectors.

Andrew Alderwick authored on 28/03/2021 17:19:06
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;
... ...
@@ -464,7 +464,7 @@ int
464 464
 start(Uxn *u)
465 465
 {
466 466
 	int ticknext = 0;
467
-	evaluxn(u, u->vreset);
467
+	evaluxn(u, PAGE_VECTORS);
468 468
 	loadtheme(u->ram.dat + PAGE_DEVICE + 0x00f8);
469 469
 	if(screen.reqdraw)
470 470
 		redraw(pixels, u);
... ...
@@ -489,7 +489,7 @@ start(Uxn *u)
489 489
 				break;
490 490
 			}
491 491
 		}
492
-		evaluxn(u, u->vframe);
492
+		evaluxn(u, PAGE_VECTORS + 0x08);
493 493
 		if(screen.reqdraw)
494 494
 			redraw(pixels, u);
495 495
 	}
... ...
@@ -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];