diff lwasm/insn_rlist.c @ 373:00fced888c5d

Fix psh/pul to not accept the stack pointer as a valid argument Don't allow "pshs s", "puls s", "pshu u", or "pulu u" - none of those are valid on the 6809 (not encodable) so they need to throw an error.
author William Astle <lost@l-w.ca>
date Wed, 24 Jun 2015 19:39:13 -0600
parents 8764142b3192
children 35d4213e6657
line wrap: on
line diff
--- a/lwasm/insn_rlist.c	Mon Jun 22 19:23:11 2015 -0600
+++ b/lwasm/insn_rlist.c	Wed Jun 24 19:39:13 2015 -0600
@@ -47,6 +47,23 @@
 		}
 		if (**p == ',')
 			(*p)++;
+		if ((instab[l -> insn].ops[0]) & 2)
+		{
+			// pshu/pulu
+			if (rn == 6)
+			{
+				lwasm_register_error2(as, l, E_REGISTER_BAD, "'%s'", "u");
+				return;
+			}
+		}
+		else
+		{
+			if (rn == 9)
+			{
+				lwasm_register_error2(as, l, E_REGISTER_BAD, "'%s'", "s");
+				return;
+			}
+		}
 		if (rn == 8)
 			rn = 6;
 		else if (rn == 9)