MAMEWorld >> Programming
Previous thread Previous  View all threads Index   Next thread Next   Threaded Mode Threaded  

Pages: 1

amused
MAME Fan
Reged: 04/24/08
Posts: 300
Send PM


Binary-coded decimal arithmetic?
#288605 - 06/03/12 06:35 PM


I have been looking for good algorithms for binary-coded decimal arithmetic. The best I have been able to find is
this page and it really doesn't go into as much detail as I would like. In particular, it says nothing about multiplication or division. Also, I suspect the addition and subtraction algorithms could be improved upon.

I want to know what algorithms for BCD arithmetic anyone might have come across in games. For example, I have seen Web pages giving very detailed information about the workings of Pac-Man, but of course they wouldn't have the "boring" stuff such as how the points are actually added up. Also, I am curious as to how games that multiply numbers (for example, Giga Wing, and some gambling games) do so.



Quantum Leaper
OCRer and Monkey Typist for Galaxy Game
Reged: 03/08/04
Posts: 198
Loc: Orion spiral arm of the Milky Way
Send PM


Re: Binary-coded decimal arithmetic? new [Re: amused]
#288987 - 06/09/12 03:53 AM


> I have been looking for good algorithms for binary-coded decimal arithmetic. The best
> I have been able to find is
> this page and it really doesn't go into as much detail as I would like. In
> particular, it says nothing about multiplication or division. Also, I suspect the
> addition and subtraction algorithms could be improved upon.
>
I used to convert to Binary first, the do the BCD arithmetic on my C64, since the multiplication and division used to take far longer than conversion.

> I want to know what algorithms for BCD arithmetic anyone might have come across in
> games. For example, I have seen Web pages giving very detailed information about the
> workings of Pac-Man, but of course they wouldn't have the "boring" stuff such as how
> the points are actually added up. Also, I am curious as to how games that multiply
> numbers (for example, Giga Wing, and some gambling games) do so.

I know Bard's Tale 2 or 3 on the C64 uses BCD for amount of gold your characters have. I wrote a cheat program for Bard's Tale 1,2 and 3 on the C64, I even have the source code for BT2 and BT3 cheat programs in D64 format. My cheat program never really did any kind of arithmetic, since all I had to do was show the number and edit them.

Edited by Quantum Leaper (06/09/12 03:58 AM)



Robbbert
Sir
Reged: 08/21/04
Posts: 3201
Loc: A long way from you
Send PM


Re: Binary-coded decimal arithmetic? new [Re: amused]
#289226 - 06/12/12 12:54 AM


> I have been looking for good algorithms for binary-coded decimal arithmetic. The best
> I have been able to find is

You could look in the roms for the Microbee or the Super-80. These computers store their floating-point numbers as BCD.


Pages: 1

MAMEWorld >> Programming
Previous thread Previous  View all threads Index   Next thread Next   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Pi 
0 registered and 46 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 2858