Browse Source

+ implemented a_load_const_reg

git-svn-id: branches/z80@44489 -
nickysn 5 years ago
parent
commit
f87c837afe
1 changed files with 8 additions and 15 deletions
  1. 8 15
      compiler/z80/cgcpu.pas

+ 8 - 15
compiler/z80/cgcpu.pas

@@ -812,24 +812,17 @@ unit cgcpu;
          shift : byte;
          shift : byte;
          i : byte;
          i : byte;
        begin
        begin
-         list.Concat(tai_comment.Create(strpnew('WARNING! not implemented: a_load_const_reg')));
          mask:=$ff;
          mask:=$ff;
          shift:=0;
          shift:=0;
-         for i:=1 to tcgsize2size[size] do
+         for i:=tcgsize2size[size] downto 1 do
            begin
            begin
-             //if ((qword(a) and mask) shr shift)=0 then
-             //  emit_mov(list,reg,NR_R1)
-             //else
-             //  begin
-             //    getcpuregister(list,NR_R26);
-             //    list.concat(taicpu.op_reg_const(A_LDI,NR_R26,(qword(a) and mask) shr shift));
-             //    a_load_reg_reg(list,OS_8,OS_8,NR_R26,reg);
-             //    ungetcpuregister(list,NR_R26);
-             //  end;
-             //
-             //mask:=mask shl 8;
-             //inc(shift,8);
-             //reg:=GetNextReg(reg);
+             list.Concat(taicpu.op_reg_const(A_LD,reg,(qword(a) and mask) shr shift));
+             if i<>1 then
+               begin
+                 mask:=mask shl 8;
+                 inc(shift,8);
+                 reg:=GetNextReg(reg);
+               end;
            end;
            end;
        end;
        end;