MCPcopy Create free account
hub / github.com/CE-Programming/CEmu / debugBasicStepInternal

Method debugBasicStepInternal

gui/qt/basicdebugger.cpp:369–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

367}
368
369void MainWindow::debugBasicStepInternal(bool next) {
370 if (!guiDebug || !guiDebugBasic) {
371 return;
372 }
373
374 const uint32_t begPC = mem_peek_long(DBG_BASIC_BEGPC);
375 const uint32_t curPC = mem_peek_long(DBG_BASIC_CURPC);
376 const uint32_t endPC = mem_peek_long(DBG_BASIC_ENDPC);
377 int index = 0;
378 if (curPC < begPC || curPC > endPC || debugBasicPrgmLookup(false, &index) == DBG_BASIC_NO_EXECUTING_PRGM) {
379 // step until valid
380 const uint16_t firstOffset = 1;
381 const uint16_t lastOffset = 0;
382 debugSync();
383 debug_step(DBG_BASIC_STEP_IN, firstOffset | (static_cast<uint32_t>(lastOffset) << 16));
384 emu.resume();
385 return;
386 }
387
388 // locate next line
389 uint32_t offset = curPC - begPC;
390 const auto &tokensMap = m_basicPrgmsTokensMap[index];
391 const auto stepField = m_basicShowFetches ? &token_highlight_t::offset : &token_highlight_t::line;
392 const int currField = tokensMap[offset].*stepField;
393 const auto compareFields = [=](const token_highlight_t &posInfo) {
394 return (posInfo.*stepField == currField) ^ next;
395 };
396 const auto first = std::find_if(tokensMap.constBegin() + offset, tokensMap.constEnd(), compareFields);
397 const auto last = std::find_if_not(first, tokensMap.constEnd(), compareFields);
398 if (first != last) {
399 const uint16_t firstOffset = (first - tokensMap.constBegin());
400 const uint16_t lastOffset = (last - tokensMap.constBegin()) - 1;
401 debugSync();
402 debug_step(next ? DBG_BASIC_STEP_NEXT : DBG_BASIC_STEP_IN, firstOffset | (static_cast<uint32_t>(lastOffset) << 16));
403 emu.resume();
404 }
405}
406
407QString MainWindow::debugBasicGetPrgmName() {
408 char name[10];

Callers

nothing calls this directly

Calls 3

mem_peek_longFunction · 0.85
debug_stepFunction · 0.85
resumeMethod · 0.80

Tested by

no test coverage detected