+ implemented ait_instruction at least for instructions without operands

git-svn-id: branches/z80@44476 -
This commit is contained in:
nickysn 2020-04-01 02:19:46 +00:00
parent 1d3f14f769
commit d682df8bcd
2 changed files with 32 additions and 3 deletions

View File

@ -31,7 +31,7 @@ unit agsdasz80;
uses uses
globtype,systems, globtype,systems,
aasmbase,aasmtai,aasmdata, aasmbase,aasmtai,aasmdata,aasmcpu,
assemble, assemble,
cpubase; cpubase;
@ -46,6 +46,7 @@ unit agsdasz80;
function sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string; function sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;
procedure WriteSection(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder;secalign:longint; procedure WriteSection(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder;secalign:longint;
secflags:TSectionFlags=[];secprogbits:TSectionProgbits=SPB_None); secflags:TSectionFlags=[];secprogbits:TSectionProgbits=SPB_None);
procedure WriteInstruction(hp: taicpu);
public public
procedure WriteTree(p : TAsmList); override; procedure WriteTree(p : TAsmList); override;
procedure WriteAsmList;override; procedure WriteAsmList;override;
@ -56,7 +57,6 @@ unit agsdasz80;
uses uses
cutils,globals,verbose, cutils,globals,verbose,
aasmcpu,
cpuinfo, cpuinfo,
cgbase,cgutils; cgbase,cgutils;
@ -285,6 +285,22 @@ unit agsdasz80;
LastSecType:=atype; LastSecType:=atype;
end; 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); procedure TSdccSdasZ80Assembler.WriteTree(p: TAsmList);
function getreferencestring(var ref : treference) : string; function getreferencestring(var ref : treference) : string;
@ -599,6 +615,10 @@ unit agsdasz80;
end; end;
end; end;
end; end;
ait_instruction :
begin
WriteInstruction(taicpu(hp));
end;
else else
begin begin
writer.AsmWrite(asminfo^.comment); writer.AsmWrite(asminfo^.comment);

View File

@ -54,7 +54,7 @@ unit cpubase;
{ This should define the array of instructions as string } { This should define the array of instructions as string }
op2strtable=array[tasmop] of string[11]; op2strtable=array[tasmop] of string[4];
const const
{ First value of opcode enumeration } { First value of opcode enumeration }
@ -62,6 +62,15 @@ unit cpubase;
{ Last value of opcode enumeration } { Last value of opcode enumeration }
lastop = high(tasmop); 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 { call/reg instructions are not considered as jmp instructions for the usage cases of
this set } this set }
jmp_instructions = [A_JP,A_JR]; jmp_instructions = [A_JP,A_JR];