[cc65] Floating point support?

From: Sidney Cadot <sidney1jigsaw.nl>
Date: 2004-09-26 13:02:07
Hi Ullrich,

> Groepaz is right, there's no floating point, and therefore no %f for 
> sscanf.

Just out of curiosity... Have you given any thought on adding floating 
point support to cc65? There's quite a number of applications that 
could benefit from this.

The way I see it, to get basic support at compiler-level one would 

(1) An agreed floating point number format

Probably having float==double would suffice at first - although using a 
4-byte FP format would violate some ISO C requirements.

It's probably not a good idea to piggyback on the formats supported by 
the platform ROMs - the C64 does 4-byte binary FP format I think, while 
the Atari uses a 6-byte BCD format.

IEEE-754 4-byte "single" format would be a natural choice IMHO.

(2) 6502 conversion routines from int <-> float and back
(3) 6502 routines to support + - * / < > <= >= == != operators

(4) When all this is in place, we'd need an overhaul of the assembler 
and the compiler to support the new types.

Then, to add library-level support, we'd need

(5) 6502 ASCII <-> FP conversion functions (e.g. for scanf/printf)
(6) A 6502 math library (pow(), exp(), sin(), cos(), ... the works)

Now if such a roadmap (or similar) would be acceptable, I would 
volunteer to take care of steps (2) and (3).

Best regards, Sidney

To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Sep 26 13:02:10 2004

This archive was generated by hypermail 2.1.8 : 2004-09-26 13:02:19 CEST