1/*
2Copyright (c) 1990 The Regents of the University of California.
3All rights reserved.
4
5Redistribution and use in source and binary forms are permitted
6provided that the above copyright notice and this paragraph are
7duplicated in all such forms and that any documentation,
8and/or other materials related to such
9distribution and use acknowledge that the software was developed
10by the University of California, Berkeley.  The name of the
11University may not be used to endorse or promote products derived
12from this software without specific prior written permission.
13THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16 */
17#include "setarch.h"
18
19#include "defines.h"
20
21	; dst A0
22	; src A1
23	; len A2
24	.global ___reg_memcpy
25___reg_memcpy:
26
27	MOVP	A0P,A3P	; keep copy of result
28	ADDP	A2P,A0P	; point to end of dst
29	ADDP	A2P,A1P	; point to end of src
30	CMPP	A0P,A3P	; see if anything to do
31	beq	quit
32
33loop:
34#ifdef __NORMAL_MODE__
35	sub     #1,A1P		; point to byte
36#else
37	subs    #1,A1P          ; point to byte
38#endif
39	mov.b	@A1P,A2L	; get byte
40	mov.b	A2L,@-A0P	; save byte
41	CMPP	A0P,A3P 	; at the front again ?
42	bne 	loop
43
44	; return with A0 pointing to dst
45quit:	rts
46
47