0% found this document useful (0 votes)
5 views8 pages

MACA LAB 2

This lab report details five assembly language programs that utilize DOS interrupts for basic I/O operations. The programs include reading and displaying a character, displaying a string, calculating the sum of two digits, converting a lowercase letter to uppercase, and comparing two ASCII characters. Each program is accompanied by an introduction, description, code, and conclusion confirming successful execution.

Uploaded by

hide5too9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views8 pages

MACA LAB 2

This lab report details five assembly language programs that utilize DOS interrupts for basic I/O operations. The programs include reading and displaying a character, displaying a string, calculating the sum of two digits, converting a lowercase letter to uppercase, and comparing two ASCII characters. Each program is accompanied by an introduction, description, code, and conclusion confirming successful execution.

Uploaded by

hide5too9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Jahangirnagar University

Savar, Dhaka, Bangladesh

Institute of Information Technology

Lab Report
Course Code: 3202
Course Title: Computer Architecture and Microprocessor Lab
Experiment No: 02
Experiment Title: Implementation of Basic I/O Operations Using DOS Interrupts in Assembly Language

Submitted By Submitted To
Name: Zillur Rahman Abdullah Name:Rashed Mazumder
Student ID: 2061 Designation: Faculty
Batch:50 Institute: IIT
Year: 3rd Year
Semester: 2nd Semester

Date of Experiment: 09/03/2025 Date of Submission:9-4-25


Program 1: Read a Character and Display it (INT 21h)
Introduction:
This program demonstrates how to read a single character from the keyboard and
display it on the screen using DOS interrupt 21h.
Description:
The program uses function 01h of INT 21h to read a character, and function 02h to
display it. The input character is stored in AL and then moved to DL for output.

Code:
.model small
.stack 100h
.code
main:
mov ah, 01h
int 21h

mov dl, al
mov ah, 02h
int 21h

mov ah, 4Ch


int 21h
end main
Conclusion:
The program successfully reads a character from the user and displays the same
character on the screen
Program 2: Display a String Terminated by $ (INT 21h Function 09h)
Introduction:
This program shows how to display a string stored in memory and terminated by a
$ symbol using DOS interrupt services.
Description:
The string is stored in the data segment and printed using function 09h of INT 21h,
which continues to print characters until it encounters the $ character.
Code:
.model small
.stack 100h
.data
msg db 'Hello, World!$', 0
.code
main:
mov ah, 09h
lea dx, msg
int 21h

mov ah, 4Ch


int 21h
end main
Conclusion:
The string was correctly displayed on the screen, verifying the use of string
printing with a $ terminator.
Program 3: Read Two Numbers and Display Their Sum
Introduction:
This program accepts two numeric characters from the user and displays their
sum as a single digit.
Description:
The program reads characters using INT 21h function 01h, converts them from
ASCII to numeric values by subtracting '0', adds them, then converts the result
back to ASCII for display.
Code:
.model small
.stack 100h
.data
msg1 db 'Enter first digit: $'
msg2 db 13,10,'Enter second digit: $'
msg3 db 13,10,'Sum is: $'
.code
main:

mov ah, 09h


lea dx, msg1
int 21h

mov ah, 01h


int 21h
sub al, '0'
mov bl, al

mov ah, 09h


lea dx, msg2
int 21h

mov ah, 01h


int 21h
sub al, '0'
add bl, al
mov ah, 09h
lea dx, msg3
int 21h
add bl, '0'
mov dl, bl
mov ah, 02h
int 21h
mov ah, 4Ch
int 21h
end main
Program 4: Convert Lowercase Letter to Uppercase
Introduction:
This program reads a lowercase letter from the user, converts it to uppercase, and
displays the result.
Description:
The program reads a character and checks if it lies between 'a' and 'z'. If so, it
subtracts 20h to convert it to uppercase using ASCII values.
Code:
.model small
.stack 100h
.code
main:
mov ah, 01h
int 21h
cmp al, 'a'
jl skip
cmp al, 'z'
jg skip
sub al, 20h
skip:
mov dl, al
mov ah, 02h
int 21h
mov ah, 4Ch
int 21h
end main
Conclusion:
The conversion from lowercase to uppercase was successfully implemented and
the result displayed on screen.
Program 5: Compare and Display the Smaller Extended ASCII Character
Introduction:
This program compares two ASCII characters stored in registers AL and BL and
displays the one that comes first in the character sequence.
Description:
By using a simple comparison (CMP), the program checks which of the two
characters has a smaller ASCII value and displays it using INT 21h function 02h.

Code :

.model small
.stack 100h
.code
main:
mov al, 'A'
mov bl, 'B'

cmp al, bl
jl show_al
jmp show_bl

show_al:
mov dl, al
jmp print
show_bl:
mov dl, bl

print:
mov ah, 02h
int 21h

mov ah, 4Ch


int 21h
end main
Conclusion:
The correct character with the lower ASCII value was displayed, confirming proper
comparison and conditional logic in Assembly.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy