visitInstruction method

void visitInstruction()

Reads the next instruction at memory location programCounter and executes it.

Implementation

void visitInstruction() async {
  final i = readb();

  if (ops.containsKey(i)) {
    if (Debugger.enableDebug) {
      if (Debugger.enableTrace && !Z.inBreak) {
        Debugger.debug('>>> (0x${(programCounter- 1).toRadixString(16)}) ($i)');
        Debugger.debug(Debugger.dumpLocals());
      }

      if (Debugger.enableStackTrace) {
        Debugger.debug('Call Stack: $callStack');
        Debugger.debug('Game Stack: $stack');
      }

      if (Debugger.isBreakPoint(programCounter- 1)) {
        Z.inBreak = true;
        Debugger.debugStartAddr = programCounter- 1;
      }
    }
    // call the instruction
    ops[i]!();
  } else {
    notFound();
  }

  // final result = readb();
  // log.finest("visitInstruction() Calling Operation: $result");
  // ops[result]();
}