0% found this document useful (0 votes)
3K views22 pages

8086 Microprocesser Instructions

Microprocessors are integrated chips that can execute multiple programs. They contain processing units and some integrated memory. Microcontrollers are used for specific embedded system applications. Macro instructions introduced by programmers are converted to micro instructions that the machine can understand at a low level. The 8086 processor supports various instruction types like arithmetic, logical, shift, and flow control instructions. The MUL and IMUL instructions perform unsigned and signed multiplication respectively, storing results in register pairs. The DIV and IDIV instructions perform unsigned and signed division respectively.

Uploaded by

Saddam Hussain
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3K views22 pages

8086 Microprocesser Instructions

Microprocessors are integrated chips that can execute multiple programs. They contain processing units and some integrated memory. Microcontrollers are used for specific embedded system applications. Macro instructions introduced by programmers are converted to micro instructions that the machine can understand at a low level. The 8086 processor supports various instruction types like arithmetic, logical, shift, and flow control instructions. The MUL and IMUL instructions perform unsigned and signed multiplication respectively, storing results in register pairs. The DIV and IDIV instructions perform unsigned and signed division respectively.

Uploaded by

Saddam Hussain
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

Microprocessor Just an intro

o An Integrated chip with the multi programmable capability. o It is a general purpose chip with some integrated memory as well processing unit. o The normal computers have a microprocessor with some external central processing units. It is called microcomputer. o Speed of the microprocessor decided by the number of clock cycles passed for an instruction execution.

Microcontroller Just an intro


o The purpose of microcontroller is a specific. o Normally the embedded system applications developed by using microcontroller.

Macro instructions/ Micro instructions


o The macro instructions introduced to increase the flexibility of the programmer and to reduce the code size. o The macro instructions will be converted as micro instructions. That will only understandable by the machine. o The micro instructions will have the micro level operation with the control function. Such as register movement, fetch, memory read.

The Instructions type in 8086


o o o o o o o o o Arithmetic instructions (ADD, SUB, MUL, DIV) Logical Instructions (AND, OR, XOR) Register transfer instructions (MOV, XCHG) Shift instructions (SHL, SHR) Rotate Instructions (ROR, ROL, RCL, RCR) The Bit operation (TEST) I/O instructions (IN, OUT) String instructions (MOVS, LODS) Program flow control instructions (JMP, CALL, RET, HLT)

MUL (unsigned Multiplication)


o This MUL instruction used to multiply the unsigned number. o The Multiplication is manually can be done by repeated addition. Syntax : MUL operand Operand may be reg/mem : 8/16 for 8bit (byte multiplication) AX := AL*operand; AL is a silent operand opcode : F6 for 16bits operands (byte multiplication) AX :DX = AX*operand; AX is a silent operand opcode : F7
cntd..... cntd.....

The basic principle is, for n-bit multiplication the result range must exceed the limit of n-bits. So, 2*n bits allotted to store the result. Flags affected : CF ,OF
Operand 8-bit Reg 16-bit Reg 8-bit Mem 16-bit Mem Clock cycles 70 77 118 133 (76 83) + EA (124 139) + EA : Instruction size(bytes) 2 2 2-4 2-4

Instruction code format

1111011w mod100r/m

Example
MOV AL,100 MOV BL,10 SUB AH,AH MUL BL ;AX AL*BL AX 03 E8h(100010) ;opcode : F6 E3 ;11 100 011 --------------------------------------------------------------------------MOV AX,2048 MOV BX,90 MUL BX ;CF & OF flags set to 1 ; 184320 ; AL 00 AH D0 DL 02 DX 00 2^17=131072 AX=184320-131072=53248 (D0 00 h) ;opcode : F7 E3 ;11 100 011

IMUL (signed Multiplication)


o IMUL instruction used for the signed multiplication. o Syntax : IMUL operand Operand may be reg/mem : 8/16 for 8bit (byte multiplication) AX := AL*operand; AL is a silent operand opcode : F6 for 16 bits (Word multiplication) AX:DX = AX*operand ;AX is a silent operand opcode : F7

Flags affected : CF ,OF


