Professional Documents
Culture Documents
TO THE
INSTRUCTION SET OF
8088 MICROPROCESSOR
1 PNEC
Instruction Set of 8088 MP
8086/8088 M.Ps Instruction Set
Divided into following Categories;
i) Data Movement Instructions
ii) Arithmetic & Logic Instructions
iii) Shift & Rotate Instructions
iv) Program Transfer Instructions
v) String Instructions
2 PNEC
Instruction Set of 8088 MP
Examples:
XCHG Instructions
3 PNEC
Instruction Set of 8088 MP
Examples:
4 PNEC
Instruction Set of 8088 MP
Examples:
5 PNEC
Instruction Set of 8088 MP
Examples:
6 PNEC
Instruction Set of 8088 MP
String Instructions:
Examples:
7 PNEC
Instruction Set of 8088 MP
Description of some Data Movement Commands: MOV Command
8 PNEC
Instruction Set of 8088 MP
Description of some Data Movement Commands: OUT Command
i) In OUT command syntax is OUT Destination, Source
Example: OUT DX,AL
Here ‘Source’ of data is AL register and ‘Destination’ of data is
mentioned, in form of Address, in DX register.
On execution of this command data in AL ‘moves’ to the O/P
device whose address is present in DX register.
[Note: Data in AL is not moved into DX, rather copied and sent to
the output device whose address is mentioned in DX]
Remember in o/p operation Data must be kept in AL register and
Address of the device in DX register.
9 PNEC
Instruction Set of 8088 MP
Description of some Arithmetic Commands:
MUL Commands
i) In Multiply command for ‘Byte times Byte operation’ or simply ‘8 bit
Multiplication’, Multiplicand is to be kept in AL register and
multiplier in other 8 bit register or a memory location
Example: MUL BL; AL x BL=16 bit result goes in AX register
ii) For ‘Word times Word operation’ or simply 16 bit multiplication,
Multiplicand is kept in AX register and multiplier in other 16 bit
register or a memory locations
& 32 bit result goes in AX & DX register, with Higher 16 bits in DX &
lower 16 bits in AX Registers respectively
Example: MUL BX; AX x BX= 32 bit result goes in DX & AX
10 PNEC
Instruction Set of 8088 MP
Description
DIV commands:
In 8 bit division, Dividend is kept in AX register divider in other 8
bit register or a memory location. After division Quotient goes in
AL & Remainder goes in AH
Example: DIV BL; AX / BL => Quotient = AL, Remainder = AH
11 PNEC
Instruction Set of 8088 MP
Description
Logic Commands Examples:
AND AX, BX
OR CX, DX
NOT BH
XOR BL, DH
If AX = FFFFh, BX = 00AAh, i.e AX = 1111 1111 1111 1111
& BX = 0000 0000 1010 1010
and we run the command AND AX,BX, then after execution
=> AX = 0000 0000 1010 1010h & BX remains unchanged
12 PNEC
Instruction Set of 8088 MP
Logic Commands
Examples:
If AX = FFFFh, BX = 00AAh, i.e
AX = 1111 1111 1111 1111
BX = 0000 0000 1010 1010
XOR AH, BL
AH = 1111 1111
BL = 1010 1010
Þ AH = 0101 0101
Þ BL = 10101010 (unchanged)
13 PNEC
Instruction Set of 8088 MP
Logic Commands
Example:
BH = 0000 1111
NOT BH
=> BH = 11110000
14 PNEC
Instruction Set of 8088 MP
Shift Command
If CH = 00000001
SHL CH, 01
=> CH = 00000010
AL = 10000000
SHR AL,01
=> AL = 01000000
15 PNEC
Instruction Set of 8088 MP
Logic Commands
Examples:
Rotate Command
CH = 00000001
ROR CH, 01
=> CH = 10000000
AL = 10000000
ROL AL,01
=> AL = 00000001
16 PNEC
Instruction Set of 8088 MP
17 PNEC
Instruction Set of 8088 MP
18 PNEC
Instruction Set of 8088 MP
19 PNEC
Instruction Set of 8088 MP
Program Transfer Instructions:
Un Conditional JUMP Commands;
Example: JMP 0100h
In this command MP is asked to jump to the
mentioned memory location (eg address 0100h),
while doing this no condition is required to be
satisfied or tested. It is just an order for MP to ‘jump’
i.e to a particular memory location and fetch the next
instruction from it.
20 PNEC
Instruction Set of 8088 MP
Types of Unconditional jump commands;
i) Short Jump, ii) Near Jump and iii) Far Jump
Range of each type is +/- 128 Bytes, +/- 32KB, 64KB
respectively, from the location on which the jump command is
written
Short Jump is of 2 Bytes, one byte for the opcode and other for the
address,
Near jump is of 3 bytes, one for the opcode and two bytes for the
address,
Far jump is of 5 bytes, one for the opcode and four bytes for the
address
21 PNEC
Instruction Set of 8088 MP
Conditional JUMP Commands;
Examples: JS, JZ, JNZ, JP, JNP, JG, JL etc
In these commands MP is asked to jump to the
mentioned memory location (eg address 0100h),
while doing this, specified condition/status is required
to be satisfied. It is just an order for MP to ‘jump’ to a
particular memory location and fetch the next
instruction from it, if and only if condition is satisfied,
otherwise not.
22 PNEC
Instruction Set of 8088 MP
Conditional JUMP Commands;
Conditional Jump commands test the Flag bits of the Status/Flag
Register, like ZF, SF, OF, PF, CF etc,
If the condition under test is found to be true, only then jump
takes place.
Range of Conditional Jumps is +127 bytes ahead and -128 bytes
back from the location on which the jump command is written
Example: SUB AL,BL
JZ Address
In the above example if due to the Subtraction Zero Flag gets
Set, now when JZ command tests the ZF and finds it Set then
MP “jumps” to the specified address/location and fetches the
23 next command from it PNEC
Instruction Set of 8088 MP
Conditional JUMP Commands;
Example 1: SUB AL,BL
JZ Address
In the above example if due to Subtraction, Zero Flag gets Set,
now when JZ command tests the ZF and finds it Set then MP
“jumps” to the specified address/location and fetches the next
command from it
Example 2: ADD AH,DH
JC Address
In the above example if due to Addition, Carry Flag gets Set, now
when JC command tests the CF and finds it Set then MP “jumps”
to the specified address/location and fetches the next command
24 from it PNEC
Instruction Set of 8088 MP (Contd)
Conditional JUMP Commands: More Examples;
JL = Jump if Less
JG = Jump if Greater
JA = Jump if Above
JB = Jump if Below
JE = Jump if Equal
JAE = Jump if Above or Equal
JLE = Jump if Less or Equal
25 PNEC
Instruction Set of 8088 MP
String Instructions:
By ‘String’ we mean series of data on consecutive
memory locations
String commands are power full command which
allow the programmer to perform operations on large
blocks of data, present on consecutive locations.
Operations may include movement of data, scanning
of data, comparison of data etc.
Examples: MOVS, SCAS, CPMS etc
26 PNEC
the MOVS instruction is used to copy a
data item (byte, word or doubleword) from
the source string to the destination string.
The source string is pointed by DS:SI and
the destination string is pointed by ES:DI.
29 PNEC
Program Example 1
Task:
Write a program to turn ON LEDs and a speaker, connected with
an I.C. Keep program running.
30 PNEC
31 PNEC
32 PNEC
Program Example 2
Task:
Write a program to get data from an input device (having address
FF10h) and multiply it with a number 0Fh.
If the product is not greater than the number stored on memory
location 2000h then send it to the output device(having address
AA20h) and keep program running, other wise save it on memory
location 3000h and halt the program.
This program is an example of IN/OUT, Memory Read/Write and
Arithmetic operations.
33 PNEC
Program Example
Write comments for each command