+ implemented tcgz80.a_adjust_sp

git-svn-id: branches/z80@45116 -
This commit is contained in:
nickysn 2020-04-26 17:04:15 +00:00
parent 723faf14a9
commit 7957560fba
2 changed files with 42 additions and 35 deletions

View File

@ -2089,42 +2089,45 @@ unit cgcpu;
procedure tcgz80.a_adjust_sp(list : TAsmList; value : longint); procedure tcgz80.a_adjust_sp(list : TAsmList; value : longint);
var var
i : integer; i : integer;
sym: TAsmSymbol;
ref: treference;
begin begin
//case value of case value of
// 0: 0:
// ; ;
// {-14..-1: -7..-1:
// begin begin
// if ((-value) mod 2)<>0 then for i:=value to -1 do
// list.concat(taicpu.op_reg(A_PUSH,NR_R0)); list.concat(taicpu.op_reg(A_DEC,NR_SP));
// for i:=1 to (-value) div 2 do end;
// list.concat(taicpu.op_const(A_RCALL,0)); 1..7:
// end; begin
// 1..7: for i:=1 to value do
// begin list.concat(taicpu.op_reg(A_INC,NR_SP));
// for i:=1 to value do end;
// list.concat(taicpu.op_reg(A_POP,NR_R0)); else
// end;} begin
// else sym:=current_asmdata.RefAsmSymbol('FPC_Z80_SAVE_HL',AT_DATA);
// begin reference_reset_symbol(ref,sym,0,1,[]);
// list.concat(taicpu.op_reg_const(A_SUBI,NR_R28,lo(word(-value))));
// list.concat(taicpu.op_reg_const(A_SBCI,NR_R29,hi(word(-value)))); // block interrupts
// // get SREG list.concat(taicpu.op_none(A_DI));
// list.concat(taicpu.op_reg_const(A_IN,NR_R0,NIO_SREG));
// // save HL
// // block interrupts list.concat(taicpu.op_ref_reg(A_LD,ref,NR_HL));
// list.concat(taicpu.op_none(A_CLI));
// // adjust SP
// // write high SP list.concat(taicpu.op_reg_const(A_LD,NR_HL,value));
// list.concat(taicpu.op_const_reg(A_OUT,NIO_SP_HI,NR_R29)); list.concat(taicpu.op_reg_reg(A_ADD,NR_HL,NR_SP));
// list.concat(taicpu.op_reg_reg(A_LD,NR_SP,NR_HL));
// // release interrupts
// list.concat(taicpu.op_const_reg(A_OUT,NIO_SREG,NR_R0)); // restore HL
// list.concat(taicpu.op_reg_ref(A_LD,NR_HL,ref));
// // write low SP
// list.concat(taicpu.op_const_reg(A_OUT,NIO_SP_LO,NR_R28)); // release interrupts
// end; list.concat(taicpu.op_none(A_EI));
//end; end;
end;
end; end;

View File

@ -15,6 +15,10 @@
**********************************************************************} **********************************************************************}
var
z80_save_hl: Word; public name 'FPC_Z80_SAVE_HL';
procedure fpc_cpuinit;{$ifdef SYSTEMINLINE}inline;{$endif} procedure fpc_cpuinit;{$ifdef SYSTEMINLINE}inline;{$endif}
begin begin
end; end;