Chapter 3
Chapter 3
Logical address, also referred to as the Effective Address (EA) or Offset, is contained within the 16-bit registers
IP, BP, SP, BX, SI, or DI.
Note that the range of logical addresses spans from 0000H to FFFFH.
Because injecting four zeros in the least significant bits of the segment address (in binary) is equivalent to
performing a left shift of 4 positions (4 bits), which is essentially a multiplication by 24 = 16.
Example:
Consider the instruction MOV BL, [SI].
Assuming the DS register contains the value 2400H and the SI register contains 0410H, the physical address of
the source operand pointed to by the SI register in the data segment is given by:
phys_addr = DS x 10H + SI = 2400H x 10H + 0410H = 24410H.
If the CS register contains the value 2367H and the IP register contains the value 5563H, the physical address
of the instruction is given by:
phys_addr = CS x 10H + IP = 2367H x 10H + 5563H = 28BD3H.
Example:
Consider the instruction MOV BL, ES:[SI].
Assuming the DS register contains the value 2400H, the SI register contains 0410H, and ES contains 5000H, the
physical address of the source operand pointed to by the SI register in the Extra segment is given by:
phys_addr = ES x 10H + SI = 5000H x 10H + 0410H = 50410H.
2 Addressing Modes
Data transfer instructions allow for moving data from a source to a destination, including:
Register to memory.
Register to register.
Memory to register.
Note: The 8086 does not permit memory-to-memory transfers; to achieve this, you must go through an
intermediate register.
Syntax: MOV destination, source
Note: MOV is an abbreviation of the verb "to move," signifying the action of moving.
There are various ways to specify the address of a memory location within an instruction, and these are known
as addressing modes.
Exemple 1 :
Consider the instruction: MOV AL, [SI]
Example 2:
Consider the following two examples:
a) MOV BL, [SI]
b) MOV CL, [DI]
These instructions show that the data located in the memory locations pointed to by the SI and DI index
registers are transferred to the BL and CL registers, respectively. The physical address (PA) of the desired
memory location is given by:
PA1 = DS × 10H + SI (for the instruction: MOV BL, [SI])
PA2 = DS × 10H + DI (for the instruction: MOV CL, [DI])
If the DS register contains the value 0500H, and the SI and DI registers contain the values 0082H and 0092H,
respectively, the physical addresses of the memory operands corresponding to the above instructions are as
follows:
PA1 = 0500H × 10H + 0082H = 5082H.
PA2 = 0500H × 10H + 0092H = 5092H.
Example 3:
In this example, indexed addressing is used to access elements of a memory array named TABLE.
TABLE represents the offset of the first element (a memory word) of the array, and the SI register serves as the
array index:
MOV SI, 0 ; SI points to the first element of the 'TABLE' array
MOV word ptr TABLE[SI], 1234H
MOV SI, 2
MOV word ptr TABLE[SI], 5678H
Si DF = 0 alors SI = SI + 2 Sinon SI = SI 2.
Remarque : Ces instructions n nt pas les indicateurs
5 Tutorial exercises No 3
Exercise 01 :
Evaluate the following instructions, are they correct (yes/no)? (Then provide your justification)
TEMP1 and TEMP2 are two memory bytes.
a) MOV TEMP1, TEMP2
b) MOV AL, BX
c) MOV BX, AL
d) MOV TEMP1, AX
e) MOV 55H, AL
f) MOV AL, [4000H]
g) MOV AL, [SI]
h) MOV AL, SI
i) MOV BX, [2000H]
j) MOV byte ptr [1100H], 6500H
k) PUSH BL
l) PUSH BX
Exercise 02 :
Choose the correct answer
1. The range of effective addresses (EA) spanning from
a) 0000H à FFFFH.
b) 00000H à FFFFFH.
2. The range of physical addresses (PA: Physical Address) ranging from
a) 0000H à FFFFH.
b) 00000H à FFFFFH.
3. In indexed addressing, the address of the operand is stored in
a) le registre SI ou DI.
b) le registre BX ou BP.
c) Les registres SI et BX.
4. In indirect addressing mode, the physical address of the operand is obtained by combining the content of the
DS register:
a) with an immediate value.
b) with one or more general registers.
Exercise 03:
1. If the physical address of the instruction MOV AL, [BX+SI] is 46F32H and the content of the IP register is
6F02H, determine the content of the CS register.
2. Determine the Physical Address of the Source Operand (PASO) for the instruction, knowing that BX = 0430H,
DS = 2300H, SI = 320H, and AL = 33H.
3. Rewrite the instruction using direct addressing.
Exercise 04:
1. If the physical address of an instruction is 46F32H and the content of the code segment register CS is
42F3H, determine the value contained in the instruction pointer register IP.
2. Determine the physical address (PA) of the memory location pointed to by SI in the instruction: MOV BL,
[SI]. Knowing that the content of SI = 0410H and that of DS = 2400H.
3.
a) Determine the physical address of the operand in the instruction: MOV AL, [SI][BX], knowing that the
content of SI = 0220H, BX = 0140H, and DS = 3000H.
b) What type of addressing is used in this instruction?
c) Can this instruction be written in another form? If yes, rewrite it.
d) Determine the physical address of the operand in the instruction MOV AL, [SI][BX+200H]. What type of
addressing is used in the last instruction?