diff src/pseudo.c @ 65:31d8e85706e7

Implemented setdp and corrected handling of direct page detection in insn_gen_aux()
author lost
date Mon, 05 Jan 2009 01:40:01 +0000
parents aaddd47219b4
children c8c772ef5df9
line wrap: on
line diff
--- a/src/pseudo.c	Mon Jan 05 01:27:08 2009 +0000
+++ b/src/pseudo.c	Mon Jan 05 01:40:01 2009 +0000
@@ -396,42 +396,19 @@
 	lwasm_register_symbol(as, l, l -> sym, rval, SYMBOL_SET);
 }
 
-/*
-void pseudo_setdp(asmstate_t *as, sourceline_t *cl, char **optr)
+OPFUNC(pseudo_setdp)
 {
-	int rval, v1;
+	int rval;
 
-	if (cl -> hassym)
-	{
-		register_error(as, cl, ERR_SYM);
-		cl -> hassym = 0;
-		return;
-	}
-	else
-	{
-		rval = eval_expr(as, cl, optr, &v1);
-		if (rval == -1)
-		{
-			errorp1(ERR_FORWARD);
-		}
-		if (rval < 0)
-		{
-			cl -> opcode = -1;
-			return;
-		}
-	}
-	// setdp needs to resolve properly on pass 2
-	if (v1 > 0xff || v1 < 0)
-	{
-		errorp1(ERR_OVERFLOW);
-	}	
-	as -> dpval = v1 & 0xff;
-	cl -> dpval = v1 & 0xff;
-	cl -> issetdp = 1;
-	cl -> numcodebytes = 0;
-//printf("%s\n", "SETDP2");
+	// setdp is needed on both passes	
+	if (lwasm_expr_result(as, l, p, EXPR_PASS1CONST | EXPR_PASS2CONST | EXPR_BYTE, &rval) < 0)
+		rval = 0;
+
+	l -> symaddr = rval & 0xFF;
+	l -> addrset = 2;
+	
+	as -> dpval = rval & 0xFF;
 }
-*/
 
 OPFUNC(pseudo_fcc)
 {