Lookup Instructions

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

MOV

A0,

0x100

 

MOV

A0,

*A0

; DP = 0x101 after execution

Interrupt

RPT N–2

FIRK A2, R0++

...

;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

; DP = 0x101

 

SUB A0, 0x1

; A0 = 0x100

after execution

MOV A0, *A0

; DP = 0x101

after execution

...

 

 

IRET

 

 

4-58

Page 144
Image 144
Texas Instruments MSP50C6xx manual MOV An, adrs SUB An MOV An, *An