Write ALP to divide number at 6068H by a non-zero number at 6067H. Store quotient at 6069H and remainder at 606AH. - Computer Science 2

Advertisements
Advertisements
Answer in Brief

Write ALP to divide number at 6068H by a non-zero number at 6067H. Store quotient at 6069H and remainder at 606AH.

Advertisements

Solution

Mnemonics Comment
Opcode Operand
        MVI C, 00 ; Store 00 in C Register
          LXI H, 6067 ; Store 6067 in HL pair
       MOV A, M ; Copy memory to Acc
 INX H ; Increment HL pair by 1
      MOV B, M ; Copy memory to B Register
   BACK: CMP B ; Compare Acc. with B Register
             JC : NEXT ; If Cy = 1, go to next
            SUB B ; Subtract B from Acc
            INR C ; Increment C content by 1
            JMP : BACK ; Jump to Back
            INX H ; Increment HL pair by 1
            MOV M, C ; Store Quotient in memory
            INX H ; Increment HL pair by 1
            MOV M, A ; Store Reminder in memory
            RST 1.0 ; Restart.
Concept: Instruction Set and Programming of 8085
  Is there an error in this question or solution?
2014-2015 (March)

APPEARS IN

Share
Notifications



      Forgot password?
Use app×