CALLA | Call a subroutine |
Syntax |
CALLA dst |
Operation | dst → tmp 20-bit dst is evaluated and stored |
| SP – 2 → SP |
| PC.19:16 → @SP updated PC with return address to TOS (MSBs) |
| SP – 2 → SP |
| PC.15:0 → @SP updated PC to TOS (LSBs) |
| tmp → PC saved 20-bit dst to PC |
Description | A subroutine call is made to a 20-bit address anywhere in the full address space. All seven source addressing modes can be used. The call instruction is an address-word instruction. If the destination address is contained in a memory location X, it is contained in two ascending words, X (LSBs) and (X + 2) (MSBs). Two words on the stack are needed for the return address. The return is made with the instruction RETA. |
Status Bits | N: | Not affected |
| Z: | Not affected |
| C: | Not affected |
| V: | Not affected |
Mode Bits | OSCOFF, CPUOFF, and GIE are not affected. |
Examples | Examples for all addressing modes are given. |
| Immediate mode: Call a subroutine at label EXEC or call directly an address. |
CALLA #EXEC ; Start address EXEC
CALLA #01AA04h ; Start address 01AA04h
| Symbolic mode: Call a subroutine at the 20-bit address contained in addresses EXEC (LSBs) and EXEC+2 (MSBs). EXEC is located at the address (PC + X) where X is within +32 K. Indirect addressing. |
CALLA EXEC ; Start address at @EXEC. z16(PC)
| Absolute mode: Call a subroutine at the 20-bit address contained in absolute addresses EXEC (LSBs) and EXEC+2 (MSBs). Indirect addressing. |
CALLA &EXEC ; Start address at @EXEC
| Register mode: Call a subroutine at the 20-bit address contained in register R5. Indirect R5. |
CALLA R5 ; Start address at @R5
| Indirect mode: Call a subroutine at the 20-bit address contained in the word pointed to by register R5 (LSBs). The MSBs have the address (R5 + 2). Indirect, indirect R5. |
CALLA @R5 ; Start address at @R5
| Indirect, Auto-Increment mode: Call a subroutine at the 20-bit address contained in the words pointed to by register R5 and increment the 20-bit address in R5 afterwards by 4. The next time the S/W flow uses R5 as a pointer, it can alter the program execution due to access to the next word address in the table pointed to by R5. Indirect, indirect R5. |
CALLA @R5+ ; Start address at @R5. R5 + 4
| Indexed mode: Call a subroutine at the 20-bit address contained in the address pointed to by register (R5 + X); for example, a table with addresses starting at X. (R5 + X) points to the LSBs, (R5 + X + 2) points to the MSBs of the word address. X is within R5 + 32 K. Indirect, indirect (R5 + X). |
CALLA X(R5) ; Start address at @(R5+X). z16(R5)