Removed memory passing in console_deo

This commit is contained in:
Devine Lu Linvega 2024-07-01 07:53:37 -08:00
parent ed24273f66
commit 44c501ba91
4 changed files with 10 additions and 15 deletions

View File

@ -214,18 +214,13 @@ console_dei(Uint8 addr)
} }
void void
console_deo(Uint8 port) console_deo(Uint8 addr)
{ {
FILE *fd = NULL; FILE *fd;
Uint8 *d = &uxn.dev[0x10]; switch(addr) {
switch(port) { case 0x15: /* Console/dead */ start_fork(&uxn.dev[0x10]); break;
case 0x5: /* Console/dead */ start_fork(d); break; case 0x16: /* Console/exit*/ kill_child(&uxn.dev[0x10], 0); break;
case 0x6: /* Console/exit*/ kill_child(d, 0); break; case 0x18: fd = stdout, fputc(uxn.dev[0x18], fd), fflush(fd); break;
case 0x8: fd = stdout; break; case 0x19: fd = stderr, fputc(uxn.dev[0x19], fd), fflush(fd); break;
case 0x9: fd = stderr; break;
}
if(fd) {
fputc(d[port], fd);
fflush(fd);
} }
} }

View File

@ -17,4 +17,4 @@ WITH REGARD TO THIS SOFTWARE.
int console_input(Uint8 c, int type); int console_input(Uint8 c, int type);
void console_listen(int i, int argc, char **argv); void console_listen(int i, int argc, char **argv);
Uint8 console_dei(Uint8 addr); Uint8 console_dei(Uint8 addr);
void console_deo(Uint8 port); void console_deo(Uint8 addr);

View File

@ -67,7 +67,7 @@ emu_deo(Uint8 addr, Uint8 value)
if(p > 0x7 && p < 0xe) if(p > 0x7 && p < 0xe)
screen_palette(); screen_palette();
break; break;
case 0x10: console_deo(p); break; case 0x10: console_deo(addr); break;
case 0x20: screen_deo(p); break; case 0x20: screen_deo(p); break;
case 0xa0: file_deo(addr); break; case 0xa0: file_deo(addr); break;
case 0xb0: file_deo(addr); break; case 0xb0: file_deo(addr); break;

View File

@ -38,7 +38,7 @@ emu_deo(Uint8 addr, Uint8 value)
uxn.dev[addr] = value; uxn.dev[addr] = value;
switch(addr & 0xf0) { switch(addr & 0xf0) {
case 0x00: system_deo(p); break; case 0x00: system_deo(p); break;
case 0x10: console_deo(p); break; case 0x10: console_deo(addr); break;
case 0xa0: file_deo(addr); break; case 0xa0: file_deo(addr); break;
case 0xb0: file_deo(addr); break; case 0xb0: file_deo(addr); break;
} }