Open mist64 opened 2 years ago
How does basic do string to float parsing now; can't we just jump to that routine to implement VAL_1?
We could (and that's what the C128 does), but it would break the separation between BASIC and the Math library, as I've attempted it in the X16.
The original Microsoft BASIC 6502 source code had Math package almost 100% separate from the actual BASIC interpreter. So I thought it would be great to separate it out for the X16: If a machine code application wants to use floating point Math, but does not use the BASIC interpreter, it can reuse the BASIC zero page area, as long as it avoids the Math library's area:
The Commodore computers never had such a separation. If you wanted to use floating point but not BASIC, you had to be either avoid the complete BASIC zero page area, or be very careful about which addresses to use.
The problem is that VAL_1
ultimately relies on FIN
, which uses CHRGET
, which uses a lot of BASIC zero page space.
thank you for the explanation
The X16 ROM supports the C128/C65 Math package, as described here:
The only missing function is
VAL_1
, which converts an ASCII string to floating point. The C128 implementation callsFIN
, which depends on both the string library andCHRGET
, both of which are part of BASIC not of the Math package, so the backport isn't straightforward.We need to write an implementation that is independent of BASIC, pulls in as little of BASIC as possible, and, if possible, have BASIC use it.