Browse code

Added mock behavior for the friend port

Devine Lu Linvega authored on 02/05/2023 17:31:33
Showing 3 changed files
... ...
@@ -83,6 +83,13 @@ system_deo(Uxn *u, Uint8 *d, Uint8 port)
83 83
 	case 0x3:
84 84
 		system_cmd(u->ram, PEEK2(d + 2));
85 85
 		break;
86
+	case 0x5:
87
+		if(PEEK2(d + 4)){
88
+			Uxn friend;
89
+			uxn_boot(&friend, u->ram);
90
+			uxn_eval(&friend, PEEK2(d + 4));
91
+		}
92
+		break;
86 93
 	case 0xe:
87 94
 		system_inspect(u);
88 95
 		break;
... ...
@@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
17 17
 WITH REGARD TO THIS SOFTWARE.
18 18
 */
19 19
 
20
-Uint16 deo_mask[] = {0x6a08, 0x0300, 0xc028, 0x8000, 0x8000, 0x8000, 0x8000, 0x0000, 0x0000, 0x0000, 0xa260, 0xa260, 0x0000, 0x0000, 0x0000, 0x0000};
20
+Uint16 deo_mask[] = {0xc028, 0x0300, 0xc028, 0x8000, 0x8000, 0x8000, 0x8000, 0x0000, 0x0000, 0x0000, 0xa260, 0xa260, 0x0000, 0x0000, 0x0000, 0x0000};
21 21
 Uint16 dei_mask[] = {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x07ff, 0x0000, 0x0000, 0x0000};
22 22
 
23 23
 Uint8
... ...
@@ -53,16 +53,17 @@ main(int argc, char **argv)
53 53
 	if(!system_load(&u, argv[i++]))
54 54
 		return system_error("Load", "Failed");
55 55
 	u.dev[0x17] = argc - i;
56
-	if(!uxn_eval(&u, PAGE_PROGRAM))
57
-		return u.dev[0x0f] & 0x7f;
58
-	for(; i < argc; i++) {
59
-		char *p = argv[i];
60
-		while(*p) console_input(&u, *p++, CONSOLE_ARG);
61
-		console_input(&u, '\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA);
62
-	}
63
-	while(!u.dev[0x0f]) {
64
-		int c = fgetc(stdin);
65
-		if(c != EOF) console_input(&u, (Uint8)c, CONSOLE_STD);
56
+	if(uxn_eval(&u, PAGE_PROGRAM)) {
57
+		for(; i < argc; i++) {
58
+			char *p = argv[i];
59
+			while(*p) console_input(&u, *p++, CONSOLE_ARG);
60
+			console_input(&u, '\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA);
61
+		}
62
+		while(!u.dev[0x0f]) {
63
+			int c = fgetc(stdin);
64
+			if(c != EOF) console_input(&u, (Uint8)c, CONSOLE_STD);
65
+		}
66 66
 	}
67
+	free(u.ram);
67 68
 	return u.dev[0x0f] & 0x7f;
68 69
 }
... ...
@@ -41,7 +41,7 @@ WITH REGARD TO THIS SOFTWARE.
41 41
 
42 42
 #define WIDTH 64 * 8
43 43
 #define HEIGHT 40 * 8
44
-#define PAD 4
44
+#define PAD 2
45 45
 #define TIMEOUT_MS 334
46 46
 #define BENCH 0
47 47
 
... ...
@@ -52,7 +52,7 @@ static SDL_AudioDeviceID audio_id;
52 52
 static SDL_Rect gRect;
53 53
 static SDL_Thread *stdin_thread;
54 54
 
55
-Uint16 deo_mask[] = {0xff08, 0x0300, 0xc028, 0x8000, 0x8000, 0x8000, 0x8000, 0x0000, 0x0000, 0x0000, 0xa260, 0xa260, 0x0000, 0x0000, 0x0000, 0x0000};
55
+Uint16 deo_mask[] = {0xff28, 0x0300, 0xc028, 0x8000, 0x8000, 0x8000, 0x8000, 0x0000, 0x0000, 0x0000, 0xa260, 0xa260, 0x0000, 0x0000, 0x0000, 0x0000};
56 56
 Uint16 dei_mask[] = {0x0000, 0x0000, 0x003c, 0x0014, 0x0014, 0x0014, 0x0014, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x07ff, 0x0000, 0x0000, 0x0000};
57 57
 
58 58
 /* devices */