/// <summary> /// Reads the Data from a Stream /// </summary> /// <param name="format"></param> /// <param name="reader"></param> private void Unserialize(System.IO.BinaryReader reader) { opcode = reader.ReadUInt16(); if (((Bhav)parent).Header.Format < 0x8007) { addr1 = formatSpecificSetAddr((ushort)reader.ReadByte()); addr2 = formatSpecificSetAddr((ushort)reader.ReadByte()); } else { addr1 = formatSpecificSetAddr(reader.ReadUInt16()); addr2 = formatSpecificSetAddr(reader.ReadUInt16()); } if (((Bhav)parent).Header.Format < 0x8003) { nodeversion = 0; operands = new wrappedByteArray(this, reader); reserved_01 = new wrappedByteArray(this, new byte[8]); } else if (((Bhav)parent).Header.Format < 0x8005) { nodeversion = 0; operands = new wrappedByteArray(this, reader); reserved_01 = new wrappedByteArray(this, reader); } else { nodeversion = reader.ReadByte(); operands = new wrappedByteArray(this, reader); reserved_01 = new wrappedByteArray(this, reader); } }
/// <summary> /// Constructor /// </summary> internal Instruction(Bhav parent, ushort opcode, ushort addr1, ushort addr2, byte nodeversion, byte[] operands, byte[] reserved_01) { this.parent = parent; this.opcode = opcode; this.addr1 = formatSpecificSetAddr(addr1); this.addr2 = formatSpecificSetAddr(addr2); this.nodeversion = nodeversion; this.operands = new wrappedByteArray(this, operands); this.reserved_01 = new wrappedByteArray(this, reserved_01); }
/// <summary> /// Constructor /// </summary> public Instruction(Bhav parent) { this.parent = parent; this.operands = new wrappedByteArray(this, (byte[])nooperands.Clone()); this.reserved_01 = new wrappedByteArray(this, new byte[8]); }