[net.lang.forth] Slow 4xFORTH multiplication

murrax@utai.UUCP (Murray Sherk) (07/07/86)

*** REPLACE THIS LINE WITH YOUR MESSAGE ***
I recently discovered something pretty interesting that rather disillusioned
me about 4xFORTH for the Atari ST. Apparently the authors did not use the
multiplication instructions available in the 68000 instruction set.
It is easy to hack together a 32 bit by 32 bit multiplication routine using
four 68000 MULU instructions and some SWAPping (SWPping in 4xFORTH assembler).
This yields a 64 bit product. If you want only a 32 bit product then you can
get away with only two MULU instructions.

The new multiplication routine is at least 4 or 5 times faster than the oone
supplied with 4xFORTH (and about the same as the one supplied with Holmes &
Duckworth FORTH). The word
  : TEST 100000 0 DO I I * DROP LOOP ;
runs in under 10 seconds with the new "*".

For a product that prides itself on speed, the slow multiplication is
really unacceptable. By the way, the 68000 DIVU instruction can be used to
speed up /MOD, /, and MOD as well but it is trickier. You can only use it
if the divisor's magnitude fits into 16 bits. Resort to the old versions
if the divisor is too big.

One last thing: I found the 4xFORTH assembler to be quite quirky and VERY
poorly documented (even with the examples that came with Version 2.0).
Does anybody have a public domain FORTH 68000 assembler?

-- Murray Sherk    (University of Toronto,  Ontario, Canada)