You are on page 1of 9

Green University of Bangladesh

Department of Computer Science and Engineering(CSE)


Faculty of Sciences and Engineering
Semester: (Spring, Year:2021), B.Sc. in CSE (Day)

LAB REPORT NO # 01
Course Title: Microprocessor and Microcontroller Lab

Course Code: CSE 304 Section:DC

Lab Experiment Name: a)Take a character input from user, check whether the
given character is vowel or not (a,e,i,o,u).
b)Take a number n from user. After that find out the factorial of that number n.
(Suppose for n=5, you have to find out factorial= 1 * 2 * 3 *4 * 5.
____________________________
S tudent Details

Name ID
1.
2. Md. Shahin Sarker 193002060
3.

Lab Date :________________________


Submission Date : 11/04/2021_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
___
Course Teacher’s Name : _ Md. Atikuzzaman _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
______

[For Teachers use only: Don’t Write Anything inside this box
Comments:.............................................. Date:..............................
L ab Report Status Marks: …………………………………
Signature:....................
.
1. TITLE OF THE LAB EXPERIMENT
1) Given a character, check if it is vowel or not .
2) Factorial of a positive integer is the product of an integer and all the integers
below it,the factorial of number n .

2. OBJECTIVES/AIM [1]
• To provide an introduction to syntax and structure of assembly
language.
• The main objective of this topic is to implement basic conditional
statements in assembly language.

PROCEDURE :

Problem 1
Vowel

There are 5 vowels in the English language: a, e, i, o, u

Problem 2

As we can see that 5 stacks will have to be maintained until a call to f(0) is
reached whose value is known and is returned. Therefore for n factorial, n
stacks will have to be maintained. Thus space complexity is O(n). It is also
evident from the above pictures that for n=5,  5 stacks will have to
be maintained. Therefore for n factorial, n stacks will have to be
maintained. Thus space complexity is O(n).

3. IMPLEMENTATION

Problem 1
Take a character input from user, check whether the given character is vowel or
not (a,e,i,o,u).:
org 100h

.MODEL SMALL
.STACK 100H

.DATA
msg DB "Enter the Character : $" ;message
msg1 DB 0dh,0ah, "Character is Vowel $" ;message 1
msg2 DB 0dh,0ah, "Character is not Vowel $" ;message

.CODE
MAIN PROC
MOV AX, @DATA
MOV DS, AX

mov ah, 09h


lea dx, msg ; display message
int 21h

mov ah, 01h ; set input Character


int 21H

cmp al,'a'
je vowel
cmp al,'e'
je vowel
cmp al,'i'
je vowel
cmp al,'o'
je vowel
cmp al,'u'
je vowel

mov ah,09h
lea dx,msg2
int 21h
jmp exit

vowel:
mov ah,09h
lea dx,msg1
int 21h

exit:
mov ah,4ch
int 21h

main endp
end main

ret

Problem 2

Take a number n from user. After that find out the factorial of that number n.
(Suppose for n=5, you have to find out factorial= 1 * 2 * 3 *4 * 5.

.MODEL SMALL
.STACK 10H
.CODE

MAIN PROC

mov BH,0
mov BL,10D

INPUT:

mov AH,1
int 21H
cmp AL,13D
jne NUMBER

and CX,0
mov CL,BH
dec CX
and AX,0

mov AL,BH

jmp FACT

NUMBER:

sub AL,30H
mov CL,AL
mov AL,BH
mul BL
add AL,CL
mov BH,AL

jmp INPUT
FACT:
mul CX
loop FACT

and DX,0
mov CX,10D

mov BX,0000H

STORE:

div CX ;DX:AX / CX REM = DX ,,, QUE = AX


mov [0000H+BX],DX
add BX,2H
mov DX,0
cmp AX,0
jne STORE

mov AH,2
mov DL,0DH
int 21H
mov DL,0AH
int 21H

PRINT:

sub BX,2H
mov DL,[0000H+BX]
add DL,30H
int 21H
cmp BX,0
jne PRINT

MAIN ENDP
END MAIN
.

4. TEST RESULT / OUTPUT


Take a number n from user. After that find out the factorial of that
number n. (Suppose for n=5, you have to find out factorial= 1 * 2
* 3 *4 * 5.
5. ANALYSIS AND DISCUSSION

Assembly language helps programmers to write human-readable


code that is almost similar to machine language. Machine
language is difficult to understand and read as it is just a series of
numbers. Assembly language helps in providing full control of
what tasks a computer is performing.

You might also like