Q. Explain Direct Addressing Mode with example?
Direct Addressing Mode
A direct operand signifies to contents of memory at an address referred by the name of the variable.
Mode
|
Description
|
Example
|
Direct
|
The direct operands are also calledas relocatable operands as they represent the offset of a label from the beginning of a segment. On reloading a program even in a different segment will not cause change in the offset that is why we call them relocatable. Please note that a variable is considered in Data segment (DS) and code label in code segment (SS) by default. Thus, in theexample, COUNT, bydefault will be assumed to be
in data segment, while LABEL 1, will be assumed to be in code segment. If we specify, as a direct operand then the address is non-relocatable. Please note the value of segment register will be known only at the run time.
|
MOV COUNT, CL
; move CL to COUNT (a
; byte variable)
MOV AL,COUNT
; move COUNT to AL
JMP LABEL1
; jump to LABEL1
MOV AX,DS:5
; segment register and
; offset
MOV BX,CSEG:2Ch
; segment name and offset
MOV AX,ES:COUNT
; segment register and
; Variable.
; The offsets of these
; variables are calculated
; with respect to the
; segment name (register)
; specified in the
; Instruction.
|