Mercurial > hg-old > index.cgi
comparison src/pseudo.c @ 64:aaddd47219b4
Added the 'set' directive
author | lost |
---|---|
date | Mon, 05 Jan 2009 01:27:08 +0000 |
parents | d85ba47b1e8f |
children | 31d8e85706e7 |
comparison
equal
deleted
inserted
replaced
63:d85ba47b1e8f | 64:aaddd47219b4 |
---|---|
370 rval = 0; | 370 rval = 0; |
371 | 371 |
372 l -> symaddr = rval & 0xFFFF; | 372 l -> symaddr = rval & 0xFFFF; |
373 l -> addrset = 2; | 373 l -> addrset = 2; |
374 | 374 |
375 lwasm_register_symbol(as, l, l -> sym, rval); | 375 lwasm_register_symbol(as, l, l -> sym, rval, SYMBOL_NORM); |
376 } | 376 } |
377 | 377 |
378 OPFUNC(pseudo_set) | 378 OPFUNC(pseudo_set) |
379 { | 379 { |
380 int rval; | |
381 | |
382 // set MUST run on both passes as the symbol value changes! | |
383 | |
384 if (l -> sym == NULL) | |
385 { | |
386 register_error(as, l, 1, "No symbol specified"); | |
387 return; | |
388 } | |
389 | |
390 if (lwasm_expr_result(as, l, p, EXPR_PASS1CONST | EXPR_PASS2CONST, &rval) < 0) | |
391 rval = 0; | |
392 | |
393 l -> symaddr = rval & 0xFFFF; | |
394 l -> addrset = 2; | |
395 | |
396 lwasm_register_symbol(as, l, l -> sym, rval, SYMBOL_SET); | |
380 } | 397 } |
381 | 398 |
382 /* | 399 /* |
383 void pseudo_set(asmstate_t *as, sourceline_t *cl, char **optr) | |
384 { | |
385 int rval, v1; | |
386 | |
387 if (cl -> hassym == 0) | |
388 { | |
389 errorp1(ERR_NOSYM); | |
390 return; | |
391 } | |
392 rval = eval_expr(as, cl, optr, &v1); | |
393 // eval_expr returns -1 if there was a forward ref | |
394 // or -2 if the expr was invalid | |
395 if (rval == -2) | |
396 { | |
397 // carp | |
398 errorp1(ERR_FORWARD); | |
399 } | |
400 if (rval < 0) | |
401 { | |
402 // remove symbol ref | |
403 cl -> hassym = 0; | |
404 // mark as a "comment" so it isn't processed next time | |
405 cl -> opcode = -1; | |
406 return; | |
407 } | |
408 cl -> code_symloc = v1; | |
409 cl -> isset = 1; | |
410 cl -> isequ = 1; | |
411 cl -> symaddr = v1 & 0xFFFF; | |
412 } | |
413 | |
414 void pseudo_setdp(asmstate_t *as, sourceline_t *cl, char **optr) | 400 void pseudo_setdp(asmstate_t *as, sourceline_t *cl, char **optr) |
415 { | 401 { |
416 int rval, v1; | 402 int rval, v1; |
417 | 403 |
418 if (cl -> hassym) | 404 if (cl -> hassym) |