public override void Render(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { if (Mnemonic == Mnemonic.ex_af) { writer.WriteMnemonic("ex"); writer.Tab(); writer.WriteString("af,af'"); return; } writer.WriteMnemonic(Mnemonic.ToString()); RenderOperands(writer, options); }
public override void Render(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { switch (Mnemonic) { case Mnemonic._and: Render3("&", writer, options); return; case Mnemonic._fmul: Render3("*F", writer, options); return; case Mnemonic._mov: RenderOperand(Operands[0], writer, options); writer.Tab(); RenderOperand(Operands[1], writer, options); if (Operands.Length == 2) { return; } writer.WriteString(","); RenderOperand(Operands[2], writer, options); return; } writer.WriteMnemonic(this.Mnemonic.ToString()); RenderOperands(writer, options); }
private void RenderMnemonic(MachineInstructionWriter writer) { var sb = new StringBuilder(); sb.Append(Mnemonic.ToString()); if (Condition != 0) { sb.AppendFormat(".{0}", Condition.ToString().ToLowerInvariant()); } if (Delay) { sb.Append(".d"); } if (SignExtend) { sb.AppendFormat(".x"); } if (SetFlags) { sb.Append(".f"); } if (Writeback != AddressWritebackMode.None) { sb.AppendFormat(".{0}", Writeback); } if (DirectWrite) { sb.Append(".di"); } writer.WriteMnemonic(sb.ToString()); }
private void RenderMnemonic(MachineInstructionWriter writer) { var sMnemonic = this.Mnemonic.ToString() .Replace('_', '.'); writer.WriteMnemonic(sMnemonic); }
public override void Render(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { int iOp = WriteMnemonic(writer); if (Operands == null || Operands.Length == 0) { return; } writer.Tab(); RenderOperand(Operands[iOp++], writer, options); for (; iOp < Operands.Length; ++iOp) { var op = Operands[iOp]; writer.WriteChar(','); RenderOperand(op, writer, options); } if (this.shiftCode == Mnemonic.Invalid) { return; } if (shiftCode == Mnemonic.lsl && (shiftAmount is ImmediateOperand imm && imm.Value.IsIntegerZero)) { return; } writer.WriteChar(','); writer.WriteMnemonic(shiftCode.ToString()); writer.WriteChar(' '); RenderOperand(shiftAmount, writer, options); }
private void RenderMnemonic(MachineInstructionWriter writer) { if (!instrNames.TryGetValue(Mnemonic, out string instrName)) { instrName = Mnemonic.ToString().Replace('_', '.'); } writer.WriteMnemonic(instrName); }
public override void Render(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { writer.WriteMnemonic( string.Format("{0}{1}", Mnemonic.ToString(), Annul ? ",a" : "")); RenderOperands(writer, options); }
public override void Render(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { if (repPrefix == 3) { writer.WriteMnemonic("rep"); writer.WriteChar(' '); } else if (repPrefix == 2) { writer.WriteMnemonic("repne"); writer.WriteChar(' '); } var s = new StringBuilder(Mnemonic.ToString()); switch (Mnemonic) { case Mnemonic.ins: case Mnemonic.outs: case Mnemonic.movs: case Mnemonic.cmps: case Mnemonic.stos: case Mnemonic.lods: case Mnemonic.scas: switch (dataWidth.Size) { case 1: s.Append('b'); break; case 2: s.Append('w'); break; case 4: s.Append('d'); break; case 8: s.Append('q'); break; default: throw new ArgumentOutOfRangeException(); } break; } writer.WriteMnemonic(s.ToString()); if (NeedsExplicitMemorySize()) { options |= MachineInstructionWriterOptions.ExplicitOperandSize; } RenderOperands(writer, options); }
public override void Render(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { var op = string.Format("{0}{1}", Mnemonic, setsCR0 ? "." : ""); writer.WriteMnemonic(op); RenderOperands(writer, options); }
public override void Render(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { if (!instrNames.TryGetValue(Mnemonic, out string instrName)) { instrName = Mnemonic.ToString(); } writer.WriteMnemonic(instrName); RenderOperands(writer, options); }
private void RenderMnemonic(MachineInstructionWriter writer) { if (!mnemonicNames.TryGetValue(Mnemonic, out string name)) { name = Mnemonic.ToString(); name = name.Replace('_', '.'); } writer.WriteMnemonic(name); }
public override void Render(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { if (!mnemonics.TryGetValue(Mnemonic, out var sMnemonic)) { sMnemonic = Mnemonic.ToString(); } writer.WriteMnemonic(sMnemonic); RenderOperands(writer, options); }
private void RenderMnemonic(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { var sb = new StringBuilder(Mnemonic.ToString().Replace('_', '.')); if (Condition != Avr32Condition.al) { sb.Append(Condition.ToString()); } writer.WriteMnemonic(sb.ToString()); }
public override void Render(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { writer.WriteMnemonic(Mnemonic.ToString()); writer.Tab(); switch (Operands[0]) { case PICOperandDataMemoryAddress srcmem: if (PICRegisters.TryGetRegister(srcmem.DataTarget, out var srcreg)) { writer.WriteString($"{srcreg.Name}"); } else { srcmem.Write(writer, options); } break; case PICOperandFSRIndexation srcidx: if (srcidx.Mode != FSRIndexedMode.FSR2INDEXED) { throw new InvalidOperationException($"Invalid FSR2 indexing mode: {srcidx.Mode}."); } writer.WriteString($"[0x{srcidx.Offset.ToUInt16():X2}]"); break; } writer.WriteString(","); switch (Operands[1]) { case PICOperandDataMemoryAddress dstmem: if (PICRegisters.TryGetRegister(dstmem.DataTarget, out var dstreg)) { writer.WriteString($"{dstreg.Name}"); } else { dstmem.Write(writer, options); } break; case PICOperandFSRIndexation dstidx: if (dstidx.Mode != FSRIndexedMode.FSR2INDEXED) { throw new InvalidOperationException($"Invalid FSR2 indexing mode: {dstidx.Mode}."); } writer.WriteString($"[0x{dstidx.Offset.ToUInt16():X2}]"); break; } }
public override void Render(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { (string prefix, string infix, string suffix)aaOpcode; if (!mapMnemonics.TryGetValue(Mnemonic, out aaOpcode)) { aaOpcode.prefix = Mnemonic.ToString(); } if (aaOpcode.infix != null) { writer.WriteString(aaOpcode.prefix); Operands[0].Write(writer, options); if (Operands.Length > 2) { writer.WriteString(" = "); Operands[1].Write(writer, options); writer.WriteString(aaOpcode.infix); Operands[2].Write(writer, options); } else if (Operands.Length > 1) { writer.WriteString(aaOpcode.infix); Operands[1].Write(writer, options); } else { writer.WriteString(aaOpcode.infix); } } else { writer.WriteMnemonic(aaOpcode.prefix); var sep = " "; if (Operands == null) { return; } foreach (var op in Operands) { writer.WriteString(sep); sep = ","; op.Write(writer, options); } } if (aaOpcode.suffix != null) { writer.WriteString(aaOpcode.suffix); } writer.WriteString(";"); }
public override void Render(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { writer.WriteMnemonic(this.Mnemonic.ToString()); if (Operands.Length == 0) { return; } writer.Tab(); var sep = ""; foreach (var op in Operands) { writer.WriteString(sep); sep = ","; op.Write(writer, options); } }
public override void Render(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { var memop = Operands[0] as PICOperandBankedMemory ?? throw new InvalidOperationException($"Invalid memory operand: {Operands[0]}"); writer.WriteMnemonic(Mnemonic.ToString()); writer.Tab(); var bankmem = PICMemoryDescriptor.CreateBankedAddr(memop); if (PICRegisters.TryGetAlwaysAccessibleRegister(bankmem, out var reg)) { writer.WriteString($"{reg.Name}"); } else { Operands[0].Write(writer, options); } }
public override void Write(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { writer.WriteChar('['); writer.WriteString(Base.Name); if (Offset != null && !Offset.IsIntegerZero) { if (PostIndex) { writer.WriteChar(']'); } writer.WriteChar(','); var off = Offset.ToInt32(); if (off < 0) { writer.WriteFormat("#-&{0:X}", -off); } else { writer.WriteFormat("#&{0:X}", off); } } else if (Index != null) { writer.WriteChar(','); writer.WriteString(Index.Name); if (IndexExtend != Mnemonic.Invalid && (IndexExtend != Mnemonic.lsl || IndexShift != 0)) { writer.WriteChar(','); writer.WriteMnemonic(IndexExtend.ToString()); if (IndexShift != 0) { writer.WriteString($" #{IndexShift}"); } } } if (!PostIndex) { writer.WriteChar(']'); } if (PreIndex) { writer.WriteChar('!'); } }
private void WriteMnemonic(MachineInstructionWriter writer) { var sb = new StringBuilder(); sb.Append(Mnemonic.ToString().Replace('_', ',')); if (Coprocessor != -1) { sb.AppendFormat(",{0}", Coprocessor); } if (FpFmt != FpFormat.None) { sb.AppendFormat(",{0}", FpFmt); } if (FpFmtDst != FpFormat.None) { sb.AppendFormat(",{0}", FpFmtDst); } if (Zero) { sb.Append(",z"); } if (Sign != SignExtension.None) { sb.AppendFormat(",{0}", Sign); } if (Condition != null) { sb.AppendFormat(",{0}", Condition.Display); } if (BaseReg != AddrRegMod.None) { sb.AppendFormat(",{0}", BaseReg.ToString().Replace('_', ',')); } if (CacheHint != CacheHint.None) { sb.AppendFormat(",{0}", CacheHint); } if (Annul) { sb.Append(",n"); } writer.WriteMnemonic(sb.ToString()); }
private void RenderMnemonic(MachineInstructionWriter writer) { var sb = new StringBuilder(MnemonicAsString); string suffix = ""; if (Size != null) { switch (Size.Size) { case 1: suffix = ".b"; break; case 2: suffix = ".w"; break; case 4: suffix = ".l"; break; default: break; } } sb.Append(suffix); writer.WriteMnemonic(sb.ToString()); }
public override void Render(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { var bankmem = Operands[0] as PICOperandBankedMemory ?? throw new InvalidOperationException($"Invalid memory operand: {Operands[0]}"); var bitno = Operands[1] as PICOperandMemBitNo ?? throw new InvalidOperationException($"Invalid bit number operand: {Operands[1]}"); writer.WriteMnemonic(Mnemonic.ToString()); writer.Tab(); if (PICRegisters.TryGetAlwaysAccessibleRegister(bankmem.Offset, out var reg)) { writer.WriteString($"{reg.Name}"); writer.WriteString(","); if (PICRegisters.TryGetBitField(reg, out var fld, bitno.BitNo, 1)) { writer.WriteString($"{fld.Name}"); } else { bitno.Write(writer, options); } return; }
public override void Render(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { writer.WriteMnemonic(this.Mnemonic.ToString()); RenderOperands(writer, options); }
public override void Render(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { writer.WriteMnemonic(mpopcodetostring[Opcode]); }
private void RenderMnemonic(MachineInstructionWriter writer) { writer.WriteMnemonic(Mnemonic.ToString()); }
public override void Write(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { writer.WriteMnemonic(Condition.ToString()); }
public override void Render(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { writer.WriteMnemonic(Mnemonic.ToString().ToLower()); }
private void WriteMnemonic(MachineInstructionWriter writer) { var name = this.Mnemonic.ToString().Replace('_', '.'); writer.WriteMnemonic(name); }
public override void Render(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { writer.WriteMnemonic("opcode.l"); }
public override void Render(MachineInstructionWriter writer, MachineInstructionWriterOptions options) { writer.WriteMnemonic(Mnemonic.ToString()); writer.Tab(); Operands[0].Write(writer, options); }