ref: 0fe5edeb017c23009e9d673361509923a43ac381
parent: 24aa60c70ccb02c74fe9658ca54520963e0fc688
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Dec 16 15:56:04 EST 2017
[as] Add type pseudo instruction This instruction generates a type annotation for the symbol.
--- a/as/as.h
+++ b/as/as.h
@@ -121,6 +121,7 @@
struct symbol {
String name;
+ String type;
unsigned char flags;
unsigned char pass;
unsigned char argtype;
--- a/as/ins.c
+++ b/as/ins.c
@@ -13,6 +13,7 @@
SIZE,
XSTRING,
ASCII,
+ TYPE,
};
char *
@@ -140,6 +141,9 @@
case SIZE:
sym->size = exp->value;
break;
+ case TYPE:
+ sym->type.buf = xstrdup(exp->name.buf);
+ break;
}
}
@@ -159,6 +163,12 @@
size(Op *op, Node **args)
{
symexp(SIZE, op, args);
+}
+
+void
+type(Op *op, Node **args)
+{
+ symexp(TYPE, op, args);
}
void
--- a/as/target/x80/x80.dat
+++ b/as/target/x80/x80.dat
@@ -24,6 +24,8 @@
.SIZE imm16 0 none size Z80,R800,GB80
.COMM sym,imm16 0 none common Z80,R800,GB80
.COMM imm16 0 none common Z80,R800,GB80
+.TYPE sym,imm16 0 none type Z80,R800,GB80
+.TYPE imm16 0 none type Z80,R800,GB80
.GLOBL sym+ 0 none global Z80,R800,GB80
.EXTERN sym+ 0 none extrn Z80,R800,GB80
.STRING string+ 0 none string Z80,R800,GB80