scc

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

commit 97827a05e1b575147df7d92852dae371837ecb51
parent b63b663d4d7813597a4e7a58253a67eac1848825
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 18 Jan 2018 16:54:26 +0000

[as-z80] Fix RET cc opcodes

The test for flag was inside of the test for imm, and this
was false in the case of RET.

Diffstat:
Mas/target/x80/ins.c | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/as/target/x80/ins.c b/as/target/x80/ins.c @@ -370,18 +370,18 @@ branch(int relative, Op *op, Node **args) if (imm) { val = imm->sym->value; - if (!relative) { - fun = cc2int; + if (!relative) buf[--i] = val >> 8; - } else { - fun = ss2int; + else val -= cursec->curpc - 2; - } buf[--i] = val; - if (flag) - buf[--i] |= (*fun)(flag) << 3; } + if (flag) { + fun = (relative) ? ss2int : cc2int; + buf[--i] |= (*fun)(flag) << 3; + } + emit(buf, n); }