Re: 68K/68332 Assembly/Binary Problem
- From: kevinor@xxxxxxxxx
- Date: 30 Mar 2007 13:12:56 -0700
On Mar 30, 8:44 pm, Robert Redelmeier <red...@xxxxxxxxxxxxxxx> wrote:
kevi...@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
Yea I'm pretty sure the conversions will be frequent. I just coded a
LUT generation subroutine and it took <10000 cycles up to 10^20; I
guess that bodes well enough for the conversion algorithms if I can
get them done and working.
The whole BCD thing; I'm a bit wary of trying it considering the
extension required to fit it into the specification for the
calculator; as you indicated I would need to increase the number of
words I'm dealing with yet again to cope with 64-bit decimal in BCD.
Thanks for the help though; at least it got me coding again rather
than sitting here pondering.
Now I just need to implement a sign tracker of some description...
nuts.
.
- Follow-Ups:
- Re: 68K/68332 Assembly/Binary Problem
- From: Robert Redelmeier
- 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
- Re: 68K/68332 Assembly/Binary Problem
- From: Robert Redelmeier
- 68K/68332 Assembly/Binary Problem
- Prev by Date: Re: 68K/68332 Assembly/Binary Problem
- Next by Date: Re: How send character to keyboardbuffer?
- Previous by thread: Re: 68K/68332 Assembly/Binary Problem
- Next by thread: Re: 68K/68332 Assembly/Binary Problem
- Index(es):
Relevant Pages
|
|