shithub: rgbds

Download patch

ref: 362aea22bdf6b8bb08ef032f96c030f3ddb6d597
parent: 5679c7066b0f7365f0696fd07f539e5b9dd82a7d
author: Antonio Niño Díaz <[email protected]>
date: Mon Apr 10 18:57:05 EDT 2017

Fix conflict in yacc

`LD HL,n16` and `LD SP,n16` are handled in a different rule as
`LD r16,n16`, but they are also part of that rule.

This patch converts the `LD r16,n16` rule into two rules, one for doing
`LD BC,n16` and other one for `LD DE,n16`.

Signed-off-by: Antonio Niño Díaz <[email protected]>

--- a/src/asm/asmy.y
+++ b/src/asm/asmy.y
@@ -1475,8 +1475,14 @@
 					}
 ;
 
-z80_ld_ss		:	T_Z80_LD reg_ss comma const_16bit
-					{ out_AbsByte(0x01|($2<<4)); out_RelWord(&$4); }
+z80_ld_ss		:	T_Z80_LD T_MODE_BC comma const_16bit
+					{ out_AbsByte(0x01|(REG_BC<<4)); out_RelWord(&$4); }
+				|	T_Z80_LD T_MODE_DE comma const_16bit
+					{ out_AbsByte(0x01|(REG_DE<<4)); out_RelWord(&$4); }
+				/*
+				 * HL is taken care of in z80_ld_hl
+				 * SP is taken care of in z80_ld_sp
+				 */
 ;
 
 z80_nop			:	T_Z80_NOP