Anda di halaman 1dari 24

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

Appendix Intel x86 compatible processors instruction set


We convene upon the following notations:
s: d: AL|AX: mem: mem16: mem32: r|ri|rj: r8: r16: rs: data: data8: data16: disp8: disp16: adr: adr8: adr32: port: tip: nrcel: AE: Flags notations: x: 1: 0: ?: blank: the flags value changes according to the instruction result; the flag is unconditionally set; the flag is unconditionally reset; the flags value changes unpredictably; the flags value is not modified by the instruction; source; destination; default accumulator (8 or 16 bits); the content of a memory location or two successive memory locations addressed through one of the permitted addressing modes for data memory (except immediate addressing); the content of two successive memory locations addressed through one of the permitted addressing modes for data memory (except immediate addressing); the content of four successive memory locations addressed through one of the permitted addressing modes for data memory (except immediate addressing); a common 8 bit or 16 bit register (except segment registers); an 8 bit register (except segment registers); a 16 bit register (except segment registers); a segment register; an 8 or 16 bit operand coded in the instruction format (immediate addressing); an 8 bit operand coded in the instruction format (immediate addressing); a 16 bit operand coded in the instruction format (immediate addressing); an 8 bit displacement (coded in the instruction format); a 16 bit displacement (coded in the instruction format); a complete, 16 bit address; a short, 8 bit address; a logical, 32 bit address; the address (index) of an input/output (8 bit) port an 8 bit operand coded in the instruction format that specifies the type of an interrupt; the number of cells that an operand can be shifted or rotated with; effective address;

-1-

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

Number of states calculus: cAE effective address calculus time (measured in number of states): direct addressing: AE = disp8|disp16 indexed addressing: AE = (SI)|(DI) + disp8|disp16 indirect implicit addressing: AE = (SI)|(DI) direct base relative addressing (no displacement): AE = (BX) direct base relative addressing (with displacement): AE = (BX) + disp8|disp16 indexed base relative addressing: AE = (BX) + (SI)|(DI) + disp8|disp16 implicit base relative addressing: AE = (BX) + (SI)|(DI) direct stack addressing (no displacement): AE = (BP) direct stack addressing (with displacement): AE = (BP) + disp8|disp16 indexed stack addressing: AE = (BP) + (SI)|(DI) + disp8|disp16 implicit stack addressing: AE = (BP) + (SI)|(DI)

6 states 9 states 5 states 5 states 9 states 12 states 8 states 5 states 9 states 12 states 8 states

-2-

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

AAA Operands

ASCII adjustment for addition No. of states 4 Bytes 1

OF ?

DF

IF ?

TF ?

SF x

ZF ?

AF x

PF

CF

Examples AAA

AAD

Operands

ASCII adjustment OF DF ? for division (done before the division) No. of Bytes states 60 2 AAD

IF

TF

SF x

ZF x

AF ?

PF x

CF ?

Examples

AAM

Operands

ASCII adjustment OF DF ? for multiplication (done after the multiplication) No. of Bytes states 83 1 AAM

IF

TF

SF x

ZF x

AF ?

PF x

CF ?

Examples

AAS Operands

ASCII adjustment for subtraction No. of states 4 Bytes 1

OF ?

DF

IF

TF

SF ?

ZF ?

AF x

PF ?

CF x

Examples AAS

-3-

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

Add with carry ADC d,s Operands AL|AX, data r, data mem, data r1, r 2 r, mem mem, r No. of states 4 4 17+cAE 3 9+cAE 16+cAE Bytes 2-3 3-4 3-6 2 2-4 2-4

OF x

DF

IF

TF

SF x

ZF x

AF x

PF x

CF x

Examples ADC ADC ADC ADC ADC ADC AX,9D81H CL,36H [SI],2D31H BX,SI AX,[BX] [BX+SI+64H],DI

ADD

d,s Operands

Add without carry No. of states 4 4 17+cAE 3 9+cAE 16+cAE Bytes 2-3 3-4 3-6 2 2-4 2-4

OF x

DF

IF

TF

SF x

ZF x

AF x

PF x

CF x

Examples ADD ADD ADD ADD ADD ADD AX,0F0FH DX,0F0F0H [100H],2H SI,CX DI,[BX+22H] [BX+SI],CL

AL|AX, data r, data mem, data r1, r 2 r, mem mem, r

AND

d,s Operands

Logical AND No. of states 4 4 17+cAE 3 9+cAE 16+cAE Bytes 2-3 3-4 3-6 2 2-4 2-4

OF 0

DF

IF

TF

SF x

ZF x

AF ?

PF x

CF 0

Examples AND AND AND AND AND AND AL,7FH CX,0F0H [BX],01010000B AL,BL DL,[BX+SI] [DI+10H],AL

AL|AX, data r, data mem, data r1, r 2 r, mem mem, r

-4-

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

OF CALL adr Subprogram call

DF

IF

TF

SF

ZF

AF

PF

CF

No. of Bytes Examples states adr32 28 5 CALL PROC-ALT-SEG disp16 28 3 CALL SUMA r16 16 2 CALL BX mem* 21+cAE 2-4 CALL [BX] mem** 37+cAE 2-4 CALL [SI] * subprogram call with indirect addressing defined by the assembler directive as intra-segment call; ** subprogram call with indirect addressing defined by the assembler directive as inter-segment call.

Operands

CBW Operands

Byte to word conversion (with sign) No. of states 2

OF

DF

IF

TF

SF

ZF

AF

PF

CF

Bytes 1 CBW

Examples

OF CLC Operands Clear carry flag No. of states 2 Bytes 1

DF

IF

TF

SF

ZF

AF

PF

CF 0

Examples CLC

OF CLD Operands Clear direction flag No. of Bytes states 2 1

DF 0

IF

TF

SF

ZF

AF

PF

CF

Examples CLD

CLI Operands

Clear interrupt enable flag No. of states 2 Bytes 1

OF

DF

IF 0

TF

SF

ZF

AF

PF

CF

Examples CLI
-5-

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

OF CMC Operands Complement carry flag No. of Bytes states 2 1

DF

IF

TF

SF

ZF

AF

PF

CF x

Examples CMC

CMP

s1,s2 Operands

Compare operands No. of states 4 4 17+cAE 3 9+cAE 16+cAE Bytes 2-3 3-4 3-6 2 2-4 2-4

OF x

DF

IF

TF

SF x

ZF x

AF x

PF x

CF x

Examples CMP CMP CMP CMP CMP CMP AL,0DH SI,200H [BX+DI+55H],2222H CL,DH DH,[4321H] [BP+2],SI

AL|AX, data r, data mem, data r1, r 2 r, mem mem, r

Compare the current OF DF IF TF SF ZF AF PF CF x x x x x x elements of two arrays Operands No. of Bytes Examples states 22 1 CMPSB ;bytes comparison 22 1 CMPSW ;words comparison Obs.: CMPS can be prefixed by one of the repeatability prefixes: REP, REPE|REPZ or REPNE|REPNZ; these prefixes add 9 more states. CMPS

CWD Operands

Word to double word OF DF conversion (with sign) No. of Bytes states 5 1 CWD

IF

TF

SF

ZF

AF

PF

CF

Examples

-6-

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

DAA Operands

Decimal adjustment for addition No. of states 4 Bytes 1

OF ?

DF

IF

TF

SF x

ZF x

AF x

PF x

CF x

Examples DAA

DAS Operands

Decimal adjustment for subtraction No. of states 4 Bytes 1

OF ?

DF

IF

TF

SF x

ZF x

AF x

PF x

CF x

Examples DAS

DEC

s Operands

Decrement source No. of states 2 3 15+cAE Bytes 1 2 2-4

OF x

DF

IF

TF

SF x

ZF x

AF x

PF x

CF

Examples DEC DEC DEC CX BH [SI+20H]

r16 r8 mem

DIV

s Operands

Division No. of states 80- 90 144-162 86- 96+ cAE 150-168+ cAE Bytes 2 2 2-4 2-4

OF ?

DF

IF

TF

SF ?

ZF ?

AF ?

PF ?

CF ?

Examples DIV DIV DIV DIV BL CX [400H] [SI+10H]

r8 r16 mem8 mem16

OF ESC s Operands mem Escape No. of states 7 + cAE Bytes 2-4

DF

IF

TF

SF

ZF

AF

PF

CF

Examples ESC
-7-

[BX+SI]

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

OF HLT Operands Halt processor No. of states 2 Bytes 1

DF

IF

TF

SF

ZF

AF

PF

CF

Examples HLT

IDIV

Signed integer division No. of states 101-112 165-184 107-118+ cAE 171-190+ cAE Bytes 2 2 2-4 2-4

OF ?

DF

IF

TF

SF ?

ZF ?

AF ?

PF ?

CF ?

Operands r8 r16 mem8 mem16

Examples IDIV IDIV IDIV IDIV CL BX [SI+100H] [BX+1000H]

IMUL

Signed integer multiply No. of states 80- 98 128-154 86-104+ cAE 134-160+ cAE Bytes 2 2 2-4 2-4

OF x

DF

IF

TF

SF ?

ZF ?

AF ?

PF ?

CF x

Operands r8 r16 mem8 mem16

Examples IMUL IMUL IMUL IMUL CL BX [BX] [BP+DI+30H]

IN

d,s Operands

Input from port (to accumulator) No. of states 10 8 Bytes 2 1

OF

DF

IF

TF

SF

ZF

AF

PF

CF

Examples IN IN AL,1FH AX,DX

AL|AX, port AL|AX, DX

-8-

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

INC

s Operands

Increment source No. of states 2 3 15+cAE Bytes 1 2 2-4

OF x

DF

IF

TF

SF x

ZF x

AF x

PF x

CF

Examples INC INC INC SI BL [BX+SI]

r16 r8 mem

OF INT [tip] Operands Software interrupt request No. of Bytes states 52 1 51 2

DF

IF 0

TF 0

SF

ZF

AF

PF

CF

Examples INT ; type 3 interrupt INT 67

tip (tip<>3)

INTO Operands

Interrupt on overflow (type 4) No. of states 53 or 4 Bytes 1

OF

DF

IF 0

TF 0

SF

ZF

AF

PF

CF

Examples INTO

IRET Operands

Interrupt return No. of states 24 Bytes 1

OF x

DF x

IF x

TF x

SF x

ZF x

AF x

PF x

CF x

Examples IRET

JA | JNBE disp8 Operands disp8

Jump if above | OF DF IF Jump if not below or equal (unsigned) No. of Bytes states 16 or 4 2 JA ET1

TF

SF

ZF

AF

PF

CF

Examples ;jump if ;(CF) or (ZF) = 0

-9-

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

JAE|JNB|JNC disp8 Operands disp8

Jump if above or OF DF IF equal | jump if not below | jump if not carry (unsigned) No. of Bytes states 16 or 4 2 JAE ET2

TF

SF

ZF

AF

PF

CF

Examples ;jump if (CF)=0

JB|JNAE|JC disp8 Operands disp8

jump if below | OF DF IF jump if not above or equal | jump if carry (unsigned) No. of Bytes states 16 or 4 2 JB ET3

TF

SF

ZF

AF

PF

CF

Examples ;jump if (CF)=1

JBE | JNA disp8 Operands disp8

Jump if below or OF DF IF equal | jump if not above (unsigned) No. of Bytes states 16 or 4 2 JNA ET4

TF

SF

ZF

AF

PF

CF

Examples ;jump if ;(CF)=1 or (ZF)=1

OF JCXZ disp8 Operands disp8 jump if (CX) = 0 No. of states 16 or 4 Bytes 2

DF

IF

TF

SF

ZF

AF

PF

CF

Examples JCXZ GATA

JE | JZ disp8 Operands disp8

Jump if equal | OF DF IF jump if zero (signed) No. of Bytes states 16 or 4 2 JZ ET5

TF

SF

ZF

AF

PF

CF

Examples ;jump if (ZF)=1

- 10 -

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

JG | JNLE disp8 Operands disp8

Jump if greater | OF DF IF TF SF ZF AF PF jump if not lower or equal (signed) No. of Bytes Examples states 16 or 4 2 JG ET6 ;jump if ;((SF)(OF))or(ZF)=0

CF

JGE | JNL disp8 Operands disp8

Jump if greater or OF DF IF equal | jump if not lower (signed) No. of Bytes states 16 or 4 2 JGE ET7

TF

