
    EnableDebugPin();                           /* DEBUG DEBUG */

    SaveStack(&(stacks[currentTask->taskNumber][0]));
    currentTask->mySP = SP;

/*  Switch to the new task  */

    currentTask = rlh.nextWait;                 /* The new current task */
    rlh.nextWait = currentTask->nextWait;       /* Unlink it from READY list */
    if (currentTask->nextWait != NULL) {
        currentTask->nextWait->prevWait = &rlh;
        }
    currentTask->prevWait = NULL;               /* Unlink it completely */
    currentTask->nextWait = NULL;

/*  Restore the new task's stack and stack pointer */

    SP = currentTask->mySP;
    RestoreStack(&(stacks[currentTask->taskNumber][0]));

    DisableDebugPin();                          /* DEBUG DEBUG */
