BBC BASIC for SDL 2.0 v0.27a released

New releases of BB4W and BBCSDL, and other updates, will be announced here
Post Reply
guest
Posts: 227
Joined: Mon 02 Apr 2018, 09:12

BBC BASIC for SDL 2.0 v0.27a released

Post by guest » Sat 01 Dec 2018, 14:45

I have today released version 0.27a of BBC BASIC for SDL 2.0, the cross-platform application for Windows, Linux, MacOS, Raspberry Pi, Android and iOS. The changes in this version are as follows:

1. IDEs / Compiler
  • The Create Application facility will now accept relative file paths in the REM!Icon and REM!Exefile directives (assumed to be relative to the directory containing the BASIC program being 'compiled').
  • When debugging, SDLIDE preferentially highlights the line on which a recent error occurred rather than the line currently being executed.
  • Search-and-replace, in SDLIDE, no longer misbehaves if the item being replaced begins a line and is followed by a digit (previously this resulted in a spurious line number being introduced).
2. BASIC Interpreter / Run Time Engine
  • The @dir$ variable is set differently according to how the Run Time Engine is called. Specifically, if no BASIC program is specified on the command line @dir$ is now set to the directory containing the Run Time Engine itself (change requested by a user).
  • A bug in the Raspberry Pi and 64-bit editions has been fixed. This bug could cause a crash if an undeclared structure was passed as a RETURNed parameter to a FN/PROC, when the name of the formal structure was the same as the name of the passed parameter (this isn't as unlikely as it sounds!).
  • The maximum (slowest) setting of *TEMPO has been increased to 10. Previously, if you set it higher than the default value of 5 BBCSDL could crash.
  • The 'experimental' 64-bit Linux edition now includes an equally experimental x86-64 assembler. This supports more than 500 mnemonics and over 1000 distinct instruction types; not for nothing is the x86 CPU called a Complex Instruction Set computer!
3. Libraries
  • The functions for converting a string to lowercase or uppercase in 'stringlib.bbc' and 'fnusing.bbc' have been rewritten to be much faster with long strings.
  • The calendar library 'datelib.bbc' has been extended by the addition of the FN_date$() function. This works the same way as the equivalent function in the BB4W library, but supports only English day and month names.
  • The timer library 'timerlib.bbc' now supports the 64-bit Linux edition of BBCSDL.
4. Example Programs
  • The program 'brandenburg.bbc' (in the 'sounds' folder) plays Bach's Brandenburg Concerto No. 3 accompanied by an animated 3D rendering of a street organ. The vestigial second movement has been omitted (Phil Wheeler's original 1982 transcription contained it, but it has since been lost).
  • The program 'tower.bbc' (in the 'games' folder, desktop platforms only) is a BBCSDL adaptation of the Treasure Tower subgame from David Williams' prizewinning Maizie Bones program. This illustrates how 2D and 3D rendering may be combined to achieve effects that would otherwise need assembler code. Note that although 'tower.bbc' is not included with the mobile editions (Android and iOS) the technique does work on those platforms, with the limitation that the 3D 'canvas' always fills the screen.
  • The 'hello.bbc' and 'mandel.bbc' assembly language examples now include x86-64 source code, for the 64-bit Linux edition of BBCSDL. However 'sdldebug.bbc' has not (as yet) been adapted for 64-bit operation.
This new version may be downloaded, for all the supported platforms, from the usual location: https://www.bbcbasic.co.uk/bbcsdl/. The released source code (used to build the Raspberry Pi, iOS and 64-bit Linux editions, currently) has been updated to this latest version, and can be found in the same place as previously announced.

Please do not complain to me about BBCSDL, however awful you think it is. I can only say that I try my best, despite my current problems.

mikeg
Posts: 32
Joined: Sat 23 Jun 2018, 19:52

Re: BBC BASIC for SDL 2.0 v0.27a released

Post by mikeg » Sat 01 Dec 2018, 21:27

Thanks Richard.
I shared a link to this post to my Facebook programming tools group. There are currently 56 members and its growing.

Your efforts are appreciated, especially considering there isn't many basic language developers that have made such public efforts at the level
you have and with the broad cross platform compatibility. I don't know of anyone who directly interfaces with the public like you do for BBC Basic for as long as you have. Great work Richard !!

guest
Posts: 227
Joined: Mon 02 Apr 2018, 09:12

Re: BBC BASIC for SDL 2.0 v0.27a released

Post by guest » Sat 01 Dec 2018, 22:01

guest wrote:
Sat 01 Dec 2018, 14:45
The 'experimental' 64-bit Linux edition now includes an equally experimental x86-64 assembler. This supports more than 500 mnemonics and over 1000 distinct instruction types; not for nothing is the x86 CPU called a Complex Instruction Set computer!
I'd like this new assembler to be hammered to shake loose any bugs it may have; please give it a go. I'm not a 64-bit assembly language programmer myself so I'm not well placed to spot problems, especially omissions. It supports SSE, SSE2 and SSE3 instructions, but not SSSE3, SSE4 or AVX (so the YMM and ZMM registers are not directly accessible) nor privileged instructions. The 32-bit addressing modes have been omitted because they are not useful in a flat 64-bit addressing space such as BBCSDL's.

