SlideShare a Scribd company logo
1 of 10
8086 Programming
Copy an array from one location to
another location
• .MODEL SMALL
• .DATA
• BLK1 DB 01,02,03,04,05,06,07,08,09,0AH
• BLK2 DB 10 DUP (?)
• COUNT DW 0AH
• .CODE
• MOV AX, @DATA
• MOV DS, AX
• MOV ES, AX
• MOV SI, OFFSET BLK1;
• MOV DI, OFFSET BLK2
• MOV CX, COUNT
• AGAIN:CLD
• REP MOVSB
• .MODEL SMALL
• .DATA
• BLK1 DB 01h,02h,03h,04h,05h,06h,07h,08h,09h,0AH
• BLK2 DB 10 DUP (?)
• .CODE
• MOV AX, @DATA ; MOV THE STARTING ADDRESS
• MOV DS, AX
• MOV ES, AX
• MOV SI, OFFSET BLK1 ; SET POINTER REG TO BLK1
• MOV DI, OFFSET BLK2 ; SET POINTER REG TO BLK2
• MOV CX, 0AH ; SET COUNTER
• ;ADD SI, 0009H
• ;ADD DI, 0004H
• AGAIN:
• MOV AL, [SI]
• MOV [DI], AL
• INC SI
• INC DI
• DEC CL ; DECREMENT COUNTER
• JNZ AGAIN ; TO END PROGRAM
• ;MOV AH, 4CH
• ;INT 21H
• END
To Program To Interchange A Block Of Data
• .MODEL SMALL
• .DATA
• SRC DB 10H,20H,30H,40H,50h
• DST DB 06,07,08,09,0AH
• COUNT EQU 05
• .CODE
• MOV AX, @DATA ; INITIALIZE THE DATA
REGISTER
• MOV DS, AX
• MOV ES, AX
• LEA SI, SRC
• LEA DI, DST
• MOV CL, COUNT ; INITIALIZE THE COUNTER
BACK:
MOV AL, [SI]
MOV BL, [DI]
MOV [SI], BL ; INTERCHANGE THE DATA
MOV [DI], AL
INC SI
INC DI
DEC CL
JNZ BACK ; REPEAT UNTIL COUNTER BECOMES
ZERO
MOV AH, 4CH
INT 21H
END
The 8086 String instructions
• A string is the series of bytes stored in successive memory locations.
• Word processor or text editor programs can be used to create strings.
• These programs have facility to search through the text.
Moving a String(contd.)
• Definition:
• You have a string of ASCII characters in successive memory locations in data
segment, and you want to move the string to some new location in the data
segment.
• Basic pseudo code:
REPEAT
MOVE BYTE FROM SOURCE STRING
TO DESTINATION STRING
UNTIL ALL BYTES MOVED
Moving a String(contd.)
• The basic pseudo code doesn’t help much in understanding how the algorithm will be
implemented.
• Expanded code:
INITIALIZE SOURCE POINTER, SI
INITIALIZE DESTINATION POINTER, DI
INITIALIZE COUNTER, CX
REPEAT
COPY BYTE FROM SOURCE TO DESTINATION
INCREMENT SOURCE POINTER
INCREMENT DESTINATION POINTER
DECREMENT COUNTER
UNTIL COUNTER=0
To Write An Alp To Add 2 Multibyte No.s

More Related Content

Similar to 8086 programming guide programs samples and string permutations.pptx

Assembly language programs 2
Assembly language programs 2Assembly language programs 2
Assembly language programs 2HarshitParkar6677
 
Microprocessor 8086-lab-mannual
Microprocessor 8086-lab-mannualMicroprocessor 8086-lab-mannual
Microprocessor 8086-lab-mannualyeshwant gadave
 
Microprocessor system - summarize
Microprocessor system - summarizeMicroprocessor system - summarize
Microprocessor system - summarizeHisham Mat Hussin
 
Assembly Language Tutorials for Windows - 04 Data Transfers Part-2
Assembly Language Tutorials for Windows - 04 Data Transfers Part-2Assembly Language Tutorials for Windows - 04 Data Transfers Part-2
Assembly Language Tutorials for Windows - 04 Data Transfers Part-2Sangram Kesari Ray
 
Notes arithmetic instructions
Notes arithmetic instructionsNotes arithmetic instructions
Notes arithmetic instructionsHarshitParkar6677
 
Introduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic thingsIntroduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic thingsishitasabrincse
 
8086 microprocessor pptx JNTUH ece 3rd year
8086 microprocessor pptx JNTUH ece 3rd year8086 microprocessor pptx JNTUH ece 3rd year
8086 microprocessor pptx JNTUH ece 3rd yearBharghavteja1
 
All-addressing-modes of the 80386 /microprocessor.pptx
All-addressing-modes of the 80386 /microprocessor.pptxAll-addressing-modes of the 80386 /microprocessor.pptx
All-addressing-modes of the 80386 /microprocessor.pptxVidyaAshokNemade
 
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMINGChapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMINGFrankie Jones
 
Intel8086_Flags_Addr_Modes_sample_pgms.pdf
Intel8086_Flags_Addr_Modes_sample_pgms.pdfIntel8086_Flags_Addr_Modes_sample_pgms.pdf
Intel8086_Flags_Addr_Modes_sample_pgms.pdfAnonymous611358
 
Instruction addressing and execution
Instruction addressing and executionInstruction addressing and execution
Instruction addressing and executionSilvia
 
Assembly Language Compiler Implementation
Assembly Language Compiler ImplementationAssembly Language Compiler Implementation
Assembly Language Compiler ImplementationRAVI TEJA KOMMA
 
Symbolic instructions for 8086 micro processor
Symbolic instructions for 8086 micro processorSymbolic instructions for 8086 micro processor
Symbolic instructions for 8086 micro processorSaurabh Mehta
 
Part III: Assembly Language
Part III: Assembly LanguagePart III: Assembly Language
Part III: Assembly LanguageAhmed M. Abed
 
Home works summary.pptx
Home works summary.pptxHome works summary.pptx
Home works summary.pptxHebaEng
 

Similar to 8086 programming guide programs samples and string permutations.pptx (20)

Assembly language programs 2
Assembly language programs 2Assembly language programs 2
Assembly language programs 2
 
Notes all instructions
Notes all instructionsNotes all instructions
Notes all instructions
 
Microprocessor 8086-lab-mannual
Microprocessor 8086-lab-mannualMicroprocessor 8086-lab-mannual
Microprocessor 8086-lab-mannual
 
8086 alp
8086 alp8086 alp
8086 alp
 
Microprocessor system - summarize
Microprocessor system - summarizeMicroprocessor system - summarize
Microprocessor system - summarize
 
Assembly Language Tutorials for Windows - 04 Data Transfers Part-2
Assembly Language Tutorials for Windows - 04 Data Transfers Part-2Assembly Language Tutorials for Windows - 04 Data Transfers Part-2
Assembly Language Tutorials for Windows - 04 Data Transfers Part-2
 
Notes arithmetic instructions
Notes arithmetic instructionsNotes arithmetic instructions
Notes arithmetic instructions
 
Introduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic thingsIntroduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic things
 
Assembly 8086
Assembly 8086Assembly 8086
Assembly 8086
 
8086 pgms
8086 pgms8086 pgms
8086 pgms
 
8086 microprocessor pptx JNTUH ece 3rd year
8086 microprocessor pptx JNTUH ece 3rd year8086 microprocessor pptx JNTUH ece 3rd year
8086 microprocessor pptx JNTUH ece 3rd year
 
All-addressing-modes of the 80386 /microprocessor.pptx
All-addressing-modes of the 80386 /microprocessor.pptxAll-addressing-modes of the 80386 /microprocessor.pptx
All-addressing-modes of the 80386 /microprocessor.pptx
 
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMINGChapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
 
Intel8086_Flags_Addr_Modes_sample_pgms.pdf
Intel8086_Flags_Addr_Modes_sample_pgms.pdfIntel8086_Flags_Addr_Modes_sample_pgms.pdf
Intel8086_Flags_Addr_Modes_sample_pgms.pdf
 
