* VOID diag() assubr.c
* VOID err() assubr.c
* int fprintf() c-library
- * int getline() aslex.c
+ * int as_getline() aslex.c
* VOID list() aslist.c
* VOID lstsym() aslist.c
* VOID minit() ___mch.c
dot.s_area = &dca;
symp = ˙
minit();
- while (getline()) {
+ while (as_getline()) {
cp = cb;
cpt = cbt;
ep = eb;
if (i) {
// remove output file
printf ("removing %s\n", relFile);
- unlink(relFile);
+ remove(relFile);
}
exit(i);
}
goto loop;
}
/*
- * If the first character is a letter then assume a lable,
+ * If the first character is a letter then assume a label,
* symbol, assembler directive, or assembler mnemonic is
* being processed.
*/
} while ((c = getnb()) == ',');
unget(c);
break;
+
+ case S_ULEB128:
+ case S_SLEB128:
+ do {
+ Addr_T val = absexpr();
+ int bit = sizeof(val)*8 - 1;
+ int impliedBit;
+
+ if (mp->m_type == S_ULEB128) {
+ impliedBit = 0;
+ } else {
+ impliedBit = (val & (1 << bit)) ? 1 : 0;
+ }
+ while ((bit>0) && (((val & (1 << bit)) ? 1 : 0) == impliedBit)) {
+ bit--;
+ }
+ if (mp->m_type == S_SLEB128) {
+ bit++;
+ }
+ while (bit>=0) {
+ if (bit<7) {
+ outab(val & 0x7f);
+ } else {
+ outab(0x80 | (val & 0x7f));
+ }
+ bit -= 7;
+ val >>= 7;
+ }
+ } while ((c = getnb()) == ',');
+ unget(c);
+ break;
case S_ASCII:
case S_ASCIZ:
case S_ORG:
if (dot.s_area->a_flag & A_ABS) {
outall();
- laddr = dot.s_addr = absexpr();
+ laddr = dot.s_addr = dot.s_org = absexpr();
} else {
err('o');
}
}
}
*p = 0;
- if (++incfil == MAXINC ||
- (ifp[incfil] = fopen(fn, "r")) == NULL) {
+ if ((++incfil == MAXINC) ||
+ (ifp[incfil] = fopen(fn, "r")) == NULL) {
--incfil;
err('i');
} else {
if (oap->a_size < dot.s_addr) {
oap->a_size = dot.s_addr;
}
+ } else if (oap->a_flag & A_ABS) {
+ oap->a_addr = dot.s_org;
+ oap->a_size = dot.s_addr - dot.s_org;
} else {
+ oap->a_addr = 0;
oap->a_size = dot.s_addr;
}
if (nap->a_flag & A_OVR) {