visitRoutine method

  1. @override
void visitRoutine(
  1. List<int?> params
)
override

Implementation

@override
void visitRoutine(List<int?> params) {
  assert(params.length < 9);

  //Debugger.verbose('  Calling Routine at ${pc.toRadixString(16)}');

  // assign any params passed to locals and push locals onto the call stack
  var locals = readb();

  stack.push(Engine.stackMarker);

  ////Debugger.verbose('    # Locals: ${locals}');

  assert(locals < 17);

  // add param length to call stack (v5+ needs this)
  callStack.push(params.length);

  //set the params and locals
  for (int i = 0; i < locals; i++) {
    //in V5, we don't need to read locals from memory, they are all set to 0

    callStack.push(i < params.length ? params[i]! : 0x0);
  }
  //push total locals onto the call stack
  callStack.push(locals);
}