printf.s revision 1.2
11.2Sis/* $NetBSD: printf.s,v 1.2 1999/02/16 22:46:56 is Exp $ */
21.2Sis
31.2Sis/*-
41.2Sis * Copyright (c) 1999 The NetBSD Foundation, Inc.
51.2Sis * All rights reserved.
61.1Sis *
71.2Sis * This code is derived from software contributed to The NetBSD Foundation
81.2Sis * by Ignatios Souvatzis.
91.1Sis *
101.1Sis * Redistribution and use in source and binary forms, with or without
111.1Sis * modification, are permitted provided that the following conditions
121.1Sis * are met:
131.1Sis * 1. Redistributions of source code must retain the above copyright
141.1Sis *    notice, this list of conditions and the following disclaimer.
151.1Sis * 2. Redistributions in binary form must reproduce the above copyright
161.1Sis *    notice, this list of conditions and the following disclaimer in the
171.1Sis *    documentation and/or other materials provided with the distribution.
181.1Sis * 3. All advertising materials mentioning features or use of this software
191.1Sis *    must display the following acknowledgement:
201.2Sis *        This product includes software developed by the NetBSD
211.2Sis *        Foundation, Inc. and its contributors.
221.2Sis * 4. Neither the name of The NetBSD Foundation nor the names of its
231.2Sis *    contributors may be used to endorse or promote products derived
241.2Sis *    from this software without specific prior written permission.
251.1Sis *
261.2Sis * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
271.2Sis * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
281.2Sis * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
291.2Sis * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
301.2Sis * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
311.2Sis * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
321.2Sis * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
331.2Sis * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
341.2Sis * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
351.2Sis * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
361.2Sis * POSSIBILITY OF SUCH DAMAGE.
371.1Sis */
381.1Sis
391.1Sis/*
401.1Sis * printf calling exec's RawDoFmt
411.1Sis * Beware! You have to explicitly use %ld etc. for 32bit integers!
421.1Sis */
431.1Sis	.text
441.1Sis	.globl	_printf
451.1Sis	.globl	_putchar, _SysBase
461.1Sis
471.1SisLputch:
481.1Sis	movl	d0,sp@-
491.1Sis	bsr	_putchar
501.1Sis	addql	#4,sp
511.1Sis	rts
521.1Sis
531.1Sis_printf:
541.1Sis	movml	#0x0032,sp@-
551.1Sis	lea	pc@(Lputch:w),a2
561.1Sis	lea	sp@(20),a1
571.1Sis	movl	sp@(16),a0
581.1Sis	movl	pc@(_SysBase:w),a6
591.1Sis	jsr	a6@(-0x20a)
601.1Sis	movml	sp@+, #0x4c00
611.1Sis	rts
621.1Sis#if 0
631.1SisLstorech:
641.1Sis	movb	d0, a3@+
651.1Sis	rts
661.1Sis
671.1Sis	.globl _sprintf
681.1Sis_sprintf:
691.1Sis	movml	#0x0032,sp@-
701.1Sis	movl	sp@(16),a3
711.1Sis	lea	pc@(Lstorech:w),a2
721.1Sis	lea	sp@(24),a1
731.1Sis	movl	sp@(20),a0
741.1Sis	movl	pc@(_SysBase:w),a6
751.1Sis	jsr	a6@(-0x20a)
761.1Sis	movml	sp@+, #0x4c00
771.1Sis	rts
781.1Sis#endif
79