comparison src/lwasm.c @ 58:b1d81800bc91

Added symbol listing to list file; various fixes
author lost
date Mon, 05 Jan 2009 00:20:45 +0000
parents 035b95a3690f
children 309810f39ab7
comparison
equal deleted inserted replaced
57:035b95a3690f 58:b1d81800bc91
61 } 61 }
62 62
63 void lwasm_emit(asmstate_t *as, lwasm_line_t *l, int b) 63 void lwasm_emit(asmstate_t *as, lwasm_line_t *l, int b)
64 { 64 {
65 as -> addr += 1; 65 as -> addr += 1;
66 66 as -> addr &= 0xffff;
67
67 if (as -> passnum == 1) 68 if (as -> passnum == 1)
68 return; 69 return;
69 70
70 71
71 if (l -> codelen >= l -> codesize) 72 if (l -> codelen >= l -> codesize)
196 } 197 }
197 198
198 int lwasm_expr_result(asmstate_t *as, lwasm_line_t *l, char **inp, int flag, int *val) 199 int lwasm_expr_result(asmstate_t *as, lwasm_line_t *l, char **inp, int flag, int *val)
199 { 200 {
200 lwasm_expr_stack_t *s; 201 lwasm_expr_stack_t *s;
201 char *ep; 202 const char *ep;
202 int rval; 203 int rval;
203 204
204 s = lwasm_evaluate_expr(as, l, *inp, &ep); 205 s = lwasm_evaluate_expr(as, l, *inp, &ep);
205 if (!s) 206 if (!s)
206 { 207 {
207 register_error(as, l, 1, "Bad expression"); 208 register_error(as, l, 1, "Bad expression");
208 *val = 0; 209 *val = 0;
209 return -1; 210 return -1;
210 } 211 }
211 *inp = ep; 212 *inp = (char *)ep;
212 213
213 if (flag & EXPR_PASS1CONST && as -> passnum == 1 && !lwasm_expr_is_constant(s)) 214 if (flag & EXPR_PASS1CONST && as -> passnum == 1 && !lwasm_expr_is_constant(s))
214 { 215 {
215 register_error(as, l, 1, "Illegal incomplete reference (pass 1)"); 216 register_error(as, l, 1, "Illegal incomplete reference (pass 1)");
216 *val = 0; 217 *val = 0;
256 va_end(args); 257 va_end(args);
257 } 258 }
258 259
259 int lwasm_next_context(asmstate_t *as) 260 int lwasm_next_context(asmstate_t *as)
260 { 261 {
261 return (as -> nextcontext++); 262 int r;
262 } 263 r = as -> nextcontext;
263 264 as -> nextcontext += 1;
265 debug_message(3, "lwasm_next_context(): %d (%d) pass %d", r, as -> nextcontext, as -> passnum);
266 return r;
267 }
268