SlideShare a Scribd company logo
1 of 6
1
; using dos interrupts to display strings on the user screen
#MAKE_EXE#
DSEG SEGMENT
MS1 db 0DH,0AH,"STUDY OF MICROPROCESSORS",0DH,0AH,"$"
DSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG, S:DSEG,
START:
MOV AX, DSEG
MOV DS, AX
MOV AH,09H
MOV DX,OFFSET MS1
INT 21H
MOV AH,4CH
INT 21H
CSEG ENDS
END START
;TEST PGM TO INPUT A SENTENCE & FIND THE LENGTH OF THE STRING
#MAKE_EXE#
DSEG SEGMENT
MS1 db 0DH,0AH,"ENTER THE SENTENCE",0AH,0DH,"$"
MS2 DB 25,?,25 DUP('$')
MS3 DB 0DH,0AH,"THE LENGTH OF THE STRING IS$"
L DB ?,'$'
DSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG, S:DSEG,
START:
MOV AX, DSEG
MOV DS, AX
MOV AH,09H
MOV DX,OFFSET MS1
INT 21H
MOV DX,OFFSET MS2
MOV AH,0AH
INT 21H
MOV AH,09H
LEA DX,MS3
INT 21H
MOV BL,MS2+1
ADD BL,30H
MOV L,BL
LEA DX,L
INT 21H
MOV AH,4CH
INT 21H
CSEG ENDS
2
END START
;block exchange using string instruction
#MAKE_EXE#
DSEG SEGMENT
AR1 DB 10,12,13,14,15
AR2 DB 21,22,23,24,25
AR3 DB 05 DUP(?)
DSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG,DS:DSEG, ES:DSEG
START: MOV AX,DSEG
MOV DS,AX
MOV ES,AX
LEA SI,AR1
LEA DI,AR3
CLD
MOV CX,0005H
REP MOVSB
MOV CX,0005H
LEA DI,AR1
LEA SI,AR2
REP MOVSB
MOV CX,0005H
LEA DI,AR2
LEA SI,AR3
REP MOVSB
MOV AH,4CH
INT 21H
CSEG ENDS
END START
;STRING COMPARISON THROUGH KEYBOARD & MACRO (LAB)
#MAKE_EXE#
PRINT MACRO MES
MOV AH, 09H
LEA DX,MES
INT 21H
ENDM
DSEG SEGMENT
MS1 db 0AH,0DH,"Enter the first string$"
MS2 db 0AH,0DH,"Enter the second string$"
MS3 DB 0AH,0DH,"Equal strings$"
MS4 DB 0AH,0DH,"NOT EQUAL$"
BUFF DB 25,?,25 DUP('$')
BUFF1 DB 25,?,25 DUP('$')
DSEG ENDS
3
CSEG SEGMENT
ASSUME CS:CSEG, S:DSEG, ES:DSEG
START:
MOV AX, DSEG
MOV DS, AX
MOV ES, AX
PRINT MS1
MOV AH,0AH
LEA DX,BUFF
INT 21H
LEA SI, BUFF+2
PRINT MS2
MOV AH,0AH
LEA DX,BUFF1
INT 21H
MOV CL,BUFF+1
MOV CH,BUFF1+1
CMP CH,CL
JNZ UNEQ
LEA DI, BUFF1+2
MOV CH,00H
CLD
REPE CMPSB
JNZ UNEQ
PRINT MS3
JMP FINISH
UNEQ: PRINT MS4
FINISH:
;PRINT MS5
MOV AH,4CH
INT 21H
CSEG ENDS
END START
;string comparison without using string instructions
#MAKE_EXE#
DSEG SEGMENT
ST1 DB 'TEXT'
ST2 DB 'TEST'
R DB ?
DSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG,DS:DSEG
START: MOV AX,DSEG
MOV DS,AX
MOV CX, 04H
MOV BX,0000H
BACK: MOV AL,ST1[BX]
CMP AL,ST2[BX]
JNZ UNEQ
4
INC BX
LOOP BACK
MOV R,'Y'
JMP EN
UNEQ: MOV R,'N'
EN: MOV AH,4CH
INT 21H
CSEG ENDS
END START
;PALINDROME
#MAKE_EXE#
DSEG SEGMENT
STR1 db 'abcdefg'
str_len db 07
RES DB ?
DSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG, S:DSEG, ES:DSEG
START:
MOV AX, DSEG
MOV DS, AX
MOV ES, AX
LEA SI, STR1
LEA DI, STR1+str_len
DEC DI
MOV CX, 07
SAR CX,01
NEXT: MOV AL,[SI]
MOV BL,[DI]
CMP AL,BL
JNZ NOTEQ
INC SI
DEC DI
LOOP NEXT
MOV RES,'Y'
JMP EN1
NOTEQ: MOV RES,'N'
EN1:INT 3
CSEG ENDS
END START
5
; TO DISPLAY STRING IN REVERSE ORDER (LAB)
#MAKE_EXE#
PRINT MACRO MES
MOV AH, 09H
LEA DX,MES
INT 21H
ENDM
DSEG SEGMENT
MS1 db 0AH,0DH,"Enter the string$"
MS2 db 0AH,0DH,"Enter the second string$"
MS3 DB 0AH,0DH,"REVERSE IS$"
BUFF DB 25,?,25 DUP('$')
DSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG, S:DSEG, ES:DSEG
START:
MOV AX, DSEG
MOV DS, AX
MOV ES, AX
PRINT MS1
MOV AH,0AH
LEA DX,BUFF
INT 21H
MOV CH,00
MOV CL,BUFF+1
MOV DI,CX
LEA BX,BUFF+1
PRINT MS3
BACK: MOV AH,02H
MOV DL,[BX+DI]
INT 21H
DEC DI
JNZ BACK
MOV AH,4CH
INT 21H
CSEG ENDS
END START
; TO DISPLAY STRING IN REVERSE ORDER (LAB)
#MAKE_EXE#
PRINT MACRO MES
MOV AH, 09H
LEA DX,MES
INT 21H
6
ENDM
DSEG SEGMENT
MS1 db 0AH,0DH,"Enter the string$"
MS2 DB 0AH,0DH,"REVERSE IS$"
BUFF DB 25,?,25 DUP('$')
DSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG, S:DSEG, ES:DSEG
START:
MOV AX, DSEG
MOV DS, AX
MOV ES, AX
PRINT MS1
MOV AH,0AH
LEA DX,BUFF
INT 21H
MOV CH,00
MOV CL,BUFF+1
MOV DI,CX
LEA BX,BUFF+1
PRINT MS2
BACK: MOV AH,02H
MOV DL,[BX+DI]
INT 21H
DEC DI
JNZ BACK
MOV AH,4CH
INT 21H
CSEG ENDS
END START

More Related Content

Similar to 8086 pgms

Assembly language
Assembly languageAssembly language
Assembly language
bryle12
 
APPENDER.ASM;Program APPENDER.ASM Append a short message line.docx
APPENDER.ASM;Program APPENDER.ASM Append a short message line.docxAPPENDER.ASM;Program APPENDER.ASM Append a short message line.docx
APPENDER.ASM;Program APPENDER.ASM Append a short message line.docx
rossskuddershamus
 
Home works summary.pptx
Home works summary.pptxHome works summary.pptx
Home works summary.pptx
HebaEng
 
Stack and subroutine
Stack and subroutineStack and subroutine
Stack and subroutine
Ashim Saha
 

Similar to 8086 pgms (20)

Assembly language programs 2
Assembly language programs 2Assembly language programs 2
Assembly language programs 2
 
Mcs 17 solved assignment 2015- 16
Mcs 17 solved assignment 2015- 16Mcs 17 solved assignment 2015- 16
Mcs 17 solved assignment 2015- 16
 
Assembly language programs
Assembly language programsAssembly language programs
Assembly language programs
 
Taller practico emu8086_galarraga
Taller practico emu8086_galarragaTaller practico emu8086_galarraga
Taller practico emu8086_galarraga
 
8086 programming guide programs samples and string permutations.pptx
8086 programming guide programs samples and string permutations.pptx8086 programming guide programs samples and string permutations.pptx
8086 programming guide programs samples and string permutations.pptx
 
Lec06
Lec06Lec06
Lec06
 
Microprocessor 8086-lab-mannual
Microprocessor 8086-lab-mannualMicroprocessor 8086-lab-mannual
Microprocessor 8086-lab-mannual
 
Assembly Language Compiler Implementation
Assembly Language Compiler ImplementationAssembly Language Compiler Implementation
Assembly Language Compiler Implementation
 
mm_1.pdf
mm_1.pdfmm_1.pdf
mm_1.pdf
 
Assembly Language Lecture 5
Assembly Language Lecture 5Assembly Language Lecture 5
Assembly Language Lecture 5
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
 
Assembly Language Lecture 4
Assembly Language Lecture 4Assembly Language Lecture 4
Assembly Language Lecture 4
 
Chapter 6 Flow control Instructions
Chapter 6 Flow control InstructionsChapter 6 Flow control Instructions
Chapter 6 Flow control Instructions
 
Assembly language
Assembly languageAssembly language
Assembly language
 
APPENDER.ASM;Program APPENDER.ASM Append a short message line.docx
APPENDER.ASM;Program APPENDER.ASM Append a short message line.docxAPPENDER.ASM;Program APPENDER.ASM Append a short message line.docx
APPENDER.ASM;Program APPENDER.ASM Append a short message line.docx
 
15CSL48 MP&MC manual
15CSL48 MP&MC manual15CSL48 MP&MC manual
15CSL48 MP&MC manual
 
Home works summary.pptx
Home works summary.pptxHome works summary.pptx
Home works summary.pptx
 
Exp 03
Exp 03Exp 03
Exp 03
 
Stack and subroutine
Stack and subroutineStack and subroutine
Stack and subroutine
 
Bcsl 022 solved-assignment_2012-13
Bcsl 022 solved-assignment_2012-13Bcsl 022 solved-assignment_2012-13
Bcsl 022 solved-assignment_2012-13
 

More from HarshitParkar6677

More from HarshitParkar6677 (20)

Wi fi hacking
Wi fi hackingWi fi hacking
Wi fi hacking
 
D dos attack
D dos attackD dos attack
D dos attack
 
Notes chapter 6
Notes chapter  6Notes chapter  6
Notes chapter 6
 
Interface notes
Interface notesInterface notes
Interface notes
 
Chapter6 2
Chapter6 2Chapter6 2
Chapter6 2
 
Chapter6
Chapter6Chapter6
Chapter6
 
8086 cpu 1
8086 cpu 18086 cpu 1
8086 cpu 1
 
Chapter 6 notes
Chapter 6 notesChapter 6 notes
Chapter 6 notes
 
Chapter 5 notes
Chapter 5 notesChapter 5 notes
Chapter 5 notes
 
Chap6 procedures & macros
Chap6 procedures & macrosChap6 procedures & macros
Chap6 procedures & macros
 
Chapter 5 notes new
Chapter 5 notes newChapter 5 notes new
Chapter 5 notes new
 
Notes arithmetic instructions
Notes arithmetic instructionsNotes arithmetic instructions
Notes arithmetic instructions
 
Notes all instructions
Notes all instructionsNotes all instructions
Notes all instructions
 
Notes aaa aa
Notes aaa aaNotes aaa aa
Notes aaa aa
 
Notes 8086 instruction format
Notes 8086 instruction formatNotes 8086 instruction format
Notes 8086 instruction format
 
Misc
MiscMisc
Misc
 
Copy of 8086inst logical
Copy of 8086inst logicalCopy of 8086inst logical
Copy of 8086inst logical
 
Copy of 8086inst logical
Copy of 8086inst logicalCopy of 8086inst logical
Copy of 8086inst logical
 
