Skip to content

Optimized memcpy and mempcpy#594

Merged
mateoconlechuga merged 2 commits into
masterfrom
opt_memcpy
Apr 27, 2025
Merged

Optimized memcpy and mempcpy#594
mateoconlechuga merged 2 commits into
masterfrom
opt_memcpy

Conversation

@ZERICO2005

@ZERICO2005 ZERICO2005 commented Apr 22, 2025

Copy link
Copy Markdown
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants