Re: 68K/68332 Assembly/Binary Problem
- From: kevinor@xxxxxxxxx
- Date: 30 Mar 2007 11:56:09 -0700
On Mar 30, 7:46 pm, Robert Redelmeier <red...@xxxxxxxxxxxxxxx> wrote:
kevi...@xxxxxxxxx wrote in part:
On Mar 30, 6:49 pm, Robert Redelmeier <red...@xxxxxxxxxxxxxxx> wrote:
So a calculator mostly would be working BCD arithmetic.
If yours has to work in hex & bin, it it relatively easy
to program those. And you are doing multi-word anyways.
I'm not too sure what you're saying; are you suggesting I
use BCD to represent decimal numbers?
I'm suggesting you use BCD to reprsent all numbers (when in
decimal mode), and do your calcs digit-wise in BCD. This makes
them much easier to display than converting from 64bit binary.
The decimal number number 129 is stored as 00000081h in binary
but as 00000129h in packed BCD.
When in hex/bin-mode, of course you can use binary to represent
all numbers because conversion is easy. Your only hassle
then is when the calculator is switched between modes, a relatively
infrequent occurance compared to the number of numbers displayed.
-- Robert
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.
My current train of thought is to code a number of Bin/Hex conversions
with relatively low cycle-counts.
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?
.
- Follow-Ups:
- Re: 68K/68332 Assembly/Binary Problem
- From: Wolfgang Kern
- 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
- 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
|