11 scanform(long icount, int prt, char *ifp, Map *map, int literal)
23 /*now loop over format*/
29 while (isdigit(c = *fp++)) {
37 fp=exform(fcount,prt,fp,map,literal,firstpass);
48 exform(int fcount, int prt, char *ifp, Map *map, int literal, int firstpass)
50 /* execute single format item `fcount' times
51 * sets `dotinc' and moves `dot'
52 * returns address of next format item
73 if (!literal && (c == 'i' || c == 'I' || c == 'M')
74 && (dot & (mach->pcquant-1))) {
75 dprint("warning: instruction not aligned");
78 if (prt && modifier != 'a' && modifier != 'A') {
79 symoff(buf, 512, dot, CANY);
80 dprint("%s%c%16t", buf, map==symmap? '?':'/');
83 if (printcol==0 && modifier != 'a' && modifier != 'A')
94 dprint("%*t", fcount);
99 symoff(buf, sizeof(buf), dot, CANY);
100 dprint("%s%c%16t", buf, map==symmap? '?':'/');
105 dprint("%#llux%10t", dot);
110 if (get4(map, dot, &w) < 0)
112 symoff(buf, sizeof(buf), w, CANY);
113 dprint("%s%16t", buf);
114 dotinc = mach->szaddr;
124 else if (get2(map, dot, &sh) < 0)
131 dprint("%-8#lux", w);
135 dprint("%-8#luo", w);
147 else if (get4(map, dot, &w) < 0)
151 dprint("%-16lud", w);
153 dprint("%-16#lux", w);
157 dprint("%-#16luo", w);
159 dprint("%-#16lo", w);
166 else if (get8(map, dot, &v) < 0)
170 dprint("%-20#llux", v);
172 dprint("%-20lld", v);
174 dprint("%-20llud", v);
182 else if (get1(map, dot, &ch, 1) < 0)
186 else if (modifier == 'B' || modifier == 'b')
187 dprint("%-8#lux", (long) ch);
196 else if (get2(map, dot, &sh) < 0)
205 dprint("%C%C", sp[0], sp[1]);
211 while ((i = get2(map, dot, &sh) > 0) && sh) {
218 dotinc = dot-savdot+2;
225 for (i = 0; i < 4; i++)
237 if (get1(map, dot, (uchar*)&buf[i], 1) < 0)
241 }while(!fullrune(buf, i));
248 dotinc = dot-savdot+1;
255 for (i = 0; i < 4; i++)
262 while ((i = get1(map, dot, &ch, 1) > 0) && ch) {
269 dotinc = dot-savdot+1;
276 i = machdata->das(map, dot, modifier, buf, sizeof(buf));
284 i = machdata->hexinst(map, dot, buf, sizeof(buf));
297 /* BUG: 'f' and 'F' assume szdouble is sizeof(vlong) in the literal case */
299 v = machdata->swav(dot);
300 memmove(buf, &v, mach->szfloat);
301 }else if (get1(map, dot, (uchar*)buf, mach->szfloat) < 0)
303 machdata->sftos(buf, sizeof(buf), (void*) buf);
305 dotinc = mach->szfloat;
309 /* BUG: 'f' and 'F' assume szdouble is sizeof(vlong) in the literal case */
311 v = machdata->swav(dot);
312 memmove(buf, &v, mach->szdouble);
313 }else if (get1(map, dot, (uchar*)buf, mach->szdouble) < 0)
315 machdata->dftos(buf, sizeof(buf), (void*) buf);
317 dotinc = mach->szdouble;
328 while (*fp != '"' && *fp)
335 dot=inkdot(-dotinc*fcount);
339 dot=inkdot((WORD)fcount);
343 dot=inkdot(-(WORD)fcount);
347 if (findsym(dot, CTEXT, &s))
348 dprint("%s() ", s.name);
354 error("bad modifier");
356 if (map->seg[0].fd >= 0)
368 static char hex[] = "0123456789abcdef";
370 if (c < SPC || c >= 0177)
371 dprint("\\x%c%c", hex[(c&0xF0)>>4], hex[c&0xF]);
382 if ((incr >= 0 && newdot < dot)
383 || (incr < 0 && newdot > dot))
384 error("address wraparound");