private uint onMemoryAccessRead(object sender, MemoryAccessReadEventArgs mra) { if (mra.Size == MemorySize.Word && Utils.isValidAddress(mra.Address, MemorySize.Word)) { Uart uart = ((mra.Address & 0x01d04000) == 0) ? mUart0 : mUart1; if (uart == null) { return(0); } } return(0); }//onMemoryAccessRead
}//onMemoryAccessRead private void onMemoryAccessWrite(object sender, MemoryAccessWriteEventArgs mwa) { if (mwa.Size != MemorySize.Word || Utils.isValidAddress(mwa.Address, MemorySize.Word)) { return; } Uart uart = ((mwa.Address & 0x01d04000) == 0) ? mUart0 : mUart1; switch (mwa.Address & 0x01d00000) { //ULCON:Uart Line Control Register case 0x01d00000: uart.ULCON = mwa.Value; break; //UCON:Uart Control Register case 0x01d00004: uart.UCON = mwa.Value; break; //UFCON:Uart FIFO Control Register case 0x01d00008: uart.UFCON = mwa.Value; break; //UMCON:Uart Modem Control Register case 0x01d0000c: uart.UMCON = mwa.Value; break; //UTRSTAT:Uart Tx/Rx Status Register (read-only) case 0x01d00010: break; //UERSTAT:Uart Error Status Register case 0x01d00014: uart.UERSTAT = mwa.Value; break; //UFSTAT:Uart FIFO Status Register (read-only) case 0x01d00018: //uart.UFSTAT = mwa.Value; break; //UMSTAT:Uart Modem Status Register case 0x01d0001c: //uart.UMSTAT = mwa.Value; break; //UTXH:Uart Transmit Holding(Buffer) Register case 0x01d00020: uart.UTXH = mwa.Value; break; //URXH:Uart Receive Holding(Buffer) Register case 0x01d00024: //uart.URXH = mwa.Value; break; //UBRDIV:Uart Baud Rate Division Register case 0x01d00028: uart.UBRDIV = mwa.Value; break; } } //onMemoryAccessWrite