changeset 130:50d86baf4ea2

Fixed code generation bug with forced-size offsets from X,Y,U,S
author lost@l-w.ca
date Thu, 11 Aug 2011 22:48:16 -0600
parents 5706712f8a20
children f2f3a4b0a25e
files lwasm/insn_indexed.c
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/insn_indexed.c	Thu Aug 11 22:25:29 2011 -0600
+++ b/lwasm/insn_indexed.c	Thu Aug 11 22:48:16 2011 -0600
@@ -190,7 +190,7 @@
 		(*p)++;
 	}
 
-	if (**p == '0' && *(*p+1) == ',')
+	if (**p == '0' && *((*p)+1) == ',')
 	{
 		f0 = 1;
 	}
@@ -230,6 +230,20 @@
 			(*p)++;
 	}
 
+	if (rn <= 3)
+	{
+		// X,Y,U,S
+		if (l -> lint == 1)
+		{
+			l -> pb = 0x88 | (rn << 5) | (indir ? 0x10 : 0);
+		}
+		else if (l -> lint == 2)
+		{
+			l -> pb = 0x89 | (rn << 5) | (indir ? 0x10 : 0);
+		}
+		return;
+	}
+
 	// nnnn,W is only 16 bit (or 0 bit)
 	if (rn == 4)
 	{