ref: fb23dfbf5a77f306fa0181482a78ad4ed9ce73fc
parent: ff58427122a2ef2ae2c93fbef590ff2cce43b7b1
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Dec 19 02:30:28 EST 2017
[as-z80] Copy always all the bytes from op buffer Some times it works if you don't copy all the bytes, but in some opcodes you need all the bytes.
--- a/as/target/x80/ins.c
+++ b/as/target/x80/ins.c
@@ -150,7 +150,7 @@
par1 = args[0];
par2 = args[1];
- memcpy(buf, op->bytes, n-1);
+ memcpy(buf, op->bytes, n);
buf[n-1] = par2->sym->value;
buf[n-2] |= reg2int(par1->sym->argtype) << 3;
emit(buf, n);
@@ -173,7 +173,7 @@
par1 = args[0]->left;
par2 = args[1];
- memcpy(buf, op->bytes, n-1);
+ memcpy(buf, op->bytes, n);
buf[n-1] = par1->sym->value;
buf[n-2] |= reg2int(par2->sym->argtype);
emit(buf, n);
@@ -189,7 +189,7 @@
par1 = args[0]->left;
par2 = args[1];
- memcpy(buf, op->bytes, n-1);
+ memcpy(buf, op->bytes, n);
buf[n-1] = par1->sym->value;
buf[n-2] = par2->sym->value;
emit(buf, n);
@@ -204,7 +204,7 @@
par2 = args[1];
- memcpy(buf, op->bytes, n-1);
+ memcpy(buf, op->bytes, n);
buf[n-1] = par2->sym->value;
emit(buf, n);
}
@@ -219,7 +219,7 @@
par2 = args[1];
- memcpy(buf, op->bytes, n-2);
+ memcpy(buf, op->bytes, n);
val = par2->sym->value;
buf[n-1] = val >> 8;
buf[n-2] = val;
@@ -287,7 +287,7 @@
par1 = args[0];
- memcpy(buf, op->bytes, n-1);
+ memcpy(buf, op->bytes, n);
buf[n-1] |= reg2int(par1->sym->argtype) << 4;
emit(buf, n);
}
@@ -303,7 +303,7 @@
par1 = args[0];
par2 = args[1];
- memcpy(buf, op->bytes, n-1);
+ memcpy(buf, op->bytes, n);
val = par2->sym->value;
buf[n-1] = val >> 8;
buf[n-2] = val;