IP2022 Users ManualInstruction Set Architecture
www.ubicom.com
67
The following code example uses indirect addressing.
3.1.4
Indirect-with-Offset Addressing
Indirect-with-offset addressing is used when bit 8 of the fr field is
set. The location of the operand is specified by a 7-bit unsigned
immediate from the fr field added to a 12-bit base address in a
pointer register. Addresses from 0x000 to 0x01F cannot be
accessed reliably with this addressing mode, therefore it must not
be used for this purpose. (Direct addressing should be used
instead.)
When bit 7 of the fr field is clear, the DPH/DPL register (i.e. the
data pointer) is selected as the pointer register. The upper four bits
of the DPH register are not used. Figure 3-5 shows indirect-with-
offset addressing using the DPH/DPL register as the pointer
register.
mov
w,#0x03
;load W with 0x03
mov
iph,w
;load the high byte of the
;indirect pointer from W
mov
w,#0x85
;load W with 0x85
mov
ipl,w
;load the low byte of the
;indirect pointer from W
mov
w,(ip)
;load W with the contents of the
;memory location at address 0x385