//Method: Execute //Purpose: executes specific instruction public void Execute() { curInstruction.execute(); disassembly = Instructions.disassembly; myRegisters.IncrCounter(); // Thread.Sleep(250); }
//Method: Run //Purpose: Runs through entire simulated program using CPU fetch-decode-execute. public void Run() { uint curCommand = myCPU.Fetch(); while (curCommand != 0 && !abort) { storedBranchPC = 0; stepNum++; //used for debugging stuffs //check stepnum OR pc counter /* if (stepNum == 2396) * { * string x; * }*/ if (myCPU.Decode(curCommand)) { if (Instructions.dontDoItBro == false) { myCPU.Execute(); //check to see if we wrote word to 100000 if (myRam.output) { //prompt user for input //call event handler to update screen if (outputQ.Count == 0) { output = '0'; } else { output = outputQ.Dequeue(); } myRam.output = false; putChar(this, e); } } else { myRegisters.IncrCounter(); } curCommand = myCPU.Fetch(); if (trace) { if (storedBranchPC == 0) { WriteTrace((int)myRegisters.ReadWord(15) - 12); } else { WriteTrace(storedBranchPC); } } } else { if (trace) { WriteTrace((int)myRegisters.ReadWord(15) - 8); } curCommand = 0; } } endRun(this, e); }