diff lwasm/insn_indexed.c @ 442:a9521955554f 3.0

Added pragma pcaspcr to treat PC as PCR; additional fixes for PCR addressing modes
author lost@l-w.ca
date Sat, 30 Oct 2010 12:15:00 -0600
parents 7b8d89435f30
children
line wrap: on
line diff
--- a/lwasm/insn_indexed.c	Sat Oct 30 11:51:25 2010 -0600
+++ b/lwasm/insn_indexed.c	Sat Oct 30 12:15:00 2010 -0600
@@ -257,7 +257,7 @@
 	}
 	
 	// PCR? then we have PC relative addressing (like B??, LB??)
-	if (rn == 5)
+	if (rn == 5 || (rn == 6 && CURPRAGMA(l, PRAGMA_PCASPCR)))
 	{
 		lw_expr_t e1, e2;
 		// external references are handled exactly the same as for
@@ -274,12 +274,26 @@
 		lwasm_save_expr(l, 0, e2);
 		if (l -> lint == 1)
 		{
-			l -> pb = (indir * 0x80) | 0x8C;
+			l -> pb = indir ? 0x9C : 0x8C;
 			return;
 		}
 		if (l -> lint == 2)
 		{
-			l -> pb = (indir * 0x80) | 0x8D;
+			l -> pb = indir ? 0x9D : 0x8D;
+			return;
+		}
+	}
+	
+	if (rn == 6)
+	{
+		if (l -> lint == 1)
+		{
+			l -> pb = indir ? 0x9C : 0x8C;
+			return;
+		}
+		if (l -> lint == 2)
+		{
+			l -> pb = indir ? 0x9D : 0x8D;
 			return;
 		}
 	}