daily pastebin goal
26%
SHARE
TWEET

BC_Div_DE_round

Zeda Mar 25th, 2015 (edited) 228 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. ;===============================================================
  2. BC_Div_DE_round:
  3. ;===============================================================
  4. ;Performs BC/DE, rounded
  5. ;Speed:   1226+10a+6b cycles, 1320cc worst case
  6. ;Size:    32 bytes
  7. ;Inputs:
  8. ;     BC is the numerator
  9. ;     DE is the denominator
  10. ;Outputs:
  11. ;     BC is the quotient
  12. ;     DE is divided by 2 (truncated)
  13. ;     A reflects the low bits of the quotient
  14. ;Destroys: HL
  15. ;===============================================================
  16.     ld a,b
  17.     ld hl,0
  18.     ld b,16
  19.  
  20.     rl c
  21.     rla
  22.     adc hl,hl
  23.     sbc hl,de
  24.     jr nc,$+3
  25.     add hl,de
  26.     ccf
  27.     djnz $-11
  28.     rl c
  29.     rla
  30.     ld b,a
  31.     srl d
  32.     rr e
  33.     sbc hl,de
  34.     ret c
  35.     inc bc
  36.     ret
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top