Starting console process setup

This commit is contained in:
neauoire 2023-11-10 09:32:34 -08:00
parent 59edc06ae0
commit d69d1508d0
5 changed files with 40 additions and 18 deletions

View File

@ -35,16 +35,35 @@ console_listen(Uxn *u, int i, int argc, char **argv)
} }
void void
console_deo(Uint8 *d, Uint8 port) start_fork(Uxn *u, Uint8 *d)
{ {
/* TODO */
}
void
kill_child(Uint8 *d)
{
/* TODO */
}
Uint8
console_dei(Uxn *u, Uint8 addr)
{
/* TODO */
}
void
console_deo(Uxn *u, Uint8 *d, Uint8 port)
{
FILE *fd = NULL;
switch(port) { switch(port) {
case 0x8: case 0x5: /* Console/dead */ start_fork(u, d); break;
fputc(d[port], stdout); case 0x6: /* Console/exit*/ kill_child(d); break;
fflush(stdout); case 0x8: fd = stdout; break;
return; case 0x9: fd = stderr; break;
case 0x9: }
fputc(d[port], stderr); if(fd) {
fflush(stderr); fputc(d[port], fd);
return; fflush(fd);
} }
} }

View File

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

View File

@ -96,16 +96,16 @@ screen_debugger(Uxn *u)
int i; int i;
for(i = 0; i < 0x08; i++) { for(i = 0; i < 0x08; i++) {
Uint8 pos = u->wst.ptr - 4 + i; Uint8 pos = u->wst.ptr - 4 + i;
Uint8 color = i > 4 ? 0x01 : !pos ? 0xc Uint8 color = i > 4 ? 0x01 : !pos ? 0xc :
: i == 4 ? 0x8 i == 4 ? 0x8 :
: 0x2; 0x2;
draw_byte(u->wst.dat[pos], i * 0x18 + 0x8, uxn_screen.height - 0x18, color); draw_byte(u->wst.dat[pos], i * 0x18 + 0x8, uxn_screen.height - 0x18, color);
} }
for(i = 0; i < 0x08; i++) { for(i = 0; i < 0x08; i++) {
Uint8 pos = u->rst.ptr - 4 + i; Uint8 pos = u->rst.ptr - 4 + i;
Uint8 color = i > 4 ? 0x01 : !pos ? 0xc Uint8 color = i > 4 ? 0x01 : !pos ? 0xc :
: i == 4 ? 0x8 i == 4 ? 0x8 :
: 0x2; 0x2;
draw_byte(u->rst.dat[pos], i * 0x18 + 0x8, uxn_screen.height - 0x10, color); draw_byte(u->rst.dat[pos], i * 0x18 + 0x8, uxn_screen.height - 0x10, color);
} }
screen_blit(uxn_screen.fg, arrow, 0, 0x68, uxn_screen.height - 0x20, 3, 0, 0, 0); screen_blit(uxn_screen.fg, arrow, 0, 0x68, uxn_screen.height - 0x20, 3, 0, 0, 0);

View File

@ -49,6 +49,7 @@ emu_dei(Uxn *u, Uint8 addr)
{ {
switch(addr & 0xf0) { switch(addr & 0xf0) {
case 0x00: return system_dei(u, addr); case 0x00: return system_dei(u, addr);
case 0x10: return console_dei(u, addr);
case 0x20: return screen_dei(u, addr); case 0x20: return screen_dei(u, addr);
case 0xc0: return datetime_dei(u, addr); case 0xc0: return datetime_dei(u, addr);
} }
@ -66,7 +67,7 @@ emu_deo(Uxn *u, Uint8 addr, Uint8 value)
if(p > 0x7 && p < 0xe) if(p > 0x7 && p < 0xe)
screen_palette(&u->dev[0x8]); screen_palette(&u->dev[0x8]);
break; break;
case 0x10: console_deo(&u->dev[d], p); break; case 0x10: console_deo(u, &u->dev[d], p); break;
case 0x20: screen_deo(u->ram, &u->dev[d], p); break; case 0x20: screen_deo(u->ram, &u->dev[d], p); break;
case 0xa0: file_deo(0, u->ram, &u->dev[d], p); break; case 0xa0: file_deo(0, u->ram, &u->dev[d], p); break;
case 0xb0: file_deo(1, u->ram, &u->dev[d], p); break; case 0xb0: file_deo(1, u->ram, &u->dev[d], p); break;

View File

@ -23,6 +23,7 @@ emu_dei(Uxn *u, Uint8 addr)
{ {
switch(addr & 0xf0) { switch(addr & 0xf0) {
case 0x00: return system_dei(u, addr); case 0x00: return system_dei(u, addr);
case 0x10: return console_dei(u, addr);
case 0xc0: return datetime_dei(u, addr); case 0xc0: return datetime_dei(u, addr);
} }
return u->dev[addr]; return u->dev[addr];
@ -35,7 +36,7 @@ emu_deo(Uxn *u, Uint8 addr, Uint8 value)
u->dev[addr] = value; u->dev[addr] = value;
switch(d) { switch(d) {
case 0x00: system_deo(u, &u->dev[d], p); break; case 0x00: system_deo(u, &u->dev[d], p); break;
case 0x10: console_deo(&u->dev[d], p); break; case 0x10: console_deo(u, &u->dev[d], p); break;
case 0xa0: file_deo(0, u->ram, &u->dev[d], p); break; case 0xa0: file_deo(0, u->ram, &u->dev[d], p); break;
case 0xb0: file_deo(1, u->ram, &u->dev[d], p); break; case 0xb0: file_deo(1, u->ram, &u->dev[d], p); break;
} }