1/* Copyright (c) 2006, Carlos Lamas
2
3   based on libc/pmstring/strcpy_P.S which is
4   Copyright (c) 2002, Marek Michalkiewicz
5
6   All rights reserved.
7
8   Redistribution and use in source and binary forms, with or without
9   modification, are permitted provided that the following conditions are met:
10
11   * Redistributions of source code must retain the above copyright
12     notice, this list of conditions and the following disclaimer.
13   * Redistributions in binary form must reproduce the above copyright
14     notice, this list of conditions and the following disclaimer in
15     the documentation and/or other materials provided with the
16     distribution.
17   * Neither the name of the copyright holders nor the names of
18     contributors may be used to endorse or promote products derived
19     from this software without specific prior written permission.
20
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  POSSIBILITY OF SUCH DAMAGE. */
32
33/* $Id: strcpy_PF.S 2503 2016-02-07 22:59:47Z joerg_wunsch $ */
34
35#if !defined(__AVR_TINY__)
36
37#include "macros.inc"
38
39#define dest_b1 r25
40#define dest_b0 r24
41#define src_b3 r23
42#define src_b2 r22
43#define src_b1 r21
44#define src_b0 r20
45
46#if !defined(__DOXYGEN__)
47
48	.text
49	.global	_U(strcpy_PF)
50	.type	_U(strcpy_PF), @function
51
52_U(strcpy_PF):
53
54	X_movw	ZL, src_b0
55	LPM_R0_ZPLUS_INIT src_b2
56	X_movw	XL, dest_b0
57
58.L_strcpy_PF_loop:
59
60	LPM_R0_ZPLUS_NEXT src_b2
61	st	X+, r0
62	tst	r0
63	brne	.L_strcpy_PF_loop
64
65; return dest (unchanged)
66
67	ret
68
69.L_strcpy_PF_end:
70
71	.size	_U(strcpy_PF), .L_strcpy_PF_end - _U(strcpy_PF)
72
73#endif /* not __DOXYGEN__ */
74
75#endif /* !defined(__AVR_TINY__) */
76