	move.l	4(a3),d7	; Number to convert
	lea	ReqErr(pc),a0	; String storage
	move.w	#1000,d3	; First divide number
	moveq.l	#4-1,d0		; Lenght (-1) to D0	

.Loop1:
	cmp.w	d3,d7
	bge	.Convert

	divu	#10,d3
	subq.l	#1,d0
	lea	1(a0),a0
	bra	.Loop1

.Convert:
;--------------- Convert HEX number to dec ASCII string -----------------
; D7 = hexadecimal number to convert
; A0 = Address to string storage
;
; Number must be word sized and only the last byte may be used
;
; Result is stored in two bytes at address in A0
	moveq.l	#0,d1
	moveq.l	#0,d2

HexLoop:
	move.w	d7,d1		; Number to d1
	divu	d3,d1		; Divide number with D3
	move.b	d1,(a0)		; Save byte	
	add.b	#$30,(a0)+	; Convert to ASCII code
	move.b 	d1,d2		; Move byte value to A2

	mulu	d3,d2		; Multiply D2 with D3
	sub.w	d2,d7		; Decrement D4 with D2
	divu	#10,d3		; Divide D3 with 10
	moveq.l	#0,d1		; Clear new number
	moveq.l #0,d2		; Clear byte value
	dbra	d0,HexLoop	; Continue if byte left
