dmsc / fastbasic

FastBasic - Fast BASIC interpreter for the Atari 8-bit computers
GNU General Public License v2.0
139 stars 20 forks source link

Cross compiler sometimes fails to link floating-point SIN/COS constants #52

Open ukcroupier opened 2 years ago

ukcroupier commented 2 years ago

very minor issue.

I'm getting errors when printing with commas in floating point version of the cross compiler. The following line:

? 1,2

Gives an error (it works fine in the IDE and integer compiler) and semi-colons are ok too:

Compiling 'text.tur' to assembler. Assembling 'C:\cc65\fb\10linersPOP\text.asm' to object file. Linking 'C:\cc65\fb\10linersPOP\text.o' to XEX file. ld65: Error: src/interp/fp_sincos.asm(82): PI/2 and 90 fp constants in different pages

dmsc commented 2 years ago

Hi!

Thanks for the bug report.

Sadly, this has nothing to do with the commas, it is a bug in the runtime in the SIN and COS routines - and I'm surprised it did not show earlier.

The problem is that the floating point library expects the the mentioned constants (PI/2 and 90) in the same memory page, but in your case, the linker placed the two at different pages. This occurs randomly depending on which code is included .

The workaround for now is to change the code a little, until the assembly rearranges itself.

I will try to come up with a proper solution later.

Have Fun!

ukcroupier commented 2 years ago

No problem, I was only using it to report info for debugging.