From 630537d019c94bc94dc4ebc710c888082e5a1c27 Mon Sep 17 00:00:00 2001 From: Matthew Waltz Date: Thu, 21 Nov 2024 07:55:25 -0700 Subject: [PATCH] [libc] add memcpy --- src/libc/memcpy.src | 28 ++++++++++++++++++++++++++++ src/libc/os.src | 2 -- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 src/libc/memcpy.src diff --git a/src/libc/memcpy.src b/src/libc/memcpy.src new file mode 100644 index 000000000..ad836658a --- /dev/null +++ b/src/libc/memcpy.src @@ -0,0 +1,28 @@ + assume adl=1 + + section .text + public _memcpy + +if PREFER_OS_LIBC + +_memcpy := $0000A4 + +else + +_memcpy: + ld iy,0 + add iy,sp + ld bc,(iy + 6) + sbc hl,hl + sbc hl,bc + jr z,.zero + ld de,(iy + 0) + ld hl,(iy + 3) + ldir +.zero: + ld hl,(iy + 0) + ret + +end if + + diff --git a/src/libc/os.src b/src/libc/os.src index f6b527a8e..09ce92ecb 100644 --- a/src/libc/os.src +++ b/src/libc/os.src @@ -8,8 +8,6 @@ _longjmp := 000098h _memchr := 00009Ch public _memcmp _memcmp := 0000A0h - public _memcpy -_memcpy := 0000A4h public _memmove _memmove := 0000A8h public _setjmp