2 ; Ullrich von Bassewitz, 2003-08-20
4 ; void* __fastcall__ memmove (void* dest, const void* src, size_t size);
6 ; NOTE: This function uses entry points from memcpy!
10 .import memcpy_getparams, memcpy_upwards
11 .importzp ptr1, ptr2, ptr3, ptr4, tmp1
16 ; ----------------------------------------------------------------------
19 stx ptr4+1 ; Size -> ptr4
23 ; Check for the copy direction. If dest < src, we must copy upwards (start at
24 ; low addresses and increase pointers), otherwise we must copy downwards
25 ; (start at high addresses and decrease pointers).
31 jcc memcpy_upwards ; Branch if dest < src (upwards copy)
33 ; Copy downwards. Adjust the pointers to the end of the memory regions.
43 ; Load the low offset into Y, and the counter low byte into X.
55 @L2: inx ; Bump counter low byte
59 inc ptr3+1 ; Bump counter high byte
65 ldx tmp1 ; get function result (dest)