comparison lwasm/lwasm.h @ 347:1649bc7bda5a

Some data oriented pseudo ops added
author lost@starbug
date Sat, 27 Mar 2010 20:16:24 -0600
parents a82c55070624
children dcd2978a7d18
comparison
equal deleted inserted replaced
346:a82c55070624 347:1649bc7bda5a
79 { 79 {
80 char *mess; // actual error message 80 char *mess; // actual error message
81 lwasm_error_t *next; // ptr to next error 81 lwasm_error_t *next; // ptr to next error
82 }; 82 };
83 83
84 struct line_expr_s
85 {
86 lw_expr_t expr;
87 int id;
88 struct line_expr_s *next;
89 };
90
84 typedef struct line_s line_t; 91 typedef struct line_s line_t;
85 struct line_s 92 struct line_s
86 { 93 {
87 lw_expr_t addr; // assembly address of the line 94 lw_expr_t addr; // assembly address of the line
88 int len; // the "size" this line occupies (address space wise) (-1 if unknown) 95 int len; // the "size" this line occupies (address space wise) (-1 if unknown)
93 int outputl; // size of output 100 int outputl; // size of output
94 int outputbl; // size of output buffer 101 int outputbl; // size of output buffer
95 lwasm_error_t *err; // list of errors 102 lwasm_error_t *err; // list of errors
96 line_t *prev; // previous line 103 line_t *prev; // previous line
97 line_t *next; // next line 104 line_t *next; // next line
105
106 struct line_expr_s *exprs; // expressions used during parsing
98 asmstate_t *as; // assembler state data ptr 107 asmstate_t *as; // assembler state data ptr
99 }; 108 };
100 109
101 enum 110 enum
102 { 111 {
137 int pragmas; // pragmas currently in effect 146 int pragmas; // pragmas currently in effect
138 int errorcount; // number of errors encountered 147 int errorcount; // number of errors encountered
139 int inmacro; // are we in a macro? 148 int inmacro; // are we in a macro?
140 int skipcond; // skipping a condition? 149 int skipcond; // skipping a condition?
141 int skipmacro; // are we skipping in a macro? 150 int skipmacro; // are we skipping in a macro?
151 int endseen; // have we seen an "end" pseudo?
152 int execaddr; // address from "end"
142 153
143 line_t *line_head; // start of lines list 154 line_t *line_head; // start of lines list
144 line_t *line_tail; // tail of lines list 155 line_t *line_tail; // tail of lines list
145 156
146 line_t *cl; // current line pointer 157 line_t *cl; // current line pointer
171 extern void lwasm_register_error(asmstate_t *as, line_t *cl, const char *msg, ...); 182 extern void lwasm_register_error(asmstate_t *as, line_t *cl, const char *msg, ...);
172 extern int lwasm_next_context(asmstate_t *as); 183 extern int lwasm_next_context(asmstate_t *as);
173 extern void lwasm_emit(line_t *cl, int byte); 184 extern void lwasm_emit(line_t *cl, int byte);
174 extern void lwasm_emitop(line_t *cl, int opc); 185 extern void lwasm_emitop(line_t *cl, int opc);
175 186
187 extern void lwasm_save_expr(line_t *cl, int id, lw_expr_t expr);
188 extern lw_expr_t lwasm_fetch_expr(line_t *cl, int id);
189 extern lw_expr_t lwasm_parse_expr(asmstate_t *as, char **p);
190 extern int lwasm_emitexpr(line_t *cl, lw_expr_t expr, int s);
191
192 extern void skip_operand(char **p);
193
176 #endif 194 #endif
177 195
178 #define OPLEN(op) (((op)>0xFF)?2:1) 196 #define OPLEN(op) (((op)>0xFF)?2:1)
179 197
180 #endif /* ___lwasm_h_seen___ */ 198 #endif /* ___lwasm_h_seen___ */