X-Git-Url: http://git.squeep.com/?p=dcpu16;a=blobdiff_plain;f=as-dcpu16.h;h=3b11d85445f54f460dad101a774094dd097139b4;hp=68bf54ebd36977ef5863381d68a12a5639509e7f;hb=95ed7334e5fb35010f287765161fcff1efa69758;hpb=c92abb5c1fa2c3d2bf08ea7bdc2ace34bc7066be diff --git a/as-dcpu16.h b/as-dcpu16.h index 68bf54e..3b11d85 100644 --- a/as-dcpu16.h +++ b/as-dcpu16.h @@ -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_))