8 fmtinstall('A', Aconv);
9 fmtinstall('P', Pconv);
10 fmtinstall('S', Sconv);
11 fmtinstall('N', Nconv);
12 fmtinstall('B', Bconv);
13 fmtinstall('D', Dconv);
14 fmtinstall('R', Rconv);
20 char str[STRINGSZ], ss[STRINGSZ], *s;
24 memset(str, 0, sizeof str);
25 bits = va_arg(fp->args, Bits);
29 strncat(str, " ", sizeof str - 1);
31 snprint(ss, sizeof ss, "$%ld", var[i].offset);
35 strncat(str, s, sizeof str - 1);
36 bits.b[i/32] &= ~(1L << (i%32));
38 return fmtstrcpy(fp, str);
42 ".EQ", ".NE", ".CS", ".CC",
43 ".MI", ".PL", ".VS", ".VC",
44 ".HI", ".LS", ".GE", ".LT",
45 ".GT", ".LE", "", ".NV",
51 char str[STRINGSZ], sc[20];
55 p = va_arg(fp->args, Prog*);
58 strcpy(sc, extra[s & C_SCOND]);
65 if(s & C_UBIT) /* ambiguous with FBIT */
67 if(a == AMULL || a == AMULAL || a == AMULLU || a == AMULALU)
68 snprint(str, sizeof str, " %A%s %D,R%d,%D", a, sc, &p->from, p->reg, &p->to);
71 if(p->from.type == D_CONST)
72 snprint(str, sizeof str, " %A%s %R,%D", a, sc, &p->from, &p->to);
74 if(p->to.type == D_CONST)
75 snprint(str, sizeof str, " %A%s %D,%R", a, sc, &p->from, &p->to);
77 snprint(str, sizeof str, " %A%s %D,%D", a, sc, &p->from, &p->to);
80 snprint(str, sizeof str, " %A %D/%d,%D", a, &p->from, p->reg, &p->to);
83 snprint(str, sizeof str, " %A %D,%d,%D", a, &p->from, p->reg, &p->to);
86 snprint(str, sizeof str, " %A%s %D,%D", a, sc, &p->from, &p->to);
88 if(p->from.type != D_FREG)
89 snprint(str, sizeof str, " %A%s %D,R%d,%D", a, sc, &p->from, p->reg, &p->to);
91 snprint(str, sizeof str, " %A%s %D,F%d,%D", a, sc, &p->from, p->reg, &p->to);
92 return fmtstrcpy(fp, str);
101 a = va_arg(fp->args, int);
103 if(a >= AXXX && a < ALAST)
105 return fmtstrcpy(fp, s);
116 a = va_arg(fp->args, Adr*);
120 snprint(str, sizeof str, "GOK-type(%d)", a->type);
125 if(a->name != D_NONE || a->reg != NREG || a->sym != S)
126 snprint(str, sizeof str, "%N(R%d)(NONE)", a, a->reg);
131 snprint(str, sizeof str, "$%N(R%d)", a, a->reg);
133 snprint(str, sizeof str, "$%N", a);
138 op = "<<>>->@>" + (((v>>5) & 3) << 1);
140 snprint(str, sizeof str, "R%d%c%cR%d", v&15, op[0], op[1], (v>>8)&15);
143 if(sh == 0 && (v & (3<<5)) != 0)
145 snprint(str, sizeof str, "R%d%c%c%d", v&15, op[0], op[1], sh);
148 snprint(str+strlen(str), sizeof(str)-strlen(str), "(R%d)", a->reg);
153 snprint(str, sizeof str, "%N(R%d)", a, a->reg);
155 snprint(str, sizeof str, "%N", a);
159 snprint(str, sizeof str, "(R%d,R%d)", a->reg, (char)a->offset);
163 snprint(str, sizeof str, "R%d", a->reg);
164 if(a->name != D_NONE || a->sym != S)
165 snprint(str, sizeof str, "%N(R%d)(REG)", a, a->reg);
169 snprint(str, sizeof str, "F%d", a->reg);
170 if(a->name != D_NONE || a->sym != S)
171 snprint(str, sizeof str, "%N(R%d)(REG)", a, a->reg);
175 snprint(str, sizeof str, "PSR");
176 if(a->name != D_NONE || a->sym != S)
177 snprint(str, sizeof str, "%N(PSR)(REG)", a);
181 snprint(str, sizeof str, "%ld(PC)", a->offset-pc);
185 snprint(str, sizeof str, "$%.17e", a->dval);
189 snprint(str, sizeof str, "$\"%S\"", a->sval);
192 return fmtstrcpy(fp, str);
202 a = va_arg(fp->args, Adr*);
203 snprint(str, sizeof str, "GOK-reglist");
211 memset(str, 0, sizeof str);
212 for(i=0; i<NREG; i++) {
215 strncat(str, "[R", sizeof str - 1);
217 strncat(str, ",R", sizeof str - 1);
218 snprint(str+strlen(str), sizeof(str)-strlen(str), "%d", i);
221 strncat(str, "]", sizeof str - 1);
223 return fmtstrcpy(fp, str);
230 char str[STRINGSZ], *p, *a;
232 a = va_arg(fp->args, char*);
234 for(i=0; i<NSNAME; i++) {
236 if(c >= 'a' && c <= 'z' ||
237 c >= 'A' && c <= 'Z' ||
238 c >= '0' && c <= '9' ||
239 c == ' ' || c == '%') {
266 *p++ = ((c>>3) & 7) + '0';
267 *p++ = (c & 7) + '0';
270 return fmtstrcpy(fp, str);
280 a = va_arg(fp->args, Adr*);
283 snprint(str, sizeof str, "%ld", a->offset);
288 snprint(str, sizeof str, "GOK-name(%d)", a->name);
292 snprint(str, sizeof str, "%ld", a->offset);
296 snprint(str, sizeof str, "%s+%ld(SB)", s->name, a->offset);
300 snprint(str, sizeof str, "%s<>+%ld(SB)", s->name, a->offset);
304 snprint(str, sizeof str, "%s-%ld(SP)", s->name, -a->offset);
308 snprint(str, sizeof str, "%s+%ld(FP)", s->name, a->offset);
312 return fmtstrcpy(fp, str);