ALTERA_STACK_SIZE
long stack[ALTERA_STACK_SIZE];
if ((stack_ptr < 0) || (stack_ptr >= ALTERA_STACK_SIZE))