Division program

Discussion in 'Assembly Language Programming (ALP) Forum' started by Zahid, Apr 10, 2007.

  1. Zahid

    Zahid New Member

    Joined:
    Apr 6, 2007
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    Could you send me a program for Division of two nos in microprocessor 8085?


    Regards,
    Zahid
     
  2. adventurer

    adventurer New Member

    Joined:
    May 11, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hey guy, try this...
    Code:
               LHLD 2200H   ; Get the devidend
               LDA 2202H
               MOV C, A      ; Get the divisor
               LXI D, 0000H ; Quotient = 0
    BACK : MOV A, L
               SUB C           ; Subtract divisor
               MOV L, A       ; Save partial result
               JNC SKIP        ; if CY # 1 jump
               DCR H            ; Subtract borrow of previous subtraction
    SKIP :  INX D             ; Increment quotient
               MOV A, H
               CPI, 00          ; Check if dividend < divisor
               JNZ BACK       ; if no repeat
               MOV A, L
               CMP C
               JNC BACK
               SHLD 2302H   ; Store the remainder
               XCHG
               SHLD 2300H   ; Store the quotient
               HLT
     
    Last edited by a moderator: May 12, 2007

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice