StackAlloc50 and StackFree50

Purpose: Allocate and release a small, temporary, working buffer on the stack.
Assumes: StackAlloc50: there is enough room on the stack to allocate 56 bytes.
StackFree50: SPH and SPL have the same values which they had upon returning from the StackAlloc50() call, so any registers which were PUSHed after that call have already been POPped.
StackFree50: 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: 
CheckTransmit:
   PUSH    R10                      ; Use a register out of the usual range
   LD      R10, Z + bUserBYTE       ; Z was already set to point to our data
   SBRS    R10, BIT_DDT_TRANSMIT    ; If nRF transmission is not desired, then
   RJMP    ACkTx_Exit               ;  skip to the exit point

   CALL    AStackAlloc50            ; Returns the buffer pointer in R31:R30
   PUSH    R31                      ; Save the base pointer to the start of
   PUSH    R30                      ;  the buffer for nRF_CommandHandler()
   LDI     R24, LEN_CSZ_NSend       ; We already know the byte count, so just
   ST      Z+, R24                  ;  set it now and increment 'Z'
   MOVW    R24, R30                 ; Point R25:R24 at the buffer to write
   LDI     R23, ACSZ_NSend >> 8     ; Point to the FLASH string to copy:
   LDI     R22, ACSZ_NSend & 0xFF   ;  "N>'ESW 0x___ ____'"
   CALL    AstrcpyPGM               ; Copy the string from FLASH to SRAM

;      ...                          ;  (code to write the address and value)

   LDI     R24, '>'                 ; R24 must be 2nd byte enbuffered (after
   LDI     R25, '''                 ;  the count and 'N') and R25 the 3rd
   POP     R26                      ; Restore the base buffer pointer that was
   POP     R27                      ;  PUSHed as R31:R30 above
   CALL    AnRF_CommandHandler      ; Call nRF_CommandHandler() to send it
   CALL    AStackFree50             ; Release the stack-based buffer

CkTx_Exit:
   POP     R10                      ; Restore the Register used and exit
   RET
Notes: These indicate 50 bytes, but examination of the stack before and after the call (e.g., using the "R" command) will show that actually 56 bytes are allocated and released. The pointer returned by StackAlloc50 is adjusted to place 3 unused (or "slack") bytes both after the buffer begins and before it ends. This is just to try to reduce stack errors, which can be hard to find and almost always sudden and crash the Operating System.
Also, StackAlloc50 does not save a pointer for StackFree50 to use; it simply adjusts the stack pointer down by 56 bytes. Similarly, StackFree50 just adjusts the stack pointer upward by 56 bytes.
Finally, if a few bytes mode than 50 are needed, StackAlloc50 may be called more than once, saving R31:R30 ("Z") only after the last return. Of course, call StackFree50 that same number of times to clean up before returning to the caller.
Also see:  StackAlloc250