shithub: scc

Download patch

ref: 5247d32a51b1bfab5b5c63d1894a3f896a9b9212
parent: d3a48f9fda0c555fec8d563e0155b7b915438377
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Jan 18 11:54:26 EST 2018

[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.

--- a/as/target/x80/ins.c
+++ b/as/target/x80/ins.c
@@ -370,18 +370,18 @@
 
 	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);
 }