Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   Division program (http://www.go4expert.com/forums/division-program-t3815/)

Zahid 10Apr2007 06:45

Division program
 
Hi,

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


Regards,
Zahid

adventurer 12May2007 01:47

Re: Division program
 
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



All times are GMT +5.5. The time now is 15:29.