printf.s revision 1.4
11.4Sis/* $NetBSD: printf.s,v 1.4 2001/02/26 14:58:37 is Exp $ */ 21.2Sis 31.2Sis/*- 41.3Sis * Copyright (c) 1996 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.4Sis#include <machine/asm.h> 441.1Sis .text 451.4Sis .even 461.1SisLputch: 471.1Sis movl d0,sp@- 481.4Sis bsr _C_LABEL(putchar) 491.1Sis addql #4,sp 501.1Sis rts 511.1Sis 521.4SisENTRY_NOPROFILE(printf) 531.1Sis movml #0x0032,sp@- 541.1Sis lea pc@(Lputch:w),a2 551.1Sis lea sp@(20),a1 561.1Sis movl sp@(16),a0 571.4Sis movl pc@(_C_LABEL(SysBase):w),a6 581.1Sis jsr a6@(-0x20a) 591.1Sis movml sp@+, #0x4c00 601.1Sis rts 611.1Sis#if 0 621.1SisLstorech: 631.1Sis movb d0, a3@+ 641.1Sis rts 651.1Sis 661.1Sis .globl _sprintf 671.4SisENTRY_NOPROFILE(sprintf) 681.1Sis movml #0x0032,sp@- 691.1Sis movl sp@(16),a3 701.1Sis lea pc@(Lstorech:w),a2 711.1Sis lea sp@(24),a1 721.1Sis movl sp@(20),a0 731.4Sis movl pc@(_C_LABEL(SysBase):w),a6 741.1Sis jsr a6@(-0x20a) 751.1Sis movml sp@+, #0x4c00 761.1Sis rts 771.1Sis#endif 78