diff lwasm/insn_tfm.c @ 228:560843a951f7

Added compatibility alternatives to TFM
author lost
date Fri, 12 Jun 2009 00:19:03 +0000
parents bae1e3ecdce1
children
line wrap: on
line diff
--- a/lwasm/insn_tfm.c	Fri Jun 12 00:06:24 2009 +0000
+++ b/lwasm/insn_tfm.c	Fri Jun 12 00:19:03 2009 +0000
@@ -109,3 +109,31 @@
 	}
 	lwasm_emit(as, l, (r0 << 4) | r1);
 }
+
+OPFUNC(insn_tfmrtor)
+{
+	int r0, r1;
+	static const char *regs = "D X Y U S       A B     0 0 E F ";
+	
+	lwasm_emitop(as, l, instab[opnum].ops[0]);
+	// register to register (r0,r1)
+	// registers are in order:
+	// D,X,Y,U,S,PC,W,V
+	// A,B,CC,DP,0,0,E,F
+	r0 = lwasm_lookupreg2(regs, p);
+	if (r0 < 0 || *(*p)++ != ',')
+	{
+		register_error(as, l, 1, "Bad operand");
+		r0 = r1 = 0;
+	}
+	else
+	{
+		r1 = lwasm_lookupreg2(regs, p);
+		if (r1 < 0)
+		{
+			register_error(as, l, 1, "Bad operand");
+			r0 = r1 = 0;
+		}
+	}
+	lwasm_emit(as, l, (r0 << 4) | r1);
+}