Browse Source

+ implemented OP_NOT in tcgmos6502.a_op_reg_reg_internal

Nikolay Nikolov 1 year ago
parent
commit
05ed02332b
2 changed files with 16 additions and 15 deletions
  1. 15 15
      compiler/mos6502/cgcpu.pas
  2. 1 0
      rtl/mos6502/set.inc

+ 15 - 15
compiler/mos6502/cgcpu.pas

@@ -822,21 +822,21 @@ unit cgcpu;
          //        end;
          //      ungetcpuregister(list,NR_A);
          //    end;
-         //
-         //  OP_NOT:
-         //    begin
-         //      getcpuregister(list,NR_A);
-         //      for i:=1 to tcgsize2size[size] do
-         //        begin
-         //          if i<>1 then
-         //            NextSrcDst;
-         //          a_load_reg_reg(list,OS_8,OS_8,src,NR_A);
-         //          list.concat(taicpu.op_none(A_CPL));
-         //          a_load_reg_reg(list,OS_8,OS_8,NR_A,dst);
-         //        end;
-         //      ungetcpuregister(list,NR_A);
-         //    end;
-         //
+
+           OP_NOT:
+             begin
+               getcpuregister(list,NR_A);
+               for i:=1 to tcgsize2size[size] do
+                 begin
+                   if i<>1 then
+                     NextSrcDst;
+                   a_load_reg_reg(list,OS_8,OS_8,src,NR_A);
+                   list.concat(taicpu.op_const(A_EOR,$FF));
+                   a_load_reg_reg(list,OS_8,OS_8,NR_A,dst);
+                 end;
+               ungetcpuregister(list,NR_A);
+             end;
+
          //  OP_MUL,OP_IMUL:
          //    begin
          //      tmpreg:=dst;

+ 1 - 0
rtl/mos6502/set.inc

@@ -31,4 +31,5 @@ begin
   ga := gb and gc;
   ga := gb or gc;
   ga := gb xor gc;
+  ga := not gb;
 end;