commit 2d959ad

Devine Lu Linvega  ·  2025-01-21 23:55:51 +0000 UTC
parent 160ba61
Made console_vector public
4 files changed,  +10, -8
+2, -6
 1@@ -191,16 +191,12 @@ close_console(void)
 2 	kill_child();
 3 }
 4 
 5-/* console registers */
 6-
 7-static int rVECTOR;
 8-
 9 int
10 console_input(int c, int type)
11 {
12 	if(c == EOF) c = 0, type = 4;
13 	uxn.dev[0x12] = c, uxn.dev[0x17] = type;
14-	uxn_eval(rVECTOR);
15+	uxn_eval(console_vector);
16 	return type != 4;
17 }
18 
19@@ -230,7 +226,7 @@ console_deo(Uint8 addr)
20 {
21 	FILE *fd;
22 	switch(addr) {
23-	case 0x11: rVECTOR = PEEK2(&uxn.dev[0x10]); return;
24+	case 0x11: console_vector = PEEK2(&uxn.dev[0x10]); return;
25 	case 0x18: fd = stdout, fputc(uxn.dev[0x18], fd), fflush(fd); break;
26 	case 0x19: fd = stderr, fputc(uxn.dev[0x19], fd), fflush(fd); break;
27 	case CMD_EXEC: start_fork(); break;
+2, -0
1@@ -19,3 +19,5 @@ int console_input(int c, int type);
2 void console_arguments(int i, int argc, char **argv);
3 Uint8 console_dei(Uint8 addr);
4 void console_deo(Uint8 addr);
5+
6+extern int console_vector;
+1, -0
1@@ -18,6 +18,7 @@
2 #include "devices/datetime.h"
3 
4 Uxn uxn;
5+int console_vector;
6 
7 /*
8 Copyright (c) 2022-2025 Devine Lu Linvega
+5, -2
 1@@ -19,6 +19,7 @@ WITH REGARD TO THIS SOFTWARE.
 2 */
 3 
 4 Uxn uxn;
 5+int console_vector;
 6 
 7 Uint8
 8 emu_dei(Uint8 addr)
 9@@ -52,7 +53,9 @@ main(int argc, char **argv)
10 		return !fprintf(stdout, "usage: %s [-v] file.rom [args..]\n", argv[0]);
11 	else if(!system_boot((Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++], argc > 2))
12 		return !fprintf(stdout, "Could not load %s.\n", argv[i - 1]);
13-	console_arguments(i, argc, argv);
14-	while(!uxn.dev[0x0f] && console_input(fgetc(stdin), 0x1));
15+	if(console_vector) {
16+		console_arguments(i, argc, argv);
17+		while(!uxn.dev[0x0f] && console_input(fgetc(stdin), 0x1));
18+	}
19 	return uxn.dev[0x0f] & 0x7f;
20 }