public override string ToDisassembledString(tydisasm disasm) { StringBuilder sb = new StringBuilder(); if (name == null) { return("Unknown opcode"); } sb.Append(name); sb.Append(arm_disasm.cond_names[cond]); if (arguments != null) { for (int i = 0; i < arguments.Length; i++) { if (i == 0) { sb.Append(" "); } else { sb.Append(", "); } sb.Append(arguments[i].ToDisassembledString(this, disasm)); } } return(sb.ToString()); }
public override string ToDisassembledString(line l, tydisasm disasm) { StringBuilder sb = new StringBuilder(); string base_str = base.ToDisassembledString(l, disasm); switch (type) { case location_type.Register: if (reg_list) { int added = 0; sb.Append("{"); for (int i = 0; i < 16; i++) { if (((reg_no >> i) & 0x1) == 0x1) { if (added != 0) { sb.Append(","); } sb.Append(new location { type = location_type.Register, reg_no = (uint)i }.ToDisassembledString(l, disasm)); added++; } } sb.Append("}"); } else { sb.Append(base_str); if (immshift != null) { switch (immshift.type) { case arm_disasm.SRType.SRType_LSL: sb.Append(", lsl #"); sb.Append(immshift.amount.ToString()); break; case arm_disasm.SRType.SRType_LSR: sb.Append(", lsr #"); sb.Append(immshift.amount.ToString()); break; case arm_disasm.SRType.SRType_ASR: sb.Append(", asr #"); sb.Append(immshift.amount.ToString()); break; case arm_disasm.SRType.SRType_ROR: sb.Append(", ror #"); sb.Append(immshift.amount.ToString()); break; case arm_disasm.SRType.SRType_RRX: sb.Append("rrx"); break; } break; } } break; case location_type.Immediate: sb.Append("#"); sb.Append(base_str); break; case location_type.ContentsOf: switch (arm_const_index_type) { case arm_type.None: sb.Append(base_str); break; case arm_type.Offset: sb.Append("["); sb.Append(register_names[(int)reg_no]); if (signed_immediate != 0) { sb.Append(", #"); sb.Append(signed_immediate.ToString()); } sb.Append("]"); break; case arm_type.Preindex: sb.Append("["); sb.Append(register_names[(int)reg_no]); if (signed_immediate != 0) { sb.Append(", #"); sb.Append(signed_immediate.ToString()); } sb.Append("]!"); break; case arm_type.Postindex: sb.Append("["); sb.Append(register_names[(int)reg_no]); sb.Append("], #"); sb.Append(signed_immediate.ToString()); break; } break; default: sb.Append(base_str); break; } return(sb.ToString()); }
public override string ToDisassembledString(tydisasm disasm) { StringBuilder sb = new StringBuilder(); if (o == null) { ulong reg = opcode >> 24; opcode = opcode & 0xffffff; sb.Append("Unknown opcode: "); foreach (ulong prefix in prefixes) { sb.Append(prefix.ToString("X2")); sb.Append(" "); } if ((opcode & 0xff0000) != 0) { sb.Append(((opcode >> 16) & 0xff).ToString("X2")); sb.Append(" "); } if ((opcode & 0xff00) != 0) { sb.Append(((opcode >> 8) & 0xff).ToString("X2")); sb.Append(" "); } sb.Append((opcode & 0xff).ToString("X2")); if ((reg & 0x10) == 0x10) { sb.Append(" /"); sb.Append(reg.ToString("X")); } return(sb.ToString()); } string name = o.name; foreach (ulong p in prefixes) { if (p == 0xf0) { sb.Append("lock "); } else if (p == 0xf2) { sb.Append("repne "); } else if (p == 0xf3) { sb.Append("rep "); } } sb.Append(name); for (int i = 0; i < arguments.Length; i++) { if (i == 0) { sb.Append(" "); } else { sb.Append(", "); } sb.Append(arguments[i].ToDisassembledString(this, disasm)); } return(sb.ToString()); }