SPRUIY2 November 2024 F29H850TU , F29H859TU-Q1
The Stack Addressing type allows read or write access to any location in the stack space with the address provided in addressing register A15, which is the dedicated Stack Pointer (SP).
Following is a list of key information regarding the stack pointer that helps in understanding these addressing modes:
When allocating stack space and accessing values on the stack, the recommended procedure is as follows:
For example: The program needs to allocate space for:
The total number of bytes to allocate, taking into account the alignment can be 32 (which is the nearest 64-bit address above the required 25 bytes):
64-bit +8 8 bytes total requires 8 bytes allocated
32-bit +4 12 bytes total requires 16 bytes allocated
32-bit +4 16 bytes total
32-bit +4 20 bytes total requires 24 bytes allocated
16-bit +2 22 bytes total
8-bit +1 23 bytes total
8-bit +1 24 bytes total
8-bit +1 25 bytes total requires 32 bytes allocated
Total Used = 25 bytes
Allocated = 32 bytes (closest multiple of 8-bytes [64-bits])