Texas Instruments TMS320C2XX 用户手册
BANZ
Branch on Auxiliary Register Not Zero
7-42
Example 1
BANZ
PGM0
;(PGM0 labels program address 0)
Before Instruction
After Instruction
ARP
0
ARP
0
AR0
5h
AR0
4h
Because the content of AR0 is not zero, the program branches to program ad-
dress 0 is loaded into the program counter (PC), and the program continues
executing from that location. The default auxiliary register operation is a decre-
ment of the current auxiliary register content; thus, AR0 contains 4h at the end
of the execution.
dress 0 is loaded into the program counter (PC), and the program continues
executing from that location. The default auxiliary register operation is a decre-
ment of the current auxiliary register content; thus, AR0 contains 4h at the end
of the execution.
or
Before Instruction
After Instruction
ARP
0
ARP
0
AR0
0h
AR0
FFFFh
Because the content of AR0 is zero, the branch is not executed; instead, the
PC is incremented by 2, and execution continues with the instruction following
the BANZ instruction. Because of the default decrement, AR0 is decremented
by 1, becoming –1.
PC is incremented by 2, and execution continues with the instruction following
the BANZ instruction. Because of the default decrement, AR0 is decremented
by 1, becoming –1.
Example 2
MAR *,AR0
;Set ARP to point to AR0.
LAR AR1,#3
;Load AR1 with 3.
LAR AR0,#60h
;Load AR0 with 60h.
PGM191
ADD *+,AR1
;Loop: While AR1 not zero,
BANZ PGM191,AR0 ;add data referenced by AR0
;to accumulator and increment
;AR0 value.
The contents of data-memory locations 60h–63h are added to the accumula-
tor.
tor.