Instructionsetof8086 by Alwani

Preview:

Citation preview

By:

Himanshu Alwani

Venkatesh Sharma

14/10/14 1alwanihimanshu@gmail.com

Classification of Instruction SetData Transfer Instructions

Logical & Shift & Rotate Instructions

Arithmetic Instructions

String Instructions

Branch & Loop Instructions

Miscellaneous Instructions

2

Data Transfer InstructionsThese instructions are used to transfer data

from source to destination.

The operand can be a constant, memory location, register or I/O port address.

1. MOV-Copy byte or word from source to destination

2. PUSH-Copy specified word to top of stack

3

Data Transfer Inst.(continue)3. POP-Copy word from top of stack to specified

location

4. XCHG-Exchange bytes or exchange words

5. IN-Copy a byte or word from specified port to acc.

6. OUT-Copy a byte or word from acc.to specified port

7. XLAT-Translate a byte in AL using table in memory

8. LEA-Load Effective address of operand into specified register

9. LAHF-Load AH with the lower byte of the flag register

4

Data Transfer Inst.(continue)10. LDS/LES-Load pointer to DS/ES.i.e.loads DS/ES

register and other specified register from memory

5

Logical Instructions1. AND-AND each bit in a byte or word with the

corresponding bit in another byte or a word

2. OR-OR each bit in a byte or word with the corresponding bit in another byte or a word

3. NOT-Invert each bit of a byte or word

4. XOR-Exclusive-OR each bit in a byte or word with the corresponding bit in another byte or a word

5. TEST-AND operands to update flags,but don’t change operands

6

Shift & Rotate Instructions1. SHL/SAL-Shifts bits or byte or word left, put zero(‘s)

in LSB(‘s)

2. SHR-Shifts bits or byte or word right, put zero(‘s) in MSB(‘s)

3. SAR-Shifts bits or byte or word right, copy old MSB into new MSB

4. ROR-Rotate bits of byte or word right, LSB to MSB and to CF

5. ROL-Rotate bits of byte or word left, MSB to MSB and to CF

7

Shift & Rotate Instructions6. RCR-Rotate bits of byte or word right, LSB to CF and

CF to MSB.

7. RCL-Rotate bits of byte or word left, MSB to CF and CF to LSB

8

Arithmetic Instructions1. ADD-Add specified byte to byte or specified word to

word

2. ADC-Add byte + byte +CF or word+word+CF

3. INC- Increment specified byte or specified word by 1

4. DEC- Decrement specified byte or specified word by1

5. SUB-Subtract byte from byte or word from word

6. SBB- Subtract byte from byte with borrow(CF)

7. CMP-Compare to specified byte or specified word

8. NEG-Forms 2’s compliment

9

Arithmetic Instructions9. MUL- Multiply unsigned byte by byte or unsigned

word by word

10. IMUL- Multiply signed byte by byte or unsigned word by word

11. DIV- Divide unsigned word by byte or unsigned double word by word

12. IDIV- Divide signed word by byte or signed double word by word

13. AAA-ASCII adjust after addition

10

Arithmetic & ASCII Inst.14. AAS- ASCII adjust after subtraction

15. AAM-ASCII adjust after multiplication

16. AAD-ASCII adjust before division

17. DAA-Decimal(BCD) adjust after addition

18. DAS-Decimal(BCD) adjust after subtraction

19. CBW-Fill upper byte or word with copies of sign bit of lower byte

20. CWD-Fill upper word of double word with sign bit of lower word

11

String Instructions There are very strong set of string instructions in 8086.

By using these string instructions, the size of the program is considerably reduced.

1. REPE/REPZ-Repeat instruction on until CX=O or ZF not equals to 1

2. REP-Repeat instruction on until CX=O

3. MOVS/MOVSB/MOVSW-Move byte or word from one string to another

21-Nov-2010 12

String Instructions4. REPNE/REPNZ-Repeat until CX=O or ZF=1

5. CMPS/CMPSB/CMPSW-Compare two string bytes or two string words

6. SCAS/SCASB/SCASW-Scan a string. Compare a string byte with a byte in AL or a string word with a word in AX

21-Nov-2010 ohmshankar.ece@act.edu.in 13

Conditional Jump TableMnemonic Meaning Jump Condition

JA Jump if Above CF = 0 and ZF = 0

JAE Jump if Above or Equal CF = 0

JB Jump if Below CF = 1

JBE Jump if Below or Equal CF = 1 or ZF = 1

JC Jump if Carry CF = 1

JE/JZ Jump if Equal ZF = 1

JNC Jump if Not Carry CF = 0

JNE Jump if Not Equal ZF = 0

JNZ Jump if Not Zero ZF = 0

JPE Jump if Parity Even PF = 1

JPO Jump if Parity Odd PF = 0

JMP Unconditional Jump -

14

Branch & Loop Inst.1. CALL-Call a procedure(sub-program),save return

address on stack

2. RET- Return from procedure to calling program

3. JNO-Jump if not overflow(OF=0)

4. JO-Jump if OF=1

5. JS-Jump if SF=1

6. INTO-Interrupt program execution if OF=1

7. LOOP-Loop through a sequence of instructions until CX=O

15

Branch & Loop Inst.8. JCXZ-Jump to specified address if CX=O.

16

Miscellaneous Instructions1. CLC-Clear carry flag to zero

2. STC-Set the carry flag to ONE

3. STD-Set DF=1 and decrement SP

4. CMP-Compliment the state of carry flag(CF)

5. STI-Set IE=1(Enable INTR input)

6. CLD-Clear DF=O

7. HLT-Halt the programs

8. CLI-IE=O.(Disable INTR input)

9. WAIT-wait until signal on the TEST pin is low

17

Miscellaneous Instructions10. NOP-No action except fetch and decode

11. LOCK-Prevents another processor from taking the bus while the adjacent instruction executes.

18

19

Recommended