Exemplo n.º 1
0
        /// <summary>
        /// Just testing to see how things work.
        /// TODO We need a facade to manage the simulation.
        /// </summary>
        private void btnStart_Click(object sender, EventArgs e)
        {
            MSstate state = MSstate.Get_MSstate();

#if false
            // Show the initial state
            tbOut.Text += state.ToString() + Environment.NewLine + Environment.NewLine;
#endif
            // Make a few state changes
            state.RegisterContent[MSstate.RegSet.MARlo] = 0x11;
            state.RegisterContent[MSstate.RegSet.MARhi] = 0x22;
            state.RegisterContent[MSstate.RegSet.AClo]  = 0x50;
            state.RegisterContent[MSstate.RegSet.AChi]  = 0x42;
            state.RegisterContent[MSstate.RegSet.SPhi]  = 0x50;

            // Show the results
            tbOut.Text += state.ToString() + Environment.NewLine + Environment.NewLine;

            // Execute some microcode
            MS_ALU alu = MS_ALU.Get_MS_ALU();
            alu.PerformOneMicroStatement(new MSmicrocodeStatement("", 13, 9, 0, 0, 0)); // ALUin := SPhi
            tbOut.Text += state.ToString() + Environment.NewLine + Environment.NewLine;

            alu.PerformOneMicroStatement(new MSmicrocodeStatement("", 5, 2, 0, 0, 0));  // BRhi := AClo
            alu.PerformOneMicroStatement(new MSmicrocodeStatement("", 14, 0, 0, 0, 0)); // Inc MAR&PC // TODO not working
            alu.PerformOneMicroStatement(new MSmicrocodeStatement("", 8, 9, 7, 0, 0));  // SPlo := SPhi+ALUin 50+50=A0

            // Show the results
            tbOut.Text += state.ToString() + Environment.NewLine + Environment.NewLine;
        }
Exemplo n.º 2
0
        // Perform initialization
        private void Init()
        {
            bPos = bZero = bNeg = bCarry = bNOT_CDAV = false;

            state        = MSstate.Get_MSstate();
            mseq         = MSmicrosequencer.Get_MSmicrosequencer();
            ControlTable = new MScontrolTable();
        }
Exemplo n.º 3
0
        private void LoadInitStates()
        {
            // allocate memory; it is automatically set to zeros
            MicroRegisterContent = new byte[iRegCount];

            state        = MSstate.Get_MSstate();
            alu          = MS_ALU.Get_MS_ALU();
            ControlTable = new MScontrolTable();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Gets the only instance of the PO_NameFixer class that may exist.  If a single
        /// instance of PO_NameFixer has not yet been created, one is created.
        ///
        /// PRE:    None.
        /// POST:   An MSstate (reference) has been returned, or created and returned.
        /// </summary>
        /// <returns>Returns a reference to the only existing instance of MSstate.</returns>
        public static MSstate Get_MSstate()
        {
            lock (c_stateLock)
            {
                // if this is the first request, initialize the one instance
                if (c_state == null)
                {
                    // create the single object instance
                    c_state = new MSstate();

                    c_state.RegisterContent = new Dictionary <RegSet, byte>();
                    c_state.LoadInitStates();
                } // if null

                // whether new or old, return a reference to the only instance
                return(c_state);
            } // lock
        }