commit 44c501b

Devine Lu Linvega  ·  2024-07-01 15:53:37 +0000 UTC
parent ed24273
Removed memory passing in console_deo
4 files changed,  +10, -15
+7, -12
 1@@ -214,18 +214,13 @@ console_dei(Uint8 addr)
 2 }
 3 
 4 void
 5-console_deo(Uint8 port)
 6+console_deo(Uint8 addr)
 7 {
 8-	FILE *fd = NULL;
 9-	Uint8 *d = &uxn.dev[0x10];
10-	switch(port) {
11-	case 0x5: /* Console/dead */ start_fork(d); break;
12-	case 0x6: /* Console/exit*/ kill_child(d, 0); break;
13-	case 0x8: fd = stdout; break;
14-	case 0x9: fd = stderr; break;
15-	}
16-	if(fd) {
17-		fputc(d[port], fd);
18-		fflush(fd);
19+	FILE *fd;
20+	switch(addr) {
21+	case 0x15: /* Console/dead */ start_fork(&uxn.dev[0x10]); break;
22+	case 0x16: /* Console/exit*/ kill_child(&uxn.dev[0x10], 0); break;
23+	case 0x18: fd = stdout, fputc(uxn.dev[0x18], fd), fflush(fd); break;
24+	case 0x19: fd = stderr, fputc(uxn.dev[0x19], fd), fflush(fd); break;
25 	}
26 }
+1, -1
1@@ -17,4 +17,4 @@ WITH REGARD TO THIS SOFTWARE.
2 int console_input(Uint8 c, int type);
3 void console_listen(int i, int argc, char **argv);
4 Uint8 console_dei(Uint8 addr);
5-void console_deo(Uint8 port);
6+void console_deo(Uint8 addr);
+1, -1
1@@ -67,7 +67,7 @@ emu_deo(Uint8 addr, Uint8 value)
2 		if(p > 0x7 && p < 0xe)
3 			screen_palette();
4 		break;
5-	case 0x10: console_deo(p); break;
6+	case 0x10: console_deo(addr); break;
7 	case 0x20: screen_deo(p); break;
8 	case 0xa0: file_deo(addr); break;
9 	case 0xb0: file_deo(addr); break;
+1, -1
1@@ -38,7 +38,7 @@ emu_deo(Uint8 addr, Uint8 value)
2 	uxn.dev[addr] = value;
3 	switch(addr & 0xf0) {
4 	case 0x00: system_deo(p); break;
5-	case 0x10: console_deo(p); break;
6+	case 0x10: console_deo(addr); break;
7 	case 0xa0: file_deo(addr); break;
8 	case 0xb0: file_deo(addr); break;
9 	}