SlideShare a Scribd company logo
DATA TRANSFER INSTRUCTIONS
 PUSH Operand:
 It pushes the operand into top of stack.
 E.g.: PUSH BX
 POP Des:
 It pops the operand from top of stack to Des.
 Des can be a general purpose register, segment register (except CS) or memory
location.
 E.g.: POP AX
Microprocessor.pptx
Microprocessor.pptx
Data Transfer Instructions
IN Accumulator, Port Address:
• It transfers the operand from specified port to accumulator register.
• E.g.: IN AX, 0028 H
OUT Port Address, Accumulator:
• It transfers the operand from accumulator to specified port.
• E.g.: OUT 0028 H, AX
LEA Register, Src [Load Effective Address]
• It loads a 16-bit register with the offset address of the data specified by the
Src.
E.g.: LEA BX, [DI]
• This instruction loads the contents of DI (offset) into the BX register.
Data Transfer Instructions
LES Des, Src [load ES register]
• It loads 32-bit pointer from memory source to destination register and ES.
• The offset is placed in the destination register and the segment is placed in ES.
• This instruction is very similar to LDS except that it initializes ES instead of DS.
• E.g.: LES BX, [0301 H]
Data Transfer Instructions
LAHF:
It copies the lower byte of flag register to AH.
SAHF:
It copies the contents of AH to lower byte of flag register.
PUSHF:
Pushes flag register to top of stack.
POPF:
Pops the stack top to flag register.
Data Transfer Instructions
Arithmetic Instructions
MUL Src:
• It is an unsigned multiplication instruction.
• It multiplies two bytes to produce a word or two words to produce a double word.
AX = AL * Src
DX : AX = AX * Src
• This instruction assumes one of the operand in AL or AX.
• Src can be a register or memory location.
IMUL Src:
• It is a signed multiplication instruction.
8 bit multiplication
 AL is multiplicand.
 AX keeps the result
 MOV AL,10h ; AL = 10h
 MOV CL,13h ; CL = 13h
 IMUL CL ; AX = 0130h
• AX is multiplicand
• DX:AX keep the result
• MOV AX,0100h ; AX = 0100h
• MOV BX,1234h ; BX = 1234h
• IMUL BX ; DX = 0012h
; AX = 3400h
16 bit multiplication
DIV Src:
• It is an unsigned division instruction.
• It divides word by byte or double word by word.
• The operand is stored in AX, divisor is Src and the result is stored as:
• AH = remainder AL = quotient
IDIV Src:
• It is a signed division instruction.
Arithmetic Instructions
 AL is dividend
 AL keep the result
 AH keep the remainder
 MOV AX, 0017h
 MOV BX, 0010h
 DIV BL ; AX = 0701
8 bit division
16 bit division
 DX:AX dividend.
 AX keep the result, DX keep the remainder.
 MOV AX,4022h ;
 MOV DX,0000h ;
 MOV CX,1000h ;
 DIV CX ;AX = 0004
;DX = 0022
Arithmetic Instructions
CBW (Convert Byte to Word):
• This instruction converts byte in AL to word in AX.
• The conversion is done by extending the sign bit of AL throughout AH.
CWD (Convert Word to Double Word):
• This instruction converts word in AX to double word in DX : AX.
• The conversion is done by extending the sign bit of AX throughout DX.
 MOV AL,22h
 CBW ; AX=0022h
 MOV AL,90h
 CBW ; AX=FF90h
 MOV AX, 3422h
 CWD ; DX=0000h
; AX=3422h
Ex. Conversion
BIT MANIPULATION INSTRUCTIONS
• These instructions are used at the bit level.
• These instructions can be used for:
Testing a zero bit
Set or reset a bit
Shift bits across registers
BIT MANIPULATION INSTRUCTIONS
XOR Des, Src:
• It performs XOR operation of Des and Src.
• Src can be immediate number, register or memory location.
• Des can be register or memory location.
• Both operands cannot be memory locations at the same time.
• CF and OF become zero after the operation.
• PF, SF and ZF are updated.
Bit Manipulation Instructions
SHL Des, Count:
• It shiftS bits of byte or word left, by count.
• It puts zero(s) in LSBs.
• MSB is shifted into carry flag.
• If the number of bits desired to be shifted is 1, then the immediate
number 1 can be written in Count.
• However, if the number of bits to be shifted is more than 1, then the
count is put in CL register.
Bit Manipulation Instructions
SHR Des, Count
• It shift bits of byte or word right, by count.
• It puts zero(s) in MSBs.
• LSB is shifted into carry flag.
• If the number of bits desired to be shifted is 1, then the immediate
number 1 can be written in Count.
• However, if the number of bits to be shifted is more than 1, then the
count is put in CL register.
SAL Des, Count:
• It shiftS bits of byte or word left, by count.
• It puts zero(s) in LSBs.
• MSB is shifted into carry flag.
• If the number of bits desired to be shifted is 1, then the immediate number 1 can be
written in Count.
• However, if the number of bits to be shifted is more than 1, then the count is put in CL
register.
Bit Manipulation Instructions
Bit Manipulation Instructions
SAR Des, Count
•It shift bits of byte or word right, by count.
•It does not change MSB, rather MSB is copied to the next bit and retains its value.
•LSB is shifted into carry flag.
•If the number of bits desired to be shifted is 1, then the immediate number 1 can be written in
Count.
•However, if the number of bits to be shifted is more than 1, then the count is put in CL register.
Bit Manipulation Instructions
Bit Manipulation Instructions
ROL Des, Count
• It rotates bits of byte or word left, by count.
• MSB is transferred to LSB and also to CF.
• If the number of bits desired to be shifted is 1, then the immediate number 1 can be
written in Count.
• However, if the number of bits to be shifted is more than 1, then the count is put in
CL register.
Bit Manipulation Instructions
ROR Des, Count:
• It rotates bits of byte or word right, by count.
• LSB is transferred to MSB and also to CF.
• If the number of bits desired to be shifted is 1, then the immediate
number 1 can be written in Count.
• However, if the number of bits to be shifted is more than 1, then the
count is put in CL register.
Bit Manipulation Instructions
• RCR Des, Count
• Used to rotate bits of byte/word towards the right, i.e. LSB to CF and CF to MSB.
• RCL Des, Count
• Used to rotate bits of byte/word towards the left, i.e. MSB to CF and CF to LSB.
PROGRAM EXECUTION TRANSFER INSTRUCTIONS
• These instructions cause change in the sequence of the execution of instruction.
• This change can be through a condition or sometimes unconditional.
• The conditions are represented by flags.
PROGRAM EXECUTION TRANSFER INSTRUCTIONS
• CALL Des:
• This instruction is used to call a subroutine or function or procedure.
• The address of next instruction after CALL is saved onto stack.
• RET:
• It returns the control from procedure to calling program.
• Every CALL instruction should have a RET.
JMP Des:
This instruction is used for unconditional jump from one place to another.
Jxx Des (Conditional Jump):
All the conditional jumps follow some conditional statements or any instruction that
affects the flag.
PROGRAM EXECUTION TRANSFER INSTRUCTIONS
Mnemonic 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 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
JZ Jump if Zero ZF = 1
Loop Des:
• This is a looping instruction.
• The number of times looping is required is placed in the CX register.
• With each iteration, the contents of CX are decremented.
• ZF is checked whether to loop again or not.
PROGRAM EXECUTION TRANSFER INSTRUCTIONS
String Instructions
• String in assembly language is just a sequentially stored bytes or words.
• There are very strong set of string instructions in 8086.
• By using these string instructions, the size of the program is considerably reduced.
• CMPS Des, Src
• It compares the string bytes or words.
• SCAS String
• It scans a string.
• It compares the String with byte in AL or with word in AX.
String Instructions
• MOVS / MOVSB / MOVSW:
• It causes moving of byte or word from one string to another.
• In this instruction, the source string is in Data Segment and destination string is in Extra
Segment.
• SI and DI store the offset values for source and destination index.
String Instructions
• REP (Repeat):
• This is an instruction prefix.
• It causes the repetition of the instruction until CX becomes zero.
• E.g.: REP MOVSB STR1, STR2
• It copies byte by byte contents.
• REP repeats the operation MOVSB until CX becomes zero.
String Instructions
Processor Control instruction
• STC:
• It sets the carry flag to 1.
• CLC:
• It clears the carry flag to 0.
• CMC:
• It complements the carry flag.
• STD:
• It sets the direction flag to 1.
• If it is set, string bytes are accessed from higher memory address to lower memory address.
• CLD:
• It clears the direction flag to 0.
• If it is reset, the string bytes are accessed from lower memory address to higher memory address.
Processor Control instruction
These instructions are used to execute the given instructions for a number of times.
Following is the list of instructions under this group −
•LOOP − Used to loop a group of instructions until the condition satisfies, i.e., CX = 0
•LOOPE/LOOPZ − Used to loop a group of instructions till it satisfies ZF = 1 & CX = 0
•LOOPNE/LOOPNZ − Used to loop a group of instructions till it satisfies ZF = 0 & CX = 0
•JCXZ − Used to jump to the provided address if CX = 0
Iteration Control Instructions
These instructions are used to call the interrupt during program execution.
INT
• Used to interrupt the program during execution and calling service specified.
INTO
• Used to interrupt the program during execution if OF = 1.
IRET
•Used to return from interrupt service to the main program.
Interrupt Instructions

