| Purpose: | Allocate and release a large, temporary, working buffer on the stack. |
| Assumes: | StackAlloc250: there is enough room on the stack to allocate 256 bytes.
StackFree250: SPH and SPL have the same values which they had upon returning from the StackAlloc250() call, so any registers which were PUSHed after that call have already been POPped. StackFree250: MUST use a CALL, not a JMP. |
| Passed: | Nothing |
| Returns: | R31:R30 BYTE * bPtrBuffer pointer to the buffer on the stack |
| Alters: | R0, R26, R27, SPH, SPL, and the FLAGS register |
| Example: |
|
| Notes: | These indicate 250 bytes, but 256 bytes are actually allocated and released. The pointer returned by StackAlloc250 is adjusted to place 3 unused (or "slack") bytes both after the buffer begins and before it ends. This was done just to try to reduce stack errors, which can be hard to find and almost always sudden and crash the O.S. |
| Also, StackAlloc250 does not save a pointer for StackFree250 to use; it simply adjusts the stack pointer down by 256 bytes. Similarly, StackFree250 just adjusts the stack pointer upward by 256 bytes. | |
| Be VERY careful when calling StackAlloc250 more than once, since stack space is limited and somewhat precious. | |
| Also see: | StackAlloc50 |