comparison lwasm/pseudo.c @ 382:80d615a6642c

Add REORG pseudo op For Macro-80C compatibility, add REORG pseudo op. It has some utility so this one is not protected by a pragma. Thanks to Erik G <erik@6809.org> for the patch.
author William Astle <lost@l-w.ca>
date Mon, 13 Jul 2015 21:18:02 -0600
parents e3f4aaa2a4e8
children 6ee9c67a0f8d
comparison
equal deleted inserted replaced
381:e3f4aaa2a4e8 382:80d615a6642c
963 l -> addr = e; 963 l -> addr = e;
964 } 964 }
965 l -> len = 0; 965 l -> len = 0;
966 } 966 }
967 967
968 PARSEFUNC(pseudo_parse_reorg)
969 {
970 lw_expr_t e = NULL;
971
972 l -> len = 0;
973
974 line_t *cl = l;
975 for (cl = cl -> prev; cl; cl = cl -> prev)
976 {
977 if (cl -> insn == -1) continue;
978
979 if (!strcmp("org", instab[cl -> insn].opcode))
980 {
981 if (cl -> prev)
982 {
983 e = lw_expr_copy(cl -> prev -> daddr);
984 break;
985 }
986 }
987 }
988
989 if (!e)
990 {
991 lwasm_register_error(as, l, E_ORG_NOT_FOUND);
992 return;
993 }
994
995 lw_expr_destroy(l -> daddr);
996 l -> daddr = e;
997
998 if (l -> inmod == 0)
999 {
1000 lw_expr_destroy(l -> addr);
1001 l -> addr = e;
1002 }
1003 l -> len = 0;
1004 }
1005
968 PARSEFUNC(pseudo_parse_equ) 1006 PARSEFUNC(pseudo_parse_equ)
969 { 1007 {
970 lw_expr_t e; 1008 lw_expr_t e;
971 1009
972 l -> len = 0; 1010 l -> len = 0;