当前位置: 首页>>代码示例>>C#>>正文


C# MachineInstructionWriter.Write方法代码示例

本文整理汇总了C#中MachineInstructionWriter.Write方法的典型用法代码示例。如果您正苦于以下问题:C# MachineInstructionWriter.Write方法的具体用法?C# MachineInstructionWriter.Write怎么用?C# MachineInstructionWriter.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MachineInstructionWriter的用法示例。


在下文中一共展示了MachineInstructionWriter.Write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Write

 private void Write(MachineOperand op, MachineInstructionWriter writer)
 {
     var reg = op as RegisterOperand;
     if (reg != null)
     {
         writer.Write("%{0}", reg.Register.Name);
         return;
     }
     var imm = op as ImmediateOperand;
     if (imm != null)
     {
         writer.Write(imm.Value.ToString());
         return;
     }
     var mem = op as MemoryOperand;
     if (mem != null)
     {
         mem.Write(false, writer);
         return;
     }
     var idx = op as IndexedMemoryOperand;
     if (idx != null)
     {
         idx.Write(false, writer);
         return;
     }
     writer.Write(op.ToString());
 }
开发者ID:killbug2004,项目名称:reko,代码行数:28,代码来源:SparcInstruction.cs

示例2: Render

 public override void Render(MachineInstructionWriter writer)
 {
     if (code == Opcode.illegal && op1 != null && writer.Platform != null)
     {
         var imm = op1 as M68kImmediateOperand;
         // MacOS uses invalid opcodes to invoke Macintosh Toolbox services. 
         // We may have to generalize the Platform API to allow specifying 
         // the opcode of the invoking instruction, to disambiguate from 
         // "legitimate" TRAP calls.
         var svc = writer.Platform.FindService((int)imm.Constant.ToUInt32(), null);
         if (svc != null)
         {
             writer.Write(svc.Name);
             return;
         }
     }
     if (dataWidth != null)
     {
         writer.WriteOpcode(string.Format("{0}{1}", code, DataSizeSuffix(dataWidth)));
     }
     else
     {
         writer.WriteOpcode(code.ToString());
     }
     writer.Tab();
     if (op1 != null)
     {
         op1.Write(false, writer);
         if (op2 != null)
         {
             writer.Write(',');
             op2.Write(false, writer);
         }
     }
 }
开发者ID:killbug2004,项目名称:reko,代码行数:35,代码来源:M68kInstruction.cs

示例3: Write

 public override void Write(bool fExplicit, MachineInstructionWriter writer)
 {
     writer.Write("#");
     long imm8 = Value.ToInt64();
     if (imm8 > 256 && ((imm8 & (imm8 - 1)) == 0))
     {
         /* only one bit set, and that later than bit 8.
          * Represent as 1<<... .
          */
         writer.Write("1<<");
         uint n = 0;
         while ((imm8 & 0xF) == 0)
         {
             n += 4; imm8 = imm8 >> 4;
         }
         // Now imm8 is 1, 2, 4 or 8. 
         n += (uint)((0x30002010 >> (int)(4 * (imm8 - 1))) & 15);
         writer.Write(n);
     }
     else
     {
         if (imm8 < 0 && imm8 > -100)
         {
             writer.Write('-'); imm8 = -imm8;
         }
         writer.Write("&{0:X}", imm8);
     }
 }
开发者ID:melbcat,项目名称:reko,代码行数:28,代码来源:ArmImmediateOperand.cs

示例4: Render

 public override void Render(MachineInstructionWriter writer)
 {
     writer.Write("{0} ", Address.ToLinear());
     bool inString = false;
     for (int i = 0; i < Line.Length; ++i)
     {
         int b = Line[i];
         if (inString)
         {
             writer.Write(Encoding.UTF8.GetString(Line, i, 1));
             inString = (b != 0x22);
         }
         else
         {
             if (TokenMin <= b && b < TokenMax)
             {
                 writer.Write(TokenStrs[b - TokenMin]);
             }
             else
             {
                 writer.Write(Encoding.UTF8.GetString(Line, i, 1));
             }
             inString = (b == 0x22);
         }
     }
 }
开发者ID:melbcat,项目名称:reko,代码行数:26,代码来源:C64BasicInstruction.cs

示例5: Write

 public void Write(MachineOperand op, MachineInstructionWriter writer)
 {
     var imm = op as ImmediateOperand;
     if (imm != null)
     {
         writer.Write("#");
         int imm8 = imm.Value.ToInt32();
         if (imm8 > 256 && ((imm8 & (imm8 - 1)) == 0))
         {
             /* only one bit set, and that later than bit 8.
              * Represent as 1<<... .
              */
             writer.Write("1<<");
             {
                 uint n = 0;
                 while ((imm8 & 15) == 0)
                 {
                     n += 4; imm8 = imm8 >> 4;
                 }
                 // Now imm8 is 1, 2, 4 or 8. 
                 n += (uint)((0x30002010 >> (int)(4 * (imm8 - 1))) & 15);
                 writer.Write(n);
             }
         }
         else
         {
             var fmt = (-9 <= imm8 && imm8 <= 9) ? "{0}{1}" : "&{0}{1:X}";
             var sign = "";
             if (((int)imm8) < 0 && ((int)imm8) > -100)
             {
                 imm8 = -imm8;
                 sign = "-";
             }
             writer.Write(fmt,sign,imm8);
         }
         return;
     }
     var adr = op as AddressOperand;
     if (adr != null)
     {
         adr.Write(false, writer);
         return;
     }
     var mem = op as ArmMemoryOperand;
     if (mem != null)
     {
         mem.Write(false, writer);
         return;
     }
     var sh = op as ShiftOperand;
     if (sh != null)
     {
         sh.Write(false, writer);
         return;
     }
     if (op == null)
         writer.Write("<null>");
     else 
         op.Write(false, writer);
 }
开发者ID:melbcat,项目名称:reko,代码行数:60,代码来源:ArmInstruction.cs

示例6: Render

 public override void Render(MachineInstructionWriter writer)
 {
     writer.WriteOpcode(string.Format("{0}{1}{2}",
         Opcode,
         Cond != Condition.al ? Cond.ToString() : "",
         OpFlags != OpFlags.None ? OpFlags.ToString().ToLower() : ""));
     if (Dst != null)
     {
         writer.Tab();
         Write(Dst, writer);
         if (Update) writer.Write("!");
         if (Src1 != null)
         {
             writer.Write(",");
             Write(Src1, writer);
             if (Src2 != null)
             {
                 writer.Write(",");
                 Write(Src2, writer);
                 if (Src3 != null)
                 {
                     writer.Write(",");
                     Write(Src3, writer);
                 }
             }
         }
     }
 }
开发者ID:melbcat,项目名称:reko,代码行数:28,代码来源:ArmInstruction.cs

示例7: Write

 public override void Write(bool fExplicit, MachineInstructionWriter writer)
 {
     if (Base != null)
     {
         if (Offset != null)
         {
             int offset = Offset.ToInt32();
             string fmt;
             if (offset > 0)
             {
                 fmt = "({0}+{1:X2})";
             } 
             else if (offset < 0)
             {
                 offset = -offset;
                 fmt = "({0}-{1:X2})";
             }
             else 
             {
                 fmt = "({0})";
             }
             writer.Write(string.Format(fmt, Base, offset));
         }
         else
         {
             writer.Write(string.Format("({0})", Base));
         }
     }
     else
     {
         writer.Write("(");
         writer.WriteAddress(string.Format("{0:X4}", Offset.ToUInt16()), Address.Ptr16(Offset.ToUInt16()));
         writer.Write(")");
     }
 }
开发者ID:gitter-badger,项目名称:reko,代码行数:35,代码来源:MemoryOperand.cs

示例8: Write

 public override void Write(bool fExplicit, MachineInstructionWriter writer)
 {
     Operand.Write(fExplicit, writer);
     writer.Write(",");
     writer.WriteOpcode(Opcode.ToString());
     writer.Write(' ');
     Shift.Write(fExplicit, writer);
 }
开发者ID:killbug2004,项目名称:reko,代码行数:8,代码来源:ShiftOperand.cs

