[Coco] CoCo gcc project

KnudsenMJ at aol.com KnudsenMJ at aol.com
Fri Oct 31 21:52:32 EST 2003


In a message dated 10/31/03 3:16:59 PM Eastern Standard Time, 
jdaggett at gate.net writes:

> I wished the 6809 had a DIV instruction!!!! Some base code to implement 
what the 
>  HC11 FDIV and IDIV instructions would be nice. Then you have 16 bit by 16 
> bit divide. 

To merge with another thread, the Star Wars arcade game used a 6809 and had 
an outboard hardware divide board, built of 7400-series TTL ICs.  Don't recall 
how many clocks it took.

If you look at the stock OS-9 C libraries, you will find various integer and 
floating point math routines, including signed and unsigned divide routines.  
Don't know how optimized they are.  From my own gory/glory days of writing 
math routines, ISTR that non-restoring divides are faster, at the expense of a 
few more lines of code, but you don't execute all the code for every bit.

For a different approach to trig and other functions, check out BASIC09's 
math routines, which use CORDIC rotation approximations -- faster than series 
expansion.  You'd have to figure out how they work and re-write for C's floating 
point.  Oh yes, 6809 C library already includes "double" precision routines, 
no doubt really slow, but what can you expect?  And who would use them on a 
6809 anyway?  --Mike K.



More information about the Coco mailing list