changeset 229:59a138df0401

Fixed additional parsing problems with pseudo ops
author lost
date Fri, 12 Jun 2009 01:31:18 +0000
parents 560843a951f7
children 0df2a39a268c
files ChangeLog lwasm/lwasm.h lwasm/pseudo.c
diffstat 3 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jun 12 00:19:03 2009 +0000
+++ b/ChangeLog	Fri Jun 12 01:31:18 2009 +0000
@@ -15,6 +15,7 @@
 
 [!] Fixed error in the fix for invalid operands included in 2.4 [LWASM]
 [b] Fixed bug with "include" directive operand parsing [LWASM]
+[b] Fixed additional parsing errors with pseudo ops [LWASM]
 [+] Added includebin directive to include the literal contents of a binary
     file at the current assembly address. [LWASM]
 [+] Added || and && as boolean or and boolean and respectively [LWASM]
--- a/lwasm/lwasm.h	Fri Jun 12 00:19:03 2009 +0000
+++ b/lwasm/lwasm.h	Fri Jun 12 01:31:18 2009 +0000
@@ -239,5 +239,6 @@
 #undef __lwasm_E__
 
 
+#define skip_operand(p) do { char **p2 = (char **)(p); for ( ; **p2; (*p2)++ ) ; } while (0)
 
 #endif //__lwasm_h_seen__
--- a/lwasm/pseudo.c	Fri Jun 12 00:19:03 2009 +0000
+++ b/lwasm/pseudo.c	Fri Jun 12 01:31:18 2009 +0000
@@ -34,7 +34,7 @@
 
 OPFUNC(pseudo_noop)
 {
-
+	skip_operand(p);
 }
 
 OPFUNC(pseudo_org)
@@ -54,6 +54,7 @@
 		// resolve on the second pass
 		// we saved the org address in l -> codeaddr on pass 1
 		as -> addr = l -> codeaddr;
+		skip_operand(p);
 		return;
 	}
 	
@@ -84,6 +85,7 @@
 	if (as -> passnum != 1)
 	{
 		as -> context = lwasm_next_context(as);
+		skip_operand(p);
 		return;
 	}
 
@@ -208,6 +210,7 @@
 	if (as -> passnum == 2)
 	{
 		as -> addr += l -> nocodelen;
+		skip_operand(p);
 		return;
 	}
 	r = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v, -1);
@@ -224,6 +227,7 @@
 	if (as -> passnum == 2)
 	{
 		as -> addr += l -> nocodelen;
+		skip_operand(p);
 		return;
 	}
 	r = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v, 0);
@@ -241,6 +245,7 @@
 	if (as -> passnum == 2)
 	{
 		as -> addr += l -> nocodelen;
+		skip_operand(p);
 		return;
 	}
 	r = lwasm_expr_result2(as, l, p, EXPR_SECTCONST | EXPR_PASS1CONST, &v, 0);
@@ -296,7 +301,10 @@
 	
 	// address only matters for DECB output
 	if (as -> outformat != OUTPUT_DECB)
+	{
+		skip_operand(p);
 		return;
+	}
 	
 	r = lwasm_expr_result2(as, l, p, 0, &v, 0);
 	if (r != 0)
@@ -321,6 +329,7 @@
 	
 	if (as -> passnum == 2)
 	{
+		skip_operand(p);
 		while (as -> addr < l -> symaddr)
 			lwasm_emit(as, l, 0);
 		return;
@@ -762,6 +771,7 @@
 
 	if (as -> passnum != 1)
 	{
+		skip_operand(p);
 		if (!(l -> fsize))
 		{
 			as -> skipcond = 1;
@@ -817,6 +827,7 @@
 
 	if (as -> passnum != 1)
 	{
+		skip_operand(p);
 		if (l -> fsize)
 		{
 			as -> skipcond = 1;
@@ -1087,6 +1098,7 @@
 	as -> addr = 0;
 	as -> csect = 0;
 	as -> context = lwasm_next_context(as);
+	skip_operand(p);
 }
 
 OPFUNC(pseudo_extern)
@@ -1109,6 +1121,7 @@
 	if (l -> sym)
 	{
 		lwasm_register_symbol(as, l, l -> sym, 0, SYMBOL_EXTERN);
+		for ( ; **p; (*p)++) ;
 		return;
 	}
 	
@@ -1154,7 +1167,15 @@
 	}
 
 	if (as -> passnum == 1)
+	{
+		skip_operand(p);
 		return;
+	}
+
+	if (l -> sym)
+	{
+		for ( ; **p; (*p)++) ;
+	}
 
 again:
 	if (!(l -> sym) || after == 1)