guest
Posts: 227
Joined: Mon 02 Apr 2018, 09:12

Re: BBC BASIC for SDL 2.0 v0.27a released

Post by guest » Sun 02 Dec 2018, 12:23

guest wrote:
Sat 01 Dec 2018, 22:01
I'm not a 64-bit assembly language programmer myself so I'm not well placed to spot problems, especially omissions.
I do hope there's at least one person here who has some experience of x86-64 assembly language (there surely must be?). Just a few more notes on the assembler: like the (32-bit) BB4W assembler it accepts something close to 'NASM' syntax, it's not so compatible with Microsoft's MASM - so for example indirect memory references must always be indicated explicitly by means of square brackets. However don't expect this to work because most instructions of this kind only take 32-bit addresses which aren't useful in a 64-bit flat memory space:

Code: Select all

      mov ebx,[address]  ; this doesn't work
The one exception is when you are loading (only) the al/ax/eax/rax register, which can take a full 64-bit address:

Code: Select all

      mov eax,[address]  ; this works, but only when moving to al/ax/eax/rax
However all is not lost when loading (or adding to, etc.) other registers, because you can use the x86-64's RIP-relative addressing, when accessing a memory location not very far away, typically declared in your own program:

Code: Select all

      add ebx,[rel address]  ; this works, using RIP-relative addressing
...
      .address dd value
But remember that, just as in BB4W, you must ensure there is a big gap between executable code and any written memory locations otherwise the Self Modifying Code provision will be activated and your program will run at a fraction of the speed it should (if you only read from the memory it's fine).

Let's get the 64-bit assembler thoroughly tested so I can call the 64-bit Linux edition 'complete' and also contemplate updating the MacOS edition to 64-bits. I'm relying on you!

Zaphod
Posts: 45
Joined: Sat 23 Jun 2018, 15:51

Re: BBC BASIC for SDL 2.0 v0.27a released

Post by Zaphod » Mon 03 Dec 2018, 19:39

I have looked at this for the first time, and it is pretty impressive. I have a question though, that is where does the experimental 64 bit Windows version stand.

Z

guest
Posts: 227
Joined: Mon 02 Apr 2018, 09:12

Re: BBC BASIC for SDL 2.0 v0.27a released

Post by guest » Mon 03 Dec 2018, 20:19

Zaphod wrote:
Mon 03 Dec 2018, 19:39
I have a question though, that is where does the experimental 64 bit Windows version stand.
There is no suggestion, that I am aware of, that Windows will drop support for 32-bit apps anytime soon, so really there is no pressure for a 64-bit Windows version. Compatibility would be (relatively) poor, and it would run significantly more slowly than the 32-bit version.

Although 64-bit Linux still supports 32-bit apps, it only does so via the installation of the optional 'multiarch' package, and many Linux users are very reluctant to do that because they like to keep their system 'pure'. What's more, there's a bug in the 32-bit SDL2 on Linux which causes it not to run properly even on a native 32-bit installation. So there's a clear demand for a 64-bit version of BBCSDL for that platform.

As far as MacOS is concerned, as of today it will still run 32-bit apps but Apple have announced that this will end soon. So again the need for a 64-bit version will become urgent before long. All in all Linux is the most pressing, with MacOS next and Windows a (hopefully very) distant prospect.

There might be an argument for having a 64-bit Windows version to allow people with only a Windows PC to check compatibility, except that under 64-bit Windows 'user memory' addresses are invariably in the bottom 2 Gigabytes (in my experience) and therefore it's useless for confirming that you've consistently used 64-bit variables to hold them!

guest
Posts: 227
Joined: Mon 02 Apr 2018, 09:12

Re: BBC BASIC for SDL 2.0 v0.27a released

Post by guest » Wed 05 Dec 2018, 00:54

guest wrote:
Sat 01 Dec 2018, 22:01
I'd like this new assembler to be hammered to shake loose any bugs it may have
For the record, a bug has been discovered. If you are experimenting with the assembler, make sure you always explicitly specify 'short' or 'near' when using conditional or unconditional jumps. If you omit the qualifier, it will misbehave and the generated machine code will probably crash.

guest
Posts: 227
Joined: Mon 02 Apr 2018, 09:12

Re: BBC BASIC for SDL 2.0 v0.27a released

Post by guest » Fri 07 Dec 2018, 09:28

guest wrote:
Sat 01 Dec 2018, 14:45
4. Example Programs
I should have added that 'telstar.bbc' (in the general/ folder) now includes NXtel in the list of available videotex/viewdata services.

Post Reply