SHARE
TWEET

More efficient CopyData function

luckytyphlosion Nov 7th, 2015 (edited) 161 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
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