shithub: scc

Download patch

ref: 8de2cd4ed1cc4193a4db1c7aad83133dea693f96
parent: 79d018693743069006282ff218eb85acc3c7ee2b
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Dec 15 11:29:04 EST 2017

[as] Fix ASYM argument

The problem of this argument type is that it
has to use AIMM addr type, because a symbol is
an inmediate address, but it also has to export
that it is a symbol. This can be checked looking
in the parser opcode of the node, but it wasn't
published.

--- a/as/as.h
+++ b/as/as.h
@@ -42,6 +42,18 @@
 	AREP = 128
 };
 
+enum tokens {
+	EOS = -1,
+	IDEN = 1,
+	NUMBER,
+	REG,
+	STRING,
+	SHL,
+	SHR,
+	GE,
+	LE,
+};
+
 #define MAXSYM 63
 
 typedef struct reloc Reloc;
--- a/as/expr.c
+++ b/as/expr.c
@@ -10,18 +10,6 @@
 
 #define NNODES   10
 
-enum tokens {
-	EOS = -1,
-	IDEN = 1,
-	NUMBER,
-	REG,
-	STRING,
-	SHL,
-	SHR,
-	GE,
-	LE,
-};
-
 union yylval {
 	TUINT val;
 	Symbol *sym;
--- a/as/target/z80/proc.c
+++ b/as/target/z80/proc.c
@@ -109,7 +109,7 @@
 				error("overflow in immediate operand");
 			break;
 		case ASYM:
-			if (np->op != ASYM)
+			if (np->addr != AIMM || np->op != IDEN)
 				return 0;
 			break;
 		default: