public void RunProgram(List <Opcode> program, bool silent) { if (program.Count > 0) { ProgramContext newContext = new ProgramContext(program); newContext.Silent = silent; PushContext(newContext); } }
private void PushContext(ProgramContext context) { _contexts.Add(context); _currentContext = _contexts[_contexts.Count - 1]; if (_contexts.Count > 1) { _shared.Interpreter.SetInputLock(true); } }
private bool ExecuteInstruction(ProgramContext context) { Opcode opcode = context.Program[context.InstructionPointer]; if (!(opcode is OpcodeEOF || opcode is OpcodeEOP)) { opcode.Execute(this); context.InstructionPointer += opcode.DeltaInstructionPointer; return(true); } else { if (opcode is OpcodeEOP) { BreakExecution(false); } return(false); } }
private void PopContext() { if (_contexts.Count > 0) { // remove the last context ProgramContext contextRemove = _contexts[_contexts.Count - 1]; _contexts.Remove(contextRemove); contextRemove.DisableActiveFlyByWire(_shared.BindingMgr); if (_contexts.Count > 0) { _currentContext = _contexts[_contexts.Count - 1]; } else { _currentContext = null; } if (_contexts.Count == 1) { _shared.Interpreter.SetInputLock(false); } } }