	.title	printf	Formatted print routine
	.ident	"V02.00"
;+
;
; Index		Formatted print routine
;
; Usage
;
;	printf(format, arg1, ...);
;	char *format;
;
;	printnf(format, arg1, ...);
;	char *format;
;
; Description
;
;	printf() and printnf convert, format, and print their
;	arguments, under control of the first argument. printf()
;	causes the users internal output buffer to be flushed,
;	whereas printnf() does not flush it.
;
;	See description in format.mac for further details on the
;	format argument.
;-
; Edit History
; V02.00 19-Oct-82 TTC		Rework of CS library
;
	.psect	c$data
rtnadr:	.word	1			; Temp. storage for return address
fmtbuf:	.blkb	132.			; format buffer
	.even

	.psect	c$code

printf::
	mov	(sp),rtnadr		; Save return addres
	mov	#fmtbuf,(sp)		; Push format buffer on stack
	call	format			; Format the string
	call	ttosf			; Output formatted string
	mov	rtnadr,(sp)		; Restore return address
	return

printnf::
	mov	(sp),rtnadr		; Save return addres
	mov	#fmtbuf,(sp)		; Push format buffer on stack
	call	format			; format the string
	call	ttosnf			; output string without flushing
	mov	rtnadr,(sp)		; Restore return address
	return
	.end
