SlideShare a Scribd company logo
1 of 14
Byte and String Manipulation
Unit -1
Presented By
Mrs. M.P.Sasirekha
String Instruction in 8086
• The String Instruction in 8086 are namely,
• REP/REPE/REPZ/REPNE/REPNZ
• MOVS/MOVSB/MOVSN
• CMPS/CMPSB/CMPSW
• SCAS/SCASB/SCASW
• LODS/LODSB/LODSW
• STOS/STOSB/STOSW
REP/REPE/REPZ/REPNE/REPNZ
Instruction
• REP is a prefix which is written before one of the String
Instruction in 8086. These instructions repeat until specified
condition exists.
MOVS/MOVSB/MOVSW Instruction
• This instruction copies a byte or word from a location in the data
segment to a location in the extra segment.
• The offset of the source byte or word in the data segment must
be in the SI register.
• The offset of the destination in the extra segment must be
contained in the DI register.
• For multiple byte or multiple word moves the number of
elements to be moved is put in the CX register so that it can
function as a counter.
• After the byte or word is moved SI and DI are automatically
adjusted to point to the next source and the next destination.
MOVS/MOVSB/MOVSW Instruction
• If the direction flag is 0, then SI and DI will be incremented by 1
after a byte move and they will incremented by 2 after a word
move.
• If the DF is a 1, then SI and DI will be decremented by 1 after a
byte move and they will be decremented by 2 after a word
move.
• MOVS affects no flags.
• The way to tell the assembler whether to code the instruction for
a byte or word move is to add a “B” or a “W” to the MOVS
mnemonic.
• MOVSB, for example, says move a string as bytes. MOVSW
MOVS/MOVSB/MOVSW Instruction
CMPS/CMPSB/CMPSW Instruction
• A String Instruction in 8086 is a series of the same type of data
items in sequential memory locations.
• The CMPS instruction can be used to compare a byte in one
string with a byte in another string or to compare a word in one
string with a word in another string.
• SI is used to hold the offset of a byte or word in the source
string and DI is used to hold the offset of a byte or a word in the
other string. The comparison is done by subtracting the byte or
word pointed to by DI from the byte or word pointed to by SI.
• The AF, CF, OF, PF, SF, and ZF flags are affected by the
comparison, but neither operand is affected.
CMPS/CMPSB/CMPSW Instruction
• After the comparison SI and DI will be automatically
incremented or decremented according to direction flag to point
to the next element in the two strings (if DF = 0, SI and DI ↑ )
CX functions as a counter which is decremented after each
comparison.
• This will go on until CX = 0
SCAS/SCASB/SCASW Instruction
• SCAS compares a string byte with a byte in AL or a string word
with word in AX.
• The instruction affects the flags, but it does not change either
the operand in AL (AX) or the operand in the String Instruction
in 8086.
• The string to be ‘scanned must be in the extra segment and DI
must contain the offset of the byte or the word to be compared.
• After the comparison DI will be automatically incremented or
decremented according to direction flag, to point to the next
element in the two strings (if DF = 0, SI and DI ↑ ) CX functions
as a counter which is decremented after each comparison.
• This will go on until CX = 0. SCAS affects the AF, CF, OF, PF,
SF and ZF flags.
SCAS/SCASB/SCASW Instruction
LODS/LODSB/LODSW Instruction
• This instruction copies a byte from a string location pointed to
by SI to AL, or a word from a string location pointed to by SI to
AX. LODS does not affect any flags. LODSB copies byte and
LODSW copies a word.
STOS/STOSB/STOSW Instruction
• The STOS instruction copies a byte from AL or a word from AX
to a memory location in the extra segment.
• DI is used to hold the offset of the memory location in the extra
segment.
• After the copy, DI is automatically incremented or decremented
to point to the next string element in memory.
• If the direction flag, DF, is cleared, then DI will automatically be
incremented by one for a byte string or incremented by two for a
word String Instruction in 8086.
• If the direction flag is set, DI will be automatically decremented
by ono for a byte string or decremented by two for a word string.
STOS does not affect any flags. STOSB copies byte and
STOSW copies a word.
STOS/STOSB/STOSW Instruction
Thank you

