diff src/pseudo.c @ 54:360d53062bb9

Fixed typo in instruction table and added END directive
author lost
date Sun, 04 Jan 2009 20:38:12 +0000
parents 493cb8ea50a0
children 55260a178667
line wrap: on
line diff
--- a/src/pseudo.c	Sun Jan 04 20:28:30 2009 +0000
+++ b/src/pseudo.c	Sun Jan 04 20:38:12 2009 +0000
@@ -274,30 +274,41 @@
 	}
 }
 
-/*
-void pseudo_end(asmstate_t *as, sourceline_t *cl, char **optr)
+OPFUNC(pseudo_end)
 {
-	int rval, v1;
+	int rval;
+	lwasm_expr_stack_t *s;
+	
+
+	as -> endseen = 1;
 	
-	while (**optr && isspace(**optr))
-		;
-	if (**optr && **optr != '*' && **optr != ';')
+	// address only matters for DECB output
+	if (as -> outformat != OUTPUT_DECB)
+		return;
+	
+	s = lwasm_evaluate_expr(as, l, *p, NULL);
+	if (!s)
 	{
-		rval = eval_expr(as, cl, optr, &v1);
-		if (rval < 0)
-		{
-			errorp1(ERR_FORWARD);
-			return;
-		}
+		register_error(as, l, 1, "Bad expression");
+		return;
+	}
+	if (!lwasm_expr_is_constant(s))
+	{
+		register_error(as, l, 2, "Incomplete reference");
 	}
-	else
+	rval = lwasm_expr_get_value(s);
+	lwasm_expr_stack_free(s);
+
+	rval = rval & 0xffff;
+	if (as -> passnum == 2)
 	{
-		v1 = 0;
+		as -> execaddr = rval;
+		l -> symaddr = rval;
+		l -> addrset = 2;
 	}
-	if (as -> passnum == 2)
-		as -> execaddr = v1;
-}				
+}
 
+/*
 void pseudo_align(asmstate_t *as, sourceline_t *cl, char **optr)
 {
 	int rval, v1;