示例9: Write

 public override void Write(bool fExplicit, MachineInstructionWriter writer)
 {
     writer.Write("[%{0}", Base.Name);
     if (!Offset.IsNegative)
     {
         writer.Write("+");
     }
     writer.Write(Offset.ToString());
     writer.Write("]");
 }
开发者ID:killbug2004,项目名称:reko,代码行数:10,代码来源:MemoryOperand.cs

示例10: Write

 public override void Write(bool fExplicit, MachineInstructionWriter writer)
 {
     writer.Write('[');
     writer.Write(this.Base.ToString());
     if (this.Offset != null)
     {
         if (this.Preindexed)
         {
             writer.Write(",");
             if (this.Subtract)
                 writer.Write("-");
             Offset.Write(false, writer);
             writer.Write("]");
             if (this.Writeback)
                 writer.Write("!");
         }
         else
         {
             writer.Write("],");
             if (this.Subtract)
                 writer.Write("-");
             Offset.Write(false, writer);
         }
     }
     else
         writer.Write(']');
 }
开发者ID:melbcat,项目名称:reko,代码行数:27,代码来源:ArmMemoryOperand.cs

示例11: OpToString

 private void OpToString(MachineOperand op, MachineInstructionWriter writer)
 {
     if (op is ImmediateOperand)
     {
         writer.Write("#" + op.ToString());
     }
     else
     {
         writer.Write(op.ToString());
     }
 }
开发者ID:melbcat,项目名称:reko,代码行数:11,代码来源:Pdp11Instruction.cs

示例12: Render

 public override void Render(MachineInstructionWriter writer)
 {
     writer.WriteOpcode(opcode.ToString());
     if (operands.Length > 0)
     {
         writer.Tab();
         writer.Write(operands[0].ToString());
         if (operands.Length > 1)
         {
             writer.Write(",");
             writer.Write(operands[1].ToString());
         }
     }
 }
开发者ID:uxmal,项目名称:reko,代码行数:14,代码来源:AvrInstruction.cs

示例13: Render

 public override void Render(MachineInstructionWriter writer)
 {
     writer.WriteOpcode(this.Opcode.ToString());
     writer.Tab();
     bool sep = false; 
     foreach (var op in Operands)
     {
         if (sep)
             writer.Write(',');
         sep = true;
         if (op is ImmediateOperand)
             writer.Write('#');
         op.Write(false, writer);
     }
 }
开发者ID:relaxar,项目名称:reko,代码行数:15,代码来源:VaxInstruction.cs

示例14: Render

 public override void Render(MachineInstructionWriter writer)
 {
     writer.WriteOpcode(Opcode.ToString());
     if (op1 == null)
         return;
     writer.Tab();
     op1.Write(false, writer);
     if (op2 == null)
         return;
     writer.Write(",");
     op2.Write(false, writer);
     if (op3 == null)
         return;
     writer.Write(",");
     op3.Write(false, writer);
 }
开发者ID:killbug2004,项目名称:reko,代码行数:16,代码来源:AArch64Instruction.cs

示例15: Write

 public override void Write(bool fExplicit, MachineInstructionWriter writer)
 {
     writer.Write('{');
     {
         uint w = instr & 0xFFFF;
         int i = 0;
         while (w != 0)
         {
             int j;
             while ((w & (1u << i)) == 0)
                 ++i;
             for (j = i + 1; (w & (1u << j)) != 0; ++j)
                 ;
             --j;
             // registers [i..j]
             writer.Write(A32Registers.GpRegs[i].Name);
             if (j - i != 0)
             {
                 writer.Write((j - i > 1) ? '-' : ',');
                 writer.Write(A32Registers.GpRegs[j].Name);
             }
             i = j; w = (w >> (j + 1)) << (j + 1);
             if (w != 0) writer.Write(',');
         }
     }
     writer.Write('}');
     if ((instr & (1 << 22)) != 0) writer.Write('^');
 }
开发者ID:nemerle,项目名称:reko,代码行数:28,代码来源:RegisterRangeOperand.cs


注:本文中的MachineInstructionWriter.Write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。