Chapter 4 MP
Chapter 4 MP
INSTRUCTIONS
Instructions
The 8086 microprocessor supports 8 types of instructions −
• Data Transfer Instructions
• Arithmetic Instructions
• Bit Manipulation Instructions
• String Instructions
• Program Execution Transfer Instructions (Branch & Loop Instructions)
• Processor Control Instructions
• Iteration Control Instructions
• Interrupt Instructions
Data Transfer Instructions
• These instructions are used to transfer the data from the source operand to the
destination operand. Following are the list of instructions under this group −
Instruction to transfer a word
• MOV − Used to copy the byte or word from the provided source to the provided
destination.
• PPUSH − Used to put a word at the top of the stack.
• POP − Used to get a word from the top of the stack to the provided location.
• PUSHA − Used to put all the registers into the stack.
• POPA − Used to get words from the stack to all registers.
• XCHG − Used to exchange the data from two locations.
• XLAT − Used to translate a byte in AL using a table in the memory.
…cont’d
• These instructions are used to execute the given instructions for number of
times.
Following is the list of instructions under this group −
• LOOP − Used to loop a group of instructions until the condition satisfies,
i.e., CX = 0
• LOOPE/LOOPZ − Used to loop a group of instructions till it satisfies ZF = 1 &
CX = 0
• LOOPNE/LOOPNZ − Used to loop a group of instructions till it satisfies ZF =
0 & CX = 0
• JCXZ − Used to jump to the provided address if CX = 0
Interrupt Instructions
These instructions are used to call the interrupt during program execution.
• INT − Used to interrupt the program during execution and calling service
specified.
• INTO − Used to interrupt the program during execution if OF = 1
• IRET − Used to return from interrupt service to the main program
Data Movement Instruction
Notes:
• PUSH and POP work with 16 bit values only!
• PUSH immediate works only on 80186 CPU and later!
…cont’d
• The stack uses LIFO (Last In First Out) algorithm, this means that if we push
these values one by one into the stack: 1, 2, 3, 4, 5 the first value that we will
get on pop will be 5, then 4, 3, 2, and only then 1.
Another use of the stack is for exchanging the values, here is an example:
Load-Effective Address
• The lea (load effective address) instruction is used to put a memory address
into the destination.
• Examples
• lea eax, [ebx+8] :-Put [ebx+8] into EAX. After this instruction, EAX will
equal 0x00403A48
•.
Based on Functionality
• String is a series of data byte or word available in memory at consecutive
locations.
• It is either referred as byte string or word string.
• Their memory is always allocated in a sequential order.
• Instructions used to manipulate strings are called string manipulation
instructions.
• The String Instruction in 8086 are namely,
…cont’d
Arithmetic and Logic instructions
• Logical Instructions
a) AND: Logical AND
• Atleast one of the operant should be a register or a memory operant both
the operant cannot be a memory location or immediate operant.
b) OR: logical OR
• Both inputs are low in this case
…cont’d
c) NOT: logical invert