Instruction Set and Assembly Language Programming 159
6.4.5 Relative
In relative addressing mode the location of target data is speci ed with respect to the current position
of the program counter (PC). In other words, the instruction would be similar to, e.g., nd the data after
20 bytes from now. Here, now means present content of PC. Generally, this type of addressing mode is
used for a table look up in a suitable subroutine.
An example of relative addressing mode is illustrated in Figure 6.6 , where the instruction indicates
to load a byte of data into register R1. The location of the data is expressed in relative addressing mode,
which, in this example case, is seven locations away from the current value of the program counter
of the processor. Therefore, to get the data, the current value of PC is incremented by 7 (PC remains
unchanged) and the resultant location is used as the source of the data to be copied to R1.
Figure 6.6 Example of relative addressing mode
The relative addressing mode offers one advantage. Even when the address of the program is
changed, it would still correctly nd the data out as the location of data is expressed as an offset of the
current value of PC. Relative addressing mode is used extensively in conditional jump instructions of
8051. However, it is not used in 8085 instruction set.
6.4.6 Implicit
In implicit addressing mode, the location of data is not indicated in the instruction because, for the implicit
instruction, the location of data is prede ned. For example, an imaginary processor might offer an instruction
CLEAR, which is applicable only for the accumulator of that processor. Whenever the accumulator has to be
loaded with 0s, this CLEAR instruction may be used. As we see, no operand is indicated in the instruction
as the name of the accumulator is implied and no other location would be cleared by this instruction. Widely
used instruction RETURN (or RET in some cases) falls under this category. In this case, it is implied to get
the relevant data (to be used as return address) from the stack top as pointed by the stack pointer (SP).
Another frequently used instruction using implicit addressing mode is POP, i.e., to restore a data
from stack-top to some indicated location. The source of data to be POPed is implicitly indicated as the
present stack-top location. This is illustrated through Figure 6.7 by the instruction POP R1. According
to the instruction, the data are located with the help of the stack pointer (SP) at the stack-top and then
M06_GHOS1557_01_SE_C06.indd 159M06_GHOS1557_01_SE_C06.indd 159 4/29/11 5:09 PM4/29/11 5:09 PM