Browse Source

+ Z80: added the JRJP pseudo instruction

git-svn-id: trunk@45496 -
nickysn 5 years ago
parent
commit
c5d04d1a54

+ 17 - 0
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

+ 1 - 1
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;

+ 1 - 0
compiler/z80/z80op.inc

@@ -30,6 +30,7 @@ A_INI,
 A_INIR,
 A_JP,
 A_JR,
+A_JRJP,
 A_LD,
 A_LDD,
 A_LDDR,

+ 1 - 0
compiler/z80/z80stdopnames.inc

@@ -30,6 +30,7 @@
 'inir',
 'jp',
 'jr',
+'jrjp',
 'ld',
 'ldd',
 'lddr',

+ 70 - 0
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;