ref: 8730d2ebb4229ca39985e459cefc8180d6ee441e
parent: 813c707f576ae9ab4209c5b155fc348571465313
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Dec 18 09:58:13 EST 2017
[as-z80] Add call and return group
--- a/as/target/gen.awk
+++ b/as/target/gen.awk
@@ -77,6 +77,8 @@
out = out "AIMM64"
} else if (match(a, /^imm3/)) {
out = out "AIMM3"
+ } else if (match(a, /^rst/)) {
+ out = out "ARST"
} else if (match(a, /^\(IY\+n\)/)) {
out = out "AINDEX_IY"
} else if (match(a, /^\(IX\+n\)/)) {
--- a/as/target/x80/ins.c
+++ b/as/target/x80/ins.c
@@ -375,7 +375,21 @@
}
void
+cc(Op *op, Node **args)
+{
+ /* TODO */
+ abort();
+}
+
+void
jr(Op *op, Node **args)
+{
+ /* TODO */
+ abort();
+}
+
+void
+rst(Op *op, Node **args)
{
/* TODO */
abort();
--- a/as/target/x80/proc.h
+++ b/as/target/x80/proc.h
@@ -58,6 +58,7 @@
AIMM3, /* 3 bit immediate */
AZERO, /* a literal 0 */
+ ARST, /* 0h, 08h, 10h, 18h, 20h, 28h, 30h, 38h */
};
extern int rclass(int reg);
--- a/as/target/x80/x80.dat
+++ b/as/target/x80/x80.dat
@@ -33,7 +33,6 @@
.ALIGN imm16+ 0 none align Z80,R800,GB80
.END none 0 none end Z80,R800,GB80
-RET none 1 0xc9 noargs Z80,R800,GB80
# p is any register from B, C, D, E, IXL, IXH, A
@@ -339,3 +338,12 @@
JR ss,imm8 2 0x00 jr Z80,R800,GB80
JP IY 2 0xfd,0xe9 noargs Z80,R800
DJNZ imm8 2 0x10 jr Z80,R800,GB80
+
+# Call and return group
+CALL imm16 3 0xcd imm16 Z80,R800,GB80
+CALL cc,imm16 3 0xc6 cc_imm16 Z80,R800
+RET none 1 0xc9 noargs Z80,R800,GB80
+RET cc 1 0xc0 cc Z80,R800
+RETI none 2 0xed,0x4d noargs Z80,R800
+RETN none 2 0xed,0x45 noargs Z80,R800
+RST rst 1 0xc7 rst Z80,R800,GB80