Jahangirnagar University
Savar, Dhaka, Bangladesh
Institute of Information Technology
Lab Report
Course Code: 3204
Course Title: Computer Architecture and Microprocessor Lab
Experiment No: 03
Experiment Title: Sign Detection, Character Processing, and Arithmetic Operations in Assembly
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: 12/03/2025 Date of Submission:9-4-25
1. Sign Detection in AX
Introduction:
This program checks the sign of the value stored in the AX register. Based on the
sign, it places a corresponding value in the BX register.
Description:
If the value in AX is negative, BX is set to -1. If AX is zero, BX is set to 0. If AX is
positive, BX is set to 1.
Code:
mov bx, 0
cmp ax, 0
jl negative
jg positive
jmp done
negative:
mov bx, -1
jmp done
positive:
mov bx, 1
done:
Conclusion:
This code segment successfully identifies the sign of AX and reflects it in BX using
conditional jumps.
2. Display Uppercase Letters Only
Introduction:
This program reads a single character and checks if it is an uppercase alphabet
character (A-Z).
Description:
The ASCII range for uppercase letters is 65 ('A') to 90 ('Z'). If the input character
falls within this range, it is displayed.
Code:
mov ah, 1
int 21h
cmp al, 'A'
jl end
cmp al, 'Z'
jg end
mov dl, al
mov ah, 2
int 21h
end:
Conclusion:
Only uppercase letters are identified and displayed, while any other character
input is ignored.
3. Display Y or y, Otherwise Exit
Introduction:
This code reads a character and checks if it is 'y' or 'Y'. If yes, it displays the
character; otherwise, the program exits.
Description:
Using simple comparisons, the program determines whether to print the
character or terminate execution.
Code:
mov ah, 1
int 21h
cmp al, 'y'
je display
cmp al, 'Y'
je display
jmp exit
display:
mov dl, al
mov ah, 2
int 21h
exit:
Conclusion:
The program ensures only 'y' or 'Y' characters are displayed, effectively ignoring all
other input.
4. Maximum of Two Numbers
Introduction:
This program reads two numbers and prints the larger of the two.
Description:
After comparing the two input values, the larger one is stored in DL and displayed
using DOS interrupt.
Code:
mov ah, 1
int 21h
sub al, 30h
mov bl, al
mov ah, 1
int 21h
sub al, 30h
cmp al, bl
jg second
mov dl, bl
jmp print
second:
mov dl, al
print:
add dl, 30h
mov ah, 2
int 21h
Conclusion:
This code accurately compares two numbers and outputs the greater of the two
using ASCII conversion.
5. Sum of Arithmetic Series (1 + 4 + 7 + ... + 148)
Introduction:
This program computes the sum of the arithmetic series with the first term as 1
and a common difference of 3, ending at 148.
Description:
The series follows the pattern: Tn = a + (n - 1) * d, where a = 1 and d = 3. The loop
adds each term to the AX register.
Code:
mov ax, 0
mov cx, 1
start:
add ax, cx
add cx, 3
cmp cx, 149
jle start
Conclusion:
The program effectively accumulates the series into AX using a loop that iterates
through every term until 148.