7 fmtinstall('R', Rconv);
8 fmtinstall('A', Aconv);
9 fmtinstall('D', Dconv);
10 fmtinstall('S', Sconv);
11 fmtinstall('P', Pconv);
22 p = va_arg(fp->args, Prog*);
28 snprint(str, sizeof(str), "(%ld) %A %D,%d,%D",
29 p->line, p->as, &p->from, p->from.scale, &p->to);
33 snprint(str, sizeof(str), "(%ld) %A %D,%D",
34 p->line, p->as, &p->from, &p->to);
39 snprint(str, sizeof(str), "(%ld) %A %D/%d,%D",
40 p->line, p->as, &p->from, p->from.scale, &p->to);
44 return fmtstrcpy(fp, str);
52 i = va_arg(fp->args, int);
53 return fmtstrcpy(fp, anames[i]);
59 char str[STRINGSZ+40];
63 a = va_arg(fp->args, Adr*);
65 if(i >= D_INDIR && i < D_M0) {
67 snprint(str, sizeof(str), "%ld(%R)", a->offset, i-D_INDIR);
69 snprint(str, sizeof(str), "(%R)", i-D_INDIR);
75 snprint(str, sizeof(str), "%R", i);
83 if(bigP != P && bigP->pcond != P)
85 snprint(str, sizeof(str), "%lux+%s", bigP->pcond->pc,
88 snprint(str, sizeof(str), "%lux", bigP->pcond->pc);
90 snprint(str, sizeof(str), "%ld(PC)", a->offset);
94 snprint(str, sizeof(str), "%s+%ld(SB)", a->sym->name, a->offset);
98 snprint(str, sizeof(str), "%s<%d>+%ld(SB)", a->sym->name,
99 a->sym->version, a->offset);
103 snprint(str, sizeof(str), "%s+%ld(SP)", a->sym->name, a->offset);
108 snprint(str, sizeof(str), "%s+%ld(FP)", a->sym->name, a->offset);
110 snprint(str, sizeof(str), "%ld(FP)", a->offset);
114 snprint(str, sizeof(str), "$%ld", a->offset);
118 snprint(str, sizeof(str), "$(%.8lux,%.8lux)", a->ieee.h, a->ieee.l);
122 snprint(str, sizeof(str), "$\"%S\"", a->scon);
128 snprint(str, sizeof(str), "$%D", a);
134 if(a->index != D_NONE)
135 return fmtprint(fp, "%s(%R*%d)", str, a->index, a->scale);
137 return fmtstrcpy(fp, str);
176 "GDTR", /* [D_GDTR] */
177 "IDTR", /* [D_IDTR] */
178 "LDTR", /* [D_LDTR] */
180 "TASK", /* [D_TASK] */
209 "NONE", /* [D_NONE] */
211 [D_M0] "M0", /* [D_M0] */
220 [D_X0] "X0", /* [D_X0] */
236 r = va_arg(fp->args, int);
237 if((r >= D_AL && r <= D_NONE) || (r >= D_M0 && r <= D_X0+7))
238 snprint(str, sizeof(str), "%s", regstr[r-D_AL]);
240 snprint(str, sizeof(str), "gok(%d)", r);
242 return fmtstrcpy(fp, str);
249 char str[30], *p, *a;
251 a = va_arg(fp->args, char*);
253 for(i=0; i<sizeof(double); i++) {
255 if(c >= 'a' && c <= 'z' ||
256 c >= 'A' && c <= 'Z' ||
257 c >= '0' && c <= '9') {
264 if(c < 040 || c >= 0177)
265 break; /* not portable */
283 *p++ = ((c>>3) & 7) + '0';
284 *p++ = (c & 7) + '0';
287 return fmtstrcpy(fp, str);
293 char buf[STRINGSZ], *tn;
297 if(curtext != P && curtext->from.sym != S)
298 tn = curtext->from.sym->name;
300 vseprint(buf, buf+sizeof(buf), fmt, arg);
302 print("%s: %s\n", tn, buf);
305 if(nerrors > 20 && !debug['A']) {
306 print("too many errors\n");