| |
Blackspawn Account closed
Registered: Jun 2002 Posts: 11 |
Binary coded decimals
Hi folks!
I'm just reading "Escape From New York dissected" by Lasse Öörni. I'm curious to know why he uses binary coded decimals all the time, e.g. for hiscores, time counter etc. I don't see the real advantage of them here. Any ideas?
Regards,
Blackspawn
|
|
| |
cadaver
Registered: Feb 2002 Posts: 1160 |
Yeah, in complex programs it's much more flexible to use non-BCD numbers for all calculations, to make arbitrary arithmetic operations possible, AND only convert them when displaying.
But EFNY is an oldschoolish game where there's only simple addition & subtraction to the values, so in that case using BCD arithmetic makes the printing a bit more straightforward, and faster. |
| |
cadaver
Registered: Feb 2002 Posts: 1160 |
Btw. then there's also Richard's way, to store scores etc. directly on screen memory (!) and handle them one digit (0-9) at a time :)))))) |
| |
Graham Account closed
Registered: Dec 2002 Posts: 990 |
including BCD into the assembler language is rather stupid i think. all calculations and stuff are way easier to do in binary. for example a BCD-multiplication would be rather complicated and slow. i think BCD only made its way into assembler languages due to very lame cobol compiler programmers...
|
| |
Dbug
Registered: Aug 2003 Posts: 5 |
Quote: including BCD into the assembler language is rather stupid i think. all calculations and stuff are way easier to do in binary. for example a BCD-multiplication would be rather complicated and slow. i think BCD only made its way into assembler languages due to very lame cobol compiler programmers...
Ok, multiplication and divides are not straightforward in BCD mode, but additions, subtractions and comparisons work perfectly in that mode, and it's a lot easier to handle things supposed to be displayed in decimal in BCD than in binary.
I'm currently writing a game for the Minigame compo 2003, and for displaying scores I'm simply storing them in BCD and then use a standard hexadecimal display routine.
|