ref: 989be0ccc62e691120b60f29a8da641b60954e52
parent: 454f06c1318b499daa5fd441e4053f749bb111d1
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed Sep 27 18:21:16 EDT 2017
[as] Add basic AIMM argument matching in z80 This matching is ignoring the size of the immediate at this moment.
--- a/as/expr.c
+++ b/as/expr.c
@@ -350,6 +350,7 @@
basic_atom:
np = node(yytoken, NULL, NULL);
np->sym = yylval.sym;
+ np->addr = addr;
next();
break;
default:
--- a/as/target/z80/proc.c
+++ b/as/target/z80/proc.c
@@ -53,23 +53,25 @@
int
match(Op *op, Node **args)
{
- char *p;
- int a, olda;
+ unsigned char *p;
+ int arg;
+ Node *np;
if (!op->args)
return args == NULL;
- for (p = op->args; *p; ++p) {
- if (*p != AREP)
- a = *p;
- else
+ for (p = op->args; (arg = *p) && *args; ++p) {
+ if (arg & AREP)
--p;
-
- switch (a) {
+ switch (arg & ~AREP) {
case AIMM8:
case AIMM16:
case AIMM32:
case AIMM64:
+ np = *args++;
+ if (np->addr != AIMM)
+ return 0;
+ break;
default:
abort();
}