More Related Content

What's hot

8086 instructions
8086 instructions8086 instructions
8086 instructionsRavi Anand
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086aviban
 
8086 instruction set (with simulator)
8086 instruction set (with simulator)8086 instruction set (with simulator)
8086 instruction set (with simulator)Aswini Dharmaraj
 
Memory banking-of-8086-final
Memory banking-of-8086-finalMemory banking-of-8086-final
Memory banking-of-8086-finalEstiak Khan
 
8086 pin details
8086 pin details8086 pin details
8086 pin detailsAJAL A J
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086Dr. AISHWARYA N
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051SARITHA REDDY
 
Addressing modes of 8086 - Binu Joy
Addressing modes of 8086 - Binu JoyAddressing modes of 8086 - Binu Joy
Addressing modes of 8086 - Binu JoyBinu Joy
 
Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor  Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor Mustapha Fatty
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086Akhila Rahul
 
Logical Instructions used in 8086 microprocessor
Logical Instructions used in 8086 microprocessorLogical Instructions used in 8086 microprocessor
Logical Instructions used in 8086 microprocessorRabin BK
 
80486 microprocessor
80486 microprocessor80486 microprocessor
80486 microprocessorMihika Shah
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086Vijay Kumar
 
Presentation on 8086 Microprocessor
Presentation  on   8086 MicroprocessorPresentation  on   8086 Microprocessor
Presentation on 8086 MicroprocessorNahian Ahmed
 
8237 dma controller
8237 dma controller8237 dma controller
8237 dma controllerTech_MX
 

What's hot (20)

8086 instructions
8086 instructions8086 instructions
8086 instructions
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
8086 instruction set (with simulator)
8086 instruction set (with simulator)8086 instruction set (with simulator)
8086 instruction set (with simulator)
 
Memory banking-of-8086-final
Memory banking-of-8086-finalMemory banking-of-8086-final
Memory banking-of-8086-final
 
8086 pin details
8086 pin details8086 pin details
8086 pin details
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051
 
8086
80868086
8086
 
Addressing modes of 8086 - Binu Joy
Addressing modes of 8086 - Binu JoyAddressing modes of 8086 - Binu Joy
Addressing modes of 8086 - Binu Joy
 
Module 1 8086
Module 1 8086Module 1 8086
Module 1 8086
 
Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor  Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor
 
Instruction types
Instruction typesInstruction types
Instruction types
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Logical Instructions used in 8086 microprocessor
Logical Instructions used in 8086 microprocessorLogical Instructions used in 8086 microprocessor
Logical Instructions used in 8086 microprocessor
 
80486 microprocessor
80486 microprocessor80486 microprocessor
80486 microprocessor
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Unit 2 mpmc
Unit 2 mpmcUnit 2 mpmc
Unit 2 mpmc
 
8086 memory segmentation
8086 memory segmentation8086 memory segmentation
8086 memory segmentation
 
Presentation on 8086 Microprocessor
Presentation  on   8086 MicroprocessorPresentation  on   8086 Microprocessor
Presentation on 8086 Microprocessor
 
8237 dma controller
8237 dma controller8237 dma controller
8237 dma controller
 

Similar to Byte and string manipulation 8086

Microprocessors-based systems (under graduate course) Lecture 8 of 9
Microprocessors-based systems (under graduate course) Lecture 8 of 9 Microprocessors-based systems (under graduate course) Lecture 8 of 9
Microprocessors-based systems (under graduate course) Lecture 8 of 9 Randa Elanwar
 
Microprocessor.pptx
Microprocessor.pptxMicroprocessor.pptx
Microprocessor.pptxNishatNishu5
 
String_manipulations.pdf
String_manipulations.pdfString_manipulations.pdf
String_manipulations.pdfAnonymous611358
 
Instruction Set Of 8086 DIU CSE
Instruction Set Of 8086 DIU CSEInstruction Set Of 8086 DIU CSE
Instruction Set Of 8086 DIU CSEsalmancreation
 
Chap 3_2.ppt
Chap 3_2.pptChap 3_2.ppt
Chap 3_2.pptinian2
 
N_Asm Assembly strings (sol)
N_Asm Assembly strings (sol)N_Asm Assembly strings (sol)
N_Asm Assembly strings (sol)Selomon birhane
 
Instructionsetof8086 by Alwani
Instructionsetof8086 by AlwaniInstructionsetof8086 by Alwani
Instructionsetof8086 by AlwaniHimanshu Alwani
 
Instruction set-of-8086
Instruction set-of-8086Instruction set-of-8086
Instruction set-of-8086mudulin
 
ppt-U2 - (Instruction Set of 8086, Simple programs).pptx
ppt-U2 - (Instruction Set of 8086, Simple programs).pptxppt-U2 - (Instruction Set of 8086, Simple programs).pptx
ppt-U2 - (Instruction Set of 8086, Simple programs).pptxRaviKiranVarma4
 
unit1.pdf
unit1.pdfunit1.pdf
unit1.pdfSaruM1
 
Assembly language
Assembly languageAssembly language
Assembly languagePiyush Jain
 
Unit 2 assembly language programming
Unit 2   assembly language programmingUnit 2   assembly language programming
Unit 2 assembly language programmingKartik Sharma
 
8086 instruction set
8086 instruction set8086 instruction set
8086 instruction setmeenakshi_l
 

Similar to Byte and string manipulation 8086 (20)

8086inst stringsl
8086inst stringsl8086inst stringsl
8086inst stringsl
 
Chapter3 8086inst stringsl
Chapter3 8086inst stringslChapter3 8086inst stringsl
Chapter3 8086inst stringsl
 
Chap 8086 string
Chap 8086 stringChap 8086 string
Chap 8086 string
 
Microprocessors-based systems (under graduate course) Lecture 8 of 9
Microprocessors-based systems (under graduate course) Lecture 8 of 9 Microprocessors-based systems (under graduate course) Lecture 8 of 9
Microprocessors-based systems (under graduate course) Lecture 8 of 9
 
Instruction set
Instruction setInstruction set
Instruction set
 
Assembly language
Assembly languageAssembly language
Assembly language
 
Microprocessor.pptx
Microprocessor.pptxMicroprocessor.pptx
Microprocessor.pptx
 
String_manipulations.pdf
String_manipulations.pdfString_manipulations.pdf
String_manipulations.pdf
 
Microprocessor
MicroprocessorMicroprocessor
Microprocessor
 
Instruction Set Of 8086 DIU CSE
Instruction Set Of 8086 DIU CSEInstruction Set Of 8086 DIU CSE
Instruction Set Of 8086 DIU CSE
 
Chap 3_2.ppt
Chap 3_2.pptChap 3_2.ppt
Chap 3_2.ppt
 
N_Asm Assembly strings (sol)
N_Asm Assembly strings (sol)N_Asm Assembly strings (sol)
N_Asm Assembly strings (sol)
 
Instructionsetof8086 by Alwani
Instructionsetof8086 by AlwaniInstructionsetof8086 by Alwani
Instructionsetof8086 by Alwani
 
Instruction set-of-8086
Instruction set-of-8086Instruction set-of-8086
Instruction set-of-8086
 
ppt-U2 - (Instruction Set of 8086, Simple programs).pptx
ppt-U2 - (Instruction Set of 8086, Simple programs).pptxppt-U2 - (Instruction Set of 8086, Simple programs).pptx
ppt-U2 - (Instruction Set of 8086, Simple programs).pptx
 
unit1.pdf
unit1.pdfunit1.pdf
unit1.pdf
 
Assembly language
Assembly languageAssembly language
Assembly language
 
Unit 2 assembly language programming
Unit 2   assembly language programmingUnit 2   assembly language programming
Unit 2 assembly language programming
 
8086-instruction sets.ppt
8086-instruction sets.ppt8086-instruction sets.ppt
8086-instruction sets.ppt
 
