callVN2 method

void callVN2()

Implementation

void callVN2() {
  //Debugger.verbose('${pcHex(-1)} [call_vn2]');

  var operands = visitOperandsVar(8, true);

  // var resultStore = Engine.STACK_MARKER;

  var returnAddr = programCounter;

  assert(operands.isNotEmpty);

  if (operands[0].value == 0) {
    //calling routine at address 0x00 automatically returns FALSE (ref 6.4.3)
    log.fine("call_vn got a zero address but is skipping store");
    //writeVariable(resultStore, Engine.FALSE);
  } else {
    //unpack function address
    operands[0].rawValue = unpack(operands[0].value!);

    //move to the routine address
    programCounter = operands[0].rawValue!;

    // peel off the first operand
    operands.removeAt(0);

    //setup the routine stack frame and locals
    visitRoutine(operands.map<int?>((o) => o.value).toList());

    //push the result store address onto the call stack
    callStack.push(Engine.stackMarker);

    //push the return address onto the call stack
    callStack.push(returnAddr);
  }
}