gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 34945fa9b49848cb815b92ee796e4b6ab88a4ba4 parent 08ccffbf7ff31be4df264b4d682e1e17429dfacc Author: Phidias618 <126189685+Phidias618@users.noreply.github.com> Date: Sun, 17 May 2026 15:43:05 +0200 refactor memcpy() for the z80 target Diffstat:
| M | gbdk-lib/libc/asm/z80/memcpy.s | 18 | ++++++++++-------- |
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/gbdk-lib/libc/asm/z80/memcpy.s b/gbdk-lib/libc/asm/z80/memcpy.s @@ -7,24 +7,26 @@ ; The Z80 has the ldir instruction, but the chain of ldi is faster. _memcpy: -___memcpy: +___memcpy: ex de, hl pop af pop bc push af - ld a, b - or c + + ld a, c + or b ret z + push de + ld a, c - and #15 add a - sub #32 neg - ld iy, #1$ - add iyl + and #31 + + add #<1$ ld iyl, a - adc iyh + adc #>1$ sub iyl ld iyh, a xor a
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.