SlideShare une entreprise Scribd logo
1  sur  16
Télécharger pour lire hors ligne
Lab Report on
Microprocessor and Assembly Language Lab
Course Code: CSE 232
Fall-2014
Submitted To:
Nasrin Akter
Dept. of Computer Science & Engineering
Faculty of Science & Information Technology
Submitted by:
Syed Ahmed Zaki
ID:131-15-2169
Sec: B
Dept. of CSE,FSIT
Date of submission: 12, December 2014
Contents
Problem Page
Problem 1 2
Problem 2 4
Problem 3 7
Problem 4 8
Problem 5 9
Problem 6 10
Problem 7 11
Problem 8 12
1
Problem 1: The sum of 5 and 4 is 9
Solution:
.model small
.stack 100h
.data
m1 db "Enter two number: $"
m2 db "The sum of $"
m3 db " and $"
m4 db " = $"
.code
main proc
mov ax,@data
mov ds,ax
lea dx,m1
mov ah,9
int 21h
mov ah,1
int 21h
mov bl,al
mov ah,1
int 21h
mov bh,al
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
lea dx,m2
mov ah,9
int 21h
2
mov ah,2
mov dl,bl
int 21h
mov ah,9
lea dx,m3
int 21h
mov ah,2
mov dl,bh
int 21h
lea dx,m4
mov ah,9
int 21h
sub bl,30h
sub bh,30h
add bl,bh
add bl,30h
mov ah,2
mov dl,bl
int 21h
mov ah,4ch
int 21h
main endp
end main
Output:
3
Problem 2: Write a program to display the left margin:
Enter seven initial:12345
1
2
3
4
5
Solution:
.model small
.stack 100h
.data
m1 db "Enter five initial:$"
.code
main proc
mov ax,@data
mov ds,ax
lea dx,m1
mov ah,9
int 21h
mov ah,1
int 21h
mov bl,al
mov ah,1
int 21h
mov bh,al
mov ah,1
int 21h
mov cl,al
mov ah,1
int 21h
mov ch,al
4
mov ah,1
int 21h
mov dh,al
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
mov ah,2
mov dl,bl
int 21h
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
mov ah,2
mov dl,bh
int 21h
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
mov ah,2
mov dl,cl
int 21h
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
5
mov ah,2
mov dl,ch
int 21h
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
mov ah,2
mov dl,dh
int 21h
mov ah,4ch
int 21h
main endp
end main
Output:
6
Problem 3: Suppose AL and BL contain two number,Display the one that comes
last in the sequence.
Solution:
.model small
.stack 100h
.code
main proc
mov al,68
mov bl,65
cmp al,bl
jg d1
jmp d2
d1:
mov ah,2
mov dl,al
int 21h
jmp exit
d2:
mov ah,2
mov dl,bl
int 21h
exit:
mov ah,4c
int 21h
main endp
end main
Output:
7
Problem 4: AL and BL contain two characters. Display the last character.
Solution:
.model small
.stack 100h
.code
main proc
mov al,'A'
mov bl,'M'
cmp al,bl
jg d1
jmp d2
d1:
mov ah,2
mov dl,al
int 21h
jmp exit
d2:
mov ah,2
mov dl,bl
int 21h
exit:
mov ah,4ch
int 21h
main endp
end main
Output:
8
Problem 5:If AL contain number display “n” ; If AL contain character
display “c”
Solution:
.model small
.stack 100h
.code
main proc
mov ah,1
int 21h
mov bl,al
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
cmp bl,'1'
je print_number_n
jmp print_character_c
print_number_n:
mov ah,2
mov dl,'n'
int 21h
jmp exit
print_character_c:
mov ah,2
mov dl,'c'
int 21h
exit:
mov ah,4ch
int 21h
9
main endp
end main
Output:
Problem 6: Read a character and if it is lowercase letter, Display it.
Solution:
.model small
.stack 100h
.code
main proc
mov ah,1
int 21h
mov bl,al
cmp bl,'a'
jnge end_if
cmp bl,'z'
jnge end_if
mov ah,2
mov dl,bl
int 21h
end_if:
mov ah,4ch
int 21h
10
main endp
end main
Output:
Problem 7:
Write a count – controlled loop to display a row of 60 stars.
Solution:
.model small
.stack 100h
.code
main proc
mov cx,60
mov ah,2
mov dl,'*'
count:
int 21h
loop count
main endp
end main
11
Output:
Problem 8:
Prompt the user to enter a line of text. On the next line, display the capital
letter entered that comes first alphabetically and the one that comes last. If no
capital entered, display “No capital letters”.
Solution:
.model small
.stack 100h
.data
prompt db 'Type a line of text',0dh,0ah,'$'
nocap_msg db 0dh,0ah,'No capitals $'
cap_msg db 0dh,0ah,'First Capital = '
first db '|'
db ' Last Capital = '
last db '@ $'
.code
main proc
;initialize ds
mov ax,@data
mov ds,ax
;display opening message
12
mov ah,9 ;display string function
lea dx,prompt ;get opening message
int 21h ;display it
;read and process a line of text
mov ah,1 ;read a character function
int 21h ;char in dl
while_:
;while a character is not a carriage return do
cmp al,0dh ;CR?
je end_while ;yes,exit
;if character is a capital letter
cmp al,'A' ;char >='A'?
jnge end_if ;not a capital letter
cmp al,'Z' ;char <= 'Z'?
jnle end_if ;not a capital letter
;then
;if character precedes first capital
cmp al,first ;char < first capital ?
jnl check_last ;no, >=
;then first capital = character
mov first,al ;FIRST=char
;end_if
check_last: ;char >last capital?
;if character follows last capital
cmp al,last ;char > last capital?
jng end_if ;no,<=
;then last capital=character
mov last,al ;last = char
;end_if
13
end_if:
;read a character
int 21h ;char in AL
jmp while_ ;repeat loop
end_while:
;display results
mov ah,9 ;display string function
;if no capitals were typed
cmp first,'|' ;first '|'
jne caps ;no display results
;then
lea dx,nocap_msg ;no capitals
jmp display
caps:
lea dx,cap_msg ;capitals
display:
int 21h ;display message
;end_if
;dos exit
mov ah,4ch
int 21h
main endp
end main
14
Output:
15

Contenu connexe

Tendances

Decoders
DecodersDecoders
DecodersRe Man
 
Double SideBand Suppressed Carrier (DSB-SC)
Double SideBand Suppressed Carrier (DSB-SC)Double SideBand Suppressed Carrier (DSB-SC)
Double SideBand Suppressed Carrier (DSB-SC)Ridwanul Hoque
 
Demultiplexer presentation
Demultiplexer presentationDemultiplexer presentation
Demultiplexer presentationShaikat Saha
 
Encoder & Decoder
Encoder & DecoderEncoder & Decoder
Encoder & DecoderSyed Saeed
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Treesagar yadav
 
Information Theory MSU-EEE.ppt
Information Theory MSU-EEE.pptInformation Theory MSU-EEE.ppt
Information Theory MSU-EEE.pptrobomango
 
MATLAB CODE OF FIR Filter Designing LPF HPF BPF BSF
MATLAB CODE OF FIR Filter Designing LPF HPF BPF BSFMATLAB CODE OF FIR Filter Designing LPF HPF BPF BSF
MATLAB CODE OF FIR Filter Designing LPF HPF BPF BSFBharti Airtel Ltd.
 
Digital electronics logic families
Digital electronics logic familiesDigital electronics logic families
Digital electronics logic familiesBLESSINAR0
 
Chapter 03 arithmetic for computers
Chapter 03   arithmetic for computersChapter 03   arithmetic for computers
Chapter 03 arithmetic for computersBảo Hoang
 
BCD to Decimal - Digital Electronics
BCD to Decimal - Digital ElectronicsBCD to Decimal - Digital Electronics
BCD to Decimal - Digital ElectronicsMilap Bhanderi
 
Combinational circuits
Combinational circuitsCombinational circuits
Combinational circuitsSARITHA REDDY
 
Representation of Integers
Representation of IntegersRepresentation of Integers
Representation of IntegersSusantha Herath
 
Latches and flip flop
Latches and flip flopLatches and flip flop
Latches and flip flopShuaib Hotak
 

Tendances (20)

Decoders
DecodersDecoders
Decoders
 
KMAP
KMAPKMAP
KMAP
 
Double SideBand Suppressed Carrier (DSB-SC)
Double SideBand Suppressed Carrier (DSB-SC)Double SideBand Suppressed Carrier (DSB-SC)
Double SideBand Suppressed Carrier (DSB-SC)
 
Demultiplexer presentation
Demultiplexer presentationDemultiplexer presentation
Demultiplexer presentation
 
Multiplexers
MultiplexersMultiplexers
Multiplexers
 
Encoder & Decoder
Encoder & DecoderEncoder & Decoder
Encoder & Decoder
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
Ripple Carry Adder
Ripple Carry AdderRipple Carry Adder
Ripple Carry Adder
 
Information Theory MSU-EEE.ppt
Information Theory MSU-EEE.pptInformation Theory MSU-EEE.ppt
Information Theory MSU-EEE.ppt
 
MATLAB CODE OF FIR Filter Designing LPF HPF BPF BSF
MATLAB CODE OF FIR Filter Designing LPF HPF BPF BSFMATLAB CODE OF FIR Filter Designing LPF HPF BPF BSF
MATLAB CODE OF FIR Filter Designing LPF HPF BPF BSF
 
Line coding
Line codingLine coding
Line coding
 
Information theory
Information theoryInformation theory
Information theory
 
Digital electronics logic families
Digital electronics logic familiesDigital electronics logic families
Digital electronics logic families
 
Encoder and decoder
Encoder and decoderEncoder and decoder
Encoder and decoder
 
Chapter 03 arithmetic for computers
Chapter 03   arithmetic for computersChapter 03   arithmetic for computers
Chapter 03 arithmetic for computers
 
7 Segment Decoder
7 Segment Decoder7 Segment Decoder
7 Segment Decoder
 
BCD to Decimal - Digital Electronics
BCD to Decimal - Digital ElectronicsBCD to Decimal - Digital Electronics
BCD to Decimal - Digital Electronics
 
Combinational circuits
Combinational circuitsCombinational circuits
Combinational circuits
 
Representation of Integers
Representation of IntegersRepresentation of Integers
Representation of Integers
 
Latches and flip flop
Latches and flip flopLatches and flip flop
Latches and flip flop
 

Similaire à Lab report assembly

chapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionschapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionswarda aziz
 
Taller practico emu8086_galarraga
Taller practico emu8086_galarragaTaller practico emu8086_galarraga
Taller practico emu8086_galarragaFabricio Galárraga
 
Introduction to ibm pc assembly language
Introduction to ibm pc assembly languageIntroduction to ibm pc assembly language
Introduction to ibm pc assembly languagewarda aziz
 
Microprocessor and micro-controller lab (assembly programming)
Microprocessor and micro-controller lab (assembly programming)Microprocessor and micro-controller lab (assembly programming)
Microprocessor and micro-controller lab (assembly programming)shamim hossain
 
Lenguaje ensamblador EMU8086
Lenguaje ensamblador EMU8086Lenguaje ensamblador EMU8086
Lenguaje ensamblador EMU8086Santy Bolo
 
Instalación de emu8086
Instalación de emu8086Instalación de emu8086
Instalación de emu8086Alex Toapanta
 
1 ECE 175 Computer Programming for Engineering Applica.docx
1  ECE 175 Computer Programming for Engineering Applica.docx1  ECE 175 Computer Programming for Engineering Applica.docx
1 ECE 175 Computer Programming for Engineering Applica.docxoswald1horne84988
 
PostgreSQL Open SV 2018
PostgreSQL Open SV 2018PostgreSQL Open SV 2018
PostgreSQL Open SV 2018artgillespie
 
Chapter 6 Flow control Instructions
Chapter 6 Flow control InstructionsChapter 6 Flow control Instructions
Chapter 6 Flow control Instructionswarda aziz
 
Practiceproblems(1)
Practiceproblems(1)Practiceproblems(1)
Practiceproblems(1)Sena Nama
 
T02 a firstcprogram
T02 a firstcprogramT02 a firstcprogram
T02 a firstcprogramprincepavan
 
T02 a firstcprogram
T02 a firstcprogramT02 a firstcprogram
T02 a firstcprogramprincepavan
 
Solved Practice Problems For the C++ Exams
Solved Practice Problems For the C++ ExamsSolved Practice Problems For the C++ Exams
Solved Practice Problems For the C++ ExamsMuhammadTalha436
 

Similaire à Lab report assembly (20)

chapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionschapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructions
 
Taller practico emu8086_galarraga
Taller practico emu8086_galarragaTaller practico emu8086_galarraga
Taller practico emu8086_galarraga
 
Introduction to ibm pc assembly language
Introduction to ibm pc assembly languageIntroduction to ibm pc assembly language
Introduction to ibm pc assembly language
 
Microprocessor and micro-controller lab (assembly programming)
Microprocessor and micro-controller lab (assembly programming)Microprocessor and micro-controller lab (assembly programming)
Microprocessor and micro-controller lab (assembly programming)
 
Lenguaje ensamblador EMU8086
Lenguaje ensamblador EMU8086Lenguaje ensamblador EMU8086
Lenguaje ensamblador EMU8086
 
Instalación de emu8086
Instalación de emu8086Instalación de emu8086
Instalación de emu8086
 
Assembler
AssemblerAssembler
Assembler
 
07_strtok.pdf
07_strtok.pdf07_strtok.pdf
07_strtok.pdf
 
Emulador emu8086
Emulador emu8086Emulador emu8086
Emulador emu8086
 
1 ECE 175 Computer Programming for Engineering Applica.docx
1  ECE 175 Computer Programming for Engineering Applica.docx1  ECE 175 Computer Programming for Engineering Applica.docx
1 ECE 175 Computer Programming for Engineering Applica.docx
 
PostgreSQL Open SV 2018
PostgreSQL Open SV 2018PostgreSQL Open SV 2018
PostgreSQL Open SV 2018
 
Compiladores emu8086
Compiladores emu8086Compiladores emu8086
Compiladores emu8086
 
5 a4.output
5 a4.output5 a4.output
5 a4.output
 
Taller Ensambladores
Taller EnsambladoresTaller Ensambladores
Taller Ensambladores
 
Chapter 6 Flow control Instructions
Chapter 6 Flow control InstructionsChapter 6 Flow control Instructions
Chapter 6 Flow control Instructions
 
C++ TUTORIAL 3
C++ TUTORIAL 3C++ TUTORIAL 3
C++ TUTORIAL 3
 
Practiceproblems(1)
Practiceproblems(1)Practiceproblems(1)
Practiceproblems(1)
 
T02 a firstcprogram
T02 a firstcprogramT02 a firstcprogram
T02 a firstcprogram
 
T02 a firstcprogram
T02 a firstcprogramT02 a firstcprogram
T02 a firstcprogram
 
Solved Practice Problems For the C++ Exams
Solved Practice Problems For the C++ ExamsSolved Practice Problems For the C++ Exams
Solved Practice Problems For the C++ Exams
 

Plus de Syed Ahmed Zaki

Assignment on Numerical Method C Code
Assignment on Numerical Method C CodeAssignment on Numerical Method C Code
Assignment on Numerical Method C CodeSyed Ahmed Zaki
 
Presentation on Numerical Method (Trapezoidal Method)
Presentation on Numerical Method (Trapezoidal Method)Presentation on Numerical Method (Trapezoidal Method)
Presentation on Numerical Method (Trapezoidal Method)Syed Ahmed Zaki
 
Presentation on Transmission Media
Presentation on Transmission MediaPresentation on Transmission Media
Presentation on Transmission MediaSyed Ahmed Zaki
 
Architecture of 80286 microprocessor
Architecture of 80286 microprocessorArchitecture of 80286 microprocessor
Architecture of 80286 microprocessorSyed Ahmed Zaki
 
Importance of Electric Device Knowledge in Computer Science Education
Importance of Electric Device Knowledge in Computer Science EducationImportance of Electric Device Knowledge in Computer Science Education
Importance of Electric Device Knowledge in Computer Science EducationSyed Ahmed Zaki
 
Presentation on bernoulli
Presentation on bernoulliPresentation on bernoulli
Presentation on bernoulliSyed Ahmed Zaki
 
Presentation on inverse matrix
Presentation on inverse matrixPresentation on inverse matrix
Presentation on inverse matrixSyed Ahmed Zaki
 
Project Report - Diabetic Profile Management System : Structured Programming ...
Project Report - Diabetic Profile Management System : Structured Programming ...Project Report - Diabetic Profile Management System : Structured Programming ...
Project Report - Diabetic Profile Management System : Structured Programming ...Syed Ahmed Zaki
 
History and Real Life Applications of Fourier Analaysis
History and Real Life Applications of Fourier AnalaysisHistory and Real Life Applications of Fourier Analaysis
History and Real Life Applications of Fourier AnalaysisSyed Ahmed Zaki
 

Plus de Syed Ahmed Zaki (11)

Networking Lab Report
Networking Lab ReportNetworking Lab Report
Networking Lab Report
 
Assignment on Numerical Method C Code
Assignment on Numerical Method C CodeAssignment on Numerical Method C Code
Assignment on Numerical Method C Code
 
Presentation on Numerical Method (Trapezoidal Method)
Presentation on Numerical Method (Trapezoidal Method)Presentation on Numerical Method (Trapezoidal Method)
Presentation on Numerical Method (Trapezoidal Method)
 
Presentation on Transmission Media
Presentation on Transmission MediaPresentation on Transmission Media
Presentation on Transmission Media
 
Architecture of 80286 microprocessor
Architecture of 80286 microprocessorArchitecture of 80286 microprocessor
Architecture of 80286 microprocessor
 
Algorithm Presentation
Algorithm PresentationAlgorithm Presentation
Algorithm Presentation
 
Importance of Electric Device Knowledge in Computer Science Education
Importance of Electric Device Knowledge in Computer Science EducationImportance of Electric Device Knowledge in Computer Science Education
Importance of Electric Device Knowledge in Computer Science Education
 
Presentation on bernoulli
Presentation on bernoulliPresentation on bernoulli
Presentation on bernoulli
 
Presentation on inverse matrix
Presentation on inverse matrixPresentation on inverse matrix
Presentation on inverse matrix
 
Project Report - Diabetic Profile Management System : Structured Programming ...
Project Report - Diabetic Profile Management System : Structured Programming ...Project Report - Diabetic Profile Management System : Structured Programming ...
Project Report - Diabetic Profile Management System : Structured Programming ...
 
History and Real Life Applications of Fourier Analaysis
History and Real Life Applications of Fourier AnalaysisHistory and Real Life Applications of Fourier Analaysis
History and Real Life Applications of Fourier Analaysis
 

Dernier

Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxsiddharthjain2303
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingBootNeck1
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating SystemRashmi Bhat
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
Vishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsVishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsSachinPawar510423
 
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
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncssuser2ae721
 
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...Amil Baba Dawood bangali
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdfCaalaaAbdulkerim
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgsaravananr517913
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 

Dernier (20)

Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptx
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event Scheduling
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
Vishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsVishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documents
 
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
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
 
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdf
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 

Lab report assembly

  • 1. Lab Report on Microprocessor and Assembly Language Lab Course Code: CSE 232 Fall-2014 Submitted To: Nasrin Akter Dept. of Computer Science & Engineering Faculty of Science & Information Technology Submitted by: Syed Ahmed Zaki ID:131-15-2169 Sec: B Dept. of CSE,FSIT Date of submission: 12, December 2014
  • 2. Contents Problem Page Problem 1 2 Problem 2 4 Problem 3 7 Problem 4 8 Problem 5 9 Problem 6 10 Problem 7 11 Problem 8 12 1
  • 3. Problem 1: The sum of 5 and 4 is 9 Solution: .model small .stack 100h .data m1 db "Enter two number: $" m2 db "The sum of $" m3 db " and $" m4 db " = $" .code main proc mov ax,@data mov ds,ax lea dx,m1 mov ah,9 int 21h mov ah,1 int 21h mov bl,al mov ah,1 int 21h mov bh,al mov ah,2 mov dl,0dh int 21h mov dl,0ah int 21h lea dx,m2 mov ah,9 int 21h 2
  • 4. mov ah,2 mov dl,bl int 21h mov ah,9 lea dx,m3 int 21h mov ah,2 mov dl,bh int 21h lea dx,m4 mov ah,9 int 21h sub bl,30h sub bh,30h add bl,bh add bl,30h mov ah,2 mov dl,bl int 21h mov ah,4ch int 21h main endp end main Output: 3
  • 5. Problem 2: Write a program to display the left margin: Enter seven initial:12345 1 2 3 4 5 Solution: .model small .stack 100h .data m1 db "Enter five initial:$" .code main proc mov ax,@data mov ds,ax lea dx,m1 mov ah,9 int 21h mov ah,1 int 21h mov bl,al mov ah,1 int 21h mov bh,al mov ah,1 int 21h mov cl,al mov ah,1 int 21h mov ch,al 4
  • 6. mov ah,1 int 21h mov dh,al mov ah,2 mov dl,0dh int 21h mov dl,0ah int 21h mov ah,2 mov dl,bl int 21h mov ah,2 mov dl,0dh int 21h mov dl,0ah int 21h mov ah,2 mov dl,bh int 21h mov ah,2 mov dl,0dh int 21h mov dl,0ah int 21h mov ah,2 mov dl,cl int 21h mov ah,2 mov dl,0dh int 21h mov dl,0ah int 21h 5
  • 7. mov ah,2 mov dl,ch int 21h mov ah,2 mov dl,0dh int 21h mov dl,0ah int 21h mov ah,2 mov dl,dh int 21h mov ah,4ch int 21h main endp end main Output: 6
  • 8. Problem 3: Suppose AL and BL contain two number,Display the one that comes last in the sequence. Solution: .model small .stack 100h .code main proc mov al,68 mov bl,65 cmp al,bl jg d1 jmp d2 d1: mov ah,2 mov dl,al int 21h jmp exit d2: mov ah,2 mov dl,bl int 21h exit: mov ah,4c int 21h main endp end main Output: 7
  • 9. Problem 4: AL and BL contain two characters. Display the last character. Solution: .model small .stack 100h .code main proc mov al,'A' mov bl,'M' cmp al,bl jg d1 jmp d2 d1: mov ah,2 mov dl,al int 21h jmp exit d2: mov ah,2 mov dl,bl int 21h exit: mov ah,4ch int 21h main endp end main Output: 8
  • 10. Problem 5:If AL contain number display “n” ; If AL contain character display “c” Solution: .model small .stack 100h .code main proc mov ah,1 int 21h mov bl,al mov ah,2 mov dl,0dh int 21h mov dl,0ah int 21h cmp bl,'1' je print_number_n jmp print_character_c print_number_n: mov ah,2 mov dl,'n' int 21h jmp exit print_character_c: mov ah,2 mov dl,'c' int 21h exit: mov ah,4ch int 21h 9
  • 11. main endp end main Output: Problem 6: Read a character and if it is lowercase letter, Display it. Solution: .model small .stack 100h .code main proc mov ah,1 int 21h mov bl,al cmp bl,'a' jnge end_if cmp bl,'z' jnge end_if mov ah,2 mov dl,bl int 21h end_if: mov ah,4ch int 21h 10
  • 12. main endp end main Output: Problem 7: Write a count – controlled loop to display a row of 60 stars. Solution: .model small .stack 100h .code main proc mov cx,60 mov ah,2 mov dl,'*' count: int 21h loop count main endp end main 11
  • 13. Output: Problem 8: Prompt the user to enter a line of text. On the next line, display the capital letter entered that comes first alphabetically and the one that comes last. If no capital entered, display “No capital letters”. Solution: .model small .stack 100h .data prompt db 'Type a line of text',0dh,0ah,'$' nocap_msg db 0dh,0ah,'No capitals $' cap_msg db 0dh,0ah,'First Capital = ' first db '|' db ' Last Capital = ' last db '@ $' .code main proc ;initialize ds mov ax,@data mov ds,ax ;display opening message 12
  • 14. mov ah,9 ;display string function lea dx,prompt ;get opening message int 21h ;display it ;read and process a line of text mov ah,1 ;read a character function int 21h ;char in dl while_: ;while a character is not a carriage return do cmp al,0dh ;CR? je end_while ;yes,exit ;if character is a capital letter cmp al,'A' ;char >='A'? jnge end_if ;not a capital letter cmp al,'Z' ;char <= 'Z'? jnle end_if ;not a capital letter ;then ;if character precedes first capital cmp al,first ;char < first capital ? jnl check_last ;no, >= ;then first capital = character mov first,al ;FIRST=char ;end_if check_last: ;char >last capital? ;if character follows last capital cmp al,last ;char > last capital? jng end_if ;no,<= ;then last capital=character mov last,al ;last = char ;end_if 13
  • 15. end_if: ;read a character int 21h ;char in AL jmp while_ ;repeat loop end_while: ;display results mov ah,9 ;display string function ;if no capitals were typed cmp first,'|' ;first '|' jne caps ;no display results ;then lea dx,nocap_msg ;no capitals jmp display caps: lea dx,cap_msg ;capitals display: int 21h ;display message ;end_if ;dos exit mov ah,4ch int 21h main endp end main 14