public static void StepOver() { long prognum = Mem.GetByte(MemPos.prog); long linenum = Mem.GetNum(MemPos.progline, 2); SetBreakpoint(prognum, linenum + 1, true); }
public static void Push() { StackItem item = new StackItem(); item.prog = Mem.GetByte(MemPos.prog); item.progline = Mem.GetNum(MemPos.progline, 2); _gosubstack.Push(item); }
public static void Run() { long prognum; long linenum; while (true) { // get current program and line prognum = Mem.GetByte(MemPos.prog); linenum = Mem.GetNum(MemPos.progline, 2); // do debug events as needed Debug.RaiseProgLine(prognum, linenum); if (Debug.HasBreakpoint(prognum, linenum)) { Debug.RaiseBreakpoint(prognum, linenum); } // handle current line _lineText = ILCode.GetLine(prognum, linenum); _tokens = _lineText.Split('\t'); _tokenCount = _tokens.GetUpperBound(0) + 1; _tokenNum = 0; if (Functions.IsNumber(_tokens[_tokenNum])) { _tokenNum++; // line number } try { // move to next line in preparation, could be changed by command Mem.SetNum(MemPos.progline, 2, linenum + 1); ExecuteLine(); } catch (Exception ex) { Console.WriteLine(ex.Message); throw; } } }
private static long GetNumericValue() { string currToken = _tokens[_tokenNum++]; if (Functions.IsNumber(currToken)) { return(long.Parse(currToken)); } if (currToken == "FALSE") { return(0); } if (currToken == "TRUE") { return(1); } long?targetPos = null; long?targetSize = null; bool?isTargetByte = null; bool?isBuffer = null; targetPos = MemPos.GetPosByte(currToken); if (targetPos.HasValue) { targetSize = 1; isTargetByte = true; isBuffer = false; } else { targetPos = MemPos.GetPosNumeric(currToken); if (targetPos.HasValue) { targetSize = MemPos.GetSizeNumeric(currToken); isTargetByte = false; isBuffer = false; } else { targetPos = MemPos.GetPosBufferPtr(currToken); if (targetPos.HasValue) { if (_tokens[_tokenNum] == "(") { _tokenNum++; targetSize = GetNumericValue(); _tokenNum++; isTargetByte = false; isBuffer = true; } } } } if (!targetPos.HasValue || !targetSize.HasValue || !isTargetByte.HasValue || !isBuffer.HasValue) { throw new SystemException("GetNumericValue error"); } if (_tokenNum < _tokenCount && _tokens[_tokenNum] == "[") { _tokenNum++; // "[" long offset = GetNumericExpression(); if (_tokens[_tokenNum++] != "]") { throw new SystemException("GetNumericValue: No closing \"]\""); } targetPos += offset; } if (isTargetByte.Value) { return(Mem.GetByte(targetPos.Value)); } if (isBuffer.Value) { return(Mem.GetNumBuffer(targetPos.Value, targetSize.Value)); } return(Mem.GetNum(targetPos.Value, targetSize.Value)); }