Instruction Set of 80186:
Intel 80186 is the improved version of 8086, hence it has faster instruction execution time compared to the 8086 microprocessor. The 80186 processor is compatible with all instruction of 8086 microprocessors and a few new instructions are introduced with the 80186. The new instructions are ENTER/LEAVE which is used to replace several instructions when handling stack frames, PUSHA/POPA which is used for push/pop all general registers, BOUND which can check array index against bounds, INS/OUTS which is used for input/ output of string. A very useful immediate addressing mode instruction is also added for the push, imu1, and multi-bit shift instructions. The detailed operations of all new Instruction Set of 80186 are described below:
Data-Transfer Instruction Set of 80186
PUSHA This instruction is used to push the content of all registers onto the stack. Actually, it copies the content of AX, CX, DX, BX, SP, BP, SI, and DI onto the stack. The contents of the SP register are pushed before AX is pushed.
POPA This instruction can be used to pop the content of all registers from the stack. In fact, it pops DI, SI, BR, SP, BX, DX, CX, and AX from the stack. Usually, the popped SP value is discarded.
PUSH immediate This instruction can be used to push an immediate 16-hit number onto the stack. The example of PUSH immediate instruction is PUSH 4000H; Store 4000HH on stack immediately and decrement the SP by 2.
Arithmetic Instruction Set of 80186
IMUL This instruction is used for signed multiplication immediately. The common format of IMUL instruction is
IMUL Destination Register, Source, Immediate data.
This instruction has three operands. The first operand is the destination register. The second operand is the source of data which may be either the memory or the register. The third operand is the immediate data.
When the IMUL instruction is executed. the multiplication between the contents of the source operand and immediate data is performed, and the lower 16 bits of the final result will be stored in the destination register. But the upper 16 bits of the final result is ignored. The example of IMUL instruction is
IMUL BX, CX, 22; Multiply the content of CX register with 22H and result (lower 16-bits) is stored in BX register
SHIFT/ROTATE Destination, immediate data, Immediate data states number of bit shift.
INS This instruction is used to input a string byte or string word. The common format of INS instruction is INS Destination, Port.
Actually, it copies a byte using INSB or a word using INSW from I/O port to the destination memory. The port address is represented by DX and the contents of the port move to the memory location pointed by DI. After completion of data transfer, DI must be updated.
OUTS This instruction is used to output a string byte or string word. The common format of OUTS instruction is
OUTS Port, Source
Usually, this instruction copies a byte using OUTSB or word using OUTSW from a specified memory location pointed by SI to the specified I/O port. The port address is represented by the content of the DX register. After completion of data transfer, SI must be updated.
BOUND This instruction is used to detect values outside the predefined range. The Format of. BOUND instruction is
BOUND REG, SRC.
(REG) ← (SRC) and an interrupt of type 5 occurs. BOUND REG, SCR must point to 2 consecutive words in the memory.
ENTER This instruction is used to prepare the stack for procedure entry. The format of ENTER instruction is
ENTER SIZE, Level. The stepwise operation of this instruction is given below:
Step 1 Push the content of BP. Save SP to a register TEMP.
Step 2 When Level = 0, go to Step 8.
Step 3 If LEVEL – 1 = 0, go to Step 7.
Step 4 (BP) ← [(BP) – 2].
Step 5 Push to the stack pointed by BP.
Step 6 Level ← Level-1 and go to Step 3.
Step 7 Push TEMP.
Step 8 (BP) ← (TEMP).
Step 9 (SP) ← (SP) – SIZE.
(SP) ← (BP) and Pop stack into BP
In this instruction, SIZE is a non-negative integer less than 65. 536 and Level is a non-negative integer less than 256.