diff lwasm/pass1.c @ 367:c6d2a1f54e0c

Change processor target variations to pragmas. Add "pragma 6809" and "pragma 6309" which select the processor target rather than a global flag. The command line switches set or reset the pragma appropriately. Thanks to Erik G <erik@6809.org> for the patch.
author William Astle <lost@l-w.ca>
date Mon, 15 Jun 2015 21:21:58 -0600
parents 98f3e016cfd8
children 8764142b3192
line wrap: on
line diff
--- a/lwasm/pass1.c	Tue Jun 02 20:58:14 2015 -0600
+++ b/lwasm/pass1.c	Mon Jun 15 21:21:58 2015 -0600
@@ -299,7 +299,7 @@
 			if (as -> skipcond && !(instab[opnum].flags & lwasm_insn_cond))
 				goto linedone;
         	
-        	if (!nomacro && ((as -> pragmas & PRAGMA_SHADOW) || ((as -> target != TARGET_6309) && (instab[opnum].flags & lwasm_insn_is6309))))
+			if (!nomacro && ((as->pragmas & PRAGMA_SHADOW) || (!CURPRAGMA(cl, PRAGMA_6809) && (instab[opnum].flags & lwasm_insn_is6309))))
         	{
         		// check for macros even if they shadow real operations
         		// NOTE: "ENDM" cannot be shadowed
@@ -333,9 +333,11 @@
 				// no parse func means operand doesn't matter
 				if (instab[opnum].parse)
 				{
-					if ((as -> target != TARGET_6309) && (instab[opnum].flags & lwasm_insn_is6309))
+					if (CURPRAGMA(cl, PRAGMA_6809) && (instab[opnum].flags & lwasm_insn_is6309))
 						lwasm_register_error(as, cl, "Illegal use of 6309 instruction in 6809 mode (%s)", sym);
-			
+					if (!CURPRAGMA(cl, PRAGMA_6809) && (instab[opnum].flags & lwasm_insn_is6809))
+						lwasm_register_error(as, cl, "Illegal use of 6809 instruction in 6309 mode (%s)", sym);
+
 					if (as -> instruct == 0 || instab[opnum].flags & lwasm_insn_struct)
 					{
 						cl -> len = -1;