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]);
63 a = va_arg(fp->args, Adr*);
67 snprint(str, sizeof str, "%lld(%R)", a->offset, i-D_INDIR);
69 snprint(str, sizeof str, "(%R)", i-D_INDIR);
76 snprint(str, sizeof str, "$%lld,%R", a->offset, i);
78 snprint(str, sizeof str, "%R", i);
86 if(bigP != P && bigP->pcond != P)
88 snprint(str, sizeof str, "%llux+%s", bigP->pcond->pc,
91 snprint(str, sizeof str, "%llux", bigP->pcond->pc);
93 snprint(str, sizeof str, "%lld(PC)", a->offset);
97 snprint(str, sizeof str, "%s+%lld(SB)", a->sym->name, a->offset);
101 snprint(str, sizeof str, "%s<%d>+%lld(SB)", a->sym->name,
102 a->sym->version, a->offset);
106 snprint(str, sizeof str, "%s+%lld(SP)", a->sym->name, a->offset);
111 snprint(str, sizeof str, "%s+%lld(%s)", a->sym->name, a->offset, paramspace);
113 snprint(str, sizeof str, "%lld(%s)", a->offset, paramspace);
117 snprint(str, sizeof str, "$%lld", a->offset);
121 snprint(str, sizeof str, "$(%.8lux,%.8lux)", a->ieee.h, a->ieee.l);
125 snprint(str, sizeof str, "$\"%S\"", a->scon);
131 snprint(str, sizeof str, "$%D", a);
137 if(a->index != D_NONE)
138 return fmtprint(fp, "%s(%R*%d)", str, a->index, a->scale);
140 return fmtstrcpy(fp, str);
226 "GDTR", /* [D_GDTR] */
227 "IDTR", /* [D_IDTR] */
228 "LDTR", /* [D_LDTR] */
230 "TASK", /* [D_TASK] */
267 "NONE", /* [D_NONE] */
276 r = va_arg(fp->args, int);
277 if(r >= D_AL && r <= D_NONE)
278 snprint(str, sizeof str, "%s", regstr[r-D_AL]);
280 snprint(str, sizeof str, "gok(%d)", r);
282 return fmtstrcpy(fp, str);
289 char str[30], *p, *a;
291 a = va_arg(fp->args, char*);
293 for(i=0; i<sizeof(double); i++) {
295 if(c >= 'a' && c <= 'z' ||
296 c >= 'A' && c <= 'Z' ||
297 c >= '0' && c <= '9') {
304 if(c < 040 || c >= 0177)
305 break; /* not portable */
323 *p++ = ((c>>3) & 7) + '0';
324 *p++ = (c & 7) + '0';
327 return fmtstrcpy(fp, str);
333 char buf[STRINGSZ], *tn;
337 if(curtext != P && curtext->from.sym != S)
338 tn = curtext->from.sym->name;
340 vseprint(buf, buf+sizeof(buf), fmt, arg);
342 print("%s: %s\n", tn, buf);
346 print("too many errors\n");