예제 #1
0
파일: Debug.cs 프로젝트: willvin313/SharpOS
        public byte Read()
        {
            if (com == null)
            {
                return(0);
            }

            return((byte)com.ReadByte());               // fixme
        }
예제 #2
0
파일: UnoUart.cs 프로젝트: atsidaev/ZXMAK2
        public byte ReadRegister(byte addr)
        {
            switch (addr)
            {
            case UARTDATA:
            {
                byte data;
                if (_attachedDevice.ReadByte(out data))
                {
                    return(data);
                }
                return(0);
            }

            case UARTSTAT:
                return((byte)((_attachedDevice.WasReceived() ? 1 : 0) << 7 | (_attachedDevice.IsSending() ? 1 : 0) << 6));

            default:
                throw new Exception("UART: Reading invalid register " + addr);
            }
        }