Assignment 3
Assignment 3
Assignment 03
10 marks
Question 1:
MS-DOS function 2Ch returns system time in CX register. This function packs the Hour,
Minute and Second into 16-bits using following format.
Second: Bit No. 0-5,
Minute: Bit No. 6-11 and
Hour: Bit No. 12-15
To get current time of system following code is used:
mov ah, 2Ch
int 21h
Write an assembly language code that isolates hour, minute and second bits appropriately
and display the system time on console.
20 marks
Question 2:
Write an assembly language procedure named “equalsIgnoreCase”, which receives two
strings and their sizes, and returns true if the two strings contain the same characters
irrespective of the case.
For example, for strings {“aBc”} and {“Abc”} the function returns true, but for {“aBc”}
and {“aB”}, or {“aBc”} and {“Xbz”}, the function returns false.
Write a generic procedure that must handle all checks and conditions.
20 marks
Question 3:
Perfect Numbers: An integer is said to be a perfect number if the sum of its factors,
including 1 (but not the number itself), is equal to the number. For instance, 6 is a perfect
number (6 = 1 + 2 + 3).
Write an assembly language program to check whether an input number is perfect or not.
Your main procedure should ask the user to input a number. Input-Number should be
between 1 and 100. Now pass this number to a procedure named “perfect”.
Procedure ‘perfect’ should determine whether the parameter is a perfect number or not. It
should also print all factors of a perfect number. Use stack addressing to store factors of a
perfect number. You are not allowed to use array to store factors of a perfect number.
Submission Guidelines:
• Submit a folder having three .txt files. i.e. Q1.txt, Q2.txt and Q3.txt
• If your Roll no. is 18i-1716, your folder name should be 18_1716.
• Do not compress your folder: zip, rar et cetera.
• Your codes should be compatible with masm615 (available on Slate).
• Late submissions will not be accepted.
• Email submissions will not be accepted.
• You’ll get 10 marks for following these guidelines and neg 10 marks for not doing so.
• Plagiarism will result in neg 5 abs marks.