scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit 22afddcc9fd179aa0df4f1709aaf5213d7370c84
parent 40ac32e5ac6e9caeda669cbb4a3bd099b1b4d7f9
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 18 Dec 2017 14:58:13 +0000

[as-z80] Add call and return group

Diffstat:
Mas/target/gen.awk | 2++
Mas/target/x80/ins.c | 14++++++++++++++
Mas/target/x80/proc.h | 1+
Mas/target/x80/x80.dat | 10+++++++++-
4 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/as/target/gen.awk b/as/target/gen.awk @@ -77,6 +77,8 @@ function str2args(s, args, i, out, n) 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\)/)) { diff --git a/as/target/x80/ins.c b/as/target/x80/ins.c @@ -375,8 +375,22 @@ cc_imm16(Op *op, Node **args) } void +cc(Op *op, Node **args) +{ + /* TODO */ + abort(); +} + +void jr(Op *op, Node **args) { /* TODO */ abort(); } + +void +rst(Op *op, Node **args) +{ + /* TODO */ + abort(); +} diff --git a/as/target/x80/proc.h b/as/target/x80/proc.h @@ -58,6 +58,7 @@ enum args { AIMM3, /* 3 bit immediate */ AZERO, /* a literal 0 */ + ARST, /* 0h, 08h, 10h, 18h, 20h, 28h, 30h, 38h */ }; extern int rclass(int reg); diff --git 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 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 + +# 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