예제 #1
0
  // Pops the a value from the appropriate stack, decrements sp, and returns
  // the popped value.
  private short popValue(int stackID) throws ProgramException {
    short newSP = (short) (getSP() - 1);
    short value;

    if (stackID == MAIN_STACK) value = stackSegment.getValueAt(newSP);
    else value = workingStackSegment.getValueAt(newSP);

    checkSP(newSP);
    setSP(newSP);

    return value;
  }