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? */
+ unsigned int length; /* number of words of bytecode */
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;
};
};
-/* note label table holds its own structs, not pointers */
+/* note label table holds its own structs, not pointers like instruction list */
struct label_ {
char *label; /* name of label */
- struct instruction_ *instr;
+ struct instruction_ **instr; /* pointer into instruction list table */
+ unsigned int ready : 1; /* do we know where this label is yet? */
+ DCPU16_WORD addr;
};
#define LL_SIZE(entries) (((entries) * sizeof(struct label_ *)) + sizeof(struct label_list_))