Skip to content
Exercise Problems · Q5

Q.Subtract 21H from 30H and write the program and solve.

Karnataka PUCTextbookNumericImportance★★★★★est
22% · 25/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]

Clear the carry, load 30H into A and SUBB 21H; A holds 0FH and CY = 0 marks a positive result.

Concept. The 8051 provides only SUBB A, source (subtract with borrow), so CLR C is used first to force CY = 0 and give an ordinary subtraction. After SUBB, CY = 0 means the result is positive.

Program:

CLR C          ; CY = 0
MOV A, #30H    ; A = 30H
SUBB A, #21H   ; A = A - 21H
``` …

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.