Source file: /~heha/Mikrocontroller/avr-inc.zip/strlen.i90

;String-Länge (16bit sogar!) für ATmega
;h#s 01/06
#ifndef STRLEN_I90
#define STRLEN_I90

;Bietet:
;	strend1		Z auf String-Ende rücken, versaut R16
;	strlen		R17:R16 = String-Länge
;	strlen1		R17 = String-Länge, MAKRO

strend1:	;String-Ende+1 ermitteln (Z HINTER die Null)
	ld	r16,Z+		;kaum ein Unterprogramm wert!
	cpi	r16,1
	brsh	strend1
	ret			;zurück mit C=1 (!)

strlen:		;String-Länge ermitteln (16bit) - ausführlich
;PE: Z=String-Adresse im RAM
;PA: R17:R16=Länge
;VR: R16-R17
	pushhl	Z
	 rcall	strend1
	 movw	r17:r16,ZH:ZL
	pophl	Z
	sbc	r16,ZL
	sbc	r17,ZH
	ret

.macro strlen1	;String-Länge ermitteln (8bit) - sehr simpel
;PE: Z=String-Adresse im RAM
;PA: ZL=Länge
;VR: R16=0, R17=ZL, Z
	mov	r17,ZL
	rcall	strend1
	sbc	ZL,r17
.endm

#endif//STRLEN_I90
Detected encoding: ANSI (CP1252)4
Wrong umlauts? - Assume file is ANSI (CP1252) encoded