diff src/parse.c @ 63:d85ba47b1e8f

Moved symbol registration so symbols that are in skipped code do not get registered and so EQU/SET can do their own registration
author lost
date Mon, 05 Jan 2009 01:17:23 +0000
parents 035b95a3690f
children aaddd47219b4
line wrap: on
line diff
--- a/src/parse.c	Mon Jan 05 00:57:37 2009 +0000
+++ b/src/parse.c	Mon Jan 05 01:17:23 2009 +0000
@@ -66,15 +66,6 @@
 		
 		p = p2;
 		
-		if (as -> passnum == 1)
-		{
-			l -> sym = sym;
-			// have a symbol; now determine if it is valid and register it
-			// at the current address of the line
-			debug_message(1, "Registering symbol '%s' at %04X", sym, as -> addr);
-			if (lwasm_register_symbol(as, l, sym, as -> addr) < 0)
-				l -> sym = NULL;
-		}
 	}
 	else
 	{
@@ -132,6 +123,20 @@
 			goto done_line;
 	}
 	
+	// register symbol if needed
+	if (as -> skipcond == 0 && as -> inmacro == 0 && sym)
+	{
+		l -> sym = sym;
+		if (as -> passnum == 1 && !(instab[opnum].opcode && instab[opnum].setsym))
+		{
+			// have a symbol; now determine if it is valid and register it
+			// at the current address of the line
+			debug_message(1, "Registering symbol '%s' at %04X", sym, as -> addr);
+			if (lwasm_register_symbol(as, l, sym, as -> addr) < 0)
+				l -> sym = NULL;
+		}
+	}
+
 	if (!(instab[opnum].opcode) || !(instab[opnum].fn) && !(as -> skipcond || as -> inmacro))
 	{
 		// invalid operation code, throw error