8086 instruction set
8086 instruction set8086 instruction set
8086 instruction set
 

More from mpsrekha83

Delta modulation
Delta modulationDelta modulation
Delta modulationmpsrekha83
 
Block diagram of digital communication
Block diagram of digital communicationBlock diagram of digital communication
Block diagram of digital communicationmpsrekha83
 
Adaptive differential pcm
Adaptive differential pcmAdaptive differential pcm
Adaptive differential pcmmpsrekha83
 
Adaptive delta modulation
Adaptive delta modulationAdaptive delta modulation
Adaptive delta modulationmpsrekha83
 
Digital modulation techniques
Digital modulation techniquesDigital modulation techniques
Digital modulation techniquesmpsrekha83
 
Comparison of qam and psk
Comparison of qam and pskComparison of qam and psk
Comparison of qam and pskmpsrekha83
 
Spread spectrum
Spread spectrumSpread spectrum
Spread spectrummpsrekha83
 
System bus timing 8086
System bus timing 8086System bus timing 8086
System bus timing 8086mpsrekha83
 
Pulse modulation
Pulse modulationPulse modulation
Pulse modulationmpsrekha83
 
AM diode envelope demodulator
AM diode envelope demodulatorAM diode envelope demodulator
AM diode envelope demodulatormpsrekha83
 
Interrupts of 8086
Interrupts of 8086Interrupts of 8086
Interrupts of 8086mpsrekha83
 
Super heterodyne receiver
Super heterodyne receiverSuper heterodyne receiver
Super heterodyne receivermpsrekha83
 
Pre emphasis and de-emphasis
Pre emphasis and de-emphasisPre emphasis and de-emphasis
Pre emphasis and de-emphasismpsrekha83
 
Fm demodulation using zero crossing detector
Fm demodulation using zero crossing detectorFm demodulation using zero crossing detector
Fm demodulation using zero crossing detectormpsrekha83
 
FM demodulation using PLL
FM demodulation using PLLFM demodulation using PLL
FM demodulation using PLLmpsrekha83
 

More from mpsrekha83 (20)

Line coding
Line codingLine coding
Line coding
 
Delta modulation
Delta modulationDelta modulation
Delta modulation
 
Block diagram of digital communication
Block diagram of digital communicationBlock diagram of digital communication
Block diagram of digital communication
 
Adaptive differential pcm
Adaptive differential pcmAdaptive differential pcm
Adaptive differential pcm
 
Adaptive delta modulation
Adaptive delta modulationAdaptive delta modulation
Adaptive delta modulation
 
Eye pattern
Eye patternEye pattern
Eye pattern
 
Digital modulation techniques
Digital modulation techniquesDigital modulation techniques
Digital modulation techniques
 
Comparison of qam and psk
Comparison of qam and pskComparison of qam and psk
Comparison of qam and psk
 
Pn sequence
Pn sequencePn sequence
Pn sequence
 
Spread spectrum
Spread spectrumSpread spectrum
Spread spectrum
 
8086 signals
8086 signals8086 signals
8086 signals
 
System bus timing 8086
System bus timing 8086System bus timing 8086
System bus timing 8086
 
Pulse modulation
Pulse modulationPulse modulation
Pulse modulation
 
AM diode envelope demodulator
AM diode envelope demodulatorAM diode envelope demodulator
AM diode envelope demodulator
 
Interrupts of 8086
Interrupts of 8086Interrupts of 8086
Interrupts of 8086
 
Super heterodyne receiver
Super heterodyne receiverSuper heterodyne receiver
Super heterodyne receiver
 
Pre emphasis and de-emphasis
Pre emphasis and de-emphasisPre emphasis and de-emphasis
Pre emphasis and de-emphasis
 
Fm generation
Fm generationFm generation
Fm generation
 
Fm demodulation using zero crossing detector
Fm demodulation using zero crossing detectorFm demodulation using zero crossing detector
Fm demodulation using zero crossing detector
 
FM demodulation using PLL
FM demodulation using PLLFM demodulation using PLL
FM demodulation using PLL
 

