/// <summary>
        /// Reads a byte of data from a specified port address
        /// </summary>
        public override byte ReadPort(ushort port)
        {
            BitArray portBits  = new BitArray(BitConverter.GetBytes(port));
            byte     portUpper = (byte)(port >> 8);
            byte     portLower = (byte)(port & 0xff);

            int result = 0xff;

            if (DecodeINPort(port) == PortDevice.GateArray)
            {
                GateArray.ReadPort(port, ref result);
            }
            else if (DecodeINPort(port) == PortDevice.CRCT)
            {
                CRCT.ReadPort(port, ref result);
            }
            else if (DecodeINPort(port) == PortDevice.ROMSelect)
            {
            }
            else if (DecodeINPort(port) == PortDevice.Printer)
            {
            }
            else if (DecodeINPort(port) == PortDevice.PPI)
            {
                PPI.ReadPort(port, ref result);
            }
            else if (DecodeINPort(port) == PortDevice.Expansion)
            {
            }

            return((byte)result);
        }
Exemple #2
0
        /// <summary>
        /// Reads a byte of data from a specified port address
        /// </summary>
        /// <param name="port"></param>
        /// <returns></returns>
        public override byte ReadPort(ushort port)
        {
            BitArray portBits  = new BitArray(BitConverter.GetBytes(port));
            byte     portUpper = (byte)(port >> 8);
            byte     portLower = (byte)(port & 0xff);

            int result = 0xff;

            if (DecodeINPort(port) == PortDevice.GateArray)
            {
                GateArray.ReadPort(port, ref result);
            }
            else if (DecodeINPort(port) == PortDevice.CRCT)
            {
                CRCT.ReadPort(port, ref result);
            }
            else if (DecodeINPort(port) == PortDevice.ROMSelect)
            {
            }
            else if (DecodeINPort(port) == PortDevice.Printer)
            {
            }
            else if (DecodeINPort(port) == PortDevice.PPI)
            {
                PPI.ReadPort(port, ref result);
            }
            else if (DecodeINPort(port) == PortDevice.Expansion)
            {
                if (!port.Bit(7))
                {
                    // FDC
                    if (port.Bit(8) && !port.Bit(0))
                    {
                        // FDC status register
                        UPDDiskDevice.ReadStatus(ref result);
                    }
                    if (port.Bit(8) && port.Bit(0))
                    {
                        // FDC data register
                        UPDDiskDevice.ReadData(ref result);
                    }
                }
            }

            return((byte)result);
        }