64-bit BBC BASIC (again)

Richard Russell

I make no apologies for raising this subject again, as it seems increasingly likely that it will have to be addressed somehow.  Apple's iOS is already 64-bits only, and they have announced that the next major release of Mac OS will no longer support 32-bit apps.  Some major Linux distributions have discontinued their 32-bit versions, and support for 32-bit apps on their 64-bit editions is reliant on installing 'multiarch', which can be tricky and which many users are reluctant to do.

At the moment it seems improbable that Android will drop support for 32-bit apps any time soon: it has always been a 'multi-architecture' OS with both x86 and ARM (and at one time even MIPS) binaries being supported.  However since Marshmallow it has introduced a rule that shared libraries must be Position Independent, and it's difficult and inefficient to create position-independent 32-bit x86 code (there are no program-counter-relative addressing modes).  Although compilers can often be configured to create such code, adapting assembly language code to be position-independent is all but impossible, and of course my x86 BBC BASIC interpreter is 100% assembler!

It's only Windows that is likely to continue to fully support 32-bit applications - and hence 'my' BBC BASIC - for the foreseeable future.  Several major Windows applications are still 32-bits, including Microsoft's own Visual Studio and parts of Internet Explorer.  But this is little consolation when all the recent BBC BASIC developments have been of the cross-platform editions (Windows, Linux, Mac OS, Android, Raspberry Pi).

In the earlier thread we discussed at length some of the problems related to creating a 64-bit version of BBC BASIC, not least that it is impossible to maintain full compatibility with the existing versions.  We considered some alternative approaches and their pros and cons.  But no clear front-runner emerged and no good solutions were forthcoming for some of the more intractable issues, such as the SYS statement.

So to help move this forward I have created a highly experimental 64-bit version of BBCSDL (for Windows only) which should have enough functionality to allow some practical testing to be carried out and some experience gained of the implications of a transition to 64-bits.  In this version I have made no attempt to tackle the major compatibility issues, for example @hwnd% and @memhdc% are still 32-bits whereas the handles returned from SDL may not be.  The SYS statement has limited functionality with no support at all for passing floats.  And of course there's no assembler!

This version can be downloaded as bb64.zip, its contents should be extracted to a directory created specifically for the purpose.  Do not put the files in the same folder as an existing (32-bit) BBCSDL installation since the 64-bit DLLs will overwrite the 32-bit ones and break everything.  bb64.exe is the executable and opens the same kind of 'immediate mode' window that BBCSDL does when not using one of the IDEs.  bb64 will run SDLIDE.bbc but it's rather flaky and prone to crashing.

Ideally I would like everybody to download this version and have a play.  Experiment with things that ought to work (let me know if they don't!) but more importantly think about those areas where full compatibility is impossible and make suggestions for how this can best be addressed.   Last, but not least, this version badly needs an assembler so it would be incredibly helpful if somebody could volunteer to write one.


Join bb4w@groups.io to automatically receive all group messages.