Ypsilon.Emulation.Processor.YBUS.AddDevice C# (CSharp) Method

AddDevice() public method

Adds a device to specified slot index. INDEX MUST BE 1 - 16.
public AddDevice ( ADevice device, ushort index ) : void
device ADevice
index ushort
return void
        public void AddDevice(ADevice device, ushort index)
        {
            if (index == 0 || index > 16)
                return;
            if (m_Devices[index - 1] != null) {
                m_Devices[index - 1].Dispose();
                m_Devices[index - 1] = null;
            }
            m_Devices[index - 1] = device;
            foreach (Segment segment in m_References) {
                if (((segment.Reference & MemoryReferenceInfo.ReferenceType) == MemoryReferenceInfo.Device) &&
                    ((segment.Reference & MemoryReferenceInfo.DeviceIndex) == (MemoryReferenceInfo)index)) {
                    GetDeviceMemoryReference(segment, index);
                }
            }
        }