shithub: scc

Download patch

ref: 551aa2e69a72c87ff63a356d38fa3c4fe668c219
parent: ae4c6ad84253a38cb453fd4432a029262954bd69
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Dec 16 16:56:28 EST 2017

[as-z80] Simplify r8-r8 instructions

There were several functions in this file that were duplicated
because the naming schema at the beginning was different

--- a/as/target/x80/ins.c
+++ b/as/target/x80/ins.c
@@ -140,7 +140,7 @@
 }
 
 void
-xx_r8_2(Op *op, Node **args)
+xx_r8(Op *op, Node **args)
 {
 	Node *par1, *par2;
 	unsigned char buf[3];
@@ -155,22 +155,7 @@
 }
 
 void
-r8_xx_2(Op *op, Node **args)
-{
-	Node *par1, *par2;
-	unsigned char buf[3];
-	int n = op->size;
-
-	par1 = args[0];
-	par2 = args[1];
-
-	memcpy(buf, op->bytes, n);
-	buf[n-1] |= reg2int(par2->sym->argtype) << 3;
-	emit(buf, n);
-}
-
-void
-r8_xx_1(Op *op, Node **args)
+r8_xx(Op *op, Node **args)
 {
 	Node *par1, *par2;
 	unsigned char buf[3];
--- a/as/target/x80/x80.dat
+++ b/as/target/x80/x80.dat
@@ -83,14 +83,14 @@
 LD	reg_r,reg_r	1	0x40	r8_r8	Z80,R800,GB80
 LD	reg_p,reg_p	2	0xdd,0x40	r8_r8	Z80,R800
 LD	reg_q,reg_q	2	0xfd,0x40	r8_r8	Z80,R800
-LD	indir_HL,reg_r	1	0x70	xx_r8_2	Z80,R800,GB80
-LD	reg_r,indir_HL	1	0x46	r8_xx_1	Z80,R800,GB80
+LD	indir_HL,reg_r	1	0x70	xx_r8	Z80,R800,GB80
+LD	reg_r,indir_HL	1	0x46	r8_xx	Z80,R800,GB80
 
 LD	HL,imm16	3	0x21	r_imm16	Z80,R800,GB80
 
-ADD	regA,reg_r	1	0x80	xx_r8_2	Z80,R800,GB80
-ADD	regA,reg_p	2	0xdd,0x80	xx_r8_2	Z80,R800
-ADD	regA,reg_q	2	0xfd,0x80	xx_r8_2	Z80,R800
+ADD	regA,reg_r	1	0x80	xx_r8	Z80,R800,GB80
+ADD	regA,reg_p	2	0xdd,0x80	xx_r8	Z80,R800
+ADD	regA,reg_q	2	0xfd,0x80	xx_r8	Z80,R800
 ADD	regA,imm8	2	0xc6	imm8	Z80,R800,GB80
 
 ADD	regA,indir_HL	1	0x86	noargs	Z80,R800,GB80