However, it will be a lot faster if you use your own number-to-string routine and then display that string in whatever way you want.
There's a good routine at http://baze.au.com/misc/z80bits.html. You should bookmark that page by the way.
If you don't want the leading zeros, you can first do the conversion with leading zeros and then run a small loop that skips them (except the last one in case the number equals zero) or replaces them with a couple spaces (eg if you want to right align the number).
Of course if there are always 3 zeros, your solution is better.
My routine I've been using: (no leading zeroes regardless of how long the string is)
The icall is some kind of cross platform ti82/ti83 macro that's specific to my dwedit.inc file, feel free to change that to bcall.
;==========================================
; VDispA - Displays A in the small font
;==========================================
vDispA:
push hl
ld h,0
ld l,a
call vDispHL
pop hl
ret
;===========================================
; VDispHL - Displays hl in the small font
;===========================================
FormatHL:
ld de,op1+5
xor a
ld (de),a
vdhlRepeat:
icall(_divhlby10)
add a,'0'
dec de
ld (de),a
ld a,h
or l
jr nz,vdhlRepeat
ex de,hl
ret
vDispHL:
push de
push hl
call FormatHL
bcall(_vputs)
pop hl
pop de
ret
You know your hexadecimal output routine is broken when it displays the character 'G'.
I was wondering where I had gotten the routine I use for displaying variables in small text, thanks for clearing that up Dwedit... oh yeah and for the routine
I think I took out some of the variable protection and don't have formathl as a seperate routine