ref: 5ee84680d8dea7bd1149bc57fa79a2be6228ce41
parent: 5dd867285e5e00dc91a09feb6440b75726e02a82
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Dec 18 09:02:38 EST 2017
[as-z80] Add input and output group
--- a/as/target/gen.awk
+++ b/as/target/gen.awk
@@ -105,6 +105,8 @@
out = out "AINDER_HL"
} else if (match(a, /^\(SP\)/)) {
out = out "AINDER_SP"
+ } else if (match(a, /^\(C\)/)) {
+ out = out "AINDER_C"
} else if (match(a, /^SP/)) {
out = out "AREG_SP"
} else if (match(a, /^HL/)) {
@@ -121,10 +123,14 @@
out = out "AREG_AF"
} else if (match(a, /^A/)) {
out = out "AREG_A"
+ } else if (match(a, /^F/)) {
+ out = out "AREG_F"
} else if (match(a, /^\(n\)/)) {
out = out "ADIRECT"
} else if (match(a, /^I/)) {
out = out "AREG_I"
+ } else if (match(a, /^0/)) {
+ out = out "AZERO"
} else if (match(a, /^sym/)) {
out = out "ASYM"
} else if (match(a, /^string/)) {
--- a/as/target/x80/proc.h
+++ b/as/target/x80/proc.h
@@ -44,8 +44,10 @@
AINDER_DE, /* (DE) */
AINDER_BC, /* (BC) */
AINDER_SP, /* (SP) */
+ AINDER_C, /* (C) */
AIMM3, /* 3 bit immediate */
+ AZERO, /* a literal 0 */
};
extern int rclass(int reg);
--- a/as/target/x80/x80.dat
+++ b/as/target/x80/x80.dat
@@ -35,14 +35,6 @@
RET none 1 0xc9 noargs Z80,R800,GB80
-INI none 2 0xed,0xa2 noargs Z80,R800
-INIR none 2 0xed,0xb2 noargs Z80,R800
-IND none 2 0xed,0xaa noargs Z80,R800
-INDR none 2 0xed,0xba noargs Z80,R800
-OUTI none 2 0xed,0xa3 noargs Z80,R800
-OTIR none 2 0xed,0xb3 noargs Z80,R800
-OUTD none 2 0xed,0xab noargs Z80,R800
-OTDR none 2 0xed,0xbb noargs Z80,R800
# p is any register from B, C, D, E, IXL, IXH, A
# q is any register from B, C, D, E, IYL, IYH, A
@@ -320,3 +312,20 @@
RES imm3,(IY+n) 4 0xfd,0xcb,0,0x86 idx_bit Z80,R800
RES imm3,(IX+n),r 4 0xdd,0xcb,0,0x80 r_idx_bit Z80,R800
RES imm3,(IY+n),r 4 0xfd,0xcb,0,0x80 r_idx_bit Z80,R800
+
+# Input and output group
+IN A,(n) 2 0xdb imm8 Z80,R800
+IN r,(C) 2 0xed,0x40 r8_xx Z80,R800
+IN F,(C) 2 0xed,0x70 noargs Z80,R800
+INI none 2 0xed,0xa2 noargs Z80,R800
+INIR none 2 0xed,0xb2 noargs Z80,R800
+IND none 2 0xed,0xaa noargs Z80,R800
+INDR none 2 0xed,0xba noargs Z80,R800
+
+OUT (n),A 2 0xd3 imm8 Z80,R800
+OUT (C),r 2 0xed,0x41 r8_xx Z80,R800
+OUT (C),0 2 0xed,0x71 noargs Z80,R800
+OUTI none 2 0xed,0xa3 noargs Z80,R800
+OTIR none 2 0xed,0xb3 noargs Z80,R800
+OUTD none 2 0xed,0xab noargs Z80,R800
+OTDR none 2 0xed,0xbb noargs Z80,R800
--- a/as/target/z80/proc.c
+++ b/as/target/z80/proc.c
@@ -70,6 +70,9 @@
arg &= ~(AREP|AOPT);
switch (arg) {
+ case AINDER_C:
+ arg = AREG_C;
+ goto indirect;
case AINDER_HL:
arg = AREG_HL;
goto indirect;
@@ -86,6 +89,7 @@
return 0;
np = np->left;
case AREG_A:
+ case AREG_F:
case AREG_HL:
case AREG_DE:
case AREG_IY:
@@ -133,6 +137,7 @@
if (np->left->left->sym->argtype != arg)
return 0;
break;
+ case AZERO:
case AIMM3:
case AIMM8:
case AIMM16: