HSC Science (Computer Science) 12th Board ExamMaharashtra State Board
Account
It's free!

User


Login
Create free account


      Forgot password?
Share
Notifications

View all notifications
Books Shortlist
Your shortlist is empty

Solution - Write an Assembly Lariguage Program to add 2 decimal numbers stored at 1050 H and 1051 H.· Store result at 1052 H and 1053 H. - HSC Science (Computer Science) 12th Board Exam - Computer Science 2

Question

Write an Assembly Lariguage Program to add 2 decimal numbers stored at 1050 H and 1051 H.· Store result at 1052 H and 1053 H.

Solution

 

Label Mnemonics + Operand Comment
  LXI H,1050 H Initialise HL pair to memory address 1050 H
  MVI B, 00H Initialise register to store MSB of sum
  MOV A, M Move first number in accumulator
  INX H Get address of next number
  ADD M Add next number to accumulator
  DAA Decimal adjust accumulator
  JNC L1 Is Carry ? No, jump to label L1
  INR B Increment register B
L1: INX H Increment HL pair by 1
  MOV M, A Store LSB of Sum in memory
  MOV A, B Move MSB of Sum in accumulator
  INX H Increment HL pair by
  MOV M, A Store MSB of Sum in memory
  RST 1.0 Restart
Is there an error in this question or solution?

APPEARS IN

 2015-2016 (March) (with solutions)
Question 5.2.1 | 5 marks
Solution for question: Write an Assembly Lariguage Program to add 2 decimal numbers stored at 1050 H and 1051 H.· Store result at 1052 H and 1053 H. concept: Instruction Set and Programming of 8085. For the course HSC Science (Computer Science)
S