
































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Lecture notes from the University of Namibia
Typology: Lecture notes
1 / 40
This page cannot be seen from the preview
Don't miss anything!

































Opcode is short of “operation code”
An opcode is a single instruction that can be executed by the CPU. In machine
language it is a binary or hexadecimal value such as B7 loaded into the instruction
register.
In assembly language mnemonic form an opcode is a command such as MOV or ADD
or JMP.
Example:
MOV AX, 1000H ; MOV is the opcode.
; AX (register) is an operand.
Operands are manipulated by the opcode. In this example, the operands are the register
AX and the value 1000H.
Immediate Addressing Mode
■
Transfers the source, an immediate byte or word of data,
into the destination register or memory location
■ The source operand is a constant
■
The operand comes immediately after the opcode
■
For this reason, this addressing mode executes quickly
■ Immediate addressing mode can be used to load
information into any of the registers except the segment
registers and flag registers.
Example:
MOV AX, 2550H ; move 2550H into AX
MOV CX, 625 ; load the decimal value 625 into CX
MOV BL, 40H ; load 40H into BL
The data must first be moved to a general-purpose register and then to the segment
register.
Example:
MOV DS, 0123H ; illegal instruction!
Moves a byte or word between a memory location and a register.
The data is in some memory location(s) and the address of the data in memory
comes immediately after the instruction
This address is the offset address Example:
MOV AX, [2400] ; move contents of DS:2400H into AX
The physical address is calculated by combining the contents of offset location 2400
with DS
Example:
Find the physical address of the memory location and its contents after the
execution of the following, assuming that DS = 1512H.
Solution:
First 3BH is copied into AL,
Then in line two, the contents of AL are moved to logical address DS:3518 which is
Shifting DS left and adding it to the offset gives the physical address of 18638H
After the execution of the second instruction, the memory location with address
18638H will contain the value 3BH.
The Displacement Only Addressing Mode
The displacement-only addressing mode consists of a 16 bit constant that
specifies the address of the target location.
The instruction mov al,ds:[8088h] loads the al register with a copy of the byte
at memory location 8088h.
Likewise, the instruction mov ds:[1234h],dl stores the value in the dl register
to memory location 1234h:
The Displacement Only Addressing Mode
■ The displacement-only addressing mode is perfect for
accessing simple variables.
■ Intel named this the displacement-only addressing mode
because a 16 bit constant (displacement) follows the
mov opcode in memory.
■ In that respect it is quite similar to the direct addressing
mode on the x86 processors. There are some minor
differences, however.
distance from some other point. On the x86, a direct
address can be thought of as a displacement from
address zero.
■ Transfers a byte or word between a register and a memory location
addressed by an index or base register
■ The address of the memory location where the operand resides is held
by a register
■ The registers used for this purpose are SI, DI, BP and BX
■ SI, DI and BX are combined with DS in order to generate the 20-bit
physical address. BP is combined with SS.
Example:
MOV AX, [BX] ; moves into AX the contents of the memory
location pointed to by DS:BX, 1000:
■ The physical address is calculated as
1000x10+1234=11234H
■ The same rules apply when using register SI or DI.
■ Example:
MOV CL, [SI] ; move contents of DS:SI into CL
MOV [DI], AH ; move contents of AH into DS:DI
■ Example:
■ Assume that DS = 1120, SI = 2498, and AX = 17FE Show the contents
of memory locations after the execution of MOV [SI], AX ; move
contents of AX into DS:SI
Register Indirect Addressing Mode