2 ; This file, instead of "common/memmove.s", will be assembled for the pce
3 ; target. This version is smaller and faster because it uses the HuC6280's
4 ; block-copy instructions.
6 ; 2003-08-20, Ullrich von Bassewitz
7 ; 2015-10-23, Greg King
9 ; void* __fastcall__ memmove (void* dest, const void* src, size_t size);
11 ; NOTE: This function uses entry points from "pce/memcpy.s"!
16 .import memcpy_getparams, memcpy_increment, memcpy_transfer
17 .importzp ptr1, ptr2, ptr3
23 ; ----------------------------------------------------------------------
27 ; Check for the copy direction. If dest < src, we must copy downwards (start
28 ; at low addresses, and increase pointers); otherwise, we must copy upwards
29 ; (start at high addresses, and decrease pointers).
34 jcc memcpy_increment ; Branch if dest < src
36 ; Copy decrementing; adjust the pointers to the end of the memory regions.
45 lda ptr1 ; point to last byte of source
57 lda ptr2 ; point to last byte of target