// This may look like C code, but it is really -*- Asm -*-
/*
 *  smoke16/src16/strcmp.s - SMOKE-16 string-handling routines.
 *  $Revision: 1.1 $
 *  Copyright 2000, Benjamin Sittler
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */

	.text
	.align 1
// int strcmp(const char *s1, const char *s2)
	.global _strcmp
_strcmp:
	mov %0, %a2
	mov %0, %a3
strcmp0:
	movb [%a0], %a2
	movb [%a1], %a3
	add 1, %a0
	add 1, %a1
	cmp %a2, %0
	be strcmp1
	cmp %a2, %a3
	be strcmp0
strcmp1:
	sub %a2, %a3, %a0
	ret
