Assembly Language
Programming
I. Addressing Modes
II. Instruction Set
III. Assembly Language
Programs
IV. Mixed Language Programs
I. Addressing Modes
Addressing Modes??
• The different ways in which a
processor can access the operands
of an instruction are called
addressing modes.
• Operands can be located anywhere
Memory locations
Registers
I/O ports
Present in the instruction itself.
Instruction??
• A command given by the user to
perform a certain task
• It is written in a specific format
Opcode Operand field(s)
• Opcode is a unique hexadecimal
encoding of the given instruction.
• Opcode depends on the operation as
well as the operand fields.
Instructions
• Generally all instructions have
• Operation (mnemonic)
• Destination (operand)
• Source (operand)
Mnemonic Destination, Source
• Some instructions may have only
destination, while some may have
more than one source, or more than
one destination. (details later)
Operands?
• Source of data can be:
• Immediate data (available on the
instruction)
• A register
• Specified address (memory or I/O)
• Destination can be:
• A register
• Specified address (memory or I/O)
Addressing Modes
1. Register Addressing Mode
2. Immediate Addressing Mode
Memory Addressing Modes
3. Direct
4. Indirect
5. Indexed
6. Based or Relative
7. Base Indexed
8. Relative Base Indexed
9. Implied or Implicit Addressing
Mode
1. Register Addressing
• In this mode, the operands on which
instruction operate are stored in the
specified registers
• For 16 bit operand – AX, BX, CX, DX, SI,
DI, SP, BP
• For 8 bit operand – AH,AL, BH,BL,
CH,CL, DH,DL
• Example:
MOV AX, BX
BX 1234 1234 AX
2. Immediate Addressing
• In this mode, data is part of the
instruction
• Doesn’t involve computation of
address
• Example:
MOV AX, 0170h
AX
0000 0001 0111 0000
3. Direct Addressing
• Address of the data is provided in
the instruction
• Example: MOV AX, [1050H]
or MOV AX, DATA
By default DS is segment address
let DS = 2000h
EA = 2000*10 + 1050 =
21050
2105 34
0
2105 12 1234 AX
1