Advertisement
Zeda

HL_Div_C

Jan 4th, 2012
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. HL_Div_C:
  2. ;Inputs:
  3. ;     HL is the numerator
  4. ;     C is the denominator
  5. ;Outputs:
  6. ;     A is the remainder
  7. ;     B is 0
  8. ;     C is not changed
  9. ;     DE is not changed
  10. ;     HL is the quotient
  11. ;
  12.        ld b,16
  13.        xor a
  14.          add hl,hl
  15.          rla
  16.          cp c
  17.          jr c,$+4
  18.            inc l
  19.            sub c
  20.          djnz $-7
  21.        ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement