changeset 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 39490cf2d1c2
children 8e25147c2aa8
files lwasm/insn_rlist.c
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
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)