Re: 68K/68332 Assembly/Binary Problem



kevinor@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





.



Relevant Pages

  • Re: 68K/68332 Assembly/Binary Problem
    ... If yours has to work in hex & bin, it it relatively easy ... use BCD to represent decimal numbers? ... possible to input a Binary number, input an operator, input a Hex ... My current train of thought is to code a number of Bin/Hex conversions ...
    (alt.lang.asm)
  • Re: lab help
    ... display '. ... it is best to use XOR instead of mov. ... BCD numbers are already coded in hex. ...
    (comp.lang.asm.x86)
  • Re: Cox of timing problem?
    ... I've encountered problem in developing a simple BCD number display. ... is the coding for my 7-segment decoder module. ... module seg7 (clock, bcd, number_segments); ...
    (comp.lang.verilog)
  • Re: how do I get more numbers past the decimal?
    ... For very high precision, programmers use binary coded decimal. ... This page makes it seem like there are several variations on BCD: ... manipulation of numerical data for display can be greatly simplified ...
    (comp.lang.php)
  • Re: Packed Fields
    ... > when real men built their own UART modems and BCD displays out of ... "BCD in electronics ... This matches much more closely the physical reality of display ... 7-segment displays to build a metering circuit, ...
    (comp.sys.hp.mpe)