Several Binary-to-Decimal Libraries
I've put together a fairly extensive set of binary to decimal routines for the NES, each fairly thoroughly tested. There are three versions: tiny, standard, and fast. They all have a BSD-style license which has very few restrictions.
nes_bin2dec.zip
Their performance compares as follows:
The package includes demos that use each one and print the result on screen. There's also a thorough test for the 16-bit routines. They can be assembled directly with ca65 or NESASM. The fast version is based on the code Mozz posted. The standard version is based on Quietust's table version of Mozz's algorithm. The tiny version is based on Tepples' binary table code.
Post if you have any questions of problems using them.
I've put together a fairly extensive set of binary to decimal routines for the NES, each fairly thoroughly tested. There are three versions: tiny, standard, and fast. They all have a BSD-style license which has very few restrictions.
nes_bin2dec.zip
Their performance compares as follows:
Code:
bin2dec: 260 bytes
bin2dec_24bit Best: 106, Average: 758, Worst: 960
bin2dec_16bit Best: 77, Average: 356, Worst: 437
bin2dec_8bit Best: 55, Average: 65, Worst: 76
yxa2dec: 591 bytes
yxa_to_8_digits Best: 183, Average: 324, Worst: 430 (234%)
xa2dec: 283 bytes
xa_to_5_digits Best: 98, Average: 161, Worst: 208 (221%)
a_to_3_digits Best: 42, Average: 49, Worst: 56 (133%)
bin2dec_mini24: 133 bytes
bin2dec_24bit Best: 1079, Average: 1237, Worst: 1368 (62%)
bin2dec_mini16: 75 bytes
bin2dec_16bit Best: 542, Average: 570, Worst: 597 (62%)
bin2dec_24bit Best: 106, Average: 758, Worst: 960
bin2dec_16bit Best: 77, Average: 356, Worst: 437
bin2dec_8bit Best: 55, Average: 65, Worst: 76
yxa2dec: 591 bytes
yxa_to_8_digits Best: 183, Average: 324, Worst: 430 (234%)
xa2dec: 283 bytes
xa_to_5_digits Best: 98, Average: 161, Worst: 208 (221%)
a_to_3_digits Best: 42, Average: 49, Worst: 56 (133%)
bin2dec_mini24: 133 bytes
bin2dec_24bit Best: 1079, Average: 1237, Worst: 1368 (62%)
bin2dec_mini16: 75 bytes
bin2dec_16bit Best: 542, Average: 570, Worst: 597 (62%)
The package includes demos that use each one and print the result on screen. There's also a thorough test for the 16-bit routines. They can be assembled directly with ca65 or NESASM. The fast version is based on the code Mozz posted. The standard version is based on Quietust's table version of Mozz's algorithm. The tiny version is based on Tepples' binary table code.
Post if you have any questions of problems using them.