written 6.1 years ago by | • modified 6.1 years ago |
This addressing mode is required for instructions that cause a branch in the program. If the Branch is within the same segment, it is called as an Intra-Segment Branch or a Near Branch. If the Branch is in a different segment, it is called as an Inter-Segment Branch or a Far Branch.
Intra Segment Direct Addressing Mode
Address is specified directly in the instruction as an 8-bit (or 16-bit) displacement. The effective address is thus calculated by adding the displacement to current value of IP. As it is intra-segment, only IP changes, CS does not change. If the displacement is 8-bit it is called as a Short Branch. This addressing mode is also called as relative addressing mode.
Example:
Inter Segment Direct Addressing Mode
The new Branch location is specified directly in the instruction Both CS and IP get new values, as this is an inter-segment branch.
Example:
Intra Segment Indirect Addressing Mode
Address is specified indirectly through a register or a memory location (in DS only). The value in the IP is replaced with the new value. As it is intra-segment, ONLY IP changes, CS does not change.
Example:
JMP WORD PTR [BX] ; IP = {DS:[BX], DS:[BX+1]}
Inter Segment Indirect Addressing Mode
The new Branch location is specified indirectly through a register or a memory location (in DS only). Both CS and IP get new values, as this is an inter-segment branch.
Example:
JMP DWORD PTR [BX] ; IP = {DS:[BX], DS:[BX+1]}, ;CS = {DS:[BX+2], DS:[BX+3]}