本文整理汇总了C#中MachineInstructionWriter类的典型用法代码示例。如果您正苦于以下问题:C# MachineInstructionWriter类的具体用法?C# MachineInstructionWriter怎么用?C# MachineInstructionWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MachineInstructionWriter类属于命名空间,在下文中一共展示了MachineInstructionWriter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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
示例2: Render
public override void Render(MachineInstructionWriter writer)
{
if (instruction == null)
{
writer.Write("Invalid");
return;
}
writer.WriteOpcode(instruction.Mnemonic);
var ops = instruction.ArchitectureDetail.Operands;
if (ops.Length < 1)
return;
writer.Tab();
if (WriteRegisterSetInstruction(writer))
return;
Write(ops[0], writer);
if (ops.Length < 2)
return;
writer.Write(",");
Write(ops[1], writer);
if (ops.Length < 3)
return;
writer.Write(",");
Write(ops[2], writer);
if (ops.Length < 4)
return;
writer.Write(",");
Write(ops[3], writer);
}
开发者ID:gh0std4ncer,项目名称:reko,代码行数:28,代码来源:Arm32Instruction.cs
示例3: Render
public override void Render(MachineInstructionWriter writer)
{
var op = string.Format("{0}{1}",
opcode,
setsCR0 ? "." : "");
writer.WriteOpcode(op);
if (op1 != null)
{
writer.Tab();
op1.Write(true, writer);
if (op2 != null)
{
writer.Write(',');
op2.Write(true, writer);
if (op3 != null)
{
writer.Write(',');
op3.Write(true, writer);
if (op4 != null)
{
writer.Write(",");
op4.Write(true, writer);
if (op5 != null)
{
writer.Write(",");
op5.Write(true, writer);
}
}
}
}
}
}
开发者ID:killbug2004,项目名称:reko,代码行数:32,代码来源:PowerPcInstruction.cs
示例4: 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
示例5: 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
示例6: 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
示例7: 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
示例8: 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
示例9: 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:nemerle,项目名称:reko,代码行数:35,代码来源:MemoryOperand.cs
示例10: 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
示例11: 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
示例12: 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
示例13: Render
public override void Render(MachineInstructionWriter writer)
{
writer.WriteOpcode(Code.ToString());
if (Operand != null)
{
writer.Tab();
Operand.Write(true, writer);
}
}
开发者ID:gitter-badger,项目名称:reko,代码行数:9,代码来源:Instruction.cs
示例14: Write
public override void Write(bool fExplicit, MachineInstructionWriter writer)
{
string s;
if (base.Width.Size == 2)
s = string.Format("{0:X4}", Address.ToLinear());
else
s = Address.ToString();
writer.WriteAddress(s, Address);
}
开发者ID:gitter-badger,项目名称:reko,代码行数:9,代码来源:AddressOperand.cs
示例15: 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
示例16: Render
public override void Render(MachineInstructionWriter writer)
{
try
{
writer.WriteOpcode(mpopcodetostring[Opcode]);
}
catch
{
throw new NotImplementedException("Lolwut: " + Opcode);
}
}
开发者ID:nemerle,项目名称:reko,代码行数:11,代码来源:CilInstruction.cs
示例17: OpToString
private void OpToString(MachineOperand op, MachineInstructionWriter writer)
{
if (op is ImmediateOperand)
{
writer.Write("#" + op.ToString());
}
else
{
writer.Write(op.ToString());
}
}
开发者ID:gitter-badger,项目名称:reko,代码行数:11,代码来源:Pdp11Instruction.cs
示例18: Write
public override void Write(bool fExplicit, MachineInstructionWriter writer)
{
if (condition > 3)
writer.Write("cr{0}+", condition >> 2);
var s = "";
switch (condition & 3)
{
case 0: s = "lt"; break;
case 1: s = "gt"; break;
case 2: s = "eq"; break;
case 3: s = "so"; break;
}
writer.Write(s);
}
开发者ID:nemerle,项目名称:reko,代码行数:14,代码来源:PowerPcInstruction.cs
示例19: 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
示例20: Render
public override void Render(MachineInstructionWriter writer)
{
writer.WriteOpcode(Opcode.ToString());
if (op1 != null)
{
writer.Tab();
OpToString(op1, writer);
if (op2 != null)
{
writer.Write(",");
OpToString(op2, writer);
}
}
}
开发者ID:gitter-badger,项目名称:reko,代码行数:14,代码来源:Pdp11Instruction.cs
注:本文中的MachineInstructionWriter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论