jahboater
Posts: 4842
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: 4842
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: 592
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: 592
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: 592
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.

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

Re: Introduction to BBC BASIC

Sun Dec 01, 2019 11:10 am

Just released, version 1.08a of BBC BASIC for SDL 2.0 - the cross-platform programming language for Windows, MacOS, Linux, Raspbian, Android and iOS. The changes in this version are as follows:

  1. BASIC Interpreter / Run Time Engine

    The version of SDL supplied with the Windows, MacOS and iOS editions has been updated to 2.0.10. This version has the new float-coordinate rendering functions, in case you want to experiment with them. Note that there are significant changes in SDL which impact BBC BASIC, so if you notice anything not working properly please report it. (The Android edition is still at 2.0.5; the build tools being used don't work with later versions).

    Fixed a bug which sometimes required the use of '*run command' when '*command' should have worked (64-bit and ARM editions only).

    Fixed a bug which, in rare circumstances, could cause the INSTALL statement to hang (64-bit and ARM editions only).

  2. IDEs and Utilities

    SDLIDE: Goto Line (Ctrl+G) can now be executed by pressing Enter as well as clicking the OK button.

    SDLIDE: The customisable 'wheelspeed' value no longer affects clicking on the scrollbar arrows.

    Compiler: Fixed a bug causing single-capital-letter variables like A&, B# and C$ not to be crunched to 'fast' variables (they still won't be if also used as structure members).

  3. Libraries

    Modified 'arraylib.bbc' so that if an error occurs in PROC_invert() the LOCAL variables are restored (an error is to be expected if the matrix is non-invertible).

    Modified 'dlglib.bbc' to improve the listbox drag-scroll functionality.

    Updated 'eventlib.bbc' to be 64-bit compatible.

  4. Example Programs

    Added 'ellipsefit.bbc' (in the examples/general folder) which demonstrates that an axis-aligned ellipse can be defined by four points. This program is also compatible with BBC BASIC for Windows.

    Added 'bezierfit.bbc' (in the examples/general folder) to demonstrate fitting a smooth curve to a set of data points. This program is also compatible with BBC BASIC for Windows.

    Added 'multitouch.bbc' (in the examples/general folder) to demonstrate detecting multiple touch points. Requires a touchscreen or a multi-touch trackpad.

    Modified 'SkyBaby' to include a 'dynamic grid' in the SkyView display (requested by a user). As you zoom in the grid spacing gets finer; the grid lines are labelled with the altitude and azimuth in degrees.
This new version may be downloaded, for all the supported platforms, from the usual location. The GitHub repository has been updated (used to build the MacOS, Raspbian, iOS and 64-bit Linux editions, currently).

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

Re: Introduction to BBC BASIC

Thu Dec 05, 2019 12:39 pm

RichardRussell wrote:
Sun Dec 01, 2019 11:10 am
Added 'bezierfit.bbc' (in the examples/general folder) to demonstrate fitting a smooth curve to a set of data points. This program is also compatible with BBC BASIC for Windows.
Image

Heater
Posts: 13913
Joined: Tue Jul 17, 2012 3:02 pm

Re: Introduction to BBC BASIC

Thu Dec 05, 2019 10:46 pm

Cool.

Watching that is the most relaxing thing I have done all day.

Thank you.
Memory in C++ is a leaky abstraction .

Return to “Other programming languages”