Texas Instruments MSP50C6xx Calculator User Manual


 
Lookup Instructions
4-58
Lookup instructions make use of the data pointer (DP) internally. The DP
stores the address of the program memory location, loads the value to the
destination, and increments it automatically after every load. Thus, the value
of the DP is always the last used program memory address plus one. The
content of DP changes after the execution of lookup instructions. If filter
instructions FIRK and CORK are used, it is required to context save DP in the
interrupt service routine. Since these filter instructions use DP to read
coefficient data (see section 4.10), any interrupt occurring between loading the
first coefficient and the execution of a FIRK/CORK will change the last value
of DP (if the interrupt routine uses a lookup instruction). DP can be stored in
RAM ( MOV {adrs}, DP ), and a restoration is done as follows,
MOV An, {adrs}
SUB An, 0x1
MOV An, *An
Context save and restore of instructions are not required if filter instructions
are not used.
Example 4.9.1
Interrupt
MOV A0, 0x100
MOV A0, *A0
RPT N2
FIRK A2, R0++
...
; DP = 0x101 after execution
; Beginning of interrupt service routine
; context save
MOV *ctx_DP, DP ; ctx_DP stores the present DP = 0x101
...some lookup instructions...
; context restore
MOV *A0, *ctx_DP
SUB A0, 0x1
MOV A0, *A0
...
IRET
; DP = 0x101
; A0 = 0x100 after execution
; DP = 0x101 after execution