SF

ZF

AF

PF

CF

Examples ;jump if ;(SF)(OF)=0

JL | JNGE disp8 Operands disp8

Jump if lower OF DF IF | jump if not greater or equal (signed) No. of Bytes states 16 or 4 2 JL ET8

TF

SF

ZF

AF

PF

CF

Examples ;jump if ;(SF)(OF)=1

JLE | JNG disp8 Operands disp8

Jump if lower or OF DF IF TF SF ZF AF PF equal | jump if not greater (signed) No. of Bytes Examples states 16 or 4 2 JNG ET9 ;jump if ;((SF)(OF))or(ZF)=1

CF

- 11 -

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

OF DF IF TF SF ZF AF PF CF Jump (unconditioned) Operands No. of Bytes Examples states adr32 15 5 JMP OTHER_SEGMENT_LABEL disp16 15 3 JMP IN_SEGMENT_LABEL disp8 15 2 JMP SHORT_JUMP_LABEL r16 11 2 JMP CX mem* 18+cAE 2-4 JMP [BX+100H] mem** 24+cAE 2-4 JMP [DI] * jump with indirect addressing defined by the assembler directive as intrasegment jump; ** jump with indirect addressing defined by the assembler directive as intersegment jump; JMP adr

JNE | JNZ disp8 Operands disp8

Jump if not equal | OF DF IF TF SF ZF AF PF jump if not zero (signed) No. of Bytes Examples states 16 or 4 2 JNE ET10 ;jump if (ZF)=0

CF

JNO

disp8 Operands

Jump if not overflow No. of states 16 or 4 Bytes 2

OF

DF

IF

TF

SF

ZF

AF

PF

CF

Examples JNO ET11 ;jump if (OF)=0

disp8

JNP | JPO disp8 Operands disp8

Jump if not parity OF DF IF TF SF ZF AF PF | jump if parity odd No. of Bytes Examples states 16 or 4 2 JPO ET12 ;jump if (PF)=0

CF

- 12 -

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

Jump if not sign JNS disp8 Operands disp8 No. of states 16 or 4 Bytes 2

OF

DF

IF

TF

SF

ZF

AF

PF

CF

Examples JNS ET13 ;jump if (SF)=0

OF JO disp8 Operands disp8 Jump if overflow No. of states 16 or 4 Bytes 2 JO

DF

IF

TF

SF

ZF

AF

PF

CF

Examples ET14 ;jump if (OF)=1

JP | JPE disp8 Operands disp8

Jump if parity | jump if parity even No. of states 16 or 4 Bytes 2

OF

DF

IF

TF

SF

ZF

AF

PF

CF

Examples JPO ET15 ;jump if (PF)=1

OF JS disp8 Operands disp8 Jump if sign No. of states 16 or 4 Bytes 2 JS

DF

IF

TF

SF

ZF

AF

PF

CF

Examples ET16 ;jump if (SF)=1

OF LAHF Operands Load flags into AH No. of states 4 Bytes 1

DF

IF

TF

SF

ZF

AF

PF

CF

Examples LAHF

- 13 -

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

LDS

d,s Operands

r16, mem32

Load register OF DF IF TF SF ZF (destination) and data segment (DS) No. of Bytes Examples states 16+cAE 2-4 LDS SI,[10H]

AF

PF

CF

LEA

d,s Operands

r16, mem16

Load register OF DF IF TF SF ZF AF (destination) with effective address No. of Bytes Examples states 2+cAE 2-4 LEA BX,[BX+SI+0FFFH]

PF

CF

LES

d,s

Operands r16, mem32

Load register OF DF IF TF SF ZF (destination) and extended data segment (ES) No. of Bytes Examples states 16+cAE 2-4 LES DI,[BX]

AF

PF

CF

OF LOCK Operands mem Lock the system bus No. of states 2 Bytes 1

DF

IF

TF

SF

ZF

AF

PF

CF

Examples LOCK XCHG CL,BL

LODS

Operands

Load string OF DF Loads the current string component into the accumulator No. of Bytes states 12 1 LODSB 12 1 LODSW

IF

TF

SF

ZF

AF

PF

CF

Examples ; loads one byte ; loads one word

- 14 -

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

OF LOOP disp8 Operands disp8 Unconditioned loop No. of states 9 or 5 Bytes 2

DF

IF

TF

SF

ZF

AF

PF

CF

Examples LOOP CICLU_1

LOOPE|LOOPZ disp8 Operands disp8

Loop if equal | loop if zero No. of states 11 or 5 Bytes 2

OF

DF

IF

TF

SF

ZF

AF

PF

CF

Examples LOOPE CICLU_2

LOOPNE | LOOPNZ disp8 Operands disp8

Loop if not equal | loop if not zero No. of states 11 or 5 Bytes 2

OF

DF

IF

TF

SF

ZF

AF

PF

CF

Examples LOOPNE CICLU_3

Copies a byte or OF DF word from source to destination Operands No. of Bytes states r, data 4 2-3 MOV , data 10+cAE 3-6 MOV AL|AX, mem 10 3 MOV mem, AL|AX 10 3 MOV r1, r 2 2 2 MOV r, mem 8+cAE 2-4 MOV mem, r 9+cAE 2-4 MOV rs*, r16 2 2 MOV rs*, mem16 8+cAE 2-4 MOV r16, rs 2 2 MOV mem16, rs 9+cAE 2-4 MOV * any segment register except CS MOV d,s

IF

TF

SF

ZF

AF

PF

CF

Examples CX,3168H [BX],491FH AL,[1064H] [1064H],AX AX,CX BP,[BX+DELTA] [DI+100H],CX SS,DX DS,[1000H] BP,SS [2000H],CS

- 15 -

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

Copies the current OF DF IF TF SF ZF AF PF CF component of the source string into the current component of the destination string Operands No. of Bytes Examples states 18 1 MOVSB ; moves one byte 18 1 MOVSW ; moves one word Obs.: MOVS can be prefixed by the repeatability prefix REP; this prefix adds 9 more states. MOVS

MUL

s Operands

r8 r16 mem8 mem16

OF DF Unsigned integer x multiplication No. of Bytes states 70- 77 2 MUL 118-133 2 MUL 76- 83+ 2-4 MUL cAE 124-139+ 2-4 MUL cAE

IF

TF

SF ?

ZF ?

AF ?

PF ?

CF x

Examples BL CX [SI+300H] [200H]

NEG

s Operands

Negate source (2s complement) Bytes 2 2-4

OF x

DF

IF

TF

SF x

ZF x

AF x

PF x

CF 1*

No. of states r 3 mem 16+cAE * (CF) = 0 if (s) = 0H

Examples NEG NEG AL [BX]

NOT

s Operands

Logical NOT (1s complement) No. of states 3 16+cAE Bytes 2 2-4

OF

DF

IF

TF

SF

ZF

AF

PF

CF

Examples NOT NOT BL [1000H]

r mem

- 16 -

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

OR

d,s Operands

Logical OR No. of states 4 4 17+cAE 3 9+cAE 16+cAE Bytes 2-3 3-4 3-6 2 2-4 2-4

OF 0

DF

IF

TF

SF x

ZF x

AF ?

PF x

CF 0

Examples OR OR OR OR OR OR AX,3030H CX,001FH [BX+DI],1F1FH AH,BH DX,[DI] [BX],AX

AL|AX, data r, data mem, data r1, r 2 r, mem mem, r

OUT

d,s Operands

Output to port (from accumulator) No. of states 10 8 Bytes 2 1

OF

DF

IF

TF

SF

ZF

AF

PF

CF

Examples OUT OUT 44,AX DX,AL

port, AL|AX DX, AL|AX

POP

d Operands

Pop from stack (to destination) No. of states 8 17+cAE 8 Bytes 1 2-4 1

OF

DF

IF

TF

SF

ZF

AF

PF

CF

Examples POP POP POP BX [SI] ES

r16 mem16 rs (nu CS)

POPF Operands

Pop from stack to flags register No. of states 8 Bytes 1

OF x

DF x

IF x

TF x

SF x

ZF x

AF x

PF x

CF x

Examples POPF

- 17 -

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

PUSH

Push (source) on stack No. of states 11 16+cAE 10 Bytes 1 2-4 1

OF

DF

IF

TF

SF

ZF

AF

PF

CF

Operands r16 mem16 rs

Examples PUSH PUSH PUSH SI [BX] DS

PUSHF Operands

Push the flags register on stack No. of states 10 Bytes 1

OF

DF

IF

TF

SF

ZF

AF

PF

CF

Examples PUSHF

RCL s, nrcel Operands r, 1 r, CL mem, 1 mem, CL

Rotate carry left No. of states 2 8 +4/bit 15+cAE 20+cAE +4/bit Bytes 2 2 2-4 2-4

OF x

DF

IF

TF

SF

ZF

AF

PF

CF x

Examples RCL RCL RCL RCL AX,1 BL,CL ALFA,1 [DI+ALFA],CL

RCR s, nrcel Operands r, 1 r, CL mem, 1 mem, CL

Rotate carry right No. of states 2 8 +4/bit 15+cAE 20+cAE +4/bit Bytes 2 2 2-4 2-4

OF x

DF

IF

TF

SF

ZF

AF

PF

CF x

Examples RCR RCR RCR RCR BX,1 CX,CL [BX+20],1 [SI],CL

- 18 -

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

REP Operands

Repeat OF DF IF TF SF ZF (unconditionally) string operation No. of Bytes Examples states 9 1 REP MOVSB

AF

PF

CF

REPE | REPZ

Operands

Repeat while equal OF DF IF TF SF ZF | while zero the CMPS or SCAS instruction No. of Bytes Examples states 9 1 REPE CMPSB

AF

PF

CF

REPNE|REPNZ

Operands

Repeat while not OF DF equal | while not zero the CMPS or SCAS instruction No. of Bytes states 9 1 REPNE

IF

TF

SF

ZF

AF

PF

CF

Examples SCASW

RET [data16] Operands

Return from subprogram No. of states 8 12 18 17 Bytes 1 3 1 3

OF

DF

IF

TF

SF

ZF

AF

PF

CF

Examples RET RET RET RET ;intra-segment ;intra-segment ;inter-segment ;inter-segment

data16 data16

4 2

- 19 -

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

ROL s, nrcel Operands r, 1 r, CL mem, 1 mem, CL

Rotate left No. of states 2 8 +4/bit 15+cAE 20+cAE +4/bit Bytes 2 2 2-4 2-4

OF x

DF

IF

TF

SF

ZF

AF

PF

CF x

Examples ROL ROL ROL ROL DI,1 BX,CL [DI+DELTA],1 [BX+DI],CL

ROR s, nrcel Operands r, 1 r, CL mem, 1 mem, CL

Rotate right No. of states 2 8 +4/bit 15+cAE 20+cAE +4/bit Bytes 2 2 2-4 2-4

OF x

DF

IF

TF

SF

ZF

AF

PF

CF x

Examples ROR ROR ROR ROR CX,1 BX,CL [SI],1 BETA,CL

SAHF Operands

Store AH in the flags register (F) No. of states 4 Bytes 1

OF

DF

IF

TF

SF x

ZF x

AF x

PF x

CF x

Examples SAHF

SAL | SHL s,nrcel Operands r, 1 r, CL mem, 1 mem, CL

Shift right arithmetic | logical No. of states 2 8 +4/bit 15+cAE 20+cAE +4/bit

OF x Bytes 2 2 2-4 2-4

DF

IF

TF

SF x

ZF x

AF ?

PF x

CF x

Examples SHL SAL SHL SHL AL,1 SI,CL [DI+100H],1 [BP+SI],CL

- 20 -

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

SAR s, nrcel Operands r, 1 r, CL mem, 1 mem, CL

Shift arithmetic right No. of states 2 8 +4/bit 15+cAE 20+cAE +4/bit Bytes 2 2 2-4 2-4

OF x

DF

IF

TF

SF x

ZF x

AF ?

PF x

CF x

Examples SAR SAR SAR SAR AH,1 DI,CL [BP],1 [DI],CL

SBB

d,s Operands

AL|AX, data r, data mem, data r1, r 2 r, mem mem, r

Subtract with borrow No. of states 4 4 17+cAE 3 9+cAE 16+cAE

OF x Bytes 2-3 3-4 3-6 2 2-4 2-4

DF

IF

TF

SF x

ZF x

AF x

PF x

