Lecture05 - 8086 Assembly
Lecture05 - 8086 Assembly
Lecture05 - 8086 Assembly
Lecture 04
Basics of programming
ECEg - 4501 1
Programmers View
AAiT
Control &
status Address Memory
Microprocessor - RAM
SRAM
DRAM
Bus - ROM
Data PROM
Interface
EPROM
Address/data logic EEPROM
Serial Parallel
Keypad Display HDD
Port port
I/O Devices
ECEg - 4501 2
Programmers View
AAiT
ECEg - 4501 3
Basics AAiT
1. Machine Language
This are the binary codes for the instructions you want
the microcomputer to execute.
2. Assembly Language
Assembly language uses two, three, or four letter
mnemonics to represent each instruction type.
ECEg - 4501 6
Basicscntd
AAiT
ECEg - 4501 7
Addressing Modes
AAiT
ECEg - 4501 8
Addressing Modescntd
AAiT
ECEg - 4501 9
Addressing Modescntd
AAiT
For example:
Arithmetic, logical, data transfer and processor control
instructions are sequential control flow instructions.
ECEg - 4501 10
Addressing Modescntd
AAiT
1. Immediate
immediate data is a part of instruction, and appears in
the form of successive byte(s).
ECEg - 4501 11
Addressing Modescntd AAiT
2. Direct
In the direct addressing mode, a 16-bit memory
address (offset) is directly specified in the instruction
as a part of it.
3. Register
In register addressing mode, the data is stored in a
register and it is referred using the particular register.
All the registers, except IP, may be used in this mode.
ECEg - 4501 13
Addressing Modescntd
AAiT
4. Register Indirect
Sometimes, the address of the memory location,
which contains data or operand, is determined in an
indirect way, using the offset registers.
the offset address of data is in either BX, SI or DI
registers. The default segment is either DS or ES.
5. Indexed
offset of the operand is stored in one of the index
registers. DS and ES are the default segments for index
registers SI and DI respectively.
This mode is a special case of the above discussed
register indirect addressing mode.
6. Register Relative
the data is available at an effective address formed by
adding an 8-bit or 16-bit displacement with the
content of any one of the registers.
BX, BP, SI and DI in the default segment (DS or ES).
ECEg - 4501 16
Addressing Modescntd
AAiT
7. Based Indexed
The effective address of data is formed by adding
content of a base register (BX or BP) to the content of
an index register (SI or DI).
The default segment register may be ES or DS.
ECEg - 4501 19
Addressing Modescntd AAiT
1. Intrasegment Direct
the address to which the control is to be transferred
appears directly in the instruction as an immediate
displacement value.
the displacement is computed relative to the content
of the instruction pointer IP.
ECEg - 4501 21
Addressing Modescntd
AAiT
1. Intrasegment Indirect
The displacement to which the control is to be
transferred is found as the content of a register or a
memory location.
ECEg - 4501 22
Addressing Modescntd AAiT
1. Intersegment direct
This addressing mode provides a means of branching
from one code segment to another code segment.
ECEg - 4501 23
Addressing Modescntd
AAiT
1. Intersegment Indirect
The control is transferred to the location whose address
may be referred using any of the addressing modes,
Except immediate mode.
Then, the new segment address is loaded to CS and the
offset is loaded to IP.
ECEg - 4501 24
8086 Instruction Set AAiT
ECEg - 4501 25
8086 Instruction set cntd AAiT
ECEg - 4501 26
8086 Instruction set cntd AAiT
ECEg - 4501 27
8086 Instruction set cntd AAiT
2. Arithmetic instructions
I. Addition Instructions:
ADD Add byte to byte or word to word
ADC Add byte + byte + carry or word + word + carry.
INC Increment specified byte or specified word by 1.
AAA ASCII adjust after addition.
DAA Decimal (BCD) adjust after addition.
II. Subtraction Instructions:
SUB Subtract byte from byte or word from word.
SBB Subtract with borrow
DEC Decrement specified byte or specified word by 1.
NEG Invert each bit of a specified byte or word and add 1
(form 2's complement).
ECEg - 4501 28
8086 Instruction set cntd AAiT
ECEg - 4501 29
8086 Instruction set cntd AAiT
ECEg - 4501 30
8086 Instruction set cntd AAiT
CF Byte/word
RCL
CF Byte/word
RCR
ECEg - 4501 31
8086 Instruction set cntd AAiT
4. String instructions
A string is a series of bytes or a series of words in sequential
memory locations. It often consists of ASCII character codes.
ECEg - 4501 31
8086 Instruction set cntd AAiT
ECEg - 4501 32
8086 Instruction set cntd AAiT
ECEg - 4501 34
8086 Instruction set cntd AAiT
ECEg - 4501 35
8086 Instruction set cntd AAiT
ECEg - 4501 36
8086 Instruction set cntd AAiT
ECEg - 4501 37
Summary AAiT
ECEg - 4501 38
Summary cntd
AAiT
ECEg - 4501 39
Summary cntd
AAiT
ECEg - 4501 40
Summary cntd
AAiT
ECEg - 4501 41
Summary cntd
AAiT
Intrasegment Intersegment
ECEg - 4501 42