ref: 813c707f576ae9ab4209c5b155fc348571465313
parent: 5ee84680d8dea7bd1149bc57fa79a2be6228ce41
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Dec 18 09:49:19 EST 2017
[as-z80] Add Jump group
--- a/as/target/gen.awk
+++ b/as/target/gen.awk
@@ -81,6 +81,10 @@
out = out "AINDEX_IY"
} else if (match(a, /^\(IX\+n\)/)) {
out = out "AINDEX_IX"
+ } else if (match(a, /^ss/)) {
+ out = out "AREG_SSCLASS"
+ } else if (match(a, /^cc/)) {
+ out = out "AREG_CCCLASS"
} else if (match(a, /^dd/)) {
out = out "AREG_DDCLASS"
} else if (match(a, /^qq/)) {
--- a/as/target/x80/ins.c
+++ b/as/target/x80/ins.c
@@ -366,3 +366,17 @@
/* TODO */
abort();
}
+
+void
+cc_imm16(Op *op, Node **args)
+{
+ /* TODO */
+ abort();
+}
+
+void
+jr(Op *op, Node **args)
+{
+ /* TODO */
+ abort();
+}
--- a/as/target/x80/proc.h
+++ b/as/target/x80/proc.h
@@ -29,6 +29,14 @@
AREG_AF_,
AREG_SP,
+ AREG_NZ,
+ AREG_Z,
+ AREG_NC,
+ AREG_PO,
+ AREG_PE,
+ AREG_P,
+ AREG_M,
+
AREG_RCLASS, /* register class for B, C, D, E, H, L and A */
AREG_PCLASS, /* register class for B, C, D, E, IXH, IXL and A */
AREG_QCLASS, /* register class for B, C, D, E, IYH, IYL and A */
@@ -36,6 +44,8 @@
AREG_QQCLASS, /* register class for BC, DE, HL and AF */
AREG_PPCLASS, /* register class for BC, DE, IX and SP */
AREG_RRCLASS, /* register class for BC, DE, IY and SP */
+ AREG_SSCLASS, /* flag class for NZ, Z, NC, C, PO, PE, P, M */
+ AREG_CCCLASS, /* flag class for C, NC, Z, NZ */
AINDEX_IX, /* (IX+d) */
AINDEX_IY, /* (IX+d) */
--- a/as/target/x80/x80.dat
+++ b/as/target/x80/x80.dat
@@ -43,6 +43,8 @@
# qq is any register from BC, DE, HL, AF
# pp is any register from BC, DE, IX, SP
# rr is any register from BC, DE, IY, SP
+# cc is any flag from NZ, Z, NC, C, PO, PE, P, M
+# ss is any flag from C, NC, Z, NZ
# 8 bit load group
LD r,imm8 2 0x06 r8_imm8 Z80,R800,GB80
@@ -329,3 +331,11 @@
OTIR none 2 0xed,0xb3 noargs Z80,R800
OUTD none 2 0xed,0xab noargs Z80,R800
OTDR none 2 0xed,0xbb noargs Z80,R800
+
+# Jump group
+JP imm16 3 0xc3 imm16 Z80,R800,GB80
+JP cc,imm16 3 0xc2 cc_imm16 Z80,R800,GB80
+JR imm8 2 0x18 jr Z80,R800,GB80
+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