	.section	.text
	.intel_syntax
	.global	zstr_cat
zstr_cat:
	push	%ebp
	push	%edi
	mov	%edi, [%ebp + 8]	# Address of destination
	mov	%al, 0			# Search for zero
	mov	%ecx, 65535		# Limit search to 65535 bytes
	cld				# Set search direction to up-memory
	repne	scasb
	mov	%eax, %edi		# Store address of pointer in %eax
	mov	%ecx, [%ebp + 12]	# Store address of source in %ecx
	jmp	zstr_cat.loop
zstr_cat.increment:
	add	%eax, 1			# pointer = pointer + 1
	add	%ecx, 1			# source = source + 1
zstr_cat.loop:
	mov	%dl, [%ecx]		# %dl = source, referenced
	mov	[%eax], %dl		# pointer, dereferenced = %dl
	cmp	%dl, 0
	jne	zstr_cat.increment	# byte <> 0
	mov	%edx, [%ebp + 8]	# Get destination
	sub	%eax, %edx		# Return the length of string
	pop	%edi
	pop	%ebp
	ret