Recently uploaded

Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacingjaychoudhary37
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 

Recently uploaded (20)

Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacing
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 

Byte and string manipulation 8086

  • 1. Byte and String Manipulation Unit -1 Presented By Mrs. M.P.Sasirekha
  • 2. String Instruction in 8086 • The String Instruction in 8086 are namely, • REP/REPE/REPZ/REPNE/REPNZ • MOVS/MOVSB/MOVSN • CMPS/CMPSB/CMPSW • SCAS/SCASB/SCASW • LODS/LODSB/LODSW • STOS/STOSB/STOSW
  • 3. REP/REPE/REPZ/REPNE/REPNZ Instruction • REP is a prefix which is written before one of the String Instruction in 8086. These instructions repeat until specified condition exists.
  • 4. MOVS/MOVSB/MOVSW Instruction • This instruction copies a byte or word from a location in the data segment to a location in the extra segment. • The offset of the source byte or word in the data segment must be in the SI register. • The offset of the destination in the extra segment must be contained in the DI register. • For multiple byte or multiple word moves the number of elements to be moved is put in the CX register so that it can function as a counter. • After the byte or word is moved SI and DI are automatically adjusted to point to the next source and the next destination.
  • 5. MOVS/MOVSB/MOVSW Instruction • If the direction flag is 0, then SI and DI will be incremented by 1 after a byte move and they will incremented by 2 after a word move. • If the DF is a 1, then SI and DI will be decremented by 1 after a byte move and they will be decremented by 2 after a word move. • MOVS affects no flags. • The way to tell the assembler whether to code the instruction for a byte or word move is to add a “B” or a “W” to the MOVS mnemonic. • MOVSB, for example, says move a string as bytes. MOVSW
  • 7. CMPS/CMPSB/CMPSW Instruction • A String Instruction in 8086 is a series of the same type of data items in sequential memory locations. • The CMPS instruction can be used to compare a byte in one string with a byte in another string or to compare a word in one string with a word in another string. • SI is used to hold the offset of a byte or word in the source string and DI is used to hold the offset of a byte or a word in the other string. The comparison is done by subtracting the byte or word pointed to by DI from the byte or word pointed to by SI. • The AF, CF, OF, PF, SF, and ZF flags are affected by the comparison, but neither operand is affected.
  • 8. CMPS/CMPSB/CMPSW Instruction • After the comparison SI and DI will be automatically incremented or decremented according to direction flag to point to the next element in the two strings (if DF = 0, SI and DI ↑ ) CX functions as a counter which is decremented after each comparison. • This will go on until CX = 0
  • 9. SCAS/SCASB/SCASW Instruction • SCAS compares a string byte with a byte in AL or a string word with word in AX. • The instruction affects the flags, but it does not change either the operand in AL (AX) or the operand in the String Instruction in 8086. • The string to be ‘scanned must be in the extra segment and DI must contain the offset of the byte or the word to be compared. • After the comparison DI will be automatically incremented or decremented according to direction flag, to point to the next element in the two strings (if DF = 0, SI and DI ↑ ) CX functions as a counter which is decremented after each comparison. • This will go on until CX = 0. SCAS affects the AF, CF, OF, PF, SF and ZF flags.
  • 11. LODS/LODSB/LODSW Instruction • This instruction copies a byte from a string location pointed to by SI to AL, or a word from a string location pointed to by SI to AX. LODS does not affect any flags. LODSB copies byte and LODSW copies a word.
  • 12. STOS/STOSB/STOSW Instruction • The STOS instruction copies a byte from AL or a word from AX to a memory location in the extra segment. • DI is used to hold the offset of the memory location in the extra segment. • After the copy, DI is automatically incremented or decremented to point to the next string element in memory. • If the direction flag, DF, is cleared, then DI will automatically be incremented by one for a byte string or incremented by two for a word String Instruction in 8086. • If the direction flag is set, DI will be automatically decremented by ono for a byte string or decremented by two for a word string. STOS does not affect any flags. STOSB copies byte and STOSW copies a word.