[Coco] CMOC 0.1.86 is out: Support for floats via MC6839 ROM

William Astle lost at l-w.ca
Mon Mar 11 00:06:58 EDT 2024


On 2024-03-10 19:20, Sean Conner via Coco wrote:
>    I've been playing around with floating point on the 6809, using both the
> MC6839 and Color BASIC rom routines, and I found the Color BASIC ROM
> routines to be twice as fast than the MC6839:
> 
> 	https://boston.conman.org/2024/03/01.1
> 
> I'm not sure why that would be the case (and double precision math is twice
> as slow as the single precision math on the MC6839).

The Color Basic ROM routines are hardwired for a single size of floating 
point (8 bit exponent, 1 sign bit, 31 bit significand, with the sign bit 
immediately between the exponent and the significand) which is arranged 
in a way that is particularly convenient for 8 bit processors to handle. 
It is then optimized substantially for that specific format as well and 
calculation is done with no format conversion other than unpacking the 
sign bit from the significand.

The MC6839 ROM, on the other hand, handles multiple sizes of floating 
point arranged in a way that is less convenient. As a result, it does 
some inbound and outbound conversions. It also has an API layer in front 
of the actual calculations which Color Basic doesn't have and that API 
layer does a fair bit of fiddling around before the calculations even 
happen. On top of that, it has to be generic and relocatable so it uses 
position independent code and must use indexed addressing instead of 
direct page addressing. Both of those will slow things down quite a bit.

In all, it's not particularly surprising that the Color Basic ROM is 
quite a bit faster for its one operand size.

There may well be opportunities for optimization in the MC6839 ROM code 
but I haven't seen an accurate enough assembly listing of the actual 
MC6839 to make it worth examining. At least the ROM dump I have doesn't 
match any of the source code I've seen.

-- 
William Astle



More information about the Coco mailing list