changeset 49:21ae0fab469b

Added needed infra for useful listing of EQU and ORG type statements
author lost
date Sun, 04 Jan 2009 07:37:19 +0000
parents 6de358e7903f
children e672232caffe
files src/list.c src/lwasm.h src/pass1.c src/pseudo.c
diffstat 4 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/list.c	Sun Jan 04 07:31:20 2009 +0000
+++ b/src/list.c	Sun Jan 04 07:37:19 2009 +0000
@@ -67,7 +67,14 @@
 
 	for (l = as -> lineshead; l; l = l -> next)
 	{
-		fprintf(lf, "%04X ", l -> codeaddr);
+		if (l -> addrset == 1 || l -> codelen > 0 || l -> nocodelen > 0)
+		{
+			fprintf(lf, "%04X ", l -> codeaddr);
+		}
+		else
+		{
+			fprintf(lf, "     ");
+		}
 		
 		for (c = 0; c < l -> codelen && c < 5; c++)
 		{
--- a/src/lwasm.h	Sun Jan 04 07:31:20 2009 +0000
+++ b/src/lwasm.h	Sun Jan 04 07:37:19 2009 +0000
@@ -55,6 +55,8 @@
 	int codesize;		// the size of the code buffer
 	int codeaddr;		// address the code goes at
 	int nocodelen;		// for "RMB" type instructions
+	int addrset;		// set if this instruction sets the assembly address
+	int symaddr;		// set if this instruction sets a symbol addr with EQU or the like
 };
 
 // for keeping track of symbols
--- a/src/pass1.c	Sun Jan 04 07:31:20 2009 +0000
+++ b/src/pass1.c	Sun Jan 04 07:37:19 2009 +0000
@@ -140,6 +140,8 @@
 			nl -> codelen = 0;
 			nl -> codesize = 0;
 			nl -> nocodelen = 0;
+			nl -> addrset = 0;
+			nl -> symaddr = -1;
 			if (as -> linestail)
 				as -> linestail -> next = nl;
 			as -> linestail = nl;
--- a/src/pseudo.c	Sun Jan 04 07:31:20 2009 +0000
+++ b/src/pseudo.c	Sun Jan 04 07:37:19 2009 +0000
@@ -47,8 +47,9 @@
 		register_error(as, l, 1, "Illegal incomplete reference (pass 1)");
 		return;
 	}
-	rval = lwasm_expr_get_value(s);
+	rval = lwasm_expr_get_value(s) & 0xffff;
 	l -> codeaddr = rval;
+	l -> addrset = 1;
 	as -> addr = rval;
 }