A86: Re: displaying a in decimal
[Prev][Next][Index][Thread]
A86: Re: displaying a in decimal
> From: "Timothy Kong" <asmti86@hotmail.com>
> Subject: A86: Quick question...
>
> A quick question for you guys. How would you display the contents of
> a
> register (like A) onto the screen? Probably someting simple, and I'm
> just
> making it too hard ;)
>
> Tim
here's a routine:
====start code==============================
;
; input: a - number to display
; output: a - ascii of first digit
; b - $00
; l - destroyed by _vputs
; note: need to define...
_divHLby10 =$4044
; if using _OP6, change to some
; other temp storage area
;
disp_dec_a_m:
ld h,0 ;zero msb
ld l,a ;load a into lsb
ld de,_OP6 ;temp storage area
ld b,5 ;5 digits max
disp_dec_a_m_loop1:
call _divHLby10
add a,'0' ;add ascii '0'
dec de ;next mem space
ld (de),a ;load it up
djnz disp_dec_a_m_loop1
ld b,4
ld hl,_penCol
disp_dec_a_m_loop2:
ld a,(de) ;get character
cp '0' ;is it zero?
jr nz,disp_dec_a_m_done
;wasn't zero so
; done searching for
; first non zero
inc de ;increase to next
; character
ld a,4
add a,(hl)
ld (hl),a
djnz disp_dec_a_m_loop2
disp_dec_a_m_done:
ex de,hl ;get back start of
; string in hl
jp _vputs
;
======end code============================
i hope this works for you!
jimi malcolm
mailto:malcolmj1@juno.com
http://guide.ticalc.org
________________________________________________________________
YOU'RE PAYING TOO MUCH FOR THE INTERNET!
Juno now offers FREE Internet Access!
Try it today - there's no risk! For your FREE software, visit:
http://dl.www.juno.com/get/tagj.