[A83] Re: HL to string


[Prev][Next][Index][Thread]

[A83] Re: HL to string




*cough*, correction, that routine works, but it destroys the byte after the
BCD number. this should leave the memory that's supposed to be intact,
intact.

function(BCDToStr):
	push	hl
	ex	de,hl
@zero	ld	a,[hl]
	inc	hl
	dec	b
	jr	z,@done
	or	a
	jr	z,@zero
@done	dec	hl
	inc	b
	ld	a,'0'
	rld
	cp	'0'
	jr	nz,@rrd
	jr	@skip
@loop	rld
@rrd	ld	[de],a
	inc	de
@skip	rld
	ld	[de],a
	inc	de
	inc	hl
	djnz	@loop
	xor	a
	ld	[de],a
	pop	hl
	ret

-----Original Message-----
From: assembly-83-bounce@lists.ticalc.org
[mailto:assembly-83-bounce@lists.ticalc.org]On Behalf Of Kirk Meyer
Sent: Sunday, July 08, 2001 11:01 AM
To: assembly-83@lists.ticalc.org
Subject: [A83] Re: HL to string



This BCD displaying function is a bit faster.

function(BCDToStr):
	push	hl
	ex	de,hl
@zero	ld	a,[hl]
	inc	hl
	dec	b
	jr	z,@done
	or	a
	jr	z,@zero
@done	dec	hl
	inc	b
	ld	a,'0'
	rld
	cp	'0'
	jr	z,@skip
@loop	ld	[de],a
	inc	de
@skip	rld
	ld	[de],a
	inc	de
	inc	hl
	rld
	djnz	@loop
	xor	a
	ld	[de],a
	pop	hl
	ret




References: