The purpose of some instruction in 8086 microprocessor
The concept of the instructions in the 8086 microprocessor is a very scoring topic. And its a good choice to set a question in the coming semester in December. The question about the instruction of 8086 microprocessor, lets the examiner to test the deep knowledge and the ability of the students. That's why you will find a question based on the instructions of 8086 microprocessor in almost every sample papers of B.Tech. So one can prepare these type of questions here with solutions.
(i) LOOP : This instruction is used to repeat a series of instructions some number of times. The number of times the instruction sequence is to be repeated is loaded into CX. Each time loop executes CX is decremented by 1.
- If CX =/ 0 execution will jump to destination specified by label.
- IF CX = 0 execution will go to the next instruction after loop.
(ii) RET : It POPs a word (16 bit) from the top of the stack into the IP(near return) and places it in IP and CS or 32 bit number(far return) and places it in IP and CS. The execution starts where from it left the main program. Its object code is C3. The stack has 0003H = IP. CS = 1000H, the new address = 10000H = 0003H.
(iii) AAM : Numerical data coming into a computer from a terminal through keyboard is usually in ASCH code. The numbers 0 to 9 are represented by ASCH codes 30 H to 39 H.
Before multiplying two ASCH digits, the upper nibble bits of each need to be masked. This leaves unpacked CD in each byte. After the two unpacked BCD digits are multiplied, the AAM instruction is used to adjust the product of two upacked BCD digits in AX.
It works only on register AL.
It is used after multiplying the two unpacked BCD numbers.
(iv) MOVSB (Move string) : This instruction copies a byte or a word from a location in the data segment to a location in the extra segment.
The offset of the source byte/word in the DS must be SI register.
The offset of the destination in ES must be in DI register.
After byte or word is moved, SI and DI are automatically adjusted to point to the next source and next destination.