jahboater
Posts: 4767
Joined: Wed Feb 04, 2015 6:38 pm

Re: Introduction to BBC BASIC

Thu Oct 31, 2019 2:31 pm

RichardRussell wrote:
Thu Oct 31, 2019 2:02 pm
The redefining of fabsl to fabs (and others similar) is because the ARM FPU doesn't support 'long double' as meaning the 80-bit (padded to 128-bit) type that the x86 FPU supports.
In 32-bit mode on ARM "long double" is the same as "double", that is 64-bits.
In 64-bit mode, ARM "long double" is 128-bits!

For Intel, the compiler option "-mlong-double-128" gives true 128-bit floating point like aarch64.

jahboater
Posts: 4767
Joined: Wed Feb 04, 2015 6:38 pm

Re: Introduction to BBC BASIC

Thu Oct 31, 2019 2:37 pm

RichardRussell wrote:
Thu Oct 31, 2019 12:18 pm
The global variables 'esi' and 'esp' (you can see the assembly language origins of the code there!) are assigned to registers r10 and r11 respectively on ARM. From the warning you are getting these aren't suitable registers for that purpose with your system's ABI; try changing them to different registers.
Or perhaps just remove the asm("r10") part if there is no specific reason to place the variables in those registers.
You will almost certainly get worse code otherwise. As you say modern register allocater's do a good job, and an even better job if there are no pointless constraints.

Inline system calls are the only reason I have found to use "register".

User avatar
RichardRussell
Posts: 590
Joined: Thu Jun 21, 2012 10:48 am

Re: Introduction to BBC BASIC

Thu Oct 31, 2019 3:37 pm

jahboater wrote:
Thu Oct 31, 2019 2:31 pm
In 32-bit mode on ARM "long double" is the same as "double", that is 64-bits.
In 64-bit mode, ARM "long double" is 128-bits!
Indeed (and the 128-bit 'long double' is currently a software emulation) which is why I redefine those 'long double' library functions to their ordinary 'double' equivalents. I think there's a GCC compiler switch to do that on x86 but surprisingly not on ARM. I could explain why BBC BASIC uses the 'long double' type at all but unless you're as obsessively interested in the history of the language as I am it probably wouldn't be welcome!
Or perhaps just remove the asm("r10") part if there is no specific reason to place the variables in those registers.
Well, there is a "specific reason" in that those global variables are very frequently accessed and have their own dedicated registers in the assembly language implementations of BBC BASIC. That, and the comment I found that the only residual value of register variables was in exactly such a language interpreter, led me to conclude that they are probably beneficial. But one would need to do some careful benchmarking to establish that.

User avatar
RichardRussell
Posts: 590
Joined: Thu Jun 21, 2012 10:48 am

Re: Introduction to BBC BASIC

Mon Nov 04, 2019 12:04 pm

I found a rather nasty bug yesterday, which (in admittedly statistically unlikely circumstances) could cause the INSTALL statement to hang. The source at GitHub has been updated with the fix.

User avatar
RichardRussell
Posts: 590
Joined: Thu Jun 21, 2012 10:48 am

Re: Introduction to BBC BASIC

Sun Nov 10, 2019 6:23 pm

Congratulations are due to David Williams (aka BasicBoy) whose BBC BASIC game 'Tyoob' has won Second Prize at the recent SyntaxBomb game coding competition. Here's a YouTube video of the game running on a Raspberry Pi 3 (apparently it runs rather more smoothly on a RPi 4).

David has had great success with the BBC BASIC games he has submitted to SyntaxBomb; of his three contest entries ('Forces of Darkness' in the Halloween-themed contest in 2017, 'Maizie Bones' in the maze-themed contest in 2018 and 'Tyoob' in the mix-it-up contest this year) two have won First Prize and one Second Prize! In another SyntaxBomb competition (which David didn't enter) a game written in BBC BASIC also won.

Return to “Other programming languages”