All Exams Test series for 1 year @ ₹349 only
Question

Using 8051 assembly language programming numbers 54 H and 98 H are added. After addition the status of CY, AC and P flags are respectively:

This question was previously asked in
UGC NET 2023 Paper 1 Question Paper (22-Jun-2023) (Shift 2)
The correct answer is

0, 0, 1

What is asked. Add the two bytes in the accumulator and report the three PSW flags affected by ADD: carry (CY), auxiliary carry (AC) and parity (P).

Step 1 — write both numbers in binary.

\(54_{16} = 0101\ 0100_2, \qquad 98_{16} = 1001\ 1000_2\)

Step 2 — add.

\(0101\,0100 + 1001\,1000 = 1110\,1100_2 = EC_{16}\)

As a decimal check: 84 + 152 = 236, and 236 < 256, so the result still fits in one byte.

Step 3 — carry flag CY. CY is set only by a carry out of bit 7. The sum 236 is below 256, so nothing spills out of the byte:

\(CY = 0\)

Step 4 — auxiliary carry AC. AC is set by a carry from bit 3 into bit 4, i.e. by the lower-nibble addition. Here the low nibbles are 4 and 8:

\(4_{16}+8_{16}=C_{16}=12 \lt 16 \Rightarrow AC = 0\)

(AC exists for BCD arithmetic; the DA A instruction uses it to decide whether to add 6 to a nibble.)

Step 5 — parity flag P. In the 8051, P is not a latched flag but is recomputed after every instruction to reflect the accumulator: P = 1 when A contains an odd number of 1s (odd parity convention). Count the ones in EC = 1110 1100:

\(1+1+1+0+1+1+0+0 = 5 \ (\text{odd}) \Rightarrow P = 1\)

Assemble the answer: CY = 0, AC = 0, P = 1.

Common slips to avoid. Do not judge CY from the most significant bit of the result being 1 — bit 7 being set does not mean a carry occurred. Do not compute parity of the operands; P always describes the current accumulator content. And remember AC looks only at the nibble boundary, not at bit 7.

Hence, the flag status is CY = 0, AC = 0, P = 1.

Was this answer helpful?

Similar Questions

  1. In an 8086, AL = 19 BCD & BL = 36 BCD prior to execution of following example

    ADD AL, BL

    DAA

    What will be content of AL after execution of the example ?

  2. If SS = 3000 H and SP = 2000 H in 8086 microprocessor, in which memory addresses the contents of BL and BH are stored respectively, when PUSH BX instruction is executed.

  3. The BIU of 8086 contains 16 bit segment registers. What is the width of address sent out by BIU of 8086 miocroprocessor?

  4. Loop 1 : MOV A, P1

    MOV P2, A

    JNB P3.3, Loop1

    The program does the following

  5. In 8051 micro controller

    A. INT0 and INT1 pins are normally low

    B. Timer1 Interrupt Flag is auto cleared after occurrence

    C. Serial interrupt is auto cleared after occurrence

    D. Timer 0 Vector location is 000B H

    Choose the correct answer from the options given below:

  6. In 8086

    A. The stack memory is a FIFO (First In First Out)

    B. The JMP instruction cannot be prefixed with segment override prefix

    C. SAHF and POPF instructions affect the flag register

    D. DAS instruction cannot be used for 8 bit operations.

    Choose the correct answer from the options given below :

  7. In 8051

    A. INT0 and INT1 can be made edge triggered by programming TCON

    B. On reset serial communication interrupts has highest priority

    C. Upon reset all interrupts are enabled

    D. Only one interrupt is set aside for serial communication.

    Choose the correct answer from the options given below:

  8. Match List I with List II in 8086 Micro processor

    LIST I LIST II
    A. Direct memory addressing data memoryI. MOV [SI], 2500 H
    B. Immediate AddressingII. PUSHF
    C. Flag ManipulationIII. RET
    D. Control transferIV. MOV BX, [2000 H]

     

    Choose the correct answer from the options given below:

  9. Arrange following interrupts in order of polling (checking interrupt conditions) after every instructions.

    A. Serial Interrupt

    B. External 1 Interrupt

    C. Timer 1 Interrupt

    D. External 0 Interrupt

    Choose the correct answer from the options given below :

  10. Given below are two statements : one is labelled as Assertion A and the other is labelled as Reason R

    Assertion A : Some instruction read the contents of an internal port latch instead of reading the status of an external pin.

    Reason R : We must not make a distinction between reading the status of the input pin and internal latch of the output port.

    In the light of the above statements, choose the most appropriate answer from the options given below :


Important Questions from Microprocessors

  1. An 8086 address bus is a/an _____ -bit bus

  2. Program counter for any counter:

  3. In the pin out configuration of the 8085 microprocessor, the sequential input data is represented by

  4. Which of the following functions is not performed by a microprocessor?

  5. Match the columns.

    Pin

    Description

    a. D 0-D 7

    1. Reset Input

    b. RESET

    2. Data Lines

    c. A 0,A 1

    3. Internal Address

Need Expert Advice?
Test Series
UGC NET img
Teaching
UGC NET Library and Information Science 2024 - 2025 Mock Test Series
66 Tests 4 Tests Free
791 Attempts
4.4(17)
English, Hindi
More Questions from UGC NET

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App