Skip to content

Optimized memcpy and mempcpy #594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 27, 2025
Merged

Optimized memcpy and mempcpy #594

merged 2 commits into from
Apr 27, 2025

Conversation

ZERICO2005
Copy link
Contributor

@ZERICO2005 ZERICO2005 commented Apr 22, 2025

Changes:

  • optimized memcpy and mempcpy
  • optimized strlen
  • optimized memset for speed (Adds 6 bytes and 6F, but removes 5R + 12W in full execution case)
  • Added bzero. This copies zeros from 0xE40000 which has less read states, thereby making it significantly faster than memset.

memcpy and mempcpy were optimized by turning NC \ sbc hl, hl \ sbc hl, bc \ ret z into C \ sbc hl, hl \ add hl, bc \ ret nc, saving 1 byte and 1F in all cases. The carry flag is set by doing ld iy, -1 \ add iy, sp instead of the usual ld iy, 0 \ add iy, sp

@mateoconlechuga mateoconlechuga merged commit 2bbfa2d into master Apr 27, 2025
9 checks passed
@mateoconlechuga mateoconlechuga deleted the opt_memcpy branch April 27, 2025 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants