You are on page 1of 29

INTRODUCTION

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

i) Data Movement Instructions;

Examples:

MOV, IN, OUT, PUSH, POP,

XCHG Instructions
3 PNEC
Instruction Set of 8088 MP

ii) Arithmetic & Logic Instructions

Examples:

Arithmetic Instructions: ADD, SUB, MUL, DIV etc

Logic Instructions: AND, OR, XOR, NOT etc

4 PNEC
Instruction Set of 8088 MP

 Shift & Rotate Instructions

Examples:

Shift Instructions: SHL, SHR

Rotate Instructions: ROL, ROR etc

5 PNEC
Instruction Set of 8088 MP

Program Transfer Instructions:

Examples:

Call & Return, Jump Instructions

6 PNEC
Instruction Set of 8088 MP

 String Instructions:

Examples:

MOVS, SCAS, CMPS etc

7 PNEC
Instruction Set of 8088 MP
Description of some Data Movement Commands: MOV Command

i) In MOV command syntax is Move Destination, Source


Example: MOV AH,BL
Here ‘Source’ of data is BL register and ‘Destination’ of data is AH
register.
On execution of this command data in BL ‘moves’ into AH register.
[Note: In actual data is not moved rather copied and pasted in AH]
In this command Source and Destination can be registers,
memory locations(but not two locations in same command) and
some number (but not two numbers in same 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’, Multiplicand is
to be kept in AL register and multiplier in other 8 bit register
Example: MUL BL; AL x BL=16 bit result goes in AX register

ii) For ‘Word times Word operation’ Multiplicand is kept in AX register


& 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:
Here Dividend is kept in AX register. After division Quotient goes in
AL & Remainder goes in AH
Example: DIV BL; AX / BL => Quotient = AL, Remainder = AH

Example: DIV CX; DX & AX / CX => Qtnt = AX, Rmdr = DX

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 => AX = 0000 0000 1010 1010h

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

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

Some more Arithmetic Instructions


INC & DEC
INC: Increment ; It increments the contents of a register
by 1
DEC: Decrement ; It decrements the contents of a
register by 1
Examples: INC CX; Increment the contents of CX by 1,
so if earlier CX = 0025h now CX = 0026h
And if DEC CX now CX = 0024h

17 PNEC
Instruction Set of 8088 MP

Program Transfer Instructions:


CALL & RET Commands
This is a pair of commands. These commands are
used for a ‘Subroutine’. When in a program, user
needs to access or execute a subroutine, CALL
command is used.
And RET command is written as the last command
of a subroutine to return or go back to the main
program

18 PNEC
Instruction Set of 8088 MP

 Program Transfer Instructions:


 JUMP Commands;
 These commands are divided into two broad
categories;
i) Conditional Jump commands &
ii) Un Conditional Jump commands

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 conditioned 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 fond 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
 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

25 PNEC
Instruction Set of 8088 MP

String Instructions:
In the following set of commands, a block of
data is moved from DS to ES
Examples:
CLD
MOV DI, 2500
MOV SI, 3500
MOV CX, 0100
REP MOVSB
26 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

27 PNEC
Program Example
 Task:
Write a program to get data from an input device (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(address AA20h),
other wise save it on memory location 3000h.
Keep program running.
This program is an example of IN/OUT & Memory Read/Write
operations.

28 PNEC
Program Example
Write comments for each command

MOV DX,FF10 ; Loading the address of the I/P device


IN AL,DX ; Taking the data from the I/P device into the AL
MOV BH,0F ; Loading the given no. in a register
MUL BH ; Multiplying the data with the given no.
MOV BL,[2000h] ; Getting data from memory location into BL rgstr
CMP AL,BL ; Comparing the data from i/p with the data of mem
JLE 1234 ; Jumping to the given address if the data is less/eq
MOV [3000],AL ; Saving the greater data on memory location
JMP 0000 ; Jump to the start/continue the program
1234: MOV DX,AA20h ; Loading the address of the O/P device
OUT DX,AL ; Sending data out to the o/p device
JMP 0000 ; Jump to the start/continue the program

29 PNEC

You might also like