Skip to content
Solved Examples · Example 6

Q.Write a program to add two 8- bit numbers OE4H and OD9H. Show how the flag register is affected by the above instructions.

Karnataka PUCTextbookNumericImportance★★★★★est
27% · 31/115 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

[!TLDR]

Adding 0E4H and 0D9H gives 1BDH; the accumulator keeps the low byte BDH while the ninth bit sets CY = 1, and there is no half-carry so AC = 0.

Concept - addition and the flags. ADD A, source leaves the 8-bit sum in A. If the true sum is larger than FFH, the carry out of bit D7 is stored in the carry flag CY; a carry from bit D3 into bit D4 sets the auxiliary-carry flag AC (used for BCD).

Program:

MOV A, #0E4H   ; load 0E4H into A
ADD A, #0D9H   ; add 0D9H to A

Working:

  0E4H     1110 0100
+ 0D9H   + 1101 1001
-----   ------------
 1BDH   1 1011 1101
``` …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.