diff options
| -rw-r--r-- | tis100-curses.c | 9 | ||||
| -rw-r--r-- | tpu.c | 2 | ||||
| -rw-r--r-- | tpu.h | 3 |
3 files changed, 14 insertions, 0 deletions
diff --git a/tis100-curses.c b/tis100-curses.c index cc36066..e1925c7 100644 --- a/tis100-curses.c +++ b/tis100-curses.c @@ -5,10 +5,13 @@ #include "asm.h" #include <curses.h> + #include <sys/inotify.h> #include <unistd.h> #include <locale.h> + #include <errno.h> +#include <ctype.h> #include <stdarg.h> #include <string.h> #include <stdio.h> @@ -301,6 +304,9 @@ tui_draw_tpu(struct tpu *tpu) if (tpu->ports[DIR_UP].attached) { port = &tpu->ports[DIR_UP]; + if (port->dst_port->io) + tui_draw_text(sx + 10, sy - 1, A_BOLD, + "IN.%c", toupper(port->dst_port->io->c)); if (port->writing) tui_draw_lit(sx + 8, sy - 1, A_BOLD, port->out); if (port->type & PORT_OUT) @@ -315,6 +321,9 @@ tui_draw_tpu(struct tpu *tpu) if (tpu->ports[DIR_DOWN].attached) { port = &tpu->ports[DIR_DOWN]; + if (port->dst_port->io) + tui_draw_text(sx + 9, sy + TPU_H, A_BOLD, + "OUT.%c", toupper(port->dst_port->io->c)); if (port->avail) tui_draw_lit(sx + 8, sy + TPU_H, A_BOLD, port->in); if (port->type & PORT_IN) @@ -142,6 +142,7 @@ tpu_port_init(struct tpu_port *port, struct tpu *tpu) port->in = -1; port->writing = false; port->out = -1; + port->io = false; } void @@ -181,6 +182,7 @@ tpu_io_port_init(struct tpu_io_port *io_port, char c, enum tpu_port_dir dir, enum tpu_port_type type, int x, int y) { tpu_port_init(&io_port->port, NULL); + io_port->port.io = io_port; io_port->io_step = 0; io_port->type = type; io_port->file = NULL; @@ -73,6 +73,9 @@ struct tpu_port { struct tpu *tpu; enum tpu_port_type type; + /* set only if managed by io port */ + struct tpu_io_port *io; + /* NOTE: dont access dst_port during execution, * values are transfered in post execution phase */ struct tpu_port *dst_port; |
