/// <summary>
        /// Construct a timer control.
        /// </summary>
        /// <param name="host"></param>
        /// <param name="buttonTimerDisplay"></param>
        public TimerControl(IARMHost host, ButtonTimerDisplay buttonTimerDisplay)
        {
            //cache the simulator host interface and the timers user interface
            mHost = host;
            mButtonTimerDisplay = buttonTimerDisplay;

            //subscribe to the Start and Stop events so we can track when the simulation is running
            mHost.StartSimulation += mHost_Start;
            mHost.StopSimulation  += mHost_Stop;

            //Create the 2 timers and set their notification events
            mTimerBlocks[0]              = new TimerBlock();
            mTimerBlocks[1]              = new TimerBlock();
            mTimerBlocks[0].TimerNotify += TimerNotify;
            mTimerBlocks[1].TimerNotify += TimerNotify;

            //request to be notified when our area of the memory map is written or read
            mHost.RequestMemoryBlock(0x01d30000, 0xffffff00, onMemoryAccessRead, onMemoryAccessWrite);

            //request to be notified when cycles are expended so we can update the timers
            mHost.Cycles += mHost_Cycles;

            //request simulator restart notification so we can reset the timers to their default state
            mHost.Restart += mHost_Restart;

            //force timers into default state.
            init();
        }
Beispiel #2
0
        }//Init

        /// <summary>
        /// The onLoad is called after all plugins have had their init called and are all loaded.
        /// </summary>
        private void onLoad(object sender, EventArgs args)
        {
            //request a panel to display our user interface in from the simulator
            Panel panel = mHost.RequestPanel(this.PluginName);

            //create the plugin user control and add it to the requested panel
            mButtonTimerDisplay = new ButtonTimerDisplay();
            panel.Controls.Add(mButtonTimerDisplay);

            //Create the timer control and initialize it
            mTimerControl = new TimerControl(mHost, mButtonTimerDisplay);

            //Create the leds control and initialize it
            mLedsControl = new LedsControl(mHost, mButtonTimerDisplay.LedsDisplay);

            //Create the black buttons control and initialize it
            mBlackButtonsControl = new BlackButtonsControl(mHost, mButtonTimerDisplay.BlackButtons);

            //Create the eight segment control and initialize it
            mEightSegmentControl = new EightSegmentControl(mHost, mButtonTimerDisplay.EightSegmentDisplay);

            mTwoLineLCDControl = new TwoLineLCDControl(mHost, mButtonTimerDisplay.TwoLineLCDDisplay);

            mTrackBarControl = new TrackBarControl(mHost, mButtonTimerDisplay.TrackBarControl, mButtonTimerDisplay.TrackBarLabel);
        }//onLoad