* $Revision Header * Header built automatically - do not edit! *************
*
*	(C) Copyright 1991 by Olaf 'Olsen' Barthel & MXM
*
*	Name .....: Format.asm
*	Created ..: Monday 21-Jan-91 20:12
*	Revision .: 1
*
*	Date            Author          Comment
*	=========       ========        ====================
*	11-Apr-91       Olsen           Added atol.
*	21-Jan-91       Olsen           Created this file!
*
* $Revision Header *********************************************************

CALL	macro
	xref	_LVO\1
	jsr	_LVO\1(a6)
	endm

	csect	text,0,0,1,2

*--------------------------------------------------------------------------
*
*	This file contains some ANSI-`C' style routines which are either
*	not directly implemented through dos.library or utility.library
*	or were broken in amiga.lib at the time this file was created.
*
*--------------------------------------------------------------------------

	xdef	_Printf
	xdef	_FPrintf

	xdef	_SPrintf
	xdef	_VSPrintf

	xdef	_atol

*--------------------------------------------------------------------------

_Printf:
	movem.l	d2/a6,-(sp)

	move.l	12(sp),d1
	lea	16(sp),a0
	move.l	a0,d2

	move.l	_DOSBase(a4),a6

	CALL	VPrintf

	movem.l	(sp)+,d2/a6
	rts

*--------------------------------------------------------------------------

_FPrintf:
	movem.l	d2/d3/a6,-(sp)

	move.l	16(sp),d1
	move.l	20(sp),d2
	lea	24(sp),a0
	move.l	a0,d3

	move.l	_DOSBase(a4),a6

	CALL	VFPrintf

	movem.l	(sp)+,d2/d3/a6
	rts

*--------------------------------------------------------------------------

_SPrintf:
	movem.l	a2/a3/a6,-(sp)

	move.l	 4+12(sp),a3
	move.l	 8+12(sp),a0
	lea	12+12(sp),a1
	lea	stuffchar(pc),a2

	move.l	4,a6
	CALL	RawDoFmt

	movem.l	(sp)+,a2/a3/a6

	rts

*--------------------------------------------------------------------------

_VSPrintf:
	movem.l	a2/a3/a6,-(sp)

	move.l	 4+12(sp),a3
	move.l	 8+12(sp),a0
	move.l	12+12(sp),a1
	lea	stuffchar(pc),a2

	move.l	4,a6
	CALL	RawDoFmt

	movem.l	(sp)+,a2/a3/a6

	rts

stuffchar:
	move.b	d0,(a3)+
	rts

*--------------------------------------------------------------------------
*
*	A tiny replacement for atol(), implemented through StrToLong.
*
*--------------------------------------------------------------------------

_atol:	move.l	4(sp),d1

	move.l	d2,-(sp)
	move.l	a6,-(sp)

	pea.l	0

	lea.l	(sp),a0
	move.l	a0,d2

	move.l	_DOSBase(a4),a6

	CALL	StrToLong

	move.l	(sp),d0

	add.w	#4,sp
	move.l	(sp)+,a6
	move.l	(sp)+,d2

	rts

*--------------------------------------------------------------------------
*
*	These two lines are actually to make BLINK believe that some kind
*	of startup code will clear the Data/BSS segment before running the
*	main program. Since this is no longer necessary with Kickstart 2.x
*	these two lines save about 34 KBytes of disk space.
*
*--------------------------------------------------------------------------

	lea	__BSSBAS,a0
	move.l	#__BSSLEN,d0

*--------------------------------------------------------------------------

	csect	__MERGED

	xref	_DOSBase

	xref	__BSSBAS
	xref	__BSSLEN

	end
