; allows C program to call cputs with multiple arguments.
; E.g. putn("How ", "are ", "you?", 0);
; the last argument must be either 0 or ""

_text	segment public byte 'code'
	assume cs:_text

	extrn	_cputs:near

	public	_putn
_putn	proc	near
	push	si
	push	di
	push	bp
	mov	bp,sp

	mov	si,8
loop:
	mov	di,[bp+si]	; get next string
	or	di,di		; is it NULL
	je	done		; if so, nothing more to print
	or	byte ptr [di],0 ; it is "" (null string)
	je	done		; if so, nothing more to print

; now call cputs to print the string
	push	di		; push parameter on stack
	call	_cputs
	pop	di		; get rid of parameter on stack

	add	si,2		; point to next parameter
	jmp	loop

done:
	pop	bp
	pop	di
	pop	si
	ret
_putn	endp
_text	ends
	end
