Skip to content

Commit

Permalink
Fix conflict in yacc
Browse files Browse the repository at this point in the history
`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 <antonio_nd@outlook.com>
  • Loading branch information
AntonioND committed Apr 10, 2017
1 parent 5679c70 commit 362aea2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/asm/asmy.y
Original file line number Diff line number Diff line change
Expand Up @@ -1475,8 +1475,14 @@ z80_ld_a : T_Z80_LD reg_r comma T_MODE_C_IND
}
;

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
Expand Down

0 comments on commit 362aea2

Please sign in to comment.