Re: 68K/68332 Assembly/Binary Problem
- From: Robert Redelmeier <redelm@xxxxxxxxxxxxxxx>
- Date: Fri, 30 Mar 2007 19:44:41 GMT
kevinor@xxxxxxxxx wrote in part:
I probably should have mentioned this from the beginning;
the operation of the calculator is independant of a mode
function. It is possible to input a Binary number, input
an operator, input a Hex number, and request the answer of
the operation in Decimal directly. The specification also
indicates all numbers should be 64-bit; without mentioning
BCD. This would still leave a range of admittedly very high
integer values that can't be represented as 64-bit BCD.
It wouldn't be 64bit BCD, that'd never fit. You need 20 BCD
digits, or 80 bits.
In order to perform the Decimal conversions the best I can
come up with at the moment is to have a place-value table
of powers of ten and use indexing and addition algorithms
to compute the place-values during conversions. It will
take a large number of cycles but it's the best I can come
up with at the moment. Is this a valid approach do you think?
If you're dead-set on doing binary internally (do you really
think I/O mode conversions will be that frequent?) then the
fastest BCD conversion routine is likely to be a LUT on each
digit of each power of ten. 200 entries; avg 5 compares and
one branch for each digit. Possibly quicker if the upper 32
bits are zero and shortcutted.
A close second (possibly faster on some CPUs) is a short
power-of-ten LUT with successive subtractions.
-- Robert
.
- Follow-Ups:
- Re: 68K/68332 Assembly/Binary Problem
- From: kevinor
- Re: 68K/68332 Assembly/Binary Problem
- References:
- 68K/68332 Assembly/Binary Problem
- From: kevinor
- Re: 68K/68332 Assembly/Binary Problem
- From: Robert Redelmeier
- Re: 68K/68332 Assembly/Binary Problem
- From: kevinor
- Re: 68K/68332 Assembly/Binary Problem
- From: Robert Redelmeier
- Re: 68K/68332 Assembly/Binary Problem
- From: kevinor
- 68K/68332 Assembly/Binary Problem
- Prev by Date: Re: 68K/68332 Assembly/Binary Problem
- Next by Date: Re: 68K/68332 Assembly/Binary Problem
- Previous by thread: Re: 68K/68332 Assembly/Binary Problem
- Next by thread: Re: 68K/68332 Assembly/Binary Problem
- Index(es):
Relevant Pages
|
|