Instruction addressing and execution
Instruction addressing and executionInstruction addressing and execution
Instruction addressing and execution
 
Assembly Language Compiler Implementation
Assembly Language Compiler ImplementationAssembly Language Compiler Implementation
Assembly Language Compiler Implementation
 
Lecture 11
Lecture 11Lecture 11
Lecture 11
 
Symbolic instructions for 8086 micro processor
Symbolic instructions for 8086 micro processorSymbolic instructions for 8086 micro processor
Symbolic instructions for 8086 micro processor
 
Part III: Assembly Language
Part III: Assembly LanguagePart III: Assembly Language
Part III: Assembly Language
 
Home works summary.pptx
Home works summary.pptxHome works summary.pptx
Home works summary.pptx
 

Recently uploaded

(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
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
 

Recently uploaded (20)

(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
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
 

8086 programming guide programs samples and string permutations.pptx

  • 2.
  • 3. Copy an array from one location to another location • .MODEL SMALL • .DATA • BLK1 DB 01,02,03,04,05,06,07,08,09,0AH • BLK2 DB 10 DUP (?) • COUNT DW 0AH • .CODE • MOV AX, @DATA • MOV DS, AX • MOV ES, AX • MOV SI, OFFSET BLK1; • MOV DI, OFFSET BLK2 • MOV CX, COUNT • AGAIN:CLD • REP MOVSB
  • 4. • .MODEL SMALL • .DATA • BLK1 DB 01h,02h,03h,04h,05h,06h,07h,08h,09h,0AH • BLK2 DB 10 DUP (?) • .CODE • MOV AX, @DATA ; MOV THE STARTING ADDRESS • MOV DS, AX • MOV ES, AX • MOV SI, OFFSET BLK1 ; SET POINTER REG TO BLK1 • MOV DI, OFFSET BLK2 ; SET POINTER REG TO BLK2 • MOV CX, 0AH ; SET COUNTER • ;ADD SI, 0009H • ;ADD DI, 0004H • AGAIN: • MOV AL, [SI] • MOV [DI], AL • INC SI • INC DI • DEC CL ; DECREMENT COUNTER • JNZ AGAIN ; TO END PROGRAM • ;MOV AH, 4CH • ;INT 21H • END
  • 5. To Program To Interchange A Block Of Data • .MODEL SMALL • .DATA • SRC DB 10H,20H,30H,40H,50h • DST DB 06,07,08,09,0AH • COUNT EQU 05 • .CODE • MOV AX, @DATA ; INITIALIZE THE DATA REGISTER • MOV DS, AX • MOV ES, AX • LEA SI, SRC • LEA DI, DST • MOV CL, COUNT ; INITIALIZE THE COUNTER BACK: MOV AL, [SI] MOV BL, [DI] MOV [SI], BL ; INTERCHANGE THE DATA MOV [DI], AL INC SI INC DI DEC CL JNZ BACK ; REPEAT UNTIL COUNTER BECOMES ZERO MOV AH, 4CH INT 21H END
  • 6. The 8086 String instructions • A string is the series of bytes stored in successive memory locations. • Word processor or text editor programs can be used to create strings. • These programs have facility to search through the text.
  • 7. Moving a String(contd.) • Definition: • You have a string of ASCII characters in successive memory locations in data segment, and you want to move the string to some new location in the data segment. • Basic pseudo code: REPEAT MOVE BYTE FROM SOURCE STRING TO DESTINATION STRING UNTIL ALL BYTES MOVED
  • 8. Moving a String(contd.) • The basic pseudo code doesn’t help much in understanding how the algorithm will be implemented. • Expanded code: INITIALIZE SOURCE POINTER, SI INITIALIZE DESTINATION POINTER, DI INITIALIZE COUNTER, CX REPEAT COPY BYTE FROM SOURCE TO DESTINATION INCREMENT SOURCE POINTER INCREMENT DESTINATION POINTER DECREMENT COUNTER UNTIL COUNTER=0
  • 9.
  • 10. To Write An Alp To Add 2 Multibyte No.s