HSC Science (Computer Science) 12th Board ExamMaharashtra State Board
Share
Notifications

View all notifications
Books Shortlist
Your shortlist is empty

A block of data is stored from memory location 4501H and onwards. The length of the block is stored at memory location 4500H. Write an  Assembly Language Program to fmd the sum of block of data. Store the two byte result from memory location 4600 H. - HSC Science (Computer Science) 12th Board Exam - Computer Science 2

Login
Create free account


      Forgot password?

Question

A block of data is stored from memory location 4501H and onwards. The length of the block is stored at memory location 4500H. Write an  Assembly Language Program to fmd the sum of block of data. Store the two byte result from memory location 4600 H.

Solution

Label Mnemonics Comments
  LXI H, 4500 H ; Set HL pointer to 4500 H
  MOV C, M ; Get count in register C
  MVI A, 00H ; Make LSB’s of sum = 00
  MOV B, A ; Make MSB’s of sum = 00
LOOP : INX H ; Set HL to point num in series
  ADD M ; Previous No. + Next No
  JNC AHEAD ; Is carry ? No, goto AHEAD
  INR B ; Yes, add carry to MSB’s of sum
AHEAD : DCR C ; Decrement count
  JNZ LOOP ; Is count = 0 ? No, jump to LOOP
  STA 4600 H ; Store LSB’s of the sum to 4600 H
  MOV A, B ; Get MSB’s of sum in accumulator
  STA 4601 H ; Store MSBs
  RST 1.0 ; Restart
  Is there an error in this question or solution?

APPEARS IN

 2016-2017 (March) (with solutions)
Question 5.2.3 | 5.00 marks
Solution A block of data is stored from memory location 4501H and onwards. The length of the block is stored at memory location 4500H. Write an  Assembly Language Program to fmd the sum of block of data. Store the two byte result from memory location 4600 H. Concept: Instruction Set and Programming of 8085.
S
View in app×