CF x

Examples SBB SBB SBB SBB SBB SBB AX,4D2CH CL,1 [BP+SI],3F8H BL,DL DI,[BX+ALFA] [SI+100],AX

Scan string OF DF IF TF SF ZF AF PF CF x x x x x x (compares the current string element with the accumulator) Operands No. of Bytes Examples states 15 1 SCASB ; compares one byte 15 1 SCASW ; compares one word Obs.: CMPS can be prefixed by one of the repeatability prefixes: REP, REPE|REPZ or REPNE|REPNZ; these prefixes add 9 more states. SCAS

- 21 -

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

SHR s, nrcel Operands r, 1 r, CL mem, 1 mem, CL

Shift right (logical) No. of states 2 8 +4/bit 15+cAE 20+cAE +4/bit Bytes 2 2 2-4 2-4

OF x

DF

IF

TF

SF x

ZF x

AF ?

PF x

CF x

Examples SHR SHR SHR SHR BL,1 SI,CL [BP+SI],1 [BX+DI+BETA],CL

OF STC Operands Set carry flag No. of states 2 Bytes 1

DF

IF

TF

SF

ZF

AF

PF

CF 1

Examples STC

OF STD Operands Set direction flag No. of states 2 Bytes 1

DF 1

IF

TF

SF

ZF

AF

PF

CF

Examples STD OF DF

STI Operands

Set interrupt flag No. of states 2 Bytes 1 STI

IF 1

TF

SF

ZF

AF

PF

CF

Examples

- 22 -

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

Store string OF DF IF TF SF ZF AF PF CF (stores the current component of the string in the accumulator) Operands No. of Bytes Examples states 11 1 STOSB ; store one byte 11 1 STOSW ; store one word Obs.: STOS can be prefixed by the repeatability prefix REP; this prefix adds 9 more states. STOS

SUB

d,s Operands

Subtract No. of states 4 4 17+cAE 3 9+cAE 16+cAE Bytes 2-3 3-4 3-6 2 2-4 2-4

OF x

DF

IF

TF

SF x

ZF x

AF x

PF x

CF x

Examples SUB SUB SUB SUB SUB SUB AL,65H SI,5280 [SI+14H],136H CX,BX DH,[BP+4] [BP+10],CL

AL|AX, data r, data mem, data r1, r 2 r, mem mem, r

TEST

s1,s2

Operands AL|AX, data r, data mem, data r1, r 2 r, mem

Test OF DF 0 (compares the two values without storing the result) No. of Bytes states 4 2-3 TEST 5 3-4 TEST 11+cAE 3-6 TEST 3 2 TEST 9+cAE 2-4 TEST

IF

TF

SF x

ZF x

AF ?

PF x

CF 0

Examples AX,0040H SI,0050 [BP],00100000B SI,DI AL,[55H]

OF WAIT Operands Wait for coprocessor No. of states

DF

IF

TF

SF

ZF

AF

PF

CF

Bytes 1 WAIT

Examples

- 23 -

Politehnica University of Bucharest Electronics, Telecommunications and Information Technology Faculty Corneliu Burileanu

Microprocessors Architecture Lab guide Appendix

OF XCHG d,s Exchange values No. of states 3 4 17 + cAE Bytes 1 2 2-4

DF

IF

TF

SF

ZF

AF

PF

CF

Operands r16 r1, r 2 r, mem

Examples XCHG XCHG XCHG BX ;exchanges AX and BX AL,BL BX,[BP+SI]

OF XLAT Operands Translate byte No. of states 11 Bytes 1

DF

IF

TF

SF

ZF

AF

PF

CF

Examples XLAT

XOR

d,s Operands

AL|AX, data r, data mem, data r1, r 2 r, mem mem, r

OF DF 0 Logical Exclusive OR No. of Bytes states 4 2-3 XOR 4 3-4 XOR 17+cAE 3-6 XOR 3 2 XOR 9+cAE 2-4 XOR 16+cAE 2-4 XOR

IF

TF

SF x

ZF x

AF ?

PF x

CF 0

Examples AX,5522H SI,00C2H [BX+DI],2244H CX,BX AX,[SI] [SI+ALFA],DX

- 24 -

Anda mungkin juga menyukai