From c51aac0c20992a81b2e72d30ddae8328fd232b90 Mon Sep 17 00:00:00 2001 From: AntonioND Date: Tue, 21 Mar 2017 01:30:12 +0000 Subject: [PATCH] Declare some opcodes obsolete They are still working, they just output a warning. `jp [hl]` is confusing as it may be thought that the CPU reads the value pointed by hl and jumps to it. `ldi a,hl` and `ldd a,hl` are also confusing as they load from the address pointed by `hl`, the correct mnemonic should say `[hl]`. Signed-off-by: AntonioND --- src/asm/asmy.y | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/asm/asmy.y b/src/asm/asmy.y index 7e6047e1..3b0d98bd 100644 --- a/src/asm/asmy.y +++ b/src/asm/asmy.y @@ -1279,7 +1279,11 @@ z80_jp : T_Z80_JP const_16bit | T_Z80_JP ccode comma const_16bit { out_AbsByte(0xC2|($2<<3)); out_RelWord(&$4); } | T_Z80_JP T_MODE_HL_IND - { out_AbsByte(0xE9); } + { + out_AbsByte(0xE9); + if( nPass==1 ) + printf("warning:'JP [HL]' is obsolete, use 'JP HL' instead.\n"); + } | T_Z80_JP T_MODE_HL { out_AbsByte(0xE9); } ; @@ -1293,7 +1297,11 @@ z80_jr : T_Z80_JR const_PCrel z80_ldi : T_Z80_LDI T_MODE_HL_IND comma T_MODE_A { out_AbsByte(0x02|(2<<4)); } | T_Z80_LDI T_MODE_A comma T_MODE_HL - { out_AbsByte(0x0A|(2<<4)); } + { + out_AbsByte(0x0A|(2<<4)); + if( nPass==1 ) + printf("warning:'LDI A,HL' is obsolete, use 'LDI A,[HL]' or 'LD A,[HL+] instead.\n"); + } | T_Z80_LDI T_MODE_A comma T_MODE_HL_IND { out_AbsByte(0x0A|(2<<4)); } ; @@ -1301,7 +1309,11 @@ z80_ldi : T_Z80_LDI T_MODE_HL_IND comma T_MODE_A z80_ldd : T_Z80_LDD T_MODE_HL_IND comma T_MODE_A { out_AbsByte(0x02|(3<<4)); } | T_Z80_LDD T_MODE_A comma T_MODE_HL - { out_AbsByte(0x0A|(3<<4)); } + { + out_AbsByte(0x0A|(3<<4)); + if( nPass==1 ) + printf("warning:'LDD A,HL' is obsolete, use 'LDD A,[HL]' or 'LD A,[HL-] instead.\n"); + } | T_Z80_LDD T_MODE_A comma T_MODE_HL_IND { out_AbsByte(0x0A|(3<<4)); } ;