80x86 instruction set
TRANSCRIPT
-
8/11/2019 80x86 Instruction Set
1/50
The 8086 / 80286 / 80386 / 80486 InstructionSet
This HTML version of the file intel.doc from the PC Game Programmer's guide was produced byZack Smith, [email protected]. Fancy HTML modifications are copyright 2005 by Zack T Smith,all rights reserved. This information is provided in the hope that it will be useful, but without anywarranty; it is provided AS-IS, without even the implied warranty of fitness for a particular purpose.
Instructions
AAA - Ascii Adjust for AdditionUsage: AAAModi f i es f l ags: AF CF (OF, PF, SF, ZF undef i ned)
Changes cont ent s of AL t o val i d unpacked deci mal . The hi gh orderni bbl e i s zer oed.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 8 3 4 3 1
AAD - Ascii Adjust for DivisionUsage: AADModi f i es f l ags: SF ZF PF ( AF, CF, OF undef i ned)
Used bef ore di vi di ng unpacked deci mal numbers. Mul t i pl i es AH by10 and t he adds r esul t i nt o AL. Set s AH t o zer o. Thi s i nst r uct i oni s al so known t o have an undocument ed behavi or .
AL : = 10*AH+ALAH : = 0
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 60 14 19 14 2
AAM - Ascii Adjust for Multiplication
Usage: AAM Modi f i es f l ags: PF SF ZF ( AF, CF, OF undef i ned)
AH : = AL / 10AL : = AL mod 10
Used af t er mul t i pl i cat i on of t wo unpacked deci mal numbers , t hi si nst r uct i on adj ust s an unpacked deci mal number. The hi gh orderni bbl e of each byte must be zer oed bef or e usi ng t hi s i nst r uct i on.Thi s i nst r uct i on i s al so known t o have an undocumented behavi or .
Cl ocks Si zeOperands 808x 286 386 486 Byt es
-
8/11/2019 80x86 Instruction Set
2/50
none 83 16 17 15 2
AAS - Ascii Adjust for SubtractionUsage: AASModi f i es f l ags: AF CF (OF, PF, SF, ZF undef i ned)
Cor r ect s r esul t of a pr evi ous unpacked deci mal subt r act i on i n AL.Hi gh or der ni bbl e i s zer oed.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 8 3 4 3 1
ADC - Add With CarryUsage: ADC dest , sr cModi f i es f l ags: AF CF OF SF PF ZF
Sums t wo bi nar y oper ands pl aci ng the resul t i n t he dest i nat i on.I f CF i s set , a 1 i s added t o t he dest i nat i on.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, r eg 3 2 2 1 2mem, r eg 16+EA 7 7 3 2- 4 ( W88=24+EA)r eg, mem 9+EA 7 6 2 2- 4 ( W88=13+EA)r eg, i mmed 4 3 2 1 3- 4mem, i mmed 17+EA 7 7 3 3- 6 ( W88=23+EA)accum, i mmed 4 3 2 1 2- 3
ADD - Arithmetic AdditionUsage: ADD dest , sr cModi f i es f l ags: AF CF OF PF SF ZF
Adds "sr c" t o "dest " and r epl aci ng t he or i gi nal cont ent s of "dest ".Bot h operands ar e bi nary.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, r eg 3 2 2 1 2mem, r eg 16+EA 7 7 3 2- 4 ( W88=24+EA)r eg, mem 9+EA 7 6 2 2- 4 ( W88=13+EA)r eg, i mmed 4 3 2 1 3- 4mem, i mmed 17+EA 7 7 3 3- 6 ( W88=23+EA)accum, i mmed 4 3 2 1 2- 3
AND - Logical AndUsage: AND dest , sr cModi f i es f l ags: CF OF PF SF ZF ( AF undef i ned)
Per f or ms a l ogi cal AND of t he two operands r epl aci ng t he dest i nat i onwi t h t he r esul t .
-
8/11/2019 80x86 Instruction Set
3/50
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, r eg 3 2 2 1 2mem, r eg 16+EA 7 7 3 2- 4 ( W88=24+EA)r eg, mem 9+EA 7 6 1 2- 4 ( W88=13+EA)r eg, i mmed 4 3 2 1 3- 4mem, i mmed 17+EA 7 7 3 3- 6 ( W88=23+EA)
accum, i mmed 4 3 2 1 2- 3
ARPL - Adjusted Requested Privilege Level of Selector (286+ PM)Usage: ARPL dest , sr c( 286+ prot ect ed mode)Modi f i es f l ags: ZF
Compar es the RPL bi t s of "dest " agai nst " sr c". I f t he RPL bi t sof "dest " are l ess t han "sr c", t he dest i nat i on RPL bi t s ar e setequal t o t he sour ce RPL bi t s and t he Zero Fl ag i s set . Ot herwi se
t he Zer o Fl ag i s cl ear ed.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, r eg - 10 20 9 2mem, r eg - 11 21 9 4
-
8/11/2019 80x86 Instruction Set
4/50
Instructions
BOUND - Array Index Bound Check (80188+)Usage: BOUND sr c, l i mi tModi f i es f l ags: None
Ar r ay i ndex i n sour ce r egi st er i s checked agai nst upper and l owerbounds i n memor y sour ce. The f i r st wor d l ocat ed at "l i mi t " i st he l ower boundary and t he word at " l i mi t +2" i s t he upper arr ay bound.I nt er r upt 5 occur s i f t he sour ce val ue i s l ess t han or hi gher t hant he sour ce.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg16, mem32 - nj =13 nj =10 7 2r eg32, mem64 - nj =13 nj =10 7 2
- nj = no j ump taken
BSF - Bit Scan Forward (386+)Usage: BSF dest , sr cModi f i es f l ags: ZF
Scans sour ce oper and f or f i r st bi t set . Set s ZF i f a bi t i s f oundset and l oads t he dest i nat i on wi t h an i ndex t o f i r st set bi t . Cl ear sZF i s no bi t s ar e f ound set . BSF scans f or war d acr oss bi t pat t er n( 0- n) whi l e BSR scans i n r ever se ( n- 0) .
Cl ocks Si ze
Operands 808x 286 386 486 Byt es
r eg, r eg - - 10+3n 6- 42 3r eg, mem - - 10+3n 7- 43 3- 7r eg32, r eg32 - - 10+3n 6- 42 3- 7r eg32, mem32 - - 10+3n 7- 43 3- 7
BSR - Bit Scan Reverse (386+)Usage: BSR dest , sr cModi f i es f l ags: ZF
Scans sour ce oper and f or f i r st bi t set . Set s ZF i f a bi t i s f oundset and l oads t he dest i nat i on wi t h an i ndex t o f i r st set bi t . Cl ear sZF i s no bi t s ar e f ound set . BSF scans f or war d acr oss bi t pat t er n( 0- n) whi l e BSR scans i n r ever se ( n- 0) .
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, r eg - - 10+3n 6- 103 3r eg, mem - - 10+3n 7- 104 3- 7r eg32, r eg32 - - 10+3n 6- 103 3- 7r eg32, mem32 - - 10+3n 7- 104 3- 7
-
8/11/2019 80x86 Instruction Set
5/50
BSWAP - Byte Swap (486+)Usage: BSWAP r eg32Modi f i es f l ags: none
Changes t he byte or der of a 32 bi t r egi st er f r om bi g endi an t ol i t t l e endi an or vi ce ver sa. Resul t l ef t i n desti nat i on r egi steri s undef i ned i f t he oper and i s a 16 bi t r egi st er .
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg32 - - - 1 2
BT - Bit Test (386+)Usage: BT dest , sr cModi f i es f l ags: CF
The dest i nat i on bi t i ndexed by t he sour ce val ue i s copi ed i nt o t heCar r y Fl ag.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg16, i mmed8 - - 3 3 4- 8mem16, i mmed8 - - 6 6 4- 8r eg16, r eg16 - - 3 3 3- 7mem16, r eg16 - - 12 12 3- 7
BTC - Bit Test with Compliment (386+)Usage: BTC dest , sr cModi f i es f l ags: CF
The dest i nat i on bi t i ndexed by t he sour ce val ue i s copi ed i nt o t heCar r y Fl ag af t er bei ng compl i ment ed ( i nver t ed) .
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg16, i mmed8 - - 6 6 4- 8mem16, i mmed8 - - 8 8 4- 8r eg16, r eg16 - - 6 6 3- 7mem16, r eg16 - - 13 13 3- 7
BTR - Bit Test with Reset (386+)Usage: BTR dest , sr cModi f i es f l ags: CF
The dest i nat i on bi t i ndexed by t he sour ce val ue i s copi ed i nt o t heCar r y Fl ag and t hen cl ear ed i n t he dest i nat i on.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg16, i mmed8 - - 6 6 4- 8mem16, i mmed8 - - 8 8 4- 8
r eg16, r eg16 - - 6 6 3- 7mem16, r eg16 - - 13 13 3- 7
-
8/11/2019 80x86 Instruction Set
6/50
BTS - Bit Test and Set (386+)Usage: BTS dest , sr cModi f i es f l ags: CF
The dest i nat i on bi t i ndexed by t he sour ce val ue i s copi ed i nt o t heCar r y Fl ag and t hen set i n t he dest i nat i on.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg16, i mmed8 - - 6 6 4- 8mem16, i mmed8 - - 8 8 4- 8r eg16, r eg16 - - 6 6 3- 7mem16, r eg16 - - 13 13 3- 7
-
8/11/2019 80x86 Instruction Set
7/50
C Instructions
CALL - Procedure CallUsage: CALL dest i nat i onModi f i es f l ags: None
Pushes I nst r uct i on Poi nt er ( and Code Segment f or f ar cal l s) ont ost ack and l oads I nst r uct i on Poi nt er wi t h the addr ess of pr oc- name.Code cont i nues wi t h execut i on at CS: I P.
Cl ocksOper ands 808x 286 386 486
r el 16 ( near , I P r el at i ve) 19 7 7+m 3r el 32 ( near , I P r el at i ve) - - 7+m 3
r eg16 ( near , r egi st er i ndi r ect ) 16 7 7+m 5r eg32 ( near , r egi st er i ndi r ect) - - 7+m 5
mem16 ( near , memory i ndi r ect ) - 21+EA 11 10+m 5
mem32 ( near , memory i ndi r ect ) - - 10+m 5
pt r 16: 16 ( f ar , f ul l pt r suppl i ed) 28 13 17+m 18pt r 16: 32 ( f ar , f ul l pt r suppl i ed) - - 17+m 18pt r 16: 16 ( f ar , pt r suppl i ed, pr ot . mode) - 26 34+m 20pt r 16: 32 ( f ar , pt r suppl i ed, pr ot . mode) - - 34+m 20m16: 16 ( f ar , i ndi r ect ) 37+EA 16 22+m 17m16: 32 ( f ar , i ndi r ect ) - - 22+m 17m16: 16 ( f ar, i ndi r ect , pr ot . mode) - 29 38+m 20m16: 32 ( f ar , i ndi r ect , pr ot . mode) - - 38+m 20
ptr 16: 16 ( t ask, vi a TSS or t ask gat e) - 177 TS 37+TSm16: 16 ( t ask, vi a TSS or t ask gat e) - 180/ 185 5+TS 37+TS
m16: 32 ( t ask) - - TS 37+TSm16: 32 ( t ask) - - 5+TS 37+TS
pt r 16: 16 ( gate, same pr i vi l ege) - 41 52+m 35pt r 16: 32 ( gat e, same pr i vi l ege) - - 52+m 35m16: 16 ( gate, same pri vi l ege) - 44 56+m 35m16: 32 ( gate, same pri vi l ege) - - 56+m 35
ptr 16: 16 ( gate, more pri v, no par m) - 82 86+m 69pt r 16: 32 ( gate, more pr i v, no par m) - - 86+m 69m16: 16 ( gat e, more pr i v, no par m) - 83 90+m 69m16: 32 ( gat e, more pr i v, no par m) - - 90+m 69
pt r 16: 16 ( gat e, more pr i v, x par ms) - 86+4x 94+4x+m 77+4xpt r 16: 32 ( gat e, more pr i v, x par ms) - - 94+4x+m 77+4xm16: 16 ( gate, mor e pr i v, x parms) - 90+4x 98+4x+m 77+4xm16: 32 ( gat e, more pr i v, x par ms) - - 98+4x+m 77+4x
CBW - Convert Byte to WordUsage: CBW
Modi f i es f l ags: None
Conver t s byte i n AL t o word Val ue i n AX by ext endi ng si gn of AL
t hr oughout r egi st er AH.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
-
8/11/2019 80x86 Instruction Set
8/50
none 2 2 3 3 1
CDQ - Convert Double to Quad (386+)Usage: CDQ
Modi f i es f l ags: None
Conver t s si gned DWORD i n EAX to a si gned quad wor d i n EDX: EAX byext endi ng t he hi gh or der bi t of EAX t hr oughout EDX
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none - - 2 3 1
CLC - Clear CarryUsage: CLCModi f i es f l ags: CF
Cl ear s t he Car r y Fl ag.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 2 2 2 2 1
CLD - Clear Direction FlagUsage: CLD
Modi f i es f l ags: DF
Cl ear s t he Di r ect i on Fl ag causi ng st r i ng i nst r uct i ons t o i ncrementt he SI and DI i ndex regi st er s.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 2 2 2 2 1
CLI - Clear Interrupt Flag (disable)Usage: CLIModi f i es f l ags: I F
Di sabl es t he maskabl e har dwar e i nt er r upt s by cl ear i ng t he I nt er r uptf l ag. NMI ' s and sof t war e i nt er r upt s ar e not i nhi bi t ed.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 2 2 3 5 1
CLTS - Clear Task Switched Flag (286+ privileged)Usage: CLTSModi f i es f l ags: None
-
8/11/2019 80x86 Instruction Set
9/50
Cl ear s t he Task Swi t ched Fl ag i n t he Machi ne St atus Regi st er . Thi si s a pr i vi l eged oper at i on and i s gener al l y used onl y by oper at i ngsyst em code.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none - 2 5 7 2
CMC - Complement Carry FlagUsage: CMCModi f i es f l ags: CF
Toggl es ( i nver t s) t he Car r y Fl ag
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 2 2 2 2 1
CMP - CompareUsage: CMP dest , sr cModi f i es f l ags: AF CF OF PF SF ZF
Subt r act s sour ce f r om dest i nat i on and updat es t he f l ags but doesnot save r esul t . Fl ags can subsequent l y be checked f or condi t i ons.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, r eg 3 2 2 1 2
mem, r eg 9+EA 7 5 2 2- 4 ( W88=13+EA)r eg, mem 9+EA 6 6 2 2- 4 ( W88=13+EA)r eg, i mmed 4 3 2 1 3- 4mem, i mmed 10+EA 6 5 2 3- 6 ( W88=14+EA)accum, i mmed 4 3 2 1 2- 3
CMPS - Compare String (Byte, Word or Doubleword)Usage: CMPS dest , sr c
CMPSBCMPSW
CMPSD ( 386+)Modi f i es f l ags: AF CF OF PF SF ZF
Subt r act s dest i nat i on val ue f r om sour ce wi t hout savi ng r esul t s.Updat es f l ags based on t he subt r act i on and t he i ndex r egi st er s( E)SI and ( E) DI are i ncrement ed or decr ement ed dependi ng on t hest ate of t he Di r ect i on Fl ag. CMPSB i nc/ decr ement s t he i ndexr egi st ers by 1, CMPSW i nc/ decr ement s by 2, whi l e CMPSD i ncr ement sor decrement s by 4. The REP pref i xes can be used t o processent i r e dat a i t ems.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
dest , sr c 22 8 10 8 1 ( W88=30)
-
8/11/2019 80x86 Instruction Set
10/50
CMPXCHG - Compare and ExchangeUsage: CMPXCHG dest , sr c ( 486+)Modi f i es f l ags: AF CF OF PF SF ZF
Compar es t he accumul at or ( 8- 32 bi t s) wi t h "dest ". I f equal t he"dest " i s l oaded wi t h "s r c", ot her wi se t he accumul at or i s l oadedwi t h "dest ".
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, r eg - - - 6 2mem, r eg - - - 7 2
- add 3 cl ocks i f t he "mem, r eg" compar i son f ai l s
CWD - Convert Word to DoublewordUsage: CWD
Modi f i es f l ags: None
Extends si gn of word i n r egi st er AX t hr oughout r egi st er DX f or mi nga doubl eword quant i t y i n DX: AX.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 5 2 2 3 1
CWDE - Convert Word to Extended Doubleword (386+)Usage: CWDEModi f i es f l ags: None
Conver t s a s i gned word i n AX t o a si gned doubl eword i n EAX byext endi ng the si gn bi t of AX t hr oughout EAX.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none - - 3 3 1
-
8/11/2019 80x86 Instruction Set
11/50
Instructions
DAA - Decimal Adjust for AdditionUsage: DAAModi f i es f l ags: AF CF PF SF ZF ( OF undef i ned)
Cor r ect s r esul t ( i n AL) of a pr evi ous BCD addi t i on oper at i on.Cont ent s of AL ar e changed t o a pai r of packed deci mal di gi t s.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 4 3 4 2 1
DAS - Decimal Adjust for SubtractionUsage: DASModi f i es f l ags: AF CF PF SF ZF ( OF undef i ned)
Cor r ect s r esul t ( i n AL) of a pr evi ous BCD subt r act i on oper at i on.Cont ent s of AL ar e changed t o a pai r of packed deci mal di gi t s.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 4 3 4 2 1
DEC - DecrementUsage: DEC destModi f i es f l ags: AF OF PF SF ZF
Unsi gned bi nar y subt r act i on of one f r om t he dest i nat i on.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 3 2 2 1 2mem 15+EA 7 6 3 2- 4r eg16/ 32 3 2 2 1 1
DIV - DivideUsage: DI V sr cModi f i es f l ags: ( AF, CF, OF, PF, SF, ZF undef i ned)
Unsi gned bi nar y di vi si on of accumul at or by sour ce. I f t he sour cedi vi sor i s a byte val ue t hen AX i s di vi ded by "sr c" and t he quot i enti s pl aced i n AL and t he r emai nder i n AH. I f sour ce operand i s a wor dval ue, t hen DX: AX i s di vi ded by "sr c" and t he quot i ent i s st or ed i n AXand the r emai nder i n DX.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 80- 90 14 14 16 2r eg16 144- 162 22 22 24 2r eg32 - - 38 40 2mem8 ( 86- 96) +EA 17 17 16 2- 4
-
8/11/2019 80x86 Instruction Set
12/50
mem16 ( 150- 168) +EA 25 25 24 2- 4 ( W88=158- 176+EA)mem32 - - 41 40 2- 4
-
8/11/2019 80x86 Instruction Set
13/50
Instructions
ENTER - Make Stack Frame (80188+)Usage: ENTER l ocal s, l evelModi f i es f l ags: None
Modi f i es st ack f or ent r y t o pr ocedur e f or hi gh l evel l anguage.Operand " l ocal s" speci f i es t he amount of st or age t o be al l ocat edon t he st ack. "Level " speci f i es t he nest i ng l evel of t he r out i ne.Pai r ed wi t h t he LEAVE i nst r uct i on, t hi s i s an ef f i ci ent met hod ofent r y and exi t t o pr ocedur es.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
i mmed16, 0 - 11 10 14 4i mmed16, 1 - 15 12 17 4i mmed16, i mmed8 - 12+4( n- 1) 15+4( n- 1) 17+3n 4
ESC - EscapeUsage: ESC i mmed, sr cModi f i es f l ags: None
Provi des access t o t he dat a bus f or ot her r esi dent pr ocessor s.The CPU t r eat s i t as a NOP but pl aces memor y oper and on bus.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
i mmed, r eg 2 9- 20 ? 2
i mmed, mem 2 9- 20 ? 2- 4
-
8/11/2019 80x86 Instruction Set
14/50
Instructions
HLT - Halt CPU
Usage: HLTModi f i es f l ags: None
Hal t s CPU unt i l RESET l i ne i s act i vat ed, NMI or maskabl e i nt er r uptr ecei ved. The CPU becomes dormant but r etai ns t he curr ent CS: I Pf or l ater restart .
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 2 2 5 4 1
-
8/11/2019 80x86 Instruction Set
15/50
Instructions
IDIV - Signed Integer DivisionUsage: I DI V sr cModi f i es f l ags: ( AF, CF, OF, PF, SF, ZF undef i ned)
Si gned bi nar y di vi si on of accumul at or by sour ce. I f sour ce i s abyte val ue, AX i s di vi ded by "s r c" and t he quot i ent i s st or ed i nAL and t he r emai nder i n AH. I f sour ce i s a wor d val ue, DX: AX i sdi vi ded by "sr c", and t he quot i ent i s st or ed i n AL and t her emai nder i n DX.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 101- 112 17 19 19 2r eg16 165- 184 25 27 27 2r eg32 - - 43 43 2mem8 ( 107- 118) +EA 20 22 20 2- 4mem16 ( 171- 190) +EA 38 30 28 2- 4 ( W88=175- 194)mem32 - - 46 44 2- 4
IMUL - Signed MultiplyUsage: I MUL sr c
I MUL sr c, i mmed ( 286+)I MUL dest , sr c, i mmed8 ( 286+)I MUL dest , sr c ( 386+)
Modi f i es f l ags: CF OF (AF, PF, SF, ZF undef i ned)
Si gned mul t i pl i cat i on of accumul at or by "sr c" wi t h resul t pl acedi n t he accumul at or . I f t he sour ce oper and i s a byte val ue, i ti s mul t i pl i ed by AL and t he r esul t st or ed i n AX. I f t he sour ceoper and i s a wor d val ue i t i s mul t i pl i ed by AX and t he r esul t i s
st or ed i n DX: AX. Ot her var i at i ons of t hi s i nst r uct i on al l owspeci f i cat i on of sour ce and dest i nat i on r egi st er s as wel l as at hi r d i mmedi at e f act or .
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 80- 98 13 9- 14 13- 18 2r eg16 128- 154 21 9- 22 13- 26 2r eg32 - - 9- 38 12- 42 2mem8 86- 104 16 12- 17 13- 18 2- 4mem16 134- 160 24 12- 25 13- 26 2- 4mem32 - - 12- 41 13- 42 2- 4
r eg16, r eg16 - - 9- 22 13- 26 3- 5r eg32, r eg32 - - 9- 38 13- 42 3- 5r eg16, mem16 - - 12- 25 13- 26 3- 5r eg32, mem32 - - 12- 41 13- 42 3- 5r eg16, i mmed - 21 9- 22 13- 26 3r eg32, i mmed - 21 9- 38 13- 42 3- 6r eg16, r eg16, i mmed - 2 9- 22 13- 26 3- 6r eg32, r eg32, i mmed - 21 9- 38 13- 42 3- 6r eg16, mem16, i mmed - 24 12- 25 13- 26 3- 6r eg32, mem32, i mmed - 24 12- 41 13- 42 3- 6
IN - Input Byte or Word From PortUsage: I N accum, por tModi f i es f l ags: None
-
8/11/2019 80x86 Instruction Set
16/50
A byte, word or dwor d i s r ead f r om"por t " and pl aced i n AL, AX orEAX r espect i vel y. I f t he por t number i s i n t he r ange of 0- 255i t can be speci f i ed as an i mmedi ate, otherwi se t he por t numbermust be speci f i ed i n DX. Val i d port r anges on t he PC are 0- 1024,t hough val ues t hrough 65535 may be speci f i ed and r ecogni zed byt hi r d par t y vendor s and PS/ 2' s.
Cl ocks Si ze
Operands 808x 286 386 486 Byt es
accum, i mmed8 10/ 14 5 12 14 2accum, i mmed8 ( PM) 6/ 26 8/ 28/ 27 2accum, DX 8/ 12 5 13 14 1accum, DX ( PM) 7/ 27 8/ 28/ 27 1
- 386+ protected mode t i mi ngs depend on pr i vi l ege l evel s.
f i r st number i s t he t i mi ng i f : CPL I OPLsecond number i s t he t i mi ng i f : CPL > I OPL or i n VM 86 mode ( 386)
CPL I OPL ( 486)t hi r d number i s t he t i mi ng when: vi r t ual mode on 486 pr ocessor
- 486 vi r t ual mode al ways r equi r es 27 cycl es
INC - IncrementUsage: I NC destModi f i es f l ags: AF OF PF SF ZF
Adds one t o dest i nat i on unsi gned bi nary operand.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 3 2 2 1 2
r eg16 3 2 2 1 1r eg32 3 2 2 1 1mem 15+EA 7 6 3 2- 4 ( W88=23+EA)
INS - Input String from Port (80188+)Usage: I NS dest , por t
I NSBI NSW
I NSD ( 386+)Modi f i es f l ags: None
Loads dat a f r om por t t o t he dest i nat i on ES: ( E) DI ( even i f adest i nat i on oper and i s suppl i ed) . ( E) DI i s adj ust ed by t he si zeof t he oper and and i ncr eased i f t he Di r ect i on Fl ag i s cl ear ed anddecr eased i f t he Di r ect i on Fl ag i s set . For I NSB, I NSW, I NSD nooperands are al l owed and the si ze i s determi ned by t he mnemoni c.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
dest , por t - 5 15 17 1dest , por t ( PM) - 5 9/ 29 10/ 32/ 30 1none - 5 15 17 1none ( PM) - 5 9/ 29 10/ 32/ 30 1
- 386+ protected mode t i mi ngs depend on pr i vi l ege l evel s.
f i r st number i s t he t i mi ng i f : CPL I OPL
-
8/11/2019 80x86 Instruction Set
17/50
second number i s t he t i mi ng i f : CPL > I OPLt hi r d number i s t he t i mi ng i f : vi r t ual mode on 486 pr ocessor
INT - InterruptUsage: I NT num
Modi f i es f l ags: TF I F
I ni t i at es a sof t war e i nt er r upt by pushi ng t he f l ags, cl ear i ng t heTr ap and I nt er r upt Fl ags, pushi ng CS f ol l owed by I P and l oadi ngCS: I P wi t h t he val ue f ound i n t he i nt er r upt vect or t abl e. Execut i ont hen begi ns at t he l ocat i on addressed by t he new CS: I P
Cl ocks Si zeOper ands 808x 286 386 486 Byt es
3 ( const ant ) 52/ 72 23+m 33 26 23 ( prot . mode, same pr i v. ) - 40+m 59 44 23 ( prot . mode, more pr i v. ) - 78+m 99 71 2
3 ( f r om VM86 t o PL 0) - - 119 82 23 ( prot . mode vi a t ask gat e) - 167+m TS 37+TS 2i mmed8 51/ 71 23+m 37 30 1i mmed8 ( prot . mode, same pr i v. ) - 40+m 59 44 1i mmed8 ( prot . mode, more pr i v. ) - 78+m 99 71 1i mmed8 ( f r om VM86 t o PL 0) - - 119 86 1i mmed8 ( prot . mode, vi a t ask gat e) - 167+m TS 37+TS 1
INTO - Interrupt on OverflowUsage: I NTOModi f i es f l ags: I F TF
I f t he Over f l ow Fl ag i s set t hi s i nst r uct i on gener at es an I NT 4
whi ch causes t he code addressed by 0000: 0010 t o be executed.
Cl ocks Si zeOperands 808x 286 386 486 Bytes
none: j ump 53/ 73 24+m 35 28 1no j ump 4 3 3 3
( pr ot . mode, same pr i v. ) - - 59 46 1( pr ot . mode, mor e pr i v. ) - - 99 73 1( f r omVM86 t o PL 0) - - 119 84 1( pr ot . mode, vi a t ask gate) - TS 39+TS 1
INVD - Invalidate Cache (486+)Usage: I NVDModi f i es f l ags: none
Fl ushes CPU i nt er nal cache. I ssues speci al f unct i on bus cycl ewhi ch i ndi cat es t o f l ush exter nal caches. Dat a i n wr i t e- backext er nal caches i s l ost .
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none - - - 4 2
INVLPG - Invalidate Translation Look-Aside Buffer Entry (486+)
-
8/11/2019 80x86 Instruction Set
18/50
Usage: I NVLPGModi f i es f l ags: none
I nval i dat es a si ngl e page t abl e ent r y i n t he Tr ansl at i onLook- Asi de Buf f er . I nt el war ns t hat t hi s i nst r uct i on may bei mpl ement ed di f f er ent l y on f ut ur e pr ocessor s.
Cl ocks Si ze
Operands 808x 286 386 486 Byt es
none - - - 12 2
- t i mi ng i s f or TLB ent r y hi t onl y.
IRET/IRETD - Interrupt ReturnUsage: I RET
I RETD ( 386+)Modi f i es f l ags: AF CF DF I F PF SF TF ZF
Ret ur ns cont r ol t o poi nt of i nt er r upt i on by poppi ng I P, CSand t hen t he Fl ags f r omt he st ack and cont i nues execut i on att hi s l ocat i on. CPU except i on i nt er r upt s wi l l r et ur n t o t hei nst r uct i on t hat cause t he except i on because t he CS: I P pl acedon t he st ack dur i ng t he i nt er r upt i s t he addr ess of t he of f endi ngi nst ruct i on.
Cl ocks Si zeOper ands 808x 286 386 486 Byt es
i r et 32/ 44 17+m 22 15 1i r et ( pr ot . mode) - 31+m 38 15 1i r et ( t o l ess pr i vi l ege) - 55+m 82 36 1i r et ( di f f erent t ask, NT=1) - 169+m TS TS+32 1i r et d - - 22/ 38 15 1i r et d ( t o l ess pr i vi l ege) - - 82 36 1i r etd ( t o VM86 mode) - - 60 15 1i r et d ( di f f er ent t ask, NT=1) - - TS TS+32 1
- 386 t i mi ngs are l i st ed as real - mode/ pr ot ect ed- mode
-
8/11/2019 80x86 Instruction Set
19/50
Instructions
Jxx - Jump Instructions TableMnemoni c Meani ng J ump Condi t i on
J A J ump i f Above CF=0 and ZF=0J AE J ump i f Above or Equal CF=0J B J ump i f Bel ow CF=1J BE J ump i f Bel ow or Equal CF=1 or ZF=1J C J ump i f Car r y CF=1J CXZ J ump i f CX Zer o CX=0J E J ump i f Equal ZF=1J G J ump i f Gr eat er ( si gned) ZF=0 and SF=OFJ GE J ump i f Gr eat er or Equal ( si gned) SF=OFJ L J ump i f Less ( si gned) SF ! = OFJ LE J ump i f Less or Equal ( si gned) ZF=1 or SF ! = OFJ MP Uncondi t i onal J ump uncondi t i onalJ NA J ump i f Not Above CF=1 or ZF=1J NAE J ump i f Not Above or Equal CF=1J NB J ump i f Not Bel ow CF=0
J NBE J ump i f Not Bel ow or Equal CF=0 and ZF=0J NC J ump i f Not Car r y CF=0J NE J ump i f Not Equal ZF=0J NG J ump i f Not Gr eater ( si gned) ZF=1 or SF ! = OFJ NGE J ump i f Not Gr eater or Equal ( si gned) SF ! = OFJ NL J ump i f Not Less ( si gned) SF=OFJ NLE J ump i f Not Less or Equal ( si gned) ZF=0 and SF=OFJ NO J ump i f Not Over f l ow ( si gned) OF=0J NP J ump i f No Par i t y PF=0J NS J ump i f Not Si gned ( si gned) SF=0J NZ J ump i f Not Zer o ZF=0J O J ump i f Over f l ow ( si gned) OF=1J P J ump i f Par i t y PF=1
J PE J ump i f Par i t y Even PF=1J PO J ump i f Par i t y Odd PF=0J S J ump i f Si gned ( si gned) SF=1J Z J ump i f Zer o ZF=1
Cl ocks Si zeOperands 808x 286 386 486 Byt es
J x: j ump 16 7+m 7+m 3 2no j ump 4 3 3 1
J x near - l abel - - 7+m 3 4no j ump - - 3 1
- I t ' s a good pr ogr ammi ng pr act i ce to or gani ze code so t heexpected case i s executed wi t hout a j ump si nce the act ualj ump t akes l onger t o execut e t han f al l i ng t hrough t he t est .
- see J CXZ and J MP f or t hei r r espect i ve t i mi ngs
JCXZ/JECXZ - Jump if Register (E)CX is ZeroUsage: J CXZ l abel
J ECXZ l abel ( 386+)Modi f i es f l ags: None
Causes execut i on t o br anch t o " l abel " i f r egi st er CX i s zer o. Uses
unsi gned compar i si on.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
-
8/11/2019 80x86 Instruction Set
20/50
l abel : j ump 18 8+m 9+m 8 2
no j ump 6 4 5 5
JMP - Unconditional JumpUsage: J MP t argetModi f i es f l ags: None
Uncondi t i onal l y t r ansf er s cont r ol t o "l abel ". J umps by def aul tar e wi t hi n - 32768 t o 32767 bytes f r om t he i nst r uct i on f ol l owi ngt he j ump. NEAR and SHORT j umps cause t he I P to be updat ed whi l e FARj umps cause CS and I P t o be updat ed.
Cl ocksOper ands 808x 286 386 486
r el 8 ( r el at i ve) 15 7+m 7+m 3r el 16 ( r el at i ve) 15 7+m 7+m 3r el 32 ( r el at i ve) - - 7+m 3r eg16 ( near , r egi st er i ndi r ect ) 11 7+m 7+m 5
r eg32 ( near , r egi st er i ndi r ect) - - 7+m 5mem16 ( near, mem i ndi r ect ) 18+EA 11+m 10+m 5mem32 ( near, mem i ndi r ect ) 24+EA 15+m 10+m 5ptr 16: 16 ( f ar , dword i mmed) - - 12+m 17ptr 16: 16 ( f ar , PM dword i mmed) - - 27+m 19pt r 16: 16 ( cal l gat e, same pr i v. ) - 38+m 45+m 32pt r 16: 16 ( vi a TSS) - 175+m TS 42+TSptr 16: 16 ( vi a t ask gat e) - 180+m TS 43+TSmem16: 16 ( f ar , i ndi r ect ) - - 43+m 13mem16: 16 ( f ar , PM i ndi r ect ) - - 31+m 18mem16: 16 ( cal l gat e, same pr i v. ) - 41+m 49+m 31mem16: 16 ( vi a TSS) - 178+m 5+TS 41+TSmem16: 16 ( vi a t ask gate) - 183+m 5+TS 42+TSptr 16: 32 ( f ar , 6 byt e i mmed) - - 12+m 13pt r 16: 32 ( f ar , PM 6 byte i mmed) - - 27+m 18pt r 16: 32 ( cal l gat e, same pr i v. ) - - 45+m 31ptr 16: 32 ( vi a TSS) - - TS 42+TSpt r 16: 32 ( vi a t ask st at e) - - TS 43+TSm16: 32 ( f ar , address at dword) - - 43+m 13m16: 32 ( f ar , address at dword) - - 31+m 18m16: 32 ( cal l gat e, same pr i v. ) - - 49+m 31m16: 32 ( vi a TSS) - - 5+TS 41+TSm16: 32 ( vi a t ask st ate) - - 5+TS 42+TS
-
8/11/2019 80x86 Instruction Set
21/50
-
8/11/2019 80x86 Instruction Set
22/50
i nst r uct i on by r est or i ng SP and BP t o t hei r condi t i on bef or et he pr ocedur e st ack f r ame was i ni t i al i zed.
Timing:
Clocks operands 286 386 486 Size Bytes
none 5 4 5 1
LES - Load Pointer Using ESUsage: LES dest , sr c
Modi f i es Fl ags: None
Loads 32- bi t poi nt er f r om memory sour ce t o dest i nat i onr egi st er and ES. The of f set i s pl aced i n t he dest i nat i onr egi st er and t he segment i s pl aced i n ES. To use t hi si nst r uct i on t he word at t he l ower memory addr ess mustcont ai n t he of f set and t he word at t he hi gher addr essmust cont ai n the segment . Thi s si mpl i f i es t he l oadi ngof f ar poi nt er s f r om t he st ack and t he i nt er r upt vector t abl e.
Timing:
Clocks operands 286 386 486 Size Bytes
reg,mem 7 7 6 2-4
reg,mem (PM) 22 12 5-7
LFS - Load Pointer Using FSUsage: LFS dest , sr c
Modi f i es Fl ags: None
Loads 32- bi t poi nt er f r om memory sour ce t o dest i nat i onr egi st er and FS. The of f set i s pl aced i n t he dest i nat i onr egi st er and the segment i s pl aced i n FS. To use t hi si nst r uct i on t he word at t he l ower memory addr ess mustcont ai n t he of f set and t he word at t he hi gher addr ess mustcont ai n t he segment . Thi s si mpl i f i es t he l oadi ng of f ar poi nt er sf r om t he st ack and t he i nt er r upt vect or t abl e.
Timing:Clocks operands 286 386 486 Size Bytes
reg,mem 7 6 5-7
reg,mem (PM) 22 12 5-7
LGDT - Load Global Descriptor Table (286+ privileged)Usage: LGDT sr c
Modi f i es Fl ags: None
Loads a val ue f r om an oper and i nt o t he Gl obal Descr i pt or Tabl e
( GDT) r egi st er .
-
8/11/2019 80x86 Instruction Set
23/50
-
8/11/2019 80x86 Instruction Set
24/50
Loads t he Machi ne Status Word ( MSW) f r om dat a f ound at"src " .
Timing:
Clocks operands 286 386 486 Size Bytes
reg16 3 10 13 3
mem16 6 13 13 5
LOCK - Lock BusUsage: LOCK
LOCK: ( 386+ pref i x)
Modi f i es Fl ags: None
Thi s i nst r uct i on i s a pref i x t hat causes t he CPU asser t bus l ocksi gnal dur i ng t he execut i on of t he next i nst r uct i on. Used t o
avoi d t wo pr ocessor s f r omupdat i ng t he same dat a l ocat i on.The 286 al ways asser t s l ock dur i ng an XCHG wi t h memor yoperands. Thi s shoul d onl y be used t o l ock the bus pr i or t oXCHG, MOV, I N and OUT i nst r uct i ons.
Timing:
Clocks operands 286 386 486 Size Bytes
none 0 0 1 1
LODS - Load String (Byte, Word or Double)Usage: LODS sr c
LODSBLODSW
LODSD ( 386+)
Modi f i es Fl ags: None
Tr ansf er s st r i ng el ement addr essed by DS: SI ( even i fan oper and i s suppl i ed) t o t he accumul ator. SI i s i ncr ement edbased on the si ze of t he oper and or based on t he i nst r uct i onused. I f t he Di r ecti on Fl ag i s set SI i s decrement ed, i ft he Di r ect i on Fl ag i s cl ear SI i s i ncrement ed. Use wi t h REPpref i xes.
Timing:
Clocks operands 286 386 486 Size Bytes
src 5 5 5 1
LOOP - Decrement CX and Loop if CX Not ZeroUsage: LOOP l abel
Modi f i es Fl ags: None
Decr ement s CX by 1 and t r ansf er s cont r ol t o "l abel " i f CXi s not Zero. The " l abel " operand must be wi t hi n - 128 or 127byt es of t he i nst r ucti on f ol l owi ng t he l oop i nst r ucti on
-
8/11/2019 80x86 Instruction Set
25/50
-
8/11/2019 80x86 Instruction Set
26/50
-
8/11/2019 80x86 Instruction Set
27/50
Instructions
MOV - Move Byte or WordUsage: MOV dest , sr cModi f i es f l ags: None
Copi es byt e or wor d f r om t he sour ce operand t o t he dest i nat i onoper and. I f t he dest i nat i on i s SS i nt er r upt s ar e di sabl ed excepton ear l y buggy 808x CPUs. Some CPUs di sabl e i nt err upt s i f t hedest i nat i on i s any of t he segment r egi st er s
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, r eg 2 2 2 1 2mem, r eg 9+EA 3 2 1 2- 4 ( W88=13+EA)r eg, mem 8+EA 5 4 1 2- 4 ( W88=12+EA)mem, i mmed 10+EA 3 2 1 3- 6 ( W88=14+EA)r eg, i mmed 4 2 2 1 2- 3mem, accum 10 3 2 1 3 ( W88=14)
accum, mem 10 5 4 1 3 ( W88=14)segr eg, r eg16 2 2 2 3 2segr eg, mem16 8+EA 5 5 9 2- 4 ( W88=12+EA)r eg16, segr eg 2 2 2 3 2mem16, segr eg 9+EA 3 2 3 2- 4 ( W88=13+EA)r eg32, CR0/ CR2/ CR3 - - 6 4CR0, r eg32 - - 10 16CR2, r eg32 - - 4 4 3CR3, r eg32 - - 5 4 3r eg32, DR0/ DR1/ DR2/ DR3 - 22 10 3r eg32, DR6/ DR7 - - 22 10 3DR0/ DR1/ DR2/ DR3, r eg32 - 22 11 3DR6/ DR7, r eg32 - - 16 11 3
r eg32, TR6/ TR7 - - 12 4 3TR6/ TR7, r eg32 - - 12 4 3r eg32, TR3 3TR3, r eg32 6
- when t he 386 speci al r egi st er s ar e used al l oper ands are 32 bi t s
MOVS - Move String (Byte or Word)Usage: MOVS dest , sr c
MOVSBMOVSW
MOVSD ( 386+)
Modi f i es f l ags: None
Copi es dat a f r om addr essed by DS: SI ( even i f operands are gi ven) t ot he l ocat i on ES: DI dest i nat i on and updates SI and DI based on thesi ze of t he oper and or i nst r uct i on used. SI and DI ar e i ncr ement edwhen t he Di r ect i on Fl ag i s cl ear ed and decrement ed when t he Di r ect i onFl ag i s Set . Use wi t h REP pr ef i xes.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
dest , sr c 18 5 7 7 1 ( W88=26)
MOVSX - Move with Sign Extend (386+)Usage: MOVSX dest , sr cModi f i es f l ags: None
-
8/11/2019 80x86 Instruction Set
28/50
Copi es t he val ue of t he sour ce oper and t o t he dest i nat i on r egi st erwi t h t he si gn extended.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, r eg - - 3 3 3r eg, mem - - 6 3 3- 7
MOVZX - Move with Zero Extend (386+)Usage: MOVZX dest , sr cModi f i es f l ags: None
Copi es t he val ue of t he sour ce oper and to t he dest i nat i on regi st erwi t h t he zer oes extended.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, r eg - - 3 3 3
r eg, mem - - 6 3 3- 7
MUL - Unsigned MultiplyUsage: MUL sr cModi f i es f l ags: CF OF (AF, PF, SF, ZF undef i ned)
Unsi gned mul t i pl y of t he accumul at or by t he sour ce. I f "s r c" i sa byte val ue, t hen AL i s used as t he ot her mul t i pl i cand and t her esul t i s pl aced i n AX. I f "sr c" i s a wor d val ue, t hen AX i smul t i pl i ed by "sr c" and DX: AX r ecei ves the r esul t . I f "sr c" i sa doubl e word val ue, t hen EAX i s mul t i pl i ed by "sr c" and EDX: EAXr ecei ves t he r esul t . The 386+ uses an ear l y out al gor i t hm whi chmakes mul t i pl yi ng any si ze val ue i n EAX as f ast as i n the 8 or 16
bi t r egi s ters .
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 70- 77 13 9- 14 13- 18 2r eg16 118- 113 21 9- 22 13- 26 2r eg32 - - 9- 38 13- 42 2- 4mem8 ( 76- 83) +EA 16 12- 17 13- 18 2- 4mem16 ( 124- 139)+EA 24 12- 25 13- 26 2- 4mem32 - - 12- 21 13- 42 2- 4
-
8/11/2019 80x86 Instruction Set
29/50
Instructions
NEG - Two's Complement NegationUsage: NEG destModi f i es f l ags: AF CF OF PF SF ZF
Subtr act s t he dest i nat i on f r om 0 and saves t he 2s compl ement of"dest " back i nt o "dest ".
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg 3 2 2 1 2mem 16+EA 7 6 3 2- 4 ( W88=24+EA)
NOP - No Operation (90h)Usage: NOP
Modi f i es f l ags: None
Thi s i s a do nothi ng i nst r uct i on. I t r esul t s i n occupat i on of bothspace and t i me and i s most usef ul f or pat chi ng code segment s.( Thi s i s t he or i gi nal XCHG AL, AL i nst r uct i on)
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 3 3 3 1 1
NOT - One's Compliment Negation (Logical NOT)Usage: NOT destModi f i es f l ags: None
I nver t s t he bi t s of t he "dest " operand f ormi ng t he 1s compl ement .
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg 3 2 2 1 2mem 16+EA 7 6 3 2- 4 ( W88=24+EA)
-
8/11/2019 80x86 Instruction Set
30/50
O Instructions
OR - Inclusive Logical ORUsage: OR dest , sr cModi f i es f l ags: CF OF PF SF ZF ( AF undef i ned)
Logi cal i ncl usi ve OR of t he t wo oper ands r et ur ni ng t he r esul t i nt he dest i nat i on. Any bi t set i n ei t her oper and wi l l be set i n t hedesti nat i on.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, r eg 3 2 2 1 2mem, r eg 16+EA 7 7 3 2- 4 ( W88=24+EA)r eg, mem 9+EA 7 6 2 2- 4 ( W88=13+EA)r eg, i mmed 4 3 2 1 3- 4mem8, i mmed8 17+EA 7 7 3 3- 6mem16, i mmed16 25+EA 7 7 3 3- 6accum, i mmed 4 3 2 1 2- 3
OUT - Output Data to PortUsage: OUT por t , accum
Modi f i es f l ags: None
Tr ansf er s byt e i n AL, wor d i n AX or dwor d i n EAX t o t he speci f i edhar dware por t addr ess. I f t he port number i s i n t he r ange of 0- 255i t can be speci f i ed as an i mmedi ate. I f gr eater t han 255 t hen t hepor t number must be speci f i ed i n DX. Si nce t he PC onl y decodes 10bi t s of t he por t address, val ues over 1023 can onl y be decoded byt hi r d part y vendor equi pment and al so map t o t he port r ange 0- 1023.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
i mmed8, accum 10/ 14 3 10 16 2i mmed8, accum ( PM) - - 4/ 24 11/ 31/ 29 2DX, accum 8/ 12 3 11 16 1DX, accum ( PM) - - 5/ 25 10/ 30/ 29 1
- 386+ protected mode t i mi ngs depend on pr i vi l ege l evel s.
f i r st number i s t he t i mi ng when: CPL I OPLsecond number i s t he t i mi ng when: CPL > I OPL
t hi r d number i s t he t i mi ng when: vi r t ual mode on 486 pr ocessor
OUTS - Output String to Port (80188+)Usage: OUTS port , sr c
OUTSBOUTSW
OUTSD ( 386+)Modi f i es f l ags: None
Tr ansf er s a byt e, wor d or doubl ewor d f r om "sr c" t o t he hardwar e
por t speci f i ed i n DX. For i nst r uct i ons wi t h no oper ands t he "sr c"i s l ocat ed at DS: SI and SI i s i ncr ement ed or decrement ed by t hesi ze of t he oper and or t he si ze di ct at ed by t he i nst r uct i on f or mat .When t he Di r ect i on Fl ag i s set SI i s decr ement ed, when cl ear , SI i s
-
8/11/2019 80x86 Instruction Set
31/50
i ncr ement ed. I f t he por t number i s i n t he r ange of 0- 255 i t canbe speci f i ed as an i mmedi at e. I f gr eat er t han 255 t hen t he portnumber must be speci f i ed i n DX. Si nce the PC onl y decodes 10 bi t sof t he port addr ess, val ues over 1023 can onl y be decoded by t hi r dpar t y vendor equi pment and al so map t o t he por t r ange 0- 1023.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
por t , sr c - 5 14 17 1por t , sr c ( PM) - - 8/ 28 10/ 32/ 30 1
- 386+ protected mode t i mi ngs depend on pr i vi l ege l evel s.
f i r st number i s t he t i mi ng when: CPL I OPLsecond number i s t he t i mi ng when: CPL > I OPLt hi r d number i s t he t i mi ng when: vi r t ual mode on 486 pr ocessor
-
8/11/2019 80x86 Instruction Set
32/50
Instructions
POP - Pop Word off StackUsage: POP destModi f i es f l ags: None
Tr ansf er s wor d at t he cur r ent st ack t op ( SS: SP) t o t he dest i nat i ont hen i ncr ement s SP by t wo t o poi nt t o t he new st ack t op. CS i s nota val i d desti nat i on.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg16 8 5 4 4 1r eg32 4 - - 4 1segreg 8 5 7 3 1mem16 17+EA 5 5 6 2- 4mem32 5 - - 6 2- 4
POPA/POPAD - Pop All Registers onto Stack (80188+)Usage: POPA
POPAD ( 386+)Modi f i es f l ags: None
Pops t he top 8 words of f t he st ack i nto the 8 general pur pose 16/ 32bi t r egi st er s. Regi st er s ar e popped i n t he f ol l owi ng or der : ( E) DI ,( E) SI , ( E) BP, ( E) SP, ( E) DX, ( E) CX and ( E) AX. The ( E) SP val ue poppedf r om t he st ack i s actual l y di scar ded.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none - 19 24 9 1
POPF/POPFD - Pop Flags off StackUsage: POPF
POPFD ( 386+)Modi f i es f l ags: al l f l ags
Pops wor d/ doubl eword f r omst ack i nt o the Fl ags Regi st er and t heni ncr ement s SP by 2 ( f or POPF) or 4 ( f or POPFD) .
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 8/ 12 5 5 9 1 ( W88=12)none ( PM) - - 5 6 1
PUSH - Push Word onto StackUsage: PUSH sr c
PUSH i mmed ( 80188+ onl y)Modi f i es f l ags: None
Decrement s SP by t he si ze of t he operand ( t wo or f our , byt e val uesare si gn ext ended) and t r ansf er s one word f r omsour ce to t he st ackt op ( SS: SP) .
-
8/11/2019 80x86 Instruction Set
33/50
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg16 11/ 15 3 2 1 1r eg32 - - 2 1 1mem16 16+EA 5 5 4 2- 4 ( W88=24+EA)mem32 - - 5 4 2- 4segreg 10/ 14 3 2 3 1
i mmed - 3 2 1 2- 3
PUSHA/PUSHAD - Push All Registers onto Stack (80188+)Usage: PUSHA
PUSHAD ( 386+)Modi f i es f l ags: None
Pushes al l gener al pur pose r egi st er s ont o t he st ack i n t he f ol l owi ngor der : ( E) AX, ( E) CX, ( E) DX, ( E) BX, ( E) SP, ( E) BP, ( E) SI , ( E) DI . The
val ue of SP i s t he val ue bef or e the act ual push of SP.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none - 19 24 11 1
PUSHF/PUSHFD - Push Flags onto StackUsage: PUSHF
PUSHFD ( 386+)Modi f i es f l ags: None
Tr ansf er s t he Fl ags Regi st er onto t he st ack. PUSHF saves a 16 bi tval ue whi l e PUSHFD saves a 32 bi t val ue.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 10/ 14 3 4 4 1none ( PM) - - 4 3 1
-
8/11/2019 80x86 Instruction Set
34/50
Instructions
RCL - Rotate Through Carry LeftUsage: RCL dest , countModi f i es f l ags: CF OF
+- - - - - +- - - - - - - - - - - - - - - - - - - - - - - ++- - - | C | 7 0 | C | - - - +| +- - - - - - - - - - - - - - - - - - - - - - - +- - - - - + || |+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
Rot at es t he bi t s i n t he dest i nat i on t o t he r i ght "count " t i mes wi t hal l dat a pushed out t he r i ght si de r e- ent er i ng on t he l ef t . TheCar r y Fl ag hol ds t he l ast bi t r ot at ed out .
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, 1 2 2 9 3 2
mem, 1 15+EA 7 10 4 2- 4 ( W88=23+EA)r eg, CL 8+4n 5+n 9 8- 30 2mem, CL 20+EA+4n 8+n 10 9- 31 2- 4 ( W88=28+EA+4n)r eg, i mmed8 - 5+n 9 8- 30 3mem, i mmed8 - 8+n 10 9- 31 3- 5
REP - Repeat String OperationUsage: REPModi f i es f l ags: None
Repeat s execut i on of st r i ng i nst r uct i ons whi l e CX ! = 0. Af t ereach st r i ng oper at i on, CX i s decr ement ed and the Zer o Fl ag i st est ed. The combi nat i on of a r epeat pr ef i x and a segment over r i de
on CPU' s bef ore t he 386 may resul t i n er r or s i f an i nt er r upt occur sbef ore CX=0. The f ol l owi ng code shows code t hat i s suscept i bl e t ot hi s and how t o avoi d i t :
-
8/11/2019 80x86 Instruction Set
35/50
agai n: r ep movs byt e pt r ES: [ DI ] , ES: [ SI ] ; vul ner abl e i nst r .j cxz next ; cont i nue i f REP successf ull oop agai n ; i nt er r upt goof ed count
next :
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 2 2 2 1
REPE/REPZ - Repeat Equal / Repeat ZeroUsage: REPE
REPZModi f i es f l ags: None
Repeat s execut i on of st r i ng i nst r uct i ons whi l e CX ! = 0 and t he Zer oFl ag i s set . CX i s decr ement ed and t he Zer o Fl ag t est ed af t ereach st r i ng oper at i on. The combi nat i on of a r epeat pref i x and a
segment overr i de on pr ocessor s ot her t han the 386 may r esul t i ner r or s i f an i nt er r upt occur s bef or e CX=0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 2 2 2 1
REPNE/REPNZ - Repeat Not Equal / Repeat Not ZeroUsage: REPNE
REPNZ
Modi f i es f l ags: None
Repeat s execut i on of st r i ng i nst r uct i ons whi l e CX ! = 0 and t he Zer oFl ag i s cl ear . CX i s decr ement ed and t he Zero Fl ag t ested af t ereach st r i ng oper at i on. The combi nat i on of a r epeat pref i x and asegment overr i de on pr ocessor s ot her t han t he 386 may r esul t i ner r or s i f an i nt er r upt occur s bef or e CX=0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 2 2 2 1
RET/RETF - Return From ProcedureUsage: RET nByt es
RETF nByt esRETN nByt es
Modi f i es f l ags: None
Tr ansf er s cont r ol f r om a procedure back t o t he i nst r uct i on addr esssaved on t he st ack. "n byt es" i s an opt i onal number of byt es t or el ease. Far r et ur ns pop t he I P f ol l owed by t he CS, whi l e nearr et ur ns pop onl y the I P regi st er .
Cl ocks Si ze
Operands 808x 286 386 486 Byt es
r et n 16/ 20 11+m 10+m 5 1r et n i mmed 20/ 24 11+m 10+m 5 3
-
8/11/2019 80x86 Instruction Set
36/50
r et f 26/ 34 15+m 18+m 13 1r et f ( PM, same pr i v. ) - 32+m 18 1r et f ( PM, l esser pr i v. ) - 68 33 1r et f i mmed 25/ 33 15+m 18+m 14 3r et f i mmed ( PM, same pr i v. ) 32+m 17 1r et f i mmed ( PM, l esser pr i v. ) 68 33 1
ROL - Rotate LeftUsage: ROL dest , countModi f i es f l ags: CF OF
+- - - + +- - - - - - - - - - - - - - - - - - - - - - - +| C | | C || +- - - - - - - - - - - - - - - - - - - - - - - + | +- - - +| |+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
Rot at es t he bi t s i n t he dest i nat i on t o t he r i ght "count " t i mes wi t h
al l dat a pushed out t he r i ght si de r e- ent er i ng on t he l ef t . TheCar r y Fl ag wi l l cont ai n t he val ue of t he l ast bi t r ot at ed out .
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, 1 2 2 3 3 2mem, 1 15+EA 7 7 4 2- 4 ( W88=23+EA)r eg, CL 8+4n 5+n 3 3 2mem, CL 20+EA+4n 8+n 7 4 2- 4 ( W88=28+EA+4n)r eg, i mmed8 - 5+n 3 2 3mem, i mmed8 - 8+n 7 4 3- 5
-
8/11/2019 80x86 Instruction Set
37/50
S Instructions
SAHF - Store AH Register into FLAGSUsage: SAHFModi f i es f l ags: AF CF PF SF ZF
Tr ansf er s bi t s 0- 7 of AH i nt o t he Fl ags Regi st er . Thi s i ncl udesAF, CF, PF, SF and ZF.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 4 2 3 2 1
SAL/SHL - Shift Arithmetic Left / Shift Logical LeftUsage: SAL dest , count
SHL dest , countModi f i es f l ags: CF OF PF SF ZF ( AF undef i ned)
+- - - + +- - - - - - - - - - - - - - - - - - - - - - - +| C | | C || +- - - - - - - - - - - - - - - - - - - - - - - + +- - - +| |+- - - - - +
Shi f t s t he dest i nat i on r i ght by "count " bi t s wi t h t he cur r ent si gnbi t r epl i cat ed i n t he l ef t most bi t . The Car r y Fl ag cont ai ns t hel as t bi t shi f ted out .
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, 1 2 2 3 3 2mem, 1 15+EA 7 7 4 2- 4 ( W88=23+EA)r eg, CL 8+4n 5+n 3 3 2
mem, CL 20+EA+4n 8+n 7 4 2- 4 ( W88=28+EA+4n)r eg, i mmed8 - 5+n 3 2 3mem, i mmed8 - 8+n 7 4 3- 5
-
8/11/2019 80x86 Instruction Set
38/50
SBB - Subtract with Borrow/CarryUsage: SBB dest , sr cModi f i es f l ags: AF CF OF PF SF ZF
Subt r act s t he sour ce f r om t he dest i nat i on, and subt r act s 1 ext r a i ft he Car r y Fl ag i s set . Resul t s ar e r et ur ned i n "dest ".
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, r eg 3 2 2 1 2mem, r eg 16+EA 7 6 3 2- 4 ( W88=24+EA)r eg, mem 9+EA 7 7 2 2- 4 ( W88=13+EA)r eg, i mmed 4 3 2 1 3- 4mem, i mmed 17+EA 7 7 3 3- 6 ( W88=25+EA)accum, i mmed 4 3 2 1 2- 3
SCAS - Scan String (Byte, Word or Doubleword)
Usage: SCAS st r i ngSCASBSCASW
SCASD ( 386+)Modi f i es f l ags: AF CF OF PF SF ZF
Compar es val ue at ES: DI ( even i f oper and i s speci f i ed) f r omt heaccumul at or and set s t he f l ags si mi l ar t o a subt r act i on. DI i si ncr ement ed/ decr ement ed based on t he i nst r uct i on f ormat ( oroperand si ze) and t he st at e of t he Di r ect i on Fl ag. Use wi t h REPpref i xes.
Cl ocks Si ze
Operands 808x 286 386 486 Byt es
st r i ng 15 7 7 6 1 ( W88=19)
SETAE/SETNB - Set if Above or Equal / Set if Not Below (386+)Usage: SETAE dest
SETNB dest( unsi gned, 386+)Modi f i es f l ags: none
Set s t he byte i n t he oper and t o 1 i f t he Car r y Fl ag i s cl ear
other wi se set s t he operand t o 0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 - - 4 3 3mem8 - - 5 4 3
SETB/SETNAE - Set if Below / Set if Not Above or Equal (386+)Usage: SETB dest
SETNAE dest( unsi gned, 386+)Modi f i es f l ags: none
-
8/11/2019 80x86 Instruction Set
39/50
Set s t he byte i n t he oper and t o 1 i f t he Car r y Fl ag i s setother wi se set s t he operand t o 0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 - - 4 3 3mem8 - - 5 4 3
SETBE/SETNA - Set if Below or Equal / Set if Not Above (386+)Usage: SETBE dest
SETNA dest( unsi gned, 386+)Modi f i es f l ags: none
Set s t he byt e i n t he operand t o 1 i f t he Carr y Fl ag or t he Zer oFl ag i s set , ot her wi se set s t he oper and t o 0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 - - 4 3 3mem8 - - 5 4 3
SETE/SETZ - Set if Equal / Set if Zero (386+)Usage: SETE dest
SETZ destModi f i es f l ags: none
Set s t he byte i n t he oper and t o 1 i f t he Zer o Fl ag i s set ,other wi se set s t he operand t o 0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 - - 4 3 3mem8 - - 5 4 3
SETNE/SETNZ - Set if Not Equal / Set if Not Zero (386+)Usage: SETNE dest
SETNZ dest
Modi f i es f l ags: none
Set s t he byt e i n t he oper and t o 1 i f t he Zer o Fl ag i s cl ear ,other wi se set s t he operand t o 0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 - - 4 3 3mem8 - - 5 4 3
SETL/SETNGE - Set if Less / Set if Not Greater or Equal (386+)Usage: SETL dest
SETNGE dest( si gned, 386+)
-
8/11/2019 80x86 Instruction Set
40/50
Modi f i es f l ags: none
Set s t he byte i n t he oper and t o 1 i f t he Si gn Fl ag i s not equalt o t he Over f l ow Fl ag, ot her wi se set s t he oper and to 0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 - - 4 3 3mem8 - - 5 4 3
SETGE/SETNL - Set if Greater or Equal / Set if Not Less (386+)Usage: SETGE dest
SETNL dest( si gned, 386+)Modi f i es f l ags: none
Set s t he byte i n the oper and to 1 i f t he Si gn Fl ag equal s t heOver f l ow Fl ag, other wi se set s t he oper and t o 0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 - - 4 3 3mem8 - - 5 4 3
SETLE/SETNG - Set if Less or Equal / Set if Not greater or Equal (386+)Usage: SETLE dest
SETNG dest( si gned, 386+)Modi f i es f l ags: none
Set s t he byte i n t he oper and t o 1 i f t he Zer o Fl ag i s set or t heSi gn Fl ag i s not equal t o t he Over f l ow Fl ag, ot her wi se set s t heoperand t o 0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 - - 4 3 3mem8 - - 5 4 3
SETG/SETNLE - Set if Greater / Set if Not Less or Equal (386+)Usage: SETG dest
SETNLE dest( si gned, 386+)Modi f i es f l ags: none
Set s t he byte i n t he oper and t o 1 i f t he Zer o Fl ag i s cl ear or t heSi gn Fl ag equal s t o t he Over f l ow Fl ag, other wi se sets t he operandt o 0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 - - 4 3 3mem8 - - 5 4 3
-
8/11/2019 80x86 Instruction Set
41/50
SETS - Set if Signed (386+)Usage: SETS destModi f i es f l ags: none
Set s t he byte i n t he oper and t o 1 i f t he Si gn Fl ag i s set , other wi se
set s t he operand t o 0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 - - 4 3 3mem8 - - 5 4 3
SETNS - Set if Not Signed (386+)Usage: SETNS destModi f i es f l ags: none
Set s t he byt e i n t he oper and t o 1 i f t he Si gn Fl ag i s cl ear ,
other wi se set s t he operand t o 0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 - - 4 3 3mem8 - - 5 4 3
SETC - Set if Carry (386+)Usage: SETC destModi f i es f l ags: none
Set s t he byt e i n t he oper and t o 1 i f t he Car r y Fl ag i s set ,other wi se set s t he operand t o 0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 - - 4 3 3mem8 - - 5 4 3
SETNC - Set if Not Carry (386+)Usage: SETNC destModi f i es f l ags: none
Set s t he byt e i n t he oper and t o 1 i f t he Car r y Fl ag i s cl ear ,other wi se set s t he operand t o 0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 - - 4 3 3mem8 - - 5 4 3
SETO - Set if Overflow (386+)Usage: SETO dest
-
8/11/2019 80x86 Instruction Set
42/50
Modi f i es f l ags: none
Set s t he byte i n t he oper and t o 1 i f t he Over f l ow Fl ag i s set ,other wi se set s t he operand t o 0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 - - 4 3 3mem8 - - 5 4 3
SETNO - Set if Not Overflow (386+)Usage: SETNO destModi f i es f l ags: none
Set s t he byt e i n t he oper and t o 1 i f t he Over f l ow Fl ag i s cl ear ,other wi se set s t he operand t o 0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 - - 4 3 3mem8 - - 5 4 3
SETP/SETPE - Set if Parity / Set if Parity Even (386+)Usage: SETP dest
SETPE destModi f i es f l ags: none
Set s t he byt e i n t he oper and t o 1 i f t he Par i t y Fl ag i s set ,other wi se set s t he operand t o 0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 - - 4 3 3mem8 - - 5 4 3
SETNP/SETPO - Set if No Parity / Set if Parity Odd (386+)Usage: SETNP dest
SETPO dest
Modi f i es f l ags: none
Set s t he byt e i n t he oper and t o 1 i f t he Par i t y Fl ag i s cl ear ,other wi se set s t he operand t o 0.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg8 - - 4 3 3mem8 - - 5 4 3
SGDT - Store Global Descriptor Table (286+ privileged)Usage: SGDT destModi f i es f l ags: none
-
8/11/2019 80x86 Instruction Set
43/50
St ores t he Gl obal Descr i pt or Tabl e ( GDT) Regi st er i nt o t hespeci f i ed oper and.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
mem64 - 11 9 10 5
SIDT - Store Interrupt Descriptor Table (286+ privileged)Usage: SI DT destModi f i es f l ags: none
St or es t he I nt er r upt Descri pt or Tabl e ( I DT) Regi st er i nt o t hespeci f i ed oper and.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
mem64 - 12 9 10 5
SHL - Shift Logical LeftSee: SAL
SHR - Shift Logical RightUsage: SHR dest , countModi f i es f l ags: CF OF PF SF ZF ( AF undef i ned)
+- - - - - - - - - - - - - - - - - - - - - - - + +- - - +
0- - >| 7 - - - - - - - - - - - - - - - - > 0 | - - >| C |+- - - - - - - - - - - - - - - - - - - - - - - + +- - - +
Shi f t s t he dest i nat i on r i ght by "count " bi t s wi t h zer oes shi f t edi n on t he l ef t . The Car r y Fl ag cont ai ns the l ast bi t shi f t ed out .
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, 1 2 2 3 2mem, 1 15+EA 7 7 2- 4 ( W88=23+EA)r eg, CL 8+4n 5+n 3 2mem, CL 20+EA+4n 8+n 7 2- 4 ( W88=28+EA+4n)
r eg, i mmed8 - 5+n 3 3mem, i mmed8 - 8+n 7 3- 5
SHLD/SHRD - Double Precision Shift (386+)Usage: SHLD dest , sr c, count
SHRD dest , sr c, countModi f i es f l ags: CF PF SF ZF ( OF, AF undef i ned)
SHLD shi f t s "dest " t o t he l ef t "count " t i mes and t he bi t posi t i onsopened ar e f i l l ed wi t h t he most si gni f i cant bi t s of "sr c". SHRDshi f t s "dest " t o the r i ght "count " t i mes and t he bi t posi t i ons
opened ar e f i l l ed wi t h t he l east si gni f i cant bi t s of t he secondoper and. Onl y t he 5 l ower bi t s of "count " are used.
Cl ocks Si ze
-
8/11/2019 80x86 Instruction Set
44/50
Operands 808x 286 386 486 Byt es
r eg16, r eg16, i mmed8 - - 3 2 4r eg32, r eg32, i mmed8 - - 3 2 4mem16, r eg16, i mmed8 - - 7 3 6mem32, r eg32, i mmed8 - - 7 3 6r eg16, r eg16, CL - - 3 3 3r eg32, r eg32, CL - - 3 3 3
mem16, r eg16, CL - - 7 4 5mem32, r eg32, CL - - 7 4 5
SLDT - Store Local Descriptor Table (286+ privileged)Usage: SLDT destModi f i es f l ags: none
St ores the Local Descr i pt or Tabl e ( LDT) Regi st er i nt o t hespeci f i ed oper and.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg16 - 2 2 2 3mem16 - 2 2 3 5
SMSW - Store Machine Status Word (286+ privileged)Usage: SMSW destModi f i es f l ags: none
Store Machi ne St atus Word ( MSW) i nto "dest " .
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg16 - 2 10 2 3mem16 - 3 3 3 5
STC - Set CarryUsage: STCModi f i es f l ags: CF
Set s t he Car r y Fl ag t o 1.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 2 2 2 2 1
STD - Set Direction FlagUsage: STDModi f i es f l ags: DF
Set s t he Di r ect i on Fl ag t o 1 causi ng st r i ng i nst r uct i ons t o
aut o- decr ement SI and DI i nst ead of aut o- i ncr ement .
Cl ocks Si zeOperands 808x 286 386 486 Byt es
-
8/11/2019 80x86 Instruction Set
45/50
none 2 2 2 2 1
STI - Set Interrupt Flag (Enable Interrupts)Usage: STI
Modi f i es f l ags: I F
Set s t he I nt er r upt Fl ag t o 1, whi ch enabl es r ecogni t i on of al lhar dwar e i nt er r upt s. I f an i nt er r upt i s gener at ed by a har dwar edevi ce, an End of I nt er r upt ( EOI ) must al so be i ssued to enabl eother har dwar e i nt er r upt s of t he same or l ower pr i or i t y.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 2 2 2 5 1
STOS - Store String (Byte, Word or Doubleword)Usage: STOS dest
STOSBSTOSW
STOSDModi f i es f l ags: None
St ores val ue i n accumul at or t o l ocat i on at ES: ( E) DI ( even i f oper andi s gi ven) . ( E) DI i s i ncr ement ed/ decr ement ed based on t he si ze oft he oper and (or i nst r uct i on f or mat ) and the st at e of t he Di r ect i onFl ag. Use wi t h REP pr ef i xes.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
dest 11 3 4 5 1 ( W88=15)
STR - Store Task Register (286+ privileged)Usage: STR destModi f i es f l ags: None
St ores t he cur r ent Task Regi st er t o t he speci f i ed oper and.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg16 - 2 2 2 3mem16 - 3 2 3 5
SUB - SubtractUsage: SUB dest , sr cModi f i es f l ags: AF CF OF PF SF ZF
The sour ce i s subt r act ed f r om t he dest i nat i on and t he r esul t i sst or ed i n t he dest i nat i on.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
-
8/11/2019 80x86 Instruction Set
46/50
r eg, r eg 3 2 2 1 2mem, r eg 16+EA 7 6 3 2- 4 ( W88=24+EA)r eg, mem 9+EA 7 7 2 2- 4 ( W88=13+EA)r eg, i mmed 4 3 2 1 3- 4mem, i mmed 17+EA 7 7 3 3- 6 ( W88=25+EA)accum, i mmed 4 3 2 1 2- 3
-
8/11/2019 80x86 Instruction Set
47/50
T Instructions
TEST - Test For Bit Pattern
Usage: TEST dest , sr cModi f i es f l ags: CF OF PF SF ZF ( AF undef i ned)
Per f orms a l ogi cal AND of t he t wo operands updat i ng t he f l agsr egi st er wi t hout savi ng t he r esul t .
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, r eg 3 2 1 1 2r eg, mem 9+EA 6 5 1 2- 4 ( W88=13+EA)mem, r eg 9+EA 6 5 2 2- 4 ( W88=13+EA)r eg, i mmed 5 3 2 1 3- 4mem, i mmed 11+EA 6 5 2 3- 6accum, i mmed 4 3 2 1 2- 3
-
8/11/2019 80x86 Instruction Set
48/50
V Instructions
VERR - Verify Read (286+ protected)Usage: VERR sr cModi f i es f l ags: ZF
Ver i f i es t he speci f i ed segment sel ect or i s val i d and i s r eadabl eat t he cur r ent pri vi l ege l evel . I f t he segment i s readabl e,t he Zer o Fl ag i s set , ot her wi se i t i s cl ear ed.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg16 - 14 10 11 3mem16 - 16 11 11 5
VERW - Verify Write (286+ protected)Usage: VERW sr c
Modi f i es f l ags: ZF
Ver i f i es t he speci f i ed segment sel ect or i s val i d and i s rat abl eat t he cur r ent pr i vi l ege l evel . I f t he segment i s wr i t abl e,t he Zer o Fl ag i s set , ot her wi se i t i s cl ear ed.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg16 - 14 15 11 3mem16 - 16 16 11 5
-
8/11/2019 80x86 Instruction Set
49/50
W Instructions
WAIT/FWAIT - Event WaitUsage: WAI T
FWAI TModi f i es f l ags: None
CPU ent er s wai t st at e unt i l t he copr ocessor si gnal s i t has f i ni shedi t s oper at i on. Thi s i nst r uct i on i s used t o pr event t he CPU f r om
accessi ng memory t hat may be t empor ar i l y i n use by t he copr ocessor .WAI T and FWAI T are i dent i cal .
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none 4 3 6+ 1- 3 1
WBINVD - Write-Back and Invalidate Cache (486+)Usage: WBI NVDModi f i es f l ags: None
Fl ushes i nt er nal cache, t hen si gnal s t he exter nal cache t o wr i t eback cur r ent dat a f ol l owed by a si gnal t o f l ush t he exter nal cache.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
none - - - 5 2
-
8/11/2019 80x86 Instruction Set
50/50
Instructions
XCHG - ExchangeUsage: XCHG dest , sr cModi f i es f l ags: None
Exchanges cont ent s of sour ce and dest i nat i on.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, r eg 4 3 3 3 2mem, r eg 17+EA 5 5 5 2- 4 ( W88=25+EA)r eg, mem 17+EA 5 5 3 2- 4 ( W88=25+EA)accum, r eg 3 3 3 3 1r eg, accum 3 3 3 3 1
XLAT/XLATB - Translate
Usage: XLAT t r ansl at i on- t abl eXLATB ( masm 5. x)
Modi f i es f l ags: None
Repl aces t he byte i n AL wi t h byte f r oma user t abl e addr essed byBX. The or i gi nal val ue of AL i s the i ndex i nt o t he t r ansl at e t abl e.The best way t o descr i be t hi s i s MOV AL, [ BX+AL]
Cl ocks Si zeOperands 808x 286 386 486 Byt es
t abl e of f set 11 5 5 4 1
XOR - Exclusive ORUsage: XOR dest , sr cModi f i es f l ags: CF OF PF SF ZF ( AF undef i ned)
Per f orms a bi t wi se excl usi ve OR of t he operands and r etur nst he r esul t i n t he desti nat i on.
Cl ocks Si zeOperands 808x 286 386 486 Byt es
r eg, r eg 3 2 2 1 2mem, r eg 16+EA 7 6 3 2- 4 ( W88=24+EA)
r eg, mem 9+EA 7 7 2 2- 4 ( W88=13+EA)r eg, i mmed 4 3 2 1 3- 4mem, i mmed 17+EA 7 7 3 3- 6 ( W88=25+EA)accum, i mmed 4 3 2 1 2- 3