Browse code

System now carries the debug flag, System/0xf is now stopping eval

neauoire authored on 28/07/2021 17:29:09
Showing 6 changed files
... ...
@@ -323,6 +323,8 @@ int
323 323
 evaluxn(Uxn *u, Uint16 vec)
324 324
 {
325 325
 	Uint8 instr;
326
+  if(u->dev[0].dat[0xf]) 
327
+    return 0;
326 328
 	u->ram.ptr = vec;
327 329
 	if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;
328 330
 	while(u->ram.ptr) {
... ...
@@ -231,6 +231,8 @@ int
231 231
 evaluxn(Uxn *u, Uint16 vec)
232 232
 {
233 233
 	Uint8 instr;
234
+	if(u->dev[0].dat[0xf]) 
235
+		return 0;
234 236
 	u->ram.ptr = vec;
235 237
 	if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;
236 238
 	while(u->ram.ptr) {
... ...
@@ -16,6 +16,8 @@
16 16
 %8//  { #03 SFT2 }
17 17
 %8**  { #30 SFT2 }
18 18
 
19
+%BREAKPOINT { #0101 #0e DEO2 }
20
+
19 21
 ( devices )
20 22
 
21 23
 |00 @System     [ &vector $2 &pad      $6 &r      $2 &g     $2 &b      $2 ]
... ...
@@ -132,6 +134,9 @@ BRK
132 134
 		#3b .octave LDZ #0c * + ;play JSR2 &no-b
133 135
 	DUP #6b ! ,&no-c2 JCN
134 136
 		#3c .octave LDZ #0c * + ;play JSR2 &no-c2
137
+	DUP #1b ! ,&no-esc JCN
138
+		BREAKPOINT
139
+		&no-esc
135 140
 	POP
136 141
 
137 142
 	( release )
... ...
@@ -55,6 +55,8 @@ int
55 55
 evaluxn(Uxn *u, Uint16 vec)
56 56
 {
57 57
 	Uint8 instr;
58
+	if(u->dev[0].dat[0xf]) 
59
+		return 0;
58 60
 	u->ram.ptr = vec;
59 61
 	if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;
60 62
 	while(u->ram.ptr) {
... ...
@@ -156,6 +156,8 @@ stepuxn(Uxn *u, Uint8 instr)
156 156
 int
157 157
 evaluxn(Uxn *u, Uint16 vec)
158 158
 {
159
+	if(u->dev[0].dat[0xf])
160
+		return 0;
159 161
 	u->ram.ptr = vec;
160 162
 	u->wst.error = 0;
161 163
 	u->rst.error = 0;
... ...
@@ -33,7 +33,7 @@ static Uint32 stdin_event;
33 33
 
34 34
 #define PAD 4
35 35
 
36
-static Uint8 zoom = 0, debug = 0, reqdraw = 0, bench = 0;
36
+static Uint8 zoom = 0, reqdraw = 0, bench = 0;
37 37
 
38 38
 static int
39 39
 clamp(int val, int min, int max)
... ...
@@ -64,7 +64,7 @@ audio_callback(void *u, Uint8 *stream, int len)
64 64
 static void
65 65
 redraw(Uxn *u)
66 66
 {
67
-	if(debug)
67
+	if(u->dev[0].dat[0xe])
68 68
 		inspect(&ppu, u->wst.dat, u->wst.ptr, u->rst.ptr, u->ram.dat);
69 69
 	SDL_UpdateTexture(bgTexture, &gRect, ppu.bg.pixels, ppu.width * sizeof(Uint32));
70 70
 	SDL_UpdateTexture(fgTexture, &gRect, ppu.fg.pixels, ppu.width * sizeof(Uint32));
... ...
@@ -78,7 +78,7 @@ redraw(Uxn *u)
78 78
 static void
79 79
 toggledebug(Uxn *u)
80 80
 {
81
-	debug = !debug;
81
+	u->dev[0].dat[0xe] = !u->dev[0].dat[0xe];
82 82
 	redraw(u);
83 83
 }
84 84
 
... ...
@@ -229,11 +229,11 @@ system_talk(Device *d, Uint8 b0, Uint8 w)
229 229
 	if(!w) {
230 230
 		d->dat[0x2] = d->u->wst.ptr;
231 231
 		d->dat[0x3] = d->u->rst.ptr;
232
-	} else {
232
+	} else if(b0 > 0x7 && b0 < 0xe) {
233 233
 		putcolors(&ppu, &d->dat[0x8]);
234 234
 		reqdraw = 1;
235
-	}
236
-	(void)b0;
235
+	} else if(b0 == 0xf)
236
+		d->u->ram.ptr = 0x0000;
237 237
 }
238 238
 
239 239
 static void
... ...
@@ -390,7 +390,7 @@ run(Uxn *u)
390 390
 			}
391 391
 		}
392 392
 		evaluxn(u, mempeek16(devscreen->dat, 0));
393
-		if(reqdraw)
393
+		if(reqdraw || u->dev[0].dat[0xe])
394 394
 			redraw(u);
395 395
 		if(!bench) {
396 396
 			elapsed = (SDL_GetPerformanceCounter() - start) / (double)SDL_GetPerformanceFrequency() * 1000.0f;