--- /dev/null
+#ifndef AS_DCPU16_H_PTFNJB09
+#define AS_DCPU16_H_PTFNJB09
+
+#include "dcpu16.h"
+
+struct instruction_ {
+ char *label; /* set if a label points here */
+ char *opcode; /* tokenized instruction text */
+ struct operand_ *operands; /* list of operands */
+ unsigned int length; /* words */
+ unsigned int ready : 1; /* bytecode computed? */
+ DCPU16_WORD instr_words[];
+};
+
+
+enum operand_types_{
+ OT_DIRECT, /* these operands simply render their contents into bytecode */
+ OT_NEXT, /* these operands increase instruction length */
+ OT_LABEL /* labels need to be computed then converted to other types */
+};
+
+struct operand_ {
+ struct operand_ *next;
+ char *operand; /* tokenized operand text */
+ enum operand_types_ type;
+ union {
+ DCPU16_WORD word_value;
+ struct instruction_ *label_destination;
+ } value;
+};
+
+
+#define IL_SIZE(entries) (((entries) * sizeof(struct instruction_ *)) + sizeof(struct instruction_list_))
+
+struct instruction_list_ {
+ size_t allocated;
+ size_t entries;
+ struct instruction_ *instr[];
+};
+
+
+/* note label table holds its own structs, not pointers */
+struct label_ {
+ char *label; /* name of label */
+ struct instruction_ *instr;
+};
+
+#define LL_SIZE(entries) (((entries) * sizeof(struct label_ *)) + sizeof(struct label_list_))
+
+struct label_list_ {
+ size_t allocated;
+ size_t entries;
+ struct label_ label[];
+};
+
+#endif /* AS_DCPU16_H_PTFNJB09 */