#ifndef GBASM_TYPES_H #define GBASM_TYPES_H #include #include "gbasm/gb_types.h" #include "gbasm/emitter.h" struct gbasm_parsed_inst { const char *src_line; const char *file_name; const char *opcode; int line_num; struct gbasm_operand operands[GBASM_MAX_OPERANDS]; int num_operands; }; struct gbasm_op_info { char *opcode; uint32_t operand_types[GBASM_MAX_OPERANDS]; int (*check)(const struct gbasm_parsed_inst *inst, const struct gbasm_op_info *op_info); size_t (*length)(const struct gbasm_parsed_inst *inst, const struct gbasm_op_info *info); size_t (*emit)(struct emitter *emitter, const struct gbasm_parsed_inst *inst); }; struct gbasm_operand_info { const char *token; bool fixed; union { /* Valid iff fixed == true */ int (*convert)(const char *token, struct gbasm_operand *operand); /* Valid iff fixed == false */ struct gbasm_operand op_info; }; }; struct gbasm_operand_prefix { const char *prefix; int (*convert)(const char *token, struct gbasm_operand *operand); }; #endif