#include "types.h" #include #include #include void tape_init(Tape* tape, uint8_t len) { tape->index = 0; tape->len = len; tape->data = malloc(tape->len); memset(tape->data, 0, len); } void tape_free(Tape* tape) { free(tape->data); } void tape_left(Tape* tape) { tape->index--; } void tape_right(Tape* tape) { tape->index++; } void tape_increment(Tape* tape) { tape->data[tape->index]++; } void tape_decrement(Tape* tape) { tape->data[tape->index]--; } uint8_t tape_get(Tape* tape) { return tape->data[tape->index]; } void tape_set(Tape* tape, uint8_t value) { tape->data[tape->index] = value; } void* tape_ptr(Tape* tape) { return tape->data + tape->index; }