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

Subject: Re: [stella] Binary to Decimal routine (small!)
From: Erik Mooney <emooney@xxxxxxxxxxxxxxxx>
Date: Fri, 9 Feb 2001 10:26:06 -0500
> 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
in hexadecimal :)

Archives (includes files) at
Unsub & more at

Current Thread