File: strcat_P.S

package info (click to toggle)
avr-libc 20020203-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,448 kB
  • ctags: 6,562
  • sloc: ansic: 7,631; asm: 4,424; sh: 2,703; makefile: 338; pascal: 289
file content (47 lines) | stat: -rw-r--r-- 1,034 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
   strcat_P.S

   Contributors:
     Created by Reiner Patommel

   THIS SOFTWARE IS NOT COPYRIGHTED

   This source code is offered for use in the public domain.  You may
   use, modify or distribute it freely.

   This code is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY.  ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
   DISCLAIMED.  This includes but is not limited to warranties of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

#include "macros.inc"

#define dest_hi r25
#define dest_lo r24
#define src_hi r23
#define src_lo r22

; char *strcat_P(char *dest, const char flash *src)

	.text
	.global	_U(strcat_P)
	.type	_U(strcat_P), @function
_U(strcat_P):
	LOAD_Z(src_lo, src_hi)
	LOAD_X(dest_lo, dest_hi)
.strcat_P_skip:
	ld	__tmp_reg__, X+
	tst	__tmp_reg__
	brne	.strcat_P_skip
	sbiw	XL, 1		; undo post-increment
.strcat_P_loop:
	LPM_R0_ZP
	st	X+, r0
	tst	r0
	brne	.strcat_P_loop
; return dest (unchanged)
	ret
.strcat_P_end:
	.size	_U(strcat_P), .strcat_P_end - _U(strcat_P)