diff lwasm/insn_gen.c @ 136:b78b2f1e011e

Fixed additional instruction length problems with logic/memory operations
author lost@l-w.ca
date Wed, 17 Aug 2011 21:04:33 -0600
parents 7317fbe024af
children f8b07153abc4
line wrap: on
line diff
--- a/lwasm/insn_gen.c	Wed Aug 17 19:44:32 2011 -0600
+++ b/lwasm/insn_gen.c	Wed Aug 17 21:04:33 2011 -0600
@@ -35,7 +35,7 @@
 extern void insn_resolve_indexed_aux(asmstate_t *as, line_t *l, int force, int elen);
 
 // "extra" is required due to the way OIM, EIM, TIM, and AIM work
-void insn_parse_gen_aux(asmstate_t *as, line_t *l, char **p)
+void insn_parse_gen_aux(asmstate_t *as, line_t *l, char **p, int elen)
 {
 	const char *optr2;
 	int v1, tv;
@@ -115,15 +115,15 @@
 	{
 		if (l -> lint2 == 0)
 		{
-			l -> len = OPLEN(instab[l -> insn].ops[0]) + 1;
+			l -> len = OPLEN(instab[l -> insn].ops[0]) + 1 + elen;
 		}
 		else if (l -> lint2 == 2)
 		{
-			l -> len = OPLEN(instab[l -> insn].ops[2]) + 2;
+			l -> len = OPLEN(instab[l -> insn].ops[2]) + 2 + elen;
 		}
 		else if (l -> lint2 == 1 && l -> lint != -1)
 		{
-			l -> len = OPLEN(instab[l -> insn].ops[1]) + l -> lint + 1;
+			l -> len = OPLEN(instab[l -> insn].ops[1]) + l -> lint + 1 + elen;
 		}
 	}
 }
@@ -168,15 +168,15 @@
 	{
 		if (l -> lint2 == 0)
 		{
-			l -> len = OPLEN(instab[l -> insn].ops[0]) + 1;
+			l -> len = OPLEN(instab[l -> insn].ops[0]) + 1 + elen;
 		}
 		else if (l -> lint2 == 2)
 		{
-			l -> len = OPLEN(instab[l -> insn].ops[2]) + 2;
+			l -> len = OPLEN(instab[l -> insn].ops[2]) + 2 + elen;
 		}
 		else if (l -> lint2 == 1 && l -> lint != -1)
 		{
-			l -> len = OPLEN(instab[l -> insn].ops[1]) + l -> lint + 1;
+			l -> len = OPLEN(instab[l -> insn].ops[1]) + l -> lint + 1 + elen;
 		}
 	}
 }
@@ -215,7 +215,7 @@
 	}
 	
 	// handle non-immediate
-	insn_parse_gen_aux(as, l, p);
+	insn_parse_gen_aux(as, l, p, 0);
 }
 
 RESOLVEFUNC(insn_resolve_gen0)
@@ -252,7 +252,7 @@
 	}
 	
 	// handle non-immediate
-	insn_parse_gen_aux(as, l, p);
+	insn_parse_gen_aux(as, l, p, 0);
 	if (l -> lint2 != -1)
 	{
 		if (l -> lint2 == 0)
@@ -313,7 +313,7 @@
 	}
 	
 	// handle non-immediate
-	insn_parse_gen_aux(as, l, p);
+	insn_parse_gen_aux(as, l, p, 0);
 	if (l -> lint2 != -1)
 	{
 		if (l -> lint2 == 0)
@@ -374,7 +374,7 @@
 	}
 	
 	// handle non-immediate
-	insn_parse_gen_aux(as, l, p);
+	insn_parse_gen_aux(as, l, p, 0);
 	if (l -> lint2 != -1)
 	{
 		if (l -> lint2 == 0)