		SCOPE
; Update to LSDOS 6.3.1 2022-09-16 dpm

; 2022-09-16 Update V 6.3.1 dpm

;	zHEXDEC - SVC 97
;	Routine to convert 16-bit hexadecimal to decimal
;	HL => value
;	DE => buffer pointer of 5-character buffer
;	HL <= destroyed (always set to zero)
;	DE <= Buffer+5
;	BC <= destroyed
;	Z  <= set
;
zHEXDEC		LD	B,5			;Length max
zHEXD		LD	A,' '			;Load blank
HEXDEC1		LD	(DE),A			;To string
		INC	DE			;Bump pointer
		DJNZ	HEXDEC1			;Go for length
		PUSH	DE			;Save end +1
		DEC	DE			;Adjust back
HEXDEC2		LD	A,10			;Base to convert to
		CALL	zDIV16			;HL+A  =  HL/A
		ADD	A,'0'			;Add ASCII to result
		LD	(DE),A			;to user string
		DEC	DE			;Move back

;	Check if done

		LD	A,H			;Get subtotal remainder
		OR	L			;Done?
		JR	NZ,HEXDEC2		;Go till completed
		POP	DE			;Restore end+1
		RET				;Return Z