Advertisement
luckytyphlosion

More efficient CopyData function

Nov 7th, 2015
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CopyData::
  2.     ld a, e
  3.     add c
  4.     jr c, .noOverflow
  5.     dec b
  6. .noOverflow
  7.     inc b
  8.     jr z, .loop2
  9.     and a
  10.     ld c, a
  11.     jr z, .handleLoop
  12. .loop1
  13.     ld a, [hli]
  14.     ld [de], a
  15.     inc e
  16.     jr nz, .loop1
  17.     inc d
  18. .handleLoop
  19.     dec b
  20.     jr nz, .loop1
  21. .loop2
  22.     ld a, [hli]
  23.     ld [de], a
  24.     inc e
  25.     dec c
  26.     jr nz, .loop2
  27.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement