English

A 8-bit number stored in memory location BABA H. Write an Assembly Language Program to add each bit of the given 8-bit number and store the resect at memory location. - Computer Science 2

Advertisements
Advertisements

Question

A 8-bit number stored in memory location BABA H. Write an Assembly Language Program to add each bit of the given 8-bit number and store the resect at memory location.

Long Answer
Advertisements

Solution

Label Instruction Comments
  LDA BABAH ; Load Acc. with content of memory LOC BABAH
MVI B, 08 ; Move data 08H to Reg. B
MVI C, OOH ; Move data OOH to Reg. C
CYCLE RRC ; Rotate Acc right
  JNC - SKIP ; if no carry, go to SKIP
INR C ; Otherwise Increment Reg. C by 1
SKIP DCR B ; Decrement Reg. B by 1
  JNZ CYCLE ; If B ≠ 0, go to CYCLE
MOV A, C ; Move Reg. C to Acс
STA FAFAH ; Store Acc to FAFA H
HLT ; Stop
shaalaa.com
  Is there an error in this question or solution?
2024-2025 (March) Official
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×