示例#1
0
        public AddressInformation(AddressingMode destinationAddressingMode, AddressingMode sourceAddressingMode, bool intraPan, ArraySegment<byte> data)
        {
            var internalOffset = 0;
            if(destinationAddressingMode != AddressingMode.None)
            {
                DestinationPan = GetValue(data, 0);
                DestinationAddress = new Address(new ArraySegment<byte>(data.Array, data.Offset + 2, destinationAddressingMode.GetBytesLength()));
                internalOffset = 2 + DestinationAddress.Bytes.Count;
            }

            if(sourceAddressingMode != AddressingMode.None)
            {
                if(intraPan)
                {
                    SourcePan = DestinationPan;
                }
                else
                {
                    SourcePan = GetValue(data, internalOffset);
                    internalOffset += 2;
                }
                SourceAddress = new Address(new ArraySegment<byte>(data.Array, data.Offset + internalOffset, sourceAddressingMode.GetBytesLength()));
            }

            Bytes = data;
        }
示例#2
0
        public Address(AddressingMode mode)
        {
            if (mode != AddressingMode.ShortAddress && mode != AddressingMode.ExtendedAddress)
            {
                throw new ArgumentException("Unsupported addressing mode");
            }

            Bytes = new byte[mode.GetBytesLength()];
        }
示例#3
0
文件: Address.cs 项目: rte-se/emul8
        public Address(AddressingMode mode)
        {
            if(mode != AddressingMode.ShortAddress && mode != AddressingMode.ExtendedAddress)
            {
                throw new ArgumentException("Unsupported addressing mode");
            }

            Bytes = new byte[mode.GetBytesLength()];
        }
示例#4
0
        public AddressInformation(AddressingMode destinationAddressingMode, AddressingMode sourceAddressingMode, bool intraPan, ArraySegment <byte> data)
        {
            var internalOffset = 0;

            if (destinationAddressingMode != AddressingMode.None)
            {
                DestinationPan     = GetValue(data, 0);
                DestinationAddress = new Address(new ArraySegment <byte>(data.Array, data.Offset + 2, destinationAddressingMode.GetBytesLength()));
                internalOffset     = 2 + DestinationAddress.Bytes.Count;
            }

            if (sourceAddressingMode != AddressingMode.None)
            {
                if (intraPan)
                {
                    SourcePan = DestinationPan;
                }
                else
                {
                    SourcePan       = GetValue(data, internalOffset);
                    internalOffset += 2;
                }
                SourceAddress = new Address(new ArraySegment <byte>(data.Array, data.Offset + internalOffset, sourceAddressingMode.GetBytesLength()));
            }

            Bytes = data;
        }