Re: A86: base 10 display of hex


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

Re: A86: base 10 display of hex




DAA would involve BCD numbers, which I cannot store the population or
money in because of speed.

essentially this code performs this operation on any number X:

HLIX = (16777216*X-16777215);
H %= 10;

i was just wondering if there was a faster way to do it

here's my current code again (input AHL):
> >
> > disp_ahl_deci:
> >         push hl
> >         pop ix
> >         ld h,0
> >         ld l,a
> >         ld b,$18
> > disp_ahl_loop:
> >         add ix,ix
> >         adc hl,hl
> >         dec lx
> >         ld a,h
> >         cp $0A
> >         jr z,disp_ahl_okay
> >         sub $0A
> >         ld h,a
> > disp_ahl_okay:
> >         djnz disp_ahl_loop
> >
> > ;this is just the division by 10 routine (which is what i need help
> > with). it only outputs one number at a time.


Dux Gregis wrote:
> 
> I'm not exactly sure how it would be implemeted, but the daa might be useful.
> Other than that, I don't see much else you can do..
> 
> Kirk Meyer wrote:
> 
> > yeah, but floating point numbers take three times as many bytes and they
> > are slow (besides, if a wanted that i would use BCD numbers instead).
> >
> >
> > Thanx

-- 

=====================================
=                                   =
=   Kirk Meyer (mailto:_@ibm.net)   =
= http://www.bigfoot.com/~kirkmeyer =
=  http://simcommunity.home.ml.org  =
=                                   =
=   "Set your affection on things   =
=    above, not on things on the    =
=      earth."  Colossians 3:2      =
=                                   =
=====================================


Follow-Ups: References: