/// <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; }
// Perform initialization private void Init() { bPos = bZero = bNeg = bCarry = bNOT_CDAV = false; state = MSstate.Get_MSstate(); mseq = MSmicrosequencer.Get_MSmicrosequencer(); ControlTable = new MScontrolTable(); }
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(); }