Browse Source

+ implemented tcgz80.g_flags2reg

git-svn-id: branches/z80@44696 -
nickysn 5 years ago
parent
commit
90e2b9ecc6
1 changed files with 12 additions and 14 deletions
  1. 12 14
      compiler/z80/cgcpu.pas

+ 12 - 14
compiler/z80/cgcpu.pas

@@ -1644,25 +1644,23 @@ unit cgcpu;
         l : TAsmLabel;
         l : TAsmLabel;
         tmpflags : TResFlags;
         tmpflags : TResFlags;
       begin
       begin
-        list.Concat(tai_comment.Create(strpnew('WARNING! not implemented: g_flags2reg')));
-        current_asmdata.getjumplabel(l);
-        {
-        if flags_to_cond(f) then
+        if f in [F_C,F_NC] then
           begin
           begin
-            tmpflags:=f;
-            inverse_flags(tmpflags);
-            emit_mov(reg,NR_R1);
-            a_jmp_flags(list,tmpflags,l);
-            list.concat(taicpu.op_reg_const(A_LDI,reg,1));
+            a_load_const_reg(list,size,0,reg);
+            if f=F_NC then
+              list.concat(taicpu.op_none(A_CCF));
+            list.concat(taicpu.op_reg(A_RL,reg));
           end
           end
         else
         else
-        }
           begin
           begin
-            //list.concat(taicpu.op_reg_const(A_LDI,reg,1));
-            //a_jmp_flags(list,f,l);
-            //emit_mov(list,reg,NR_R1);
+            current_asmdata.getjumplabel(l);
+            a_load_const_reg(list,size,0,reg);
+            tmpflags:=f;
+            inverse_flags(tmpflags);
+            a_jmp_flags(list,tmpflags,l);
+            list.concat(taicpu.op_reg(A_INC,reg));
+            cg.a_label(list,l);
           end;
           end;
-        cg.a_label(list,l);
       end;
       end;