示例#1
0
        /// <summary>
        /// Retrieves the packets.
        /// </summary>
        protected void RetrievePackets()
        {
            // Check all descriptors
            for (uint rxd = 0; rxd < 16; rxd++)
            {
                uint offset = rxd * 4;

                uint status = rxDescriptor.Read32(offset + 1);

                // Check is 31/OWN bit is not set
                if ((status & 0x80000000) == 0)
                {
                    ushort length = (ushort)(rxDescriptor.Read16(offset + 0) & 0xFFF);
                    var    data   = new byte[length];

                    for (uint i = 0; i < data.Length; i++)
                    {
                        data[i] = buffers.Read8((rxd * bufferSize) + i);
                    }

                    // if queue fails because it is already full, the packet is discarded
                    packetBuffer.QueuePacketForStack(data);

                    // Clear 31/OWN bit
                    rxDescriptor.Write32(offset + 1, status | 0x80000000);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Reads the pixel.
        /// </summary>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        /// <returns></returns>
        public byte ReadPixel(ushort x, ushort y)
        {
            if (writeMethod == WriteMethod.Pixel8)
            {
                return(memory.Read8((uint)(y * 320 + x)));
            }

            // TODO: Support more video modes
            return(0);
        }