    ;
    ;	This is a replacement for the debug routine dprintf from ddebug_lib.
    ;	Should work exactly the same by using Exec.RawDoFmt except that the
    ;	output goes to an intuition requester instead of the parallel port.
    ;
;		cseg
		section text,code

		xdef _iprintf
		xref _LVOOpenLibrary
		xref _LVOCloseLibrary
		xref _LVOEasyRequestArgs

_iprintf:	link	a5,#-20
		movem.l d0-d2/a0-a4/a6,-(sp)

		lea	intuiname,a1	;   Open intuition.library
		move.l	#37,d0
		move.l	4,a4
		move.l	a4,a6
		jsr	_LVOOpenLibrary(a6)
		move.l	d0,d2
		beq	End

		lea	-20(a5),a1      ;   Initialize the easystruct
		move.l	#20,(a1)
		move.l	#0,4(a1)
		lea	debugname,a0
		move.l	a0,8(a1)
		move.l	8(a5),12(a1)
		lea	gadgetname,a0
		move.l	a0,16(a1)

		move.l	#0,a0		;   Call EasyRequest
		move.l	#0,a2
		lea	12(a5),a3
		move.l	d2,a6
		jsr	_LVOEasyRequestArgs(a6)

		move.l	d2,a1		;   Close Intuition
		move.l	a4,a6
		jsr	_LVOCloseLibrary(a6)

End:		movem.l (sp)+,d0-d2/a0-a4/a6
		unlk	a5
		rts

;		dseg
		section libdata,data

intuiname:	dc.b	'intuition.library',0
debugname:	dc.b	'Debug message',0
gadgetname:	dc.b	'Ok',0

		end
