# HG changeset patch # User lost # Date 1231222831 0 # Node ID 9fa4f77dd119476168908b7b5a22f5c0d10b2ee6 # Parent 90a5657d54081b12f854e0aabe76f95a0e328a70 Fixed tab handling in list code; also added address to second and later lines in byte listing for a particular line diff -r 90a5657d5408 -r 9fa4f77dd119 src/list.c --- a/src/list.c Tue Jan 06 06:11:22 2009 +0000 +++ b/src/list.c Tue Jan 06 06:20:31 2009 +0000 @@ -49,7 +49,7 @@ { FILE *lf; lwasm_line_t *l; - int c; + int c, c3; char *p; if (as -> listfile[0] == '-' && as -> listfile[1] == '\0') @@ -95,27 +95,31 @@ fprintf(lf, " %20.20s:%05d ", l -> filename, l -> lineno); // print line here - for (c = 0, p = l -> text; *p; c++, p++) + for (c3 = 0, c = 0, p = l -> text; *p; c++, p++) { if (*p == '\t') { int c2; - c2 = 8 - (c % 8); + c2 = 8 - (c3 % 8); + c3 += c2; while (c2--) fputc(' ', lf); } else + { + c3++; fputc(*p, lf); + } } fputc('\n', lf); if (l -> codelen > 5) { - fprintf(lf, " "); + fprintf(lf, "%04X ", (l -> codeaddr + 5) & 0xFFFF); for (c = 5; c < l -> codelen; c++) { if (!(c % 5) && c != 5) { - fprintf(lf, "\n "); + fprintf(lf, "\n%04X ", (l -> codeaddr + c) & 0xFFFF); } fprintf(lf, "%02X", l -> bytes[c]); }