浏览代码

+ implemented OP_OR in tcgmos6502.a_op_const_reg_internal

Nikolay Nikolov 1 年之前
父节点
当前提交
95f7f4b16c
共有 1 个文件被更改,包括 33 次插入28 次删除
  1. 33 28
      compiler/mos6502/cgcpu.pas

+ 33 - 28
compiler/mos6502/cgcpu.pas

@@ -1051,34 +1051,39 @@ unit cgcpu;
                      end;
                  end;
              end;
-       //    OP_OR:
-       //      begin
-       //        curvalue:=a and mask;
-       //        for i:=1 to tcgsize2size[size] do
-       //          begin
-       //            case curvalue of
-       //              0:
-       //                {nothing};
-       //              $ff:
-       //                list.concat(taicpu.op_reg_const(A_LD,reg,$ff));
-       //              else
-       //                begin
-       //                  getcpuregister(list,NR_A);
-       //                  emit_mov(list,NR_A,reg);
-       //                  list.concat(taicpu.op_reg_const(A_OR,NR_A,curvalue));
-       //                  emit_mov(list,reg,NR_A);
-       //                  ungetcpuregister(list,NR_A);
-       //                end;
-       //            end;
-       //            if i<>tcgsize2size[size] then
-       //              begin
-       //                NextReg;
-       //                mask:=mask shl 8;
-       //                inc(shift,8);
-       //                curvalue:=(qword(a) and mask) shr shift;
-       //              end;
-       //          end;
-       //      end;
+           OP_OR:
+             begin
+               curvalue:=a and mask;
+               for i:=1 to tcgsize2size[size] do
+                 begin
+                   case curvalue of
+                     0:
+                       {nothing};
+                     $ff:
+                       begin
+                         getcpuregister(list,NR_A);
+                         list.concat(taicpu.op_const(A_LDA,$ff));
+                         a_load_reg_reg(list,OS_8,OS_8,NR_A,reg);
+                         ungetcpuregister(list,NR_A);
+                       end;
+                     else
+                       begin
+                         getcpuregister(list,NR_A);
+                         emit_mov(list,NR_A,reg);
+                         list.concat(taicpu.op_const(A_ORA,curvalue));
+                         emit_mov(list,reg,NR_A);
+                         ungetcpuregister(list,NR_A);
+                       end;
+                   end;
+                   if i<>tcgsize2size[size] then
+                     begin
+                       NextReg;
+                       mask:=mask shl 8;
+                       inc(shift,8);
+                       curvalue:=(qword(a) and mask) shr shift;
+                     end;
+                 end;
+             end;
        //    OP_XOR:
        //      begin
        //        curvalue:=a and mask;