actually commit minor cleanups
[dcpu16] / as-dcpu16.h
index 68bf54ebd36977ef5863381d68a12a5639509e7f..3b11d85445f54f460dad101a774094dd097139b4 100644 (file)
@@ -7,26 +7,15 @@ 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? */
+    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;
 };
 
 
@@ -39,10 +28,12 @@ struct instruction_list_ {
 };
 
 
-/* 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_))