示例#1
0
        }//UpdateUserInterface

        /// <summary>
        /// This function is called when the memory locations declared by the timers has been read.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="mra"></param>
        /// <returns></returns>
        private uint onMemoryAccessRead(object sender, MemoryAccessReadEventArgs mra)
        {
            // only word access allowed
            if (mra.Size != MemorySize.Word)
            {
                return(0);
            }

            //determine the timer block number from bit 4
            int block = ((int)mra.Address >> 4) & 0x01;

            //and access the timer based on the address (bits 0-3)
            switch (mra.Address & 0x0f)
            {
            case 0x00:    //wtcon
                return(mTimerBlocks[block].ControlRegister);

            case 0x04:    //wtdat
                return(mTimerBlocks[block].DataRegister);

            case 0x08:    //wtcnt
                return(mTimerBlocks[block].CountRegister);

            case 0x0c:    //intID
                return(mInterruptID);

            default: break;
            } //switch
            return(0);
        }     //onMemoryAccessRead
示例#2
0
        private uint onMemoryAccessRead(object sender, MemoryAccessReadEventArgs mra)
        {
            if (mra.Size != MemorySize.Word)
            {
                return(0);
            }

            return(mMemory[mra.Address / 4]);
        }
示例#3
0
        }//init

        /// <summary>
        /// This function is called when a memory read has occurred on the button id register.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="mra"></param>
        /// <returns></returns>
        private uint onMemoryAccessRead(object sender, MemoryAccessReadEventArgs mra)
        {
            //we only allow word access
            if (mra.Size == MemorySize.Word)
            {
                return(mBlackButtonID);
            }
            return(0);
        }//onMemoryAccessRead
示例#4
0
        }//mHost_Restart

        /// <summary>
        /// This function is called when the memory locations declared by the LEDs have been read.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="mra"></param>
        /// <returns></returns>
        private uint onMemoryAccessRead(object sender, MemoryAccessReadEventArgs mra)
        {
            // only word access allowed
            if (mra.Size == MemorySize.Word)
            {
                return(mLedsState);
            }
            return(0);
        }//onMemoryAccessRead
示例#5
0
        }//init

        /// <summary>
        /// This function is called when a memory read has occurred on the button id register.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="mra"></param>
        /// <returns></returns>
        private uint onMemoryAccessRead(object sender, MemoryAccessReadEventArgs mra)
        {
            //we only allow word access
            if (mra.Size == MemorySize.Word)
            {
                return((uint)mTrackBar.Value);
            }
            return(0);
        }//onMemoryAccessRead
示例#6
0
        }//onMemoryAccessWrite

        /// <summary>
        /// This function is called whenever a read access is performed on a reserved block
        /// Input:
        ///   mra:properties of the read opertaion
        /// </summary>
        /// <param name="mra"></param>
        /// <returns></returns>
        public uint onMemoryAccessRead(object sender, MemoryAccessReadEventArgs mra)
        {
            //ignore any non-word reads
            if (mra.Size != MemorySize.Word)
            {
                return(0);
            }

            //get the current byte of the control and return it as a word
            return(mEightSegmentDisplayControl.Code);
        }//onMemoryAccessRead
示例#7
0
 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
示例#8
0
 private uint onMemoryAccessRead(object sender, MemoryAccessReadEventArgs mra)
 {
     if (mra.Size == MemorySize.Word && Utils.isValidAddress(mra.Address, MemorySize.Word))
     {
         uint index = (mra.Address - mLowerAddress) >> 2;
         if (index < mPortDefinitions.Length)
         {
             return(mPortDefinitions[index].Read());
         }
     }
     return(0);
 }//onMemoryAccessRead
示例#9
0
        private uint onMemoryAccessRead(object sender, MemoryAccessReadEventArgs mra)
        {
            if (mra.Size != MemorySize.Word)
            {
                return(0);
            }

            uint memOffset = (mra.Address - LCD_ACTIVBUFFER) / 4;

            if (memOffset >= mLcdBuffer.Length)
            {
                return(0);
            }

            return((uint)mLcdBuffer[memOffset]);
        }
