8086 Microprocesser Instructions
8086 Microprocesser Instructions
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.
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
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
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
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
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
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
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
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