changeset 72:9fa4f77dd119

Fixed tab handling in list code; also added address to second and later lines in byte listing for a particular line
author lost
date Tue, 06 Jan 2009 06:20:31 +0000
parents 90a5657d5408
children 4b37f17624a7
files src/list.c
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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]);
 			}