public void WriteBinary(BinaryWriter bw) { OpCodeDef ocd = LangDef.LangDef.GetOpCode(OpCode); OperandMode mode = LangDef.LangDef.ModeStringToMode(GetModeText()); byte[] bytes = ocd.GetBinary(mode); WriteBytes(bw, bytes); if (!writeFlipped) { if (LeftOperand != null) { LeftOperand.WriteBinary(bw); if (RightOperand != null) { RightOperand.WriteBinary(bw); } } } else { //flipped bytes implies two operands RightOperand.WriteBinary(bw); LeftOperand.WriteBinary(bw); } }
/// <summary> /// Writes out the opcode as hex text along with their op codes /// </summary> /// <returns></returns> public override string AsHextText() { //write the opcode bytes string s = ""; OpCodeDef ocd = LangDef.LangDef.GetOpCode(OpCode); OperandMode mode = LangDef.LangDef.ModeStringToMode(GetModeText()); s += ocd.GetHextText(mode); if (!writeFlipped) { if (LeftOperand != null) { s += LeftOperand.GetHexText(); if (RightOperand != null) { s += RightOperand.GetHexText(); } } } else { //flipped bytes implies two operands s += RightOperand.GetHexText(); s += LeftOperand.GetHexText(); } return(s); }