Advertisement
Zeda

HL/10

Feb 8th, 2015
710
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. HL_div_10:
  2. ;;Expects Z80 mode
  3. ;;Input: HL
  4. ;;Output: HL
  5. ;;Destroys: HL,BC
  6. ;;42cc
  7.     ld d,h
  8.     ld e,0x33
  9.     ld h,e
  10.     mlt de
  11.     mlt hl
  12. ;16cc
  13. ;DE*256+(de+hl+h)
  14. ;    ld c,h \ ld b,0
  15. ;    add hl,de \ jr nc,$+3 \ inc de
  16. ;    add hl,bc \ jr nc,$+3 \ inc de
  17. ;    ld c,h \ add hl,bc
  18. ;    rr h \ rr l
  19. ;23cc
  20.     ld b,e \ ld c,h
  21.     add hl,de \ jr nc,$+3 \ inc de
  22.     add hl,bc \ jr nc,$+3 \ inc d
  23.     ld l,h \ ld h,d \ rr h \ rr l
  24. ;20cc
  25.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement