You are on page 1of 2

Computer Architecture and Assembly Language

BS (CS)
Lab #03

Objectives: The main objective of this lab is to familiarize students with the concept of:

o Creating case conversion programs in assembly Language


o Declaring and Printing a Variable
o Working with Strings
Note: Refer the ASCII Table for this lab

Tasks:
Program1: The purpose of this program is to take input a capital letter from
user and to print corresponding small letter

dosseg
.model small
.stack 100h
.data
.code
main proc
mov ah, 1; (Ah) is used for input and 1 is sub routine service for input
int 21h; for accessing I/O device
mov dl, al; moving input character to dl
add dl, 32
mov ah, 02
int 21h; for print
mov ah, 4ch ; returning to DOS
int 21h ; interrupt 21h
main endp
end main

 Task 1: Create a Program that takes a letter in small alphabet and print its corresponding
capital letter.

Program2: Following program will print a message for asking user to give input
and then print it on screen and finally on new line it will print “Thank you”.

dosseg
.model small
.stack 100h
.data
msg1 db 'Enter character: $'
msg2 db 'Thank you$'
.code
main proc
Compiled by: Dr Khakoo Mal
mov ax, @data // to load the starting address of a datasegment
into ax.
mov ds, ax // Initializes the data segment register
lea dx, msg1 ; Load Effective Address
mov ah, 09 //for printing a character
int 21h
mov ah, 01 // Requests keyboard input
int 21h
mov dl, al
mov ah, 02
int 21h
mov dl,
0ah //
mov ah, 02
int 21h
lea dx, msg2
mov ah, 09
int 21h
mov ah,4ch
int 21h
main endp
end main
 Task 2: Change the following code as follows:
Enter first number:
Enter Second Number:
First Number
Second Number
Thank you
 Task 3: Declare the following variables in the program and print the output as follows:
Var1 db ‘*’
Var2 db ‘1234$’
Var3 db ‘1’

Output:
*
1
1234
 Task 4: Write a program to prompt the user, (b) read first, middle, and last initials
of a person's name, and (c) display them down the left margin.
Sample execution:
ENTER THREE INITIALS: JFK
J
F
K

Compiled by: Dr Khakoo Mal

You might also like