comparison src/pseudo.c @ 54:360d53062bb9

Fixed typo in instruction table and added END directive
author lost
date Sun, 04 Jan 2009 20:38:12 +0000
parents 493cb8ea50a0
children 55260a178667
comparison
equal deleted inserted replaced
53:493cb8ea50a0 54:360d53062bb9
272 lwasm_emit(as, l, 0); 272 lwasm_emit(as, l, 0);
273 lwasm_emit(as, l, 0); 273 lwasm_emit(as, l, 0);
274 } 274 }
275 } 275 }
276 276
277 OPFUNC(pseudo_end)
278 {
279 int rval;
280 lwasm_expr_stack_t *s;
281
282
283 as -> endseen = 1;
284
285 // address only matters for DECB output
286 if (as -> outformat != OUTPUT_DECB)
287 return;
288
289 s = lwasm_evaluate_expr(as, l, *p, NULL);
290 if (!s)
291 {
292 register_error(as, l, 1, "Bad expression");
293 return;
294 }
295 if (!lwasm_expr_is_constant(s))
296 {
297 register_error(as, l, 2, "Incomplete reference");
298 }
299 rval = lwasm_expr_get_value(s);
300 lwasm_expr_stack_free(s);
301
302 rval = rval & 0xffff;
303 if (as -> passnum == 2)
304 {
305 as -> execaddr = rval;
306 l -> symaddr = rval;
307 l -> addrset = 2;
308 }
309 }
310
277 /* 311 /*
278 void pseudo_end(asmstate_t *as, sourceline_t *cl, char **optr)
279 {
280 int rval, v1;
281
282 while (**optr && isspace(**optr))
283 ;
284 if (**optr && **optr != '*' && **optr != ';')
285 {
286 rval = eval_expr(as, cl, optr, &v1);
287 if (rval < 0)
288 {
289 errorp1(ERR_FORWARD);
290 return;
291 }
292 }
293 else
294 {
295 v1 = 0;
296 }
297 if (as -> passnum == 2)
298 as -> execaddr = v1;
299 }
300
301 void pseudo_align(asmstate_t *as, sourceline_t *cl, char **optr) 312 void pseudo_align(asmstate_t *as, sourceline_t *cl, char **optr)
302 { 313 {
303 int rval, v1; 314 int rval, v1;
304 int cn; 315 int cn;
305 316