## Re: [stella] Binary to Decimal routine (small!)

 Subject: Re: [stella] Binary to Decimal routine (small!) From: "Andrew Davie" Date: Sat, 10 Feb 2001 02:42:12 +1100
```The balance between ROM, RAM and timing are what I really really really like

You're right, of course... another byte of RAM gives me a 6 digit BCD and
simple code.

I'm guessing I didn't think of using BCD simply because of years of
programming the NES - which didn't HAVE BCD - yes, they disabled it!  I'm
glad I posted my routine for critique - for you've just saved me mmmh...
about 20 bytes and LOTS of cycles :)

I'll junk my ToDecimal routine... but it was still a fun challenge to write
:)  You know, a hex score is rather appealing, too.  Or is that apalling?
One of those :)

Thanks Erik.
Cheers
A

--
_  _  _| _ _        _| _    * _                               _  ,
(_|| )(_|( (/_\/\/  (_|(_|\/(_(/_                           ,~' L_|\
,-'        \
see my Museum of Soviet Calculators at                  (            \
http://www.taswegian.com/MOSCOW/soviet.html              \    __     /
L,~'  "\__/
@--> v

----- Original Message -----
From: "Erik Mooney" <emooney@xxxxxxxxxxxxxxxx>
To: <stella@xxxxxxxxxxx>
Sent: Saturday, February 10, 2001 2:26 AM
Subject: Re: [stella] Binary to Decimal routine (small!)

> > I needed a binary-to-decimal conversion routine, to convert my binary (2
> > byte) score into 5 decimal digits for use by the previously posted
> > double-height 6-digit score routine.  The last digit is 0 in my game.
As I
> > only use two bytes for my score (binary), my range is 0-65535 (ie: score
is
> > 0-655350)
>
> Go around the problem instead.  Can you spare one extra nibble of RAM?
> If so, store your score as 5 BCD digits instead of in binary, and put the
> 6507 in BCD mode to do your score computations.  That's the smallest
> ROM-consumption way to do it, and it also lets your score range up to a
> full 999,990 instead of stopping at 655K.
>
> To think even further outside the box, you could just display the score
>
>
> -
> Archives (includes files) at http://www.biglist.com/lists/stella/archives/
> Unsub & more at http://www.biglist.com/lists/stella/
>

-
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/

```