.IIF	NDF	RSX	RSX	=	0	;Assume RT11	;01 +
	.title	$itoc

	.enabl	lc, gbl
	.nlist	bex, cnd
	.list	meb

;
; Utility Routines
; Integer to Character
;
; Version x01
;
; David G. Conroy	12-Dec-77
;
; Edit history
; 01 01-Aug-79 MM	Added RT11 support
; 02 09-Jun-80 MM	Used atoi.mac code, no eis needed
;
	.globl	$itoc

;
; Inputs:
;	r0=the number
;	r1=pointer to buffer
;
; Outputs:
;	r1=updated
;-

$itoc:
	tst	r0
	bge	10$
	neg	r0
	movb	#'-, (r1)+
10$:
	jsr	pc, 20$
	clrb	(r1)
	rts	pc

20$:	mov	r0,-(sp)
	clr	r0
30$:	inc	r0
	sub	#10.,@sp
	bhis	30$
	add	#'0+10.,@sp
	dec	r0
	beq	40$
	jsr	pc,20$
40$:	movb	(sp)+,(r1)+
	rts	pc
	.end
