Browse Source

* the conditional jump instructions combined in a single instruction Bxx

Nikolay Nikolov 1 year ago
parent
commit
2c22708b1e

+ 1 - 1
compiler/aoptobj.pas

@@ -2396,7 +2396,7 @@ Unit AoptObj;
                         stoploop := False;
                     end
 {$ifdef CPU_SUPPORTS_OPT_COND_JUMP}
-                  else if (taicpu(p).opcode {$if defined(z80) or defined(mos6502)}in{$else}={$endif} aopt_condjmp) then
+                  else if (taicpu(p).opcode {$if defined(z80)}in{$else}={$endif} aopt_condjmp) then
                     ThisPassResult := OptimizeConditionalJump(ThisLabel, p, hp1, stoploop)
 {$endif CPU_SUPPORTS_OPT_COND_JUMP}
                     ;

+ 1 - 1
compiler/mos6502/aoptcpub.pas

@@ -99,7 +99,7 @@ Const
   StoreDst = 0;
 
   aopt_uncondjmp = A_JMP;
-  aopt_condjmp = [A_BPL,A_BMI,A_BVC,A_BVS,A_BCC,A_BCS,A_BNE,A_BEQ];
+  aopt_condjmp = A_Bxx;
 
 Implementation
 

+ 1 - 1
compiler/mos6502/cpubase.pas

@@ -59,7 +59,7 @@ unit cpubase;
 
       { call/reg instructions are not considered as jmp instructions for the usage cases of
         this set }
-      jmp_instructions = [A_JMP,A_BPL,A_BMI,A_BVC,A_BVS,A_BCC,A_BCS,A_BNE,A_BEQ];
+      jmp_instructions = [A_JMP,A_Bxx];
       call_jmp_instructions = [A_JSR]+jmp_instructions;
 
       { instructions that can have a condition }

+ 2 - 23
compiler/mos6502/mos6502ins.dat

@@ -43,36 +43,15 @@ abs                   $0E
 zpg,X                 $16
 abs,X                 $1E
 
-[BCC]
-rel                   $90
-
-[BCS]
-rel                   $B0
-
-[BEQ]
-rel                   $F0
-
 [BIT]
 zpg                   $24
 abs                   $2C
 
-[BMI]
-rel                   $30
-
-[BNE]
-rel                   $D0
-
-[BPL]
-rel                   $10
-
 [BRK]
 void                  $00
 
-[BVC]
-rel                   $50
-
-[BVS]
-rel                   $70
+[Bxx]
+rel                   $10
 
 [CLC]
 void                  $18

+ 1 - 1
compiler/mos6502/mos6502nop.inc

@@ -1,2 +1,2 @@
 { don't edit, this file is generated from mos6502ins.dat; to regenerate, run 'make insdat' in the compiler directory }
-152;
+145;

+ 1 - 8
compiler/mos6502/mos6502op.inc

@@ -4,16 +4,9 @@ A_None,
 A_ADC,
 A_AND,
 A_ASL,
-A_BCC,
-A_BCS,
-A_BEQ,
 A_BIT,
-A_BMI,
-A_BNE,
-A_BPL,
 A_BRK,
-A_BVC,
-A_BVS,
+A_Bxx,
 A_CLC,
 A_CLD,
 A_CLI,

+ 1 - 8
compiler/mos6502/mos6502stdopnames.inc

@@ -4,16 +4,9 @@
 'adc',
 'and',
 'asl',
-'bcc',
-'bcs',
-'beq',
 'bit',
-'bmi',
-'bne',
-'bpl',
 'brk',
-'bvc',
-'bvs',
+'bxx',
 'clc',
 'cld',
 'cli',

+ 2 - 44
compiler/mos6502/mos6502tab.inc

@@ -132,24 +132,6 @@
     code    : $1E;
     flags   : 0
   ),
-  (
-    opcode  : A_BCC;
-    adrmode : AM_RELATIVE;
-    code    : $90;
-    flags   : 0
-  ),
-  (
-    opcode  : A_BCS;
-    adrmode : AM_RELATIVE;
-    code    : $B0;
-    flags   : 0
-  ),
-  (
-    opcode  : A_BEQ;
-    adrmode : AM_RELATIVE;
-    code    : $F0;
-    flags   : 0
-  ),
   (
     opcode  : A_BIT;
     adrmode : AM_ZERO_PAGE;
@@ -162,24 +144,6 @@
     code    : $2C;
     flags   : 0
   ),
-  (
-    opcode  : A_BMI;
-    adrmode : AM_RELATIVE;
-    code    : $30;
-    flags   : 0
-  ),
-  (
-    opcode  : A_BNE;
-    adrmode : AM_RELATIVE;
-    code    : $D0;
-    flags   : 0
-  ),
-  (
-    opcode  : A_BPL;
-    adrmode : AM_RELATIVE;
-    code    : $10;
-    flags   : 0
-  ),
   (
     opcode  : A_BRK;
     adrmode : AM_IMPLICIT;
@@ -187,15 +151,9 @@
     flags   : 0
   ),
   (
-    opcode  : A_BVC;
+    opcode  : A_Bxx;
     adrmode : AM_RELATIVE;
-    code    : $50;
-    flags   : 0
-  ),
-  (
-    opcode  : A_BVS;
-    adrmode : AM_RELATIVE;
-    code    : $70;
+    code    : $10;
     flags   : 0
   ),
   (