Operand 8-bit Reg 16-bit Reg 8-bit Mem 16-bit Mem Clock cycles Instruction size(bytes) 2 2 2-4 2-4

80-98 128 154 (86 104) + EA (134 160) + EA

Instruction format :

1111011w mod101r/m

Example
MOV AL,-100 MOV BL,10 SUB AH,AH IMUL BL ;AX AL*BL AX F6 18h(-100010) ;MUL BL ; AX 06 18h(156010) ; Opcode : F6 EB ; 11 101 011 -------------------------------------------------------------------------------B DB 23H,-03H MOV AX,00E2H ;-30 MOV BX,OFFSET B MOV CL,[BX+1] IMUL BYTEPTR[BX+1] ;AX=AL*(-3); AX 5A ;(90) ;opcode : F6 6F 01 ;01 10 1 111

DIV (unsigned Division)


o DIV instruction performs the unsigned division. o The division may be done by repeated subtraction. Syntax : DIV operand; Operand may be reg/mem : 8/16

for 8bit (byte Manipulation) AL = AX / operand; AX is a silent operand AH = remainder (modulus) opcode : F6

for 16 bits (Word multiplication) AX = (DX AX) / operand; AX:DX is a silent operand DX = remainder (modulus) opcode : F7 AX must contain the dividend, DX be should be cleared before DIV instruction. Flags Affected : CF ,OF ,SF ,PF But the affection of the flags dont have any valid usage.

Operand 8-bit Reg 16-bit Reg 8-bit Mem 16-bit Mem Instruction format

Clock cycles

Instruction size(bytes) 2 2 2-4 2-4

80 - 90 144 - 162 (86 96) + EA (150 168) + EA :

1111011w mod110r/m

Example
MOV AL,100 MOV BL,11 SUB AH,AH DIV BL ;AL AX/BL AH AX%BL ;AL 09 h

AH 01 h

--------------------------------------------------------------------B DB 03H MOV AX,00E2H ;-30 DIV B ;opcode : F6 36 00 00 ; 00 110 110

IDIV (signed Division)


o IDIV instruction performs the signed division. o The sign of the remainder is always same as the sign of the dividend Syntax : IDIV operand; Operand may be reg/mem : 8/16 for 8bit (byte manipulation) AL = AX / operand; AX is a silent operand AH = remainder (modulus) opcode : F6

for 16 bits (Word multiplication) AX = (DX AX) / operand; AX:DX is a silent operand DX = remainder (modulus) opcode : F7 Flags Affected : CF ,OF ,SF ,PF Operand 8-bit Reg 16-bit Reg 8-bit Mem 16-bit Mem
Instruction code format :

Clock cycles

Instruction size(bytes) 2 2 2-4 2-4

101 112 165 184 (107 118) + EA (171 190) + EA

1111011w mod111r/m

Example
MOV BL,-10 ;DIVISOR MOV AX,101 ;DIVIDEND IDIV BL ; AH 01 AL F6(-1010) ;opcode : F6 FB ;11 111 011 ;DIV BL ; AH 65 AL 00 -----------------------------------------------------------------------------------B DB 23H,-03H MOV AX,00E2H ;-30 IDIV B ;opcode : F6 3E 00 00 ;00 11 1 110

Some extension
This is for MUL , IMUL, DIV, IDIV Instructions . Addressing mode Register Addressing mode Direct/register indirect/Based Index/Relative Based index Register relative mode bits 11 00 01

Can not use those . Immediate data

As Far our studies in i8086

Register Accumulator Register (AX) Count Register (CX) Data register (DX) Base Register (BX) Stack pointer (SP) Base pointer (BP) Source Index (SI) Destination index (DI)

The last 3 bits (m/r) 000 001 010 011 100 101 110 111

Bibliography
http://www.arl.wustl.edu/%7Elockwood/class/cs306/ books/artofasm/toc.html Intel 8086 Microprocessor Datasheet Richard C.Detmer, Essentials of 80x86 Assembly Language. Yu-Cheng Liu, Glenn A. Gibson, Microcomputer Systems : The 8086/8088 Family

You might also like