Indirect Addressing Modes
5-22
Figure 5−1. Circular Buffer with AMODE = 0
XX 08
15 8 7 0
Buffer size = 8 + 1 = 9
31 0
AR1
XAR6Top of buffer
Bottom of buffer
XAR6[7:0] is incremented until it matches AR1[7:0]
78
XXXXXX 0 0
Must be zero
XXAR6
31
XX
Matches AR1[7:0]
XXX
8
80
7 0
Example(s):
; Calculate FIR filter (X[N] = data array, C[N] = coefficient array):
MOVW DP,#Xpointer ; Load DP with page address of Xpointer
MOVL XAR6,@Xpointer ; Load XAR6 with current X pointer
MOVL XAR7,#C ; Load XAR7 with start address of C array
MOV @AR1,#N ; Load AR1 with size of data array N,
SPM −4 ; Set product shift mode to “>> 4”
ZAPA ; Zero ACC, P, OVC
RPT #N−1 ; Repeat next instruction N times
||QMACL P,*AR6%++,*XAR7++ ; ACC = ACC + P >> 4,
; P = (*AR6%++ * *XAR7++) >> 32
ADDL ACC,P << PM ; Final accumulate
MOVL @Xpointer,XAR6 ; Store XAR6 into current X pointer
MOVL @Sum,ACC ; Store result into sum