Advertisement
Zeda

HLDE_Div_C

Jan 4th, 2012
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. HLDE_Div_C:
  2. ;Inputs:
  3. ;     HLDE is a 32 bit value where HL is the upper 16 bits
  4. ;     C is the value to divide HLDE by
  5. ;Outputs:
  6. ;    A is the remainder
  7. ;    B is 0
  8. ;    C is not changed
  9. ;    HLDE is the result of the division
  10. ;
  11.      ld b,32
  12.      xor a
  13.        sll e \ rl d
  14.        adc hl,hl
  15.        rla
  16.        cp c
  17.        jr c,$+4
  18.          inc e
  19.          sub c
  20.        djnz $-10
  21.      ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement