;	kputstr.a - KPutStr implementation using ROM routines
;	$VER: kputstr.a 37.1 (10.5.96)
;	Copyright © 1996 Michael Letowski
;
;	37.1 (10.5.96) - initial version

	include	"exec/funcdef.i"
	include	"exec/exec_lib.i"

	xdef	_KPutStr
	xdef	@KPutStr

; Some aliases

	xdef	_kputs
	xdef	@kputs
	xdef	KPutStr

	section	text,code


******* debug.lib/KPutStr ***************************************************
*
*   NAME
*       KPutStr -- put a string to the debugging console. (V37)
*
*   SYNOPSIS
*       KPutStr(string)
*               A0
*
*       VOID KPutStr(STRPTR);
*
*   FUNCTION
*       Puts a NULL-terminated string to debugging console (defaults to the
*       serial port at 9600 baud). This function will not return until the
*       string has been completely transmitted.
*
*   INPUTS
*       string - a string to be outputted.
*
*   NOTES
*       @KPutStr, @kputs and KPutStr are identical assembly interfaces that
*       expect a string pointer to be in A0 register. _KPutStr, _kputs are the
*       C interfaces that expect a string pointer to be a longword on stack.
*
*   SEE ALSO
*       KPutChar(), KPrintf().
*
*****************************************************************************
*
* _KPutStr(string)
* @KPutStr(R_A0 string)
*
_KPutStr:
_kputs:
	move.l	4(sp),a0

@KPutStr:
@kputs:
KPutStr:
	move.l	a6,-(sp)
	move.l	(4).w,a6

KPSLoop:
	move.b	(a0)+,d0
	beq	KPSExit
	jsr	_LVORawPutChar(a6)
	bra	KPSLoop
KPSExit:
	move.l	(sp)+,a6
	rts

	end