Chapter3 program flow control instructions
Chapter3 program flow control instructionsChapter3 program flow control instructions
Chapter3 program flow control instructions
 
Chapter3 8086inst stringsl
Chapter3 8086inst stringslChapter3 8086inst stringsl
Chapter3 8086inst stringsl
 

Recently uploaded

1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 

Recently uploaded (20)

Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Ghuma $ Russian Call Girls Ahmedabad â‚ą7.5k Pick Up & Drop With Cash Payment 8...
Ghuma $ Russian Call Girls Ahmedabad â‚ą7.5k Pick Up & Drop With Cash Payment 8...Ghuma $ Russian Call Girls Ahmedabad â‚ą7.5k Pick Up & Drop With Cash Payment 8...
Ghuma $ Russian Call Girls Ahmedabad â‚ą7.5k Pick Up & Drop With Cash Payment 8...
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Signal Processing and Linear System Analysis
Signal Processing and Linear System AnalysisSignal Processing and Linear System Analysis
Signal Processing and Linear System Analysis
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesLinux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 

8086 pgms

  • 1. 1 ; using dos interrupts to display strings on the user screen #MAKE_EXE# DSEG SEGMENT MS1 db 0DH,0AH,"STUDY OF MICROPROCESSORS",0DH,0AH,"$" DSEG ENDS CSEG SEGMENT ASSUME CS:CSEG, S:DSEG, START: MOV AX, DSEG MOV DS, AX MOV AH,09H MOV DX,OFFSET MS1 INT 21H MOV AH,4CH INT 21H CSEG ENDS END START ;TEST PGM TO INPUT A SENTENCE & FIND THE LENGTH OF THE STRING #MAKE_EXE# DSEG SEGMENT MS1 db 0DH,0AH,"ENTER THE SENTENCE",0AH,0DH,"$" MS2 DB 25,?,25 DUP('$') MS3 DB 0DH,0AH,"THE LENGTH OF THE STRING IS$" L DB ?,'$' DSEG ENDS CSEG SEGMENT ASSUME CS:CSEG, S:DSEG, START: MOV AX, DSEG MOV DS, AX MOV AH,09H MOV DX,OFFSET MS1 INT 21H MOV DX,OFFSET MS2 MOV AH,0AH INT 21H MOV AH,09H LEA DX,MS3 INT 21H MOV BL,MS2+1 ADD BL,30H MOV L,BL LEA DX,L INT 21H MOV AH,4CH INT 21H CSEG ENDS
  • 2. 2 END START ;block exchange using string instruction #MAKE_EXE# DSEG SEGMENT AR1 DB 10,12,13,14,15 AR2 DB 21,22,23,24,25 AR3 DB 05 DUP(?) DSEG ENDS CSEG SEGMENT ASSUME CS:CSEG,DS:DSEG, ES:DSEG START: MOV AX,DSEG MOV DS,AX MOV ES,AX LEA SI,AR1 LEA DI,AR3 CLD MOV CX,0005H REP MOVSB MOV CX,0005H LEA DI,AR1 LEA SI,AR2 REP MOVSB MOV CX,0005H LEA DI,AR2 LEA SI,AR3 REP MOVSB MOV AH,4CH INT 21H CSEG ENDS END START ;STRING COMPARISON THROUGH KEYBOARD & MACRO (LAB) #MAKE_EXE# PRINT MACRO MES MOV AH, 09H LEA DX,MES INT 21H ENDM DSEG SEGMENT MS1 db 0AH,0DH,"Enter the first string$" MS2 db 0AH,0DH,"Enter the second string$" MS3 DB 0AH,0DH,"Equal strings$" MS4 DB 0AH,0DH,"NOT EQUAL$" BUFF DB 25,?,25 DUP('$') BUFF1 DB 25,?,25 DUP('$') DSEG ENDS
  • 3. 3 CSEG SEGMENT ASSUME CS:CSEG, S:DSEG, ES:DSEG START: MOV AX, DSEG MOV DS, AX MOV ES, AX PRINT MS1 MOV AH,0AH LEA DX,BUFF INT 21H LEA SI, BUFF+2 PRINT MS2 MOV AH,0AH LEA DX,BUFF1 INT 21H MOV CL,BUFF+1 MOV CH,BUFF1+1 CMP CH,CL JNZ UNEQ LEA DI, BUFF1+2 MOV CH,00H CLD REPE CMPSB JNZ UNEQ PRINT MS3 JMP FINISH UNEQ: PRINT MS4 FINISH: ;PRINT MS5 MOV AH,4CH INT 21H CSEG ENDS END START ;string comparison without using string instructions #MAKE_EXE# DSEG SEGMENT ST1 DB 'TEXT' ST2 DB 'TEST' R DB ? DSEG ENDS CSEG SEGMENT ASSUME CS:CSEG,DS:DSEG START: MOV AX,DSEG MOV DS,AX MOV CX, 04H MOV BX,0000H BACK: MOV AL,ST1[BX] CMP AL,ST2[BX] JNZ UNEQ
  • 4. 4 INC BX LOOP BACK MOV R,'Y' JMP EN UNEQ: MOV R,'N' EN: MOV AH,4CH INT 21H CSEG ENDS END START ;PALINDROME #MAKE_EXE# DSEG SEGMENT STR1 db 'abcdefg' str_len db 07 RES DB ? DSEG ENDS CSEG SEGMENT ASSUME CS:CSEG, S:DSEG, ES:DSEG START: MOV AX, DSEG MOV DS, AX MOV ES, AX LEA SI, STR1 LEA DI, STR1+str_len DEC DI MOV CX, 07 SAR CX,01 NEXT: MOV AL,[SI] MOV BL,[DI] CMP AL,BL JNZ NOTEQ INC SI DEC DI LOOP NEXT MOV RES,'Y' JMP EN1 NOTEQ: MOV RES,'N' EN1:INT 3 CSEG ENDS END START
  • 5. 5 ; TO DISPLAY STRING IN REVERSE ORDER (LAB) #MAKE_EXE# PRINT MACRO MES MOV AH, 09H LEA DX,MES INT 21H ENDM DSEG SEGMENT MS1 db 0AH,0DH,"Enter the string$" MS2 db 0AH,0DH,"Enter the second string$" MS3 DB 0AH,0DH,"REVERSE IS$" BUFF DB 25,?,25 DUP('$') DSEG ENDS CSEG SEGMENT ASSUME CS:CSEG, S:DSEG, ES:DSEG START: MOV AX, DSEG MOV DS, AX MOV ES, AX PRINT MS1 MOV AH,0AH LEA DX,BUFF INT 21H MOV CH,00 MOV CL,BUFF+1 MOV DI,CX LEA BX,BUFF+1 PRINT MS3 BACK: MOV AH,02H MOV DL,[BX+DI] INT 21H DEC DI JNZ BACK MOV AH,4CH INT 21H CSEG ENDS END START ; TO DISPLAY STRING IN REVERSE ORDER (LAB) #MAKE_EXE# PRINT MACRO MES MOV AH, 09H LEA DX,MES INT 21H
  • 6. 6 ENDM DSEG SEGMENT MS1 db 0AH,0DH,"Enter the string$" MS2 DB 0AH,0DH,"REVERSE IS$" BUFF DB 25,?,25 DUP('$') DSEG ENDS CSEG SEGMENT ASSUME CS:CSEG, S:DSEG, ES:DSEG START: MOV AX, DSEG MOV DS, AX MOV ES, AX PRINT MS1 MOV AH,0AH LEA DX,BUFF INT 21H MOV CH,00 MOV CL,BUFF+1 MOV DI,CX LEA BX,BUFF+1 PRINT MS2 BACK: MOV AH,02H MOV DL,[BX+DI] INT 21H DEC DI JNZ BACK MOV AH,4CH INT 21H CSEG ENDS END START