More Related Content

PPTX
ppt-U2 - (Instruction Set of 8086, Simple programs).pptx
PPT
8086 microprocessor assembler directives.ppt
PPT
Instruction set
PPT
Types of instructions
PPT
An instruction is a binary pattern designed inside a microprocessor to perfor...
PPTX
Instruction Set Of 8086 DIU CSE
PPTX
EPC Module-5 ES.pptxModule-5 ES.pptxModule-5 ES.pptx
PPTX
Chapter3 8086inst logical 2
ppt-U2 - (Instruction Set of 8086, Simple programs).pptx
8086 microprocessor assembler directives.ppt
Instruction set
Types of instructions
An instruction is a binary pattern designed inside a microprocessor to perfor...
Instruction Set Of 8086 DIU CSE
EPC Module-5 ES.pptxModule-5 ES.pptxModule-5 ES.pptx
Chapter3 8086inst logical 2

Similar to Microprocessor.pptx (20)

PPTX
Chap3 8086 logical
PPTX
Arithmetic instructions
PPTX
Arithmetic instrctions
PDF
8086 instructions
PPTX
Arithmetic and logical instructions set
PPTX
Instruction sets of 8086
PPT
Instruction set Madha Insstitute of Engineering
PPTX
8086 Instruction set
PPT
INTRUCTION SET OF 8086 FOR MICROPROCESSOR
PPT
Chap 3_2.ppt
PDF
Embedded system and arm with different module
PPTX
MES_MODULE 2.pptx
PPT
Instructions_introductionM2.1.about.microcontrollerppt
PPTX
Assembly language programs
PDF
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
PPTX
Loop instruction, controlling the flow of progam
PPT
Addressing mode and instruction set using 8051
PPTX
8086inst logical
PDF
Instruction set of 8086
PPT
Copy of 8086inst logical
Chap3 8086 logical
Arithmetic instructions
Arithmetic instrctions
8086 instructions
Arithmetic and logical instructions set
Instruction sets of 8086
Instruction set Madha Insstitute of Engineering
8086 Instruction set
INTRUCTION SET OF 8086 FOR MICROPROCESSOR
Chap 3_2.ppt
Embedded system and arm with different module
MES_MODULE 2.pptx
Instructions_introductionM2.1.about.microcontrollerppt
Assembly language programs
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Loop instruction, controlling the flow of progam
Addressing mode and instruction set using 8051
8086inst logical
Instruction set of 8086
Copy of 8086inst logical
Ad

Recently uploaded (20)

PDF
Basic Mud Logging Guide for educational purpose
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
Pre independence Education in Inndia.pdf
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
01-Introduction-to-Information-Management.pdf
PPTX
master seminar digital applications in india
PPTX
Cell Types and Its function , kingdom of life
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
Pharma ospi slides which help in ospi learning
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PPTX
Institutional Correction lecture only . . .
Basic Mud Logging Guide for educational purpose
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Anesthesia in Laparoscopic Surgery in India
Microbial diseases, their pathogenesis and prophylaxis
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Complications of Minimal Access Surgery at WLH
Pre independence Education in Inndia.pdf
TR - Agricultural Crops Production NC III.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
01-Introduction-to-Information-Management.pdf
master seminar digital applications in india
Cell Types and Its function , kingdom of life
Final Presentation General Medicine 03-08-2024.pptx
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Pharma ospi slides which help in ospi learning
Supply Chain Operations Speaking Notes -ICLT Program
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Institutional Correction lecture only . . .
Ad

Microprocessor.pptx

  • 1. DATA TRANSFER INSTRUCTIONS  PUSH Operand:  It pushes the operand into top of stack.  E.g.: PUSH BX  POP Des:  It pops the operand from top of stack to Des.  Des can be a general purpose register, segment register (except CS) or memory location.  E.g.: POP AX
  • 4. Data Transfer Instructions IN Accumulator, Port Address: • It transfers the operand from specified port to accumulator register. • E.g.: IN AX, 0028 H OUT Port Address, Accumulator: • It transfers the operand from accumulator to specified port. • E.g.: OUT 0028 H, AX
  • 5. LEA Register, Src [Load Effective Address] • It loads a 16-bit register with the offset address of the data specified by the Src. E.g.: LEA BX, [DI] • This instruction loads the contents of DI (offset) into the BX register. Data Transfer Instructions
  • 6. LES Des, Src [load ES register] • It loads 32-bit pointer from memory source to destination register and ES. • The offset is placed in the destination register and the segment is placed in ES. • This instruction is very similar to LDS except that it initializes ES instead of DS. • E.g.: LES BX, [0301 H] Data Transfer Instructions
  • 7. LAHF: It copies the lower byte of flag register to AH. SAHF: It copies the contents of AH to lower byte of flag register. PUSHF: Pushes flag register to top of stack. POPF: Pops the stack top to flag register. Data Transfer Instructions
  • 8. Arithmetic Instructions MUL Src: • It is an unsigned multiplication instruction. • It multiplies two bytes to produce a word or two words to produce a double word. AX = AL * Src DX : AX = AX * Src • This instruction assumes one of the operand in AL or AX. • Src can be a register or memory location. IMUL Src: • It is a signed multiplication instruction.
  • 9. 8 bit multiplication  AL is multiplicand.  AX keeps the result  MOV AL,10h ; AL = 10h  MOV CL,13h ; CL = 13h  IMUL CL ; AX = 0130h
  • 10. • AX is multiplicand • DX:AX keep the result • MOV AX,0100h ; AX = 0100h • MOV BX,1234h ; BX = 1234h • IMUL BX ; DX = 0012h ; AX = 3400h 16 bit multiplication
  • 11. DIV Src: • It is an unsigned division instruction. • It divides word by byte or double word by word. • The operand is stored in AX, divisor is Src and the result is stored as: • AH = remainder AL = quotient IDIV Src: • It is a signed division instruction. Arithmetic Instructions
  • 12.  AL is dividend  AL keep the result  AH keep the remainder  MOV AX, 0017h  MOV BX, 0010h  DIV BL ; AX = 0701 8 bit division
  • 13. 16 bit division  DX:AX dividend.  AX keep the result, DX keep the remainder.  MOV AX,4022h ;  MOV DX,0000h ;  MOV CX,1000h ;  DIV CX ;AX = 0004 ;DX = 0022
  • 14. Arithmetic Instructions CBW (Convert Byte to Word): • This instruction converts byte in AL to word in AX. • The conversion is done by extending the sign bit of AL throughout AH. CWD (Convert Word to Double Word): • This instruction converts word in AX to double word in DX : AX. • The conversion is done by extending the sign bit of AX throughout DX.
  • 15.  MOV AL,22h  CBW ; AX=0022h  MOV AL,90h  CBW ; AX=FF90h  MOV AX, 3422h  CWD ; DX=0000h ; AX=3422h Ex. Conversion
  • 16. BIT MANIPULATION INSTRUCTIONS • These instructions are used at the bit level. • These instructions can be used for: Testing a zero bit Set or reset a bit Shift bits across registers
  • 17. BIT MANIPULATION INSTRUCTIONS XOR Des, Src: • It performs XOR operation of Des and Src. • Src can be immediate number, register or memory location. • Des can be register or memory location. • Both operands cannot be memory locations at the same time. • CF and OF become zero after the operation. • PF, SF and ZF are updated.
  • 18. Bit Manipulation Instructions SHL Des, Count: • It shiftS bits of byte or word left, by count. • It puts zero(s) in LSBs. • MSB is shifted into carry flag. • If the number of bits desired to be shifted is 1, then the immediate number 1 can be written in Count. • However, if the number of bits to be shifted is more than 1, then the count is put in CL register.
  • 19. Bit Manipulation Instructions SHR Des, Count • It shift bits of byte or word right, by count. • It puts zero(s) in MSBs. • LSB is shifted into carry flag. • If the number of bits desired to be shifted is 1, then the immediate number 1 can be written in Count. • However, if the number of bits to be shifted is more than 1, then the count is put in CL register.
  • 20. SAL Des, Count: • It shiftS bits of byte or word left, by count. • It puts zero(s) in LSBs. • MSB is shifted into carry flag. • If the number of bits desired to be shifted is 1, then the immediate number 1 can be written in Count. • However, if the number of bits to be shifted is more than 1, then the count is put in CL register. Bit Manipulation Instructions Bit Manipulation Instructions
  • 21. SAR Des, Count •It shift bits of byte or word right, by count. •It does not change MSB, rather MSB is copied to the next bit and retains its value. •LSB is shifted into carry flag. •If the number of bits desired to be shifted is 1, then the immediate number 1 can be written in Count. •However, if the number of bits to be shifted is more than 1, then the count is put in CL register. Bit Manipulation Instructions
  • 22. Bit Manipulation Instructions ROL Des, Count • It rotates bits of byte or word left, by count. • MSB is transferred to LSB and also to CF. • If the number of bits desired to be shifted is 1, then the immediate number 1 can be written in Count. • However, if the number of bits to be shifted is more than 1, then the count is put in CL register.
  • 23. Bit Manipulation Instructions ROR Des, Count: • It rotates bits of byte or word right, by count. • LSB is transferred to MSB and also to CF. • If the number of bits desired to be shifted is 1, then the immediate number 1 can be written in Count. • However, if the number of bits to be shifted is more than 1, then the count is put in CL register.
  • 24. Bit Manipulation Instructions • RCR Des, Count • Used to rotate bits of byte/word towards the right, i.e. LSB to CF and CF to MSB. • RCL Des, Count • Used to rotate bits of byte/word towards the left, i.e. MSB to CF and CF to LSB.
  • 25. PROGRAM EXECUTION TRANSFER INSTRUCTIONS • These instructions cause change in the sequence of the execution of instruction. • This change can be through a condition or sometimes unconditional. • The conditions are represented by flags.
  • 26. PROGRAM EXECUTION TRANSFER INSTRUCTIONS • CALL Des: • This instruction is used to call a subroutine or function or procedure. • The address of next instruction after CALL is saved onto stack. • RET: • It returns the control from procedure to calling program. • Every CALL instruction should have a RET.
  • 27. JMP Des: This instruction is used for unconditional jump from one place to another. Jxx Des (Conditional Jump): All the conditional jumps follow some conditional statements or any instruction that affects the flag. PROGRAM EXECUTION TRANSFER INSTRUCTIONS
  • 28. Mnemonic 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 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 JZ Jump if Zero ZF = 1
  • 29. Loop Des: • This is a looping instruction. • The number of times looping is required is placed in the CX register. • With each iteration, the contents of CX are decremented. • ZF is checked whether to loop again or not. PROGRAM EXECUTION TRANSFER INSTRUCTIONS
  • 30. String Instructions • String in assembly language is just a sequentially stored bytes or words. • There are very strong set of string instructions in 8086. • By using these string instructions, the size of the program is considerably reduced.
  • 31. • CMPS Des, Src • It compares the string bytes or words. • SCAS String • It scans a string. • It compares the String with byte in AL or with word in AX. String Instructions
  • 32. • MOVS / MOVSB / MOVSW: • It causes moving of byte or word from one string to another. • In this instruction, the source string is in Data Segment and destination string is in Extra Segment. • SI and DI store the offset values for source and destination index. String Instructions
  • 33. • REP (Repeat): • This is an instruction prefix. • It causes the repetition of the instruction until CX becomes zero. • E.g.: REP MOVSB STR1, STR2 • It copies byte by byte contents. • REP repeats the operation MOVSB until CX becomes zero. String Instructions
  • 34. Processor Control instruction • STC: • It sets the carry flag to 1. • CLC: • It clears the carry flag to 0. • CMC: • It complements the carry flag.
  • 35. • STD: • It sets the direction flag to 1. • If it is set, string bytes are accessed from higher memory address to lower memory address. • CLD: • It clears the direction flag to 0. • If it is reset, the string bytes are accessed from lower memory address to higher memory address. Processor Control instruction
  • 36. These instructions are used to execute the given instructions for a number of times. Following is the list of instructions under this group − •LOOP − Used to loop a group of instructions until the condition satisfies, i.e., CX = 0 •LOOPE/LOOPZ − Used to loop a group of instructions till it satisfies ZF = 1 & CX = 0 •LOOPNE/LOOPNZ − Used to loop a group of instructions till it satisfies ZF = 0 & CX = 0 •JCXZ − Used to jump to the provided address if CX = 0 Iteration Control Instructions
  • 37. These instructions are used to call the interrupt during program execution. INT • Used to interrupt the program during execution and calling service specified. INTO • Used to interrupt the program during execution if OF = 1. IRET •Used to return from interrupt service to the main program. Interrupt Instructions