    include 'tclib.i'

	section text,code

	xref 	_CTCL_n2c

startall:
    moveq   #-13,d0     ; if user tries to start this lib!
    rts                 ;   (need -13 to identify TClibs!)
    dc.l 'TCLB'         ; TurboCalc-Lib - this field is used to identify
                        ;   TClibs and to link them in memory (i.e. that
                        ;   this entry is used and thus changed by TC
                        ;   to keep a list of all already loaded libs!)
    dc.l 'FNCT'
    dc.w 1,0            ; Version, Revision
    dc.l TCL_Name		; Little description
    dc.l TCL_Ver		; Standard Amiga version string
    dc.l TCL_Author		; ....
    dc.l 0              ; flags - reserved
    dc.l 0              ; reserved
    dc.l 0              ; reserved
; default-routines
    dc.l 0  ; init
    dc.l 0  ; exit
    dc.l 0  ; flush
    dc.l 0
;
    dc.l 0  ; flags
    dc.l 2				; number of functions
    dc.l TCL_fncdefault
	dc.l TCL_n2c
    dc.l TCL_n2cp

	TCL_Name: dc.b 'Converts a number from digits to characters',0
	TCL_Ver: dc.b '$VER: n2c 1.0 (28.1.97)',0
	TCL_Author: dc.b '© 1997 Alessandro Zummo',0

 	cnop 0,2


*** unknown function - simply return function-number as init!
TCL_fncdefault:
    move.l  d7,d0
    moveq   #TYPE_NUM,d2
    rts

TCL_n2c:
	movem.l	D3-D7/A2-A6,-(A7)	;Preserve registers

	move.l  #200,d0				;Allocate memory for string buffer
	XSR		AllocTEXTMem

	move.l	a0,a2				
	move.l	#0,d3				;Option: normal

	jsr		_CTCL_n2c			;Call n2c

	move.l  a2,d0				;Save result

	moveq   #TYPE_TEXT,d2		;Set result type

	movem.l	(A7)+,D3-D7/A2-A6	;Reload registers
    rts
    

TCL_n2cp:
	movem.l	D3-D7/A2-A6,-(A7)	;Preserve registers

	move.l  #200,d0				;Allocate memory for string buffer
	XSR		AllocTEXTMem

	move.l	a0,a2				
	move.l	#1,d3				;Option: short form

	jsr		_CTCL_n2c			;Call n2c

	move.l  a2,d0				;Save result

	moveq   #TYPE_TEXT,d2		;Set result type

	movem.l	(A7)+,D3-D7/A2-A6	;Reload registers
    rts

    end
