James_Parsons wrote:
http://www.devili.iki.fi/Computers/Commodore/C64/Programmers_Reference/Chapter_5/page_274.html
what does it mean
Stack Requirements: 13
It means that the maximum stack space consumption during the subroutine call (ACPTR) is 13 bytes. An additional two stack bytes are used for the return address back to the calling program, which Commodore did not count as part of the kernel call's stack usage. ACPTR itself makes various internal subroutine calls to handshake the serial bus, which is where some of that stack space gets used.
Although the 6502's stack is tiny by current standards it can handle quite a few nested subroutines. Assuming the worst case, in which each subroutine pushes all registers for later restoration, 42 subroutines can theoretically be nested. I say "theoretically" because interrupts will also claim stack space. Plus when BASIC is running, the stack gets used for FOR-NEXT loops, as well as handling GOSUB-RETURN pairs. You can get an OUT OF MEMORY error in BASIC if too many GOSUBs or FOR-NEXT loops are nested. The choice of error for this situation is unfortunate, because there's plenty of memory when it happens. What is really happening is that the stack pointer has been driven too close to $00, leaving insufficient stack space for another GOSUB or FOR-NEXT.