示例#1
0
        private static void initMode()
        {
            Console.Write("StepMode ( [s]low / [N]ormal / [f]ast )\n > ");
            var i = Console.ReadKey().KeyChar;

            switch (i)
            {
            case 's':
                _stepMode = StepModeEnum.Slow;
                break;

            case 'n':
                _stepMode = StepModeEnum.Normal;
                break;

            case 'f':
                _stepMode = StepModeEnum.Fast;
                break;

            default:
                _stepMode = StepModeEnum.Normal;
                break;
            }

            if (_stepMode == StepModeEnum.Normal)
            {
                Console.Write("\nTimeout (30ms)\n > ");
                var t = Console.ReadLine();
                int ms;
                _timeOut = int.TryParse(t, out ms) ? ms : 30;
            }
        }
示例#2
0
        private static void initMode()
        {
            Console.Write("StepMode ( [s]low / [N]ormal / [f]ast )\n > ");
            var i = Console.ReadKey().KeyChar;
            switch (i)
            {
                case 's':
                    _stepMode = StepModeEnum.Slow;
                    break;
                case 'n':
                    _stepMode = StepModeEnum.Normal;
                    break;
                case 'f':
                    _stepMode = StepModeEnum.Fast;
                    break;
                default:
                    _stepMode = StepModeEnum.Normal;
                    break;
            }

            if (_stepMode == StepModeEnum.Normal)
            {
                Console.Write("\nTimeout (30ms)\n > ");
                var t = Console.ReadLine();
                int ms;
                _timeOut = int.TryParse(t, out ms) ? ms : 30;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Form1" /> class.
        /// </summary>
        /// <param name="args">The args.</param>
        public Form1(string[] args)
        {
            InitializeComponent();

            cpu = new Cpu();
            cpu.CommandCounter = Cpu.FromShort(100);
            cpu.StepCounter    = 0;

            activeMode = fastToolStripMenuItem;
            StepMode   = (StepModeEnum)Enum.Parse(typeof(StepModeEnum), activeMode.Text);

#if DEBUG
            args    = new string[1];
            args[0] = @"C:\Dev\ASP.Net\Mini-Power-PC\Examples\Multiplikation.lvhe";
#endif

            // Falls ein File als Parameter mit angegeben wurde, den Emulator damit starten
            if (args.Length > 0)
            {
                FileTracker.ActiveFile = new FileInfo(args[0]);
                initGui();
            }
            toolStripStatusLabel2.Text = string.Empty;

            updateGui();
        }
        /// <summary>
        /// Handles the Click event of the stepMode control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        private void stepMode_Click(object sender, EventArgs e)
        {
            if (activeMode == (ToolStripMenuItem)sender)
            {
                return;
            }

            activeMode.Checked = false;
            activeMode         = (ToolStripMenuItem)sender;
            StepMode           = (StepModeEnum)Enum.Parse(typeof(StepModeEnum), activeMode.Text);
        }
        /// <summary>
        /// Handles the Click event of the stepMode control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        private void stepMode_Click(object sender, EventArgs e)
        {
            if (activeMode == (ToolStripMenuItem)sender)
                return;

            activeMode.Checked = false;
            activeMode = (ToolStripMenuItem)sender;
            StepMode = (StepModeEnum)Enum.Parse(typeof(StepModeEnum), activeMode.Text);
        }