Re: 68K/68332 Assembly/Binary Problem



On Mar 31, 1:12 am, "Wolfgang Kern" <nowh...@xxxxxxxx> wrote:
kevinor asked:

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?

Yes indeed, it's fast but needs a prepared table in memory.
I have this table in memory all the time as it can also
help fast LUT divide (hugh figures) and quick LOG2(10)/LOG10(2)
conversion tasks.

Beside that your target (Motorola) CPU may use Big Endian storage,
You esay could follow my way with the (partial LOG)-LUT
I mentioned already in another thread within this week, within this NG.

__
wolfgang

Hey thanks for the reply.

The subroutine I've done to generate the table is pretty generic; it
could be used to generate large tables in any bases if required.

Here's the basic pseudo-code I threw together while coding it in the
Assembler;

while powersRequired != powersGenerated
{
while loopCnt != 10
{
add previousValue to...currentValue
loopCnt++
}
loopCnt = 0
save currentValue to previousValue
save currentValue to tensTable[i++]
currentValue = 0
powersGenerated++
}

I just use indirect addressing with displacement and indexing to
access the individual elements when doing the conversions; it's
running pretty well at the moment for multiplication anyway.

I'm currently working on the divide subroutine for conversion back to
an ASCII String and it's taking a bit longer. Not quite as
straightforward but still pretty doable.

.