示例#10
0
        }//init

        /// <summary>
        /// This function is called when a memory read has occurred on either the Command or Data register.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="mra"></param>
        /// <returns></returns>
        private uint onMemoryAccessRead(object sender, MemoryAccessReadEventArgs mra)
        {
            //we only allow word access
            if (mra.Size == MemorySize.Word)
            {
                //determine which register was accessed and handle it
                if (mra.Address == mBaseAddress)
                {
                    //The Command register. Return the current cursor location
                    return(mTwoLineLCDDisplay.CurrentCursorLocation.ToInt());
                }
                else
                {
                    //The Data register. Return the character at the current cursor location
                    return((uint)mTwoLineLCDDisplay.GetChar());
                }
            }
            return(0);
        }//onMemoryAccessRead
示例#11
0
        private uint onMemoryAccessRead(object sender, MemoryAccessReadEventArgs mra)
        {
            switch (mra.Address - keyboard_base)
            {
            case 0xfd:
                return(mLocs[0]);

            case 0xfb:
                return(mLocs[1]);

            case 0xf7:
                return(mLocs[2]);

            case 0xef:
                return(mLocs[3]);

            default:
                return(0xf);
            }
        }
示例#12
0
        }//onClock

        private uint onMemoryAccessRead(object sender, MemoryAccessReadEventArgs mra)
        {
            if (mra.Size == MemorySize.Byte)
            {
                return(0);
            }
            switch (mra.Address)
            {
            case 0x01d30000:
                //wtcon
                return(_wtcon);

            case 0x01d30004:
                //wtdat
                return(_wtdat);

            case 0x01d30008:
                //wtcnt
                return(_currentCycles / ((_prescaler + 1) * (uint)Math.Pow(2, _divisor)));
            } //switch
            return(0);
        }     //onMemoryAccessRead
        }//InteruptNotify

        private uint onMemoryAccessRead(object sender, MemoryAccessReadEventArgs mra)
        {
            switch (mra.Address)
            {
            case 0x01e00000:
            {        //INTCON
                uint value = _vectorMode ? (uint)0x04 : 0x00;
                value |= _IRQEnable ? (uint)0x02 : 0x00;
                value |= _FIQEnable ? (uint)0x01 : 0x00;
                return(value);
            }

            case 0x01e00004:
            {        //INTPND
                if (mra.Size != MemorySize.Word)
                {
                    break;
                }
                return(_interuptPending);
            }

            case 0x01e00008:
            {        //INTMOD
                if (mra.Size != MemorySize.Word)
                {
                    break;
                }
                return(_interuptMode);
            }

            case 0x01e0000c:
            {        //INTMSK
                if (mra.Size != MemorySize.Word)
                {
                    break;
                }
                return(_interuptMask);
            }

            case 0x01e00010:
            {        //I_PSLV
                if (mra.Size != MemorySize.Word)
                {
                    break;
                }
                return(_slavePriorities);
            }

            case 0x01e00014:
            {        //I_PMST
                if (mra.Size == MemorySize.Byte)
                {
                    break;                                     //cannot read a byte here
                }
                return(_masterPriorities);
            }

            case 0x01e00018:
            {        //I_CSLV
                if (mra.Size != MemorySize.Word)
                {
                    break;                                     //must be a full word
                }
                return(_slavePriorities);
            }

            case 0x01e0001c:
            {        //I_CMST
                if (mra.Size == MemorySize.Byte)
                {
                    break;                                     //cannot write a byte here
                }
                return(_masterPriorities);
            }

            case 0x01e00020:
            {        //I_ISPR
                if (mra.Size != MemorySize.Word)
                {
                    break;                                     //must be a full word
                }
                return(_currentInteruptService);
            }
            } //switch
            return(0);
        }     //onMemoryAccessRead
示例#14
0
 private uint onMemoryAccessRead(object sender, MemoryAccessReadEventArgs mra)
 {
     return(0);
 }