BBC BASIC for SDL 2.0 version 1.44a released

New releases of BB4W and BBCSDL, and other updates, will be announced here
Richard Russell
Posts: 662
Joined: Tue 18 Jun 2024, 09:32

BBC BASIC for SDL 2.0 version 1.44a released

Post by Richard Russell »

(This update was planned before the recent downward revision of the likely number of users).

I have released version 1.44a of BBC BASIC for SDL 2.0 - the cross-platform programming language for Windows, Mac OS, Linux, Raspberry Pi OS, Android, iOS and in-browser. The changes in this version are as follows:
  1. Environment

    In Android (only) the IDE's file selector provides access to the SD Card, if one is fitted.

    The Google Play Store now enforces API 21 (which means Android 4.1 KitKat is no longer supported) and 'edge to edge' behaviour (which means full-screen programs may extend 'behind' the status bar and be partially concealed by a camera hole or notch).

  2. BASIC Interpreter / Run Time Engine

    Added *FX 20 to restore User-Defined Characters to their default appearance.

    Modified VDU 26 so that it sets @panx% and @pany% to zero (it probably always should have).

    Manually re-sizing the window now automatically scales the output to fit, if there is no ON MOVE statement. This makes the use of PROCresize() unnecessary so long as *REFRESH is not disabled for long periods.

  3. IDEs and Utilities

    Added tooltips to SDLIDE.bbc; if you hover the mouse over a keyword or the toolbar a brief description is displayed.

    Modified touchide.bbc to include eight additional 'dark' themes in the background colour selection.

    Modified keywords.bbc, starcmds.bbc and vducodes.bbc so a long-press or Ctrl+C copies the text to the clipboard (also help.bbc in the mobile and web editions).

  4. Libraries

    Extended arraylib.bbc to include writing arrays to a file and reading them back.

    Modified msgbox.bbc so that pressing the Return / Enter key is equivalent to pressing the currently-highlighted button (if any).

    Modified mysqllib.bbc to accept 'sha2' authentication so long as the password is empty.

  5. Example Programs

    Added illusion.bbc in examples/graphics: an optical illusion (the dark blue bands are parallel).

    Added dubois.bbc in examples/sounds: Toccata pour Grand Orgue by Théodore Dubois.

    Modified lanchat.bbc so that on iOS it can still participate in chats, even if it can't initiate them because broadcasting is blocked.
This version may be downloaded, for all the supported platforms, from the usual location (the Android and iOS editions should be installed from the appropriate App Store). The GitHub repository has also been updated.
Richard Russell
Posts: 662
Joined: Tue 18 Jun 2024, 09:32

Re: BBC BASIC for SDL 2.0 version 1.44a released

Post by Richard Russell »

Richard Russell wrote: Sat 28 Mar 2026, 11:05 Manually re-sizing the window now automatically scales the output to fit, if there is no ON MOVE statement.
If for some reason you don't want this functionality, simply add an ON MOVE statement which otherwise does nothing:

Code: Select all

      ON MOVE RETURN
But in my opinion this new feature alone is reason enough to switch from BBC BASIC for Windows to BBC BASIC for SDL 2,0! :lol:
Richard Russell
Posts: 662
Joined: Tue 18 Jun 2024, 09:32

Re: BBC BASIC for SDL 2.0 version 1.44a released

Post by Richard Russell »

Richard Russell wrote: Sat 28 Mar 2026, 11:05 This version may be downloaded, for all the supported platforms, from the usual location.
If you are running a desktop edition, you will be reminded (no more than once a day though) that a new version is available, until you actually perform the update. The Android and iOS editions don't remind you, but they should update automatically from the relevant app store unless you have disabled that.
Richard Russell
Posts: 662
Joined: Tue 18 Jun 2024, 09:32

Re: BBC BASIC for SDL 2.0 version 1.44a released

Post by Richard Russell »

Richard Russell wrote: Sat 28 Mar 2026, 11:05 In Android (only) the IDE's file selector provides access to the SD Card, if one is fitted.
It is instructive to see how this was achieved. Although written in BBC BASIC, the code to access the SD Card is to all intents and purposes Javascript code (or more accurately Java Native Interface code):

Code: Select all

      DEF FNsdcard$
      LOCAL I%, activity%%, clazz%%, env%%, fileobj%%, num%, path%%, result%%, str%%, path$()

      SYS "SDL_AndroidGetJNIEnv" TO env%%
      SYS "SDL_AndroidGetActivity" TO activity%%
      IF @platform% AND &40 THEN
        `FindClass`              = ](]env%%+48)
        `DeleteLocalRef`         = ](]env%%+184)
        `GetObjectClass`         = ](]env%%+248)
        `GetMethodID`            = ](]env%%+264)
        `CallObjectMethod`       = ](]env%%+272)
        `GetStringUTFChars`      = ](]env%%+1352)
        `ReleaseStringUTFChars`  = ](]env%%+1360)
        `GetArrayLength`         = ](]env%%+1368)
        `GetObjectArrayElement`  = ](]env%%+1384)
      ELSE
        env%% = !^env%% : activity%% = !^activity%%
        `FindClass`              = !(!env%%+24)
        `DeleteLocalRef`         = !(!env%%+92)
        `GetObjectClass`         = !(!env%%+124)
        `GetMethodID`            = !(!env%%+132)
        `CallObjectMethod`       = !(!env%%+136)
        `GetStringUTFChars`      = !(!env%%+676)
        `ReleaseStringUTFChars`  = !(!env%%+680)
        `GetArrayLength`         = !(!env%%+684)
        `GetObjectArrayElement`  = !(!env%%+692)
      ENDIF

      SYS `GetObjectClass`, env%%, activity%% TO clazz%%
      SYS `GetMethodID`, env%%, clazz%%, "getExternalFilesDirs", \
      \                  "(Ljava/lang/String;)[Ljava/io/File;" TO GetExternalFilesDirs%%
      SYS `FindClass`, env%%, "java/io/File" TO fileClass%%
      SYS `GetMethodID`, env%%, fileClass%%, "getAbsolutePath", \
      \                  "()Ljava/lang/String;" TO GetAbsolutePath%%
      IF GetExternalFilesDirs%% = 0 OR GetAbsolutePath%% = 0 THEN = ""

      FOR I% = 1 TO 3
        SYS `CallObjectMethod`, env%%, activity%%, GetExternalFilesDirs%%, 0 TO result%%
        IF result%% EXIT FOR ELSE WAIT 100
      NEXT
      IF result%% = 0 THEN = ""

      SYS `GetArrayLength`, env%%, result%% TO num%
      IF num% = 0 THEN = ""
      DIM path$(num% - 1)
      FOR I% = 0 TO num%-1
        SYS `GetObjectArrayElement`, env%%, result%%, I% TO fileobj%%
        IF fileobj%% THEN
          SYS `CallObjectMethod`, env%%, fileobj%%, GetAbsolutePath%%, 0 TO str%%
          SYS `GetStringUTFChars`, env%%, str%%, 0 TO path%%
          path$(I%) = $$path%%
          SYS `ReleaseStringUTFChars`, env%%, str%%, path%%
          SYS `DeleteLocalRef`, env%%, str%%
          SYS `DeleteLocalRef`, env%%, fileobj%%
        ENDIF
      NEXT

      SYS `DeleteLocalRef`, env%%, result%%
      SYS `DeleteLocalRef`, env%%, fileClass%%
      SYS `DeleteLocalRef`, env%%, activity%%
      SYS `DeleteLocalRef`, env%%, clazz%%
      IF DIM(path$(),1) < 1 THEN = ""
      = path$(1)
I confess that this was written in close collaboration with an AI chatbot! It's the kind of code you would need to write to access other Android peripherals from BBC BASIC.
Richard Russell
Posts: 662
Joined: Tue 18 Jun 2024, 09:32

Re: BBC BASIC for SDL 2.0 version 1.44a released

Post by Richard Russell »

Richard Russell wrote: Sat 28 Mar 2026, 11:05 Added tooltips to SDLIDE.bbc; if you hover the mouse over a keyword or the toolbar a brief description is displayed.
I'm a little surprised not to have received any reaction to this, I had expected it might be controversial (one reason why you can switch it off in the Options menu). Hover-over-keyword tooltips are not uncommon in other IDEs, but have not previously been implemented in any version of BBC BASIC as far as I know.