English

Write an Assembly Language Program to divide Hexa decimal number stored in the memory location 5000H by Hexa decimal number stored in memory location 5001H. - Computer Science 2

Advertisements
Advertisements

Question

Write an Assembly Language Program to divide Hexa decimal number stored in the memory location 5000H by Hexa decimal number stored in memory location 5001H. Store the quotient at 5002H and remainder at 5003H.

Long Answer
Advertisements

Solution

Label Instrcution Comments
LDA 5001H ; Load Acc with content of 5001 H
  MOV B, A ; Move Acc to Reg. В
LDA 5000H ; Load Acc with content of 5000H
MVI C, OOH ; Inhalize Reg. C to OOH
BACK: SUB B ; Subtract B from Acc
  JC-SKIP ; If carry go to SKIP
INR C ; Increment Reg. C by 1
JMP-BACK ; JUMP to Back
SKIP ADD B ; Add Reg. B to Acc
  STA 5003 H ; Store remainder at 5003Н
MOV A, C ; Move Reg. B to Acc
STA 5002 H ; Store quotient at 5002 Н
HLT ; Stop
shaalaa.com
  Is there an error in this question or solution?
2024-2025 (March) Official
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×