/// <summary> /// Emits the opcode of the instruction. /// </summary> /// <param name="writer">The <see cref="BinaryWriter"/> to which the encoded instruction is written.</param> void EmitOpcode(BinaryWriter writer) { // We OR the least siginificant 3 bits of the opcode REG with the last byte of the opcode, if necessary. if (OpcodeReg > 0) { var actualOpcode = (byte[])Opcode.Clone(); actualOpcode[actualOpcode.Length - 1] |= (byte)(OpcodeReg & 0x7); writer.Write(actualOpcode); } else { writer.Write(Opcode); } }