Browse Source

+ implemented ait_instruction at least for instructions without operands

git-svn-id: branches/z80@44476 -
nickysn 5 years ago
parent
commit
d682df8bcd
2 changed files with 32 additions and 3 deletions
  1. 22 2
      compiler/z80/agsdasz80.pas
  2. 10 1
      compiler/z80/cpubase.pas

+ 22 - 2
compiler/z80/agsdasz80.pas

@@ -31,7 +31,7 @@ unit agsdasz80;
 
     uses
        globtype,systems,
-       aasmbase,aasmtai,aasmdata,
+       aasmbase,aasmtai,aasmdata,aasmcpu,
        assemble,
        cpubase;
 
@@ -46,6 +46,7 @@ unit agsdasz80;
         function sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;
         procedure WriteSection(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder;secalign:longint;
           secflags:TSectionFlags=[];secprogbits:TSectionProgbits=SPB_None);
+        procedure WriteInstruction(hp: taicpu);
       public
         procedure WriteTree(p : TAsmList); override;
         procedure WriteAsmList;override;
@@ -56,7 +57,6 @@ unit agsdasz80;
 
     uses
        cutils,globals,verbose,
-       aasmcpu,
        cpuinfo,
        cgbase,cgutils;
 
@@ -285,6 +285,22 @@ unit agsdasz80;
         LastSecType:=atype;
       end;
 
+    procedure TSdccSdasZ80Assembler.WriteInstruction(hp: taicpu);
+      begin
+        writer.AsmWrite(#9#9+std_op2str[hp.opcode]);
+        {if taicpu(hp).ops<>0 then
+          begin
+            for i:=0 to taicpu(hp).ops-1 do
+             begin
+               if i=0 then
+                writer.AsmWrite(#9)
+               else
+                writer.AsmWrite(',');
+               WriteOper(taicpu(hp).oper[i]^,taicpu(hp).opsize,fixed_opcode,taicpu(hp).ops,(i=2));
+             end;
+          end;}
+      end;
+
     procedure TSdccSdasZ80Assembler.WriteTree(p: TAsmList);
 
       function getreferencestring(var ref : treference) : string;
@@ -599,6 +615,10 @@ unit agsdasz80;
                       end;
                   end;
               end;
+            ait_instruction :
+              begin
+                WriteInstruction(taicpu(hp));
+              end;
             else
               begin
                 writer.AsmWrite(asminfo^.comment);

+ 10 - 1
compiler/z80/cpubase.pas

@@ -54,7 +54,7 @@ unit cpubase;
 
 
       { This should define the array of instructions as string }
-      op2strtable=array[tasmop] of string[11];
+      op2strtable=array[tasmop] of string[4];
 
     const
       { First value of opcode enumeration }
@@ -62,6 +62,15 @@ unit cpubase;
       { Last value of opcode enumeration  }
       lastop  = high(tasmop);
 
+      std_op2str:op2strtable=('',
+        'ADD','ADC','AND','BIT','CALL','CCF','CP','CPD','CPDR',
+        'CPI','CPIR','CPL','DAA','DEC','DI','DJNZ','EI','EX',
+        'EXX','HALT','IM','IN','INC','IND','INDR','INI','INIR',
+        'JP','JR','LD','LDD','LDDR','LDI','LDIR','NEG','NOP','OR',
+        'OTDR','OTIR','OUT','OUTD','OUTI','POP','PUSH','RES','RET','RETI',
+        'RETN','RL','RLA','RLC','RLCA','RLD','RR','RRA','RRC',
+        'RRCA','RRD','RST','SBC','SCF','SET','SLA','SRA','SRL','SUB','XOR');
+
       { call/reg instructions are not considered as jmp instructions for the usage cases of
         this set }
       jmp_instructions = [A_JP,A_JR];