Advertisement
Runer112

DE_mod_HL by Xeda

Apr 23rd, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. DE_mod_HL:
  2. ;Inputs:
  3. ; HL is an odd 16-bit number
  4. bit 7,h
  5. jr nz,$+6
  6. add hl,hl
  7. jp p,$-1 ;21
  8. ex de,hl
  9. ;DE is a modulus thingy
  10. ;HL is the number
  11. or a
  12. ModLoop:
  13. sbc hl,de ;15
  14. jr nc,$+3 ;12+6b
  15. add hl,de ;--
  16. sra d ;8
  17. rr e ;8
  18. jr nc,ModLoop;12|7
  19. ret
  20. ;1313 max
  21. ;76a+6b+83, a is at most 15, b is at most 15
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement