diff options
Diffstat (limited to 'tpu.h')
| -rw-r--r-- | tpu.h | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -62,19 +62,20 @@ struct tpu_port { struct tpu *dst_tpu; enum tpu_port_type type; struct tpu_port *dst_port; - bool write, read; - uint8_t val; - bool attached; + bool attached, reading; + int in, out; }; struct tpu { + enum tpu_status status; struct label_map labels; struct tpu_port ports[4]; + int read_port; uint8_t acc, bak; size_t x, y; int last; - size_t pc; + uint8_t pc; struct tpu_inst insts[TPU_MAX_INST]; size_t inst_cnt; }; @@ -98,8 +99,13 @@ void tpu_init(struct tpu *tpu); void tpu_deinit(struct tpu *tpu); struct tpu_inst *tpu_current_inst(struct tpu *tpu); void tpu_init_ports(struct tpu *tpu, struct tpu_map *map); +void tpu_update_ports(struct tpu *tpu); +bool tpu_set_inst(struct tpu *tpu, uint8_t pc, enum tpu_inst_type inst, + int op1, uint8_t op1_lit, int op2, uint8_t op2_lit); bool tpu_add_inst(struct tpu *tpu, enum tpu_inst_type inst, int op1, uint8_t op1_lit, int op2, uint8_t op2_lit); +void tpu_clear_ports(struct tpu *tpu); +enum tpu_status tpu_exec_mov(struct tpu *tpu, struct tpu_inst *inst); enum tpu_status tpu_exec(struct tpu *tpu, struct tpu_inst *inst); void tpu_step(struct tpu *tpu); |
