MaAL Final Paper BCS VI (A+B)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

COMSATS University Islamabad

Attock Campus

Program: BCS VI (A+B)

Spring 2021 Terminal


Subject: Microprocessor & Assembly Language

Date: 06/07/2021
Total Marks: 35 Time allowed: 2 hr 40 min
Email of Faculty: [email protected]

Important Guidelines for Students

1. You have to solve the paper on plain paper (preferably A4 printer paper)
2. Write your name, registration number, semester, section, subject name, page number and date
on top of the paper.
3. Sign on the bottom right of the paper.
4. Only those sheets would be accepted which has all the information as mentioned on S. No. 2
and S. No. 3.
5. After completion of the paper scan each page with CAMSCANNER Application (available on
Google PlayStore, Apple AppStore and WindowsStore).
6. Convert the scanned pages to pdf document and email it, written on the paper, to your subject
teacher through your official email address (example [email protected]). Email
from any other address will not be accepted for answer sheet submission.
7. If the paper is started at 0900 hrs you have to send the email latest by 1200 hrs. For the papers
starting at 1400 hrs the submission time is till 1700 hrs. No late email would be accepted.
8. In case of issue with email, please contact your teacher through his WhatsApp and seek
permission to send the pdf through WhatsApp. WhatsApp submission can only be done if
permitted by the teacher.

1
Q.# 1: Write an instruction sequence to reverse the bits in the accumulator. Bit 7 and bit 0 are swapped,
bit 6 and bit 1 are swapped, etc. Note: Explain the working of all code. (CLO 2, PLO 2)
(5)
Q.# 2: The 8051 instruction set does not include an instruction to XOR two bit values. Write a (6)
subroutine XRB that effectively behaves as an instruction to XOR two bits in the form XRB C, P. This
means that the two bit values are stored in C and P, respectively, prior to the calling of the subroutine,
and the XORed result should be put back in C.
Note: Explain the working of all code. (CLO 3, PLO 3)

Q. # 3: Write a program to add 897F9AH, 34BC48H and last six digits of your CNIC and save the
result in RAM memory locations starting at 40H. (CLO 2, PLO 2) (5)

Q. # 4: Find the contents of register A after each of the following is executed. (CLO 2, PLO 2) (4)

(a) MOV A, #56H (b) MOV A, #39H


SWAP A CLR C
RR A RL A
RR A RL A
(c) CLR C (d) SETB C
MOV A, #4DH MOV A, #7AH
SWAP A SWAP A
RRC A RLC A
RRC A RLC A
RRC A
Q. # 5: Write a subroutine called SQUARE to compute the square of an integer between 0 and
3.23 9. Enter the subroutine with the integer in A,and return with the square of the integer in A.
Write two versions of the subroutine: (a) using a look-up table, and (b) without using a
lookup table. Then (c) illustrate a call sequence to convert 6 to its square, 36. (CLO 2, PLO 2) (5)
Q. # 6: Write a program to toggle all the bits of PI and P2 continuously (a) using AAH and 55H (b)
using the CPL instruction. (CLO 3, PLO 3) (5)

Q. # 7: The stack pointer contains 07H, accumulator A contains 55H, and accumulator B contains
4AH. What internal RAM locations are altered, and what are their new values after executing the
following instructions?
PUSH ACC
PUSH 0F0H (CLO3, PLO 3) (5)

You might also like