diff --git a/compiler/z80/z80ins.dat b/compiler/z80/z80ins.dat index 1d1f5fac18..b500712ed1 100644 --- a/compiler/z80/z80ins.dat +++ b/compiler/z80/z80ins.dat @@ -181,6 +181,23 @@ NC,e $30,e Z,e $28,e NZ,e $20,e +; pseudo instruction - translated to JR if possible (i.e. the target is within +; -126..+129 bytes range and an appropriate form of the JR instruction exists), +; otherwise to JP +[JRJP] +; JR +e $18,e +C,e $38,e +NC,e $30,e +Z,e $28,e +NZ,e $20,e +; JP +nn $C3,nn +cc,nn %11ccc010,nn +(HL) $E9 +(IX) $DD,$E9 +(IY) $FD,$E9 + [LD] r,r' %01rrrr'r'r' r,n %00rrr110,n diff --git a/compiler/z80/z80nop.inc b/compiler/z80/z80nop.inc index 65a8aacb83..f74de227ea 100644 --- a/compiler/z80/z80nop.inc +++ b/compiler/z80/z80nop.inc @@ -1,2 +1,2 @@ { don't edit, this file is generated from z80ins.dat; to regenerate, run 'make insdat' in the compiler directory } -203; +213; diff --git a/compiler/z80/z80op.inc b/compiler/z80/z80op.inc index d641da8d60..f1859d6cd3 100644 --- a/compiler/z80/z80op.inc +++ b/compiler/z80/z80op.inc @@ -30,6 +30,7 @@ A_INI, A_INIR, A_JP, A_JR, +A_JRJP, A_LD, A_LDD, A_LDDR, diff --git a/compiler/z80/z80stdopnames.inc b/compiler/z80/z80stdopnames.inc index 7cfbe373c9..60d83a24ea 100644 --- a/compiler/z80/z80stdopnames.inc +++ b/compiler/z80/z80stdopnames.inc @@ -30,6 +30,7 @@ 'inir', 'jp', 'jr', +'jrjp', 'ld', 'ldd', 'lddr', diff --git a/compiler/z80/z80tab.inc b/compiler/z80/z80tab.inc index 8869e35da8..c3b025753f 100644 --- a/compiler/z80/z80tab.inc +++ b/compiler/z80/z80tab.inc @@ -567,6 +567,76 @@ code : '$20,e'; flags : 0 ), + ( + opcode : A_JRJP; + ops : 1; + optypes : (OT_RELJMP8,OT_NONE); + code : '$18,e'; + flags : 0 + ), + ( + opcode : A_JRJP; + ops : 2; + optypes : (OT_COND_C,OT_RELJMP8); + code : '$38,e'; + flags : 0 + ), + ( + opcode : A_JRJP; + ops : 2; + optypes : (OT_COND_NC,OT_RELJMP8); + code : '$30,e'; + flags : 0 + ), + ( + opcode : A_JRJP; + ops : 2; + optypes : (OT_COND_Z,OT_RELJMP8); + code : '$28,e'; + flags : 0 + ), + ( + opcode : A_JRJP; + ops : 2; + optypes : (OT_COND_NZ,OT_RELJMP8); + code : '$20,e'; + flags : 0 + ), + ( + opcode : A_JRJP; + ops : 1; + optypes : (OT_IMM16,OT_NONE); + code : '$C3,nn'; + flags : 0 + ), + ( + opcode : A_JRJP; + ops : 2; + optypes : (OT_COND,OT_IMM16); + code : '%11ccc010,nn'; + flags : 0 + ), + ( + opcode : A_JRJP; + ops : 1; + optypes : (OT_REF_HL,OT_NONE); + code : '$E9'; + flags : 0 + ), + ( + opcode : A_JRJP; + ops : 1; + optypes : (OT_REF_IX,OT_NONE); + code : '$DD,$E9'; + flags : 0 + ), + ( + opcode : A_JRJP; + ops : 1; + optypes : (OT_REF_IY,OT_NONE); + code : '$FD,$E9'; + flags : 0 + ), ( opcode : A_LD; ops : 2;