Texas Instruments TMS320C2XX Calculator User Manual


 
Immediate Addressing Mode
6-2
6.1 Immediate Addressing Mode
In immediate addressing, the instruction word contains a constant to be ma-
nipulated by the instruction. The ’C2xx supports two types of immediate ad-
dressing:
Short-immediate addressing. Instructions that use short-immediate ad-
dressing take an 8-bit, 9-bit, or 13-bit constant as an operand. Short-im-
mediate instructions require a single instruction word, with the constant
embedded in that word.
Long-immediate addressing. Instructions that use long-immediate ad-
dressing take a 16-bit constant as an operand and require two instruction
words. The constant is sent as the second instruction word. This 16-bit val-
ue can be used as an absolute constant or as a 2s-complement value.
6.1.1 Examples of Immediate Addressing
In Example 6–1, the immediate operand is contained as a part of the RPT
instruction word. For this RPT instruction, the instruction register will be loaded
with the value shown in Figure 6–1. Immediate operands are preceded by the
symbol #.
Example 6–1. RPT Instruction Using Short-Immediate Addressing
RPT #99 ;Execute the instruction that follows RPT
;100 times.
Figure 6–1. Instruction Register Contents for Example 6–1
0123456789101112131415
1100011011011101
8-bit constant = 99RPT opcode for immediate addressing
In Example 6–2, the immediate operand is contained in the second instruction
word. The instruction register receives, consecutively, the two 16-bit values
shown in Figure 6–2.
Example 6–2. ADD Instruction Using Long-Immediate Addressing
ADD #16384,2 ;Shift the value 16384 left by two bits
;and add the result to the accumulator.