printf.s revision 1.1
11.1Sis/*
21.1Sis * $NetBSD: printf.s,v 1.1 1996/11/29 23:36:29 is Exp $
31.1Sis *
41.1Sis *
51.1Sis * Copyright (c) 1996 Ignatios Souvatzis
61.1Sis * All rights reserved.
71.1Sis *
81.1Sis * Redistribution and use in source and binary forms, with or without
91.1Sis * modification, are permitted provided that the following conditions
101.1Sis * are met:
111.1Sis * 1. Redistributions of source code must retain the above copyright
121.1Sis *    notice, this list of conditions and the following disclaimer.
131.1Sis * 2. Redistributions in binary form must reproduce the above copyright
141.1Sis *    notice, this list of conditions and the following disclaimer in the
151.1Sis *    documentation and/or other materials provided with the distribution.
161.1Sis * 3. All advertising materials mentioning features or use of this software
171.1Sis *    must display the following acknowledgement:
181.1Sis *      This product includes software developed by Ignatios Souvatzis
191.1Sis *      for the NetBSD project.
201.1Sis * 4. The name of the author may not be used to endorse or promote products
211.1Sis *    derived from this software without specific prior written permission
221.1Sis *
231.1Sis * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
241.1Sis * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
251.1Sis * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
261.1Sis * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
271.1Sis * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
281.1Sis * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
291.1Sis * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
301.1Sis * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
311.1Sis * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
321.1Sis * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
331.1Sis *
341.1Sis */
351.1Sis
361.1Sis/*
371.1Sis * printf calling exec's RawDoFmt
381.1Sis * Beware! You have to explicitly use %ld etc. for 32bit integers!
391.1Sis */
401.1Sis	.text
411.1Sis	.globl	_printf
421.1Sis	.globl	_putchar, _SysBase
431.1Sis
441.1SisLputch:
451.1Sis	movl	d0,sp@-
461.1Sis	bsr	_putchar
471.1Sis	addql	#4,sp
481.1Sis	rts
491.1Sis
501.1Sis_printf:
511.1Sis	movml	#0x0032,sp@-
521.1Sis	lea	pc@(Lputch:w),a2
531.1Sis	lea	sp@(20),a1
541.1Sis	movl	sp@(16),a0
551.1Sis	movl	pc@(_SysBase:w),a6
561.1Sis	jsr	a6@(-0x20a)
571.1Sis	movml	sp@+, #0x4c00
581.1Sis	rts
591.1Sis#if 0
601.1SisLstorech:
611.1Sis	movb	d0, a3@+
621.1Sis	rts
631.1Sis
641.1Sis	.globl _sprintf
651.1Sis_sprintf:
661.1Sis	movml	#0x0032,sp@-
671.1Sis	movl	sp@(16),a3
681.1Sis	lea	pc@(Lstorech:w),a2
691.1Sis	lea	sp@(24),a1
701.1Sis	movl	sp@(20),a0
711.1Sis	movl	pc@(_SysBase:w),a6
721.1Sis	jsr	a6@(-0x20a)
731.1Sis	movml	sp@+, #0x4c00
741.1Sis	rts
751.1Sis#endif
76