A86: hl to string, the final sequel


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

A86: hl to string, the final sequel




That routine from ztetris works very well. I did modify it a bit
to strip the leading 0s, which kind of ticked me off. Here's the
modified version... feel free to optimize it, I'm sure it can be.

vputHL:				;
	ld de,buffer2+6		;
	xor a			; Clear last char
	ld (de),a		;
	ld b,5			; Only display five characters..
RepUnp:				;
	call UNPACK_HL		;
	or a			; If next digit is a 0, print so far
	jr z,check_rest		;
not_zero:
	dec de			;
	add a,48		;
	ld (de),a		;
	djnz RepUnp		;
disp_it:
	ex de,hl		;
	jp D_ZM_STR		;

; Checks to see if hl is at 0000, if it is, go right to disp_it
; If its not, then we just have a normal 0 digit...
check_rest:
	push de			;
	ld de,0			;
	call CP_HL_DE		;
	pop de			;
	jr z,disp_it		; We're done...
	jr not_zero		; Otherwise, keep going

-- 
Bryan Rittmeyer
mailto:bryanr@flash.net
http://www.bridges.edu/horizon/