private void UpdateStack() { var oldStackList = MachineStack.Reverse().ToList(); MachineStack.Clear(); int currentSp = _debugger.CPU.SP; ushort topStack = IsAnApp ? TopStackApp : (ushort)0xFFFF; // avoid generating a massive callstack if (currentSp < MachineStackBottom) { int maxStackSize = topStack - MachineStackBottom; topStack = (ushort)(currentSp + maxStackSize); } if ((currentSp < _oldSp) || (currentSp < topStack && oldStackList.Count == 0)) { // new stack entries to add while (currentSp != _oldSp && currentSp <= topStack) { CallStackEntry callStackEntry = CheckValidCall(currentSp); MachineStack.Push(new StackEntry((ushort)currentSp, ReadShort((ushort)currentSp), callStackEntry)); currentSp += 2; } } else if (currentSp > _oldSp) { // stack entries to remove oldStackList.RemoveAll(s => s.Address < currentSp); } foreach (StackEntry stackEntry in oldStackList) { int data = ReadShort((ushort)currentSp); if (stackEntry.Data != data) { CallStackEntry callStackEntry = CheckValidCall(currentSp); MachineStack.Push(new StackEntry((ushort)currentSp, (ushort)data, callStackEntry)); } else { MachineStack.Push(stackEntry); } currentSp += 2; } _oldSp = _debugger.CPU.SP; UpdateCallstack(); }
public RegexEngine() { _stack = new MachineStack<char>(); }
public RegexEngine() { _stack = new MachineStack <char>(); }
private void UpdateCallstack() { CallStack = new Stack <CallStackEntry>( MachineStack.Where(s => s.CallStackEntry != null) .Select(s => s.CallStackEntry).Reverse()); }
// link to the CheckMachine /// <summary> /// /// </summary> /// <param name="code"></param> /// <param name="instructionIndex"></param> /// <param name="mStack"></param> /// <returns></returns> public abstract bool Execute( AVM1Code code, int instructionIndex, MachineStack mStack );
public void Init() { StackDrink = new MachineStack <Drink>(_drink, 7); }
public void Init() { StackCoin = new MachineStack <Coin>(_coin, 7); }
public RegexBuilder() { _stack = new MachineStack<char>(); }