BBC BASIC for SDL 2.0 version 1.27a released

for discussion of bbc basic for windows/sdl, brandy and more
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.24a released

Post by Deleted User 9295 »

Comment deleted.
Last edited by Deleted User 9295 on Sun Sep 26, 2021 10:28 pm, edited 1 time in total.
nicolagiacobbe
Posts: 115
Joined: Tue Jul 03, 2007 10:40 am
Location: italy
Contact:

Re: BBC BASIC for SDL 2.0 version 1.24a released

Post by nicolagiacobbe »

Well. iOS is not my preferite platform but would be interesting to hear (in plain terms) why it won't work and what did apple do to render a difficult situation even worse.
User avatar
baz4096
Posts: 280
Joined: Sat Apr 10, 2021 3:51 pm
Location: Baildon, West Yorkshire
Contact:

Re: BBC BASIC for SDL 2.0 version 1.24a released

Post by baz4096 »

I've had issues with SDL on iOS before. Commonly used functions, in my case for keyboard entry in a game, were suddenly classified as "potential keyloggers", and threw up FUD warnings to our users. Updates weren't accepted until we refactored and used different input functions. IIRC.
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.24a released

Post by Deleted User 9295 »

I've released version 1.25a of BBC BASIC for SDL 2.0 - the cross-platform programming language for Windows, MacOS, Linux, Raspberry Pi OS, Android, iOS and in-browser. The changes in this version are as follows:
  1. BASIC Interpreter / Run Time Engine

    PAGE may now be lowered without generating an error. This is dangerous in general, but in limited memory environments (e.g. the Raspberry Pi Pico) it can be useful, as it was on the original BBC Micro.

    Implemented a new SUM operator which performs modulo-2^64 addition, i.e. overflows are ignored. Using this operator modulo-2^64 subtraction and multiplication functions can be written:

    Code: Select all

          DEF FNsub64(a%%,b%%)=a%%SUMNOTb%%SUM1
          DEF FNmul64(a%%,b%%)LOCALA%,B%:A%=a%%AND&7FFFFFFF:B%=b%%AND&7FFFFFFF
          =A%*B%SUM((a%%>>31)*B%<<<31)SUM(A%*(b%%>>31)<<<31)SUM((a%%>>31AND3)*(b%%>>31AND3)<<<62)
    
  2. IDEs and Utilities

    No changes (other than the version number of SDLIDE.bbc being updated).

  3. Libraries

    stringlib.bbc modified so that FN_binary() and FN_tobase() accept 64-bit integers.

  4. Example Programs

    There are no changes to the example programs in this release.
This version may be downloaded, for all the supported platforms, from the usual location. The GitHub repository has been updated (used to build the MacOS, Raspberry Pi, Android, iOS, 64-bit Linux and in-browser editions, currently).
Last edited by Deleted User 9295 on Fri Oct 08, 2021 11:17 pm, edited 2 times in total.
User avatar
BigEd
Posts: 4624
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: BBC BASIC for SDL 2.0 version 1.25a released

Post by BigEd »

> Using this operator modulo-2^64 subtraction and multiplication functions can be written

Hurrah!
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.25a released

Post by Deleted User 9295 »

BigEd wrote:
Fri Oct 08, 2021 6:02 pm
> Using this operator modulo-2^64 subtraction and multiplication functions can be written
Hurrah!
I've managed to simplify the modulo-264 multiplication routine a little:

Code: Select all

      DEF FNmul64(a%%,b%%)LOCALA%,B%:A%=a%%AND&7FFFFFFF:B%=b%%AND&7FFFFFFF:a%%=a%%>>31:b%%=b%%>>31
      =A%*B%SUM(a%%*B%<<<31)SUM(A%*b%%<<<31)SUM((a%%AND3)*(b%%AND3)<<<62)
Can anybody do any better?
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.25a released

Post by Deleted User 9295 »

Richard Russell wrote:
Fri Oct 08, 2021 11:28 pm
Can anybody do any better?
This is the program I used to verify my version, by comparing the result from FNmul64() with the equivalent x86-64 instruction:

Code: Select all

      DIM ]^P% 100,]^L% -1
      [OPT 11
      .mul64
      mov rax,[REL ^b%%]
      mul qword [REL ^c%%]
      mov [REL ^a%%],rax
      ret
      ]

      *hex 64
      REPEAT
        b%% = RND EOR RND <<< 32
        c%% = RND EOR RND <<< 32
        CALL mul64
        IF a%% <> FNmul64(b%%,c%%) PRINT "Failed: should be &";~a%% " but was &";~FNmul64(b%%,c%%)
        WAIT 0
      UNTIL FALSE
      END

      DEF FNmul64(a%%,b%%)LOCALA%,B%:A%=a%%AND&7FFFFFFF:B%=b%%AND&7FFFFFFF:a%%=a%%>>31:b%%=b%%>>31
      =A%*B%SUM(a%%*B%<<<31)SUM(A%*b%%<<<31)SUM((a%%AND3)*(b%%AND3)<<<62)
The *hex64 is present only so the 64-bit values can be printed in the event of a failure; the function works in *hex32 mode as well.
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.26a released

Post by Deleted User 9295 »

I've released version 1.26a of BBC BASIC for SDL 2.0 - the cross-platform programming language for Windows, MacOS, Linux, Raspberry Pi OS, Android, iOS and in-browser. The changes in this version are as follows:
  1. BASIC Interpreter / Run Time Engine

    Changed the behaviour of VDU 127 (DEL) in VDU 5 mode to correspond to that of Acorn systems, i.e. the background GCOL mode is ignored.

    Fixed a bug causing VDU 127 not to work correctly in VDU 5 mode if the text direction has been changed.

    Fixed a bug (in ARM and 64-bit editions only) whereby characters plotted in VDU 5 mode could not be read back using GET(x,y).

  2. IDEs and Utilities

    Fixed a minor bug in SDLIDE.bbc which could cause incorrect indentation of lines added at the end of a program.

    Modified compiler.bbc so that message boxes still work when path names are very long.

    Modified compiler.bbc (on Windows only) to be tolerant of spaces in the path to BBCSDL.

  3. Libraries

    Added gfxlib.bbc which partially emulates David Williams's GFXLIB2 library for BB4W; see gfxlib_docs.pdf for a detailed description.

    Added audiolib to support playing music (including MP3) and sound effects.

    Modified dlglib so that it works correctly if @ox% or @oy% is non-zero, or the graphics ORIGIN has been moved.

  4. Example Programs

    Added cowboy.bbc in examples/games; this is David Williams's GFXLIB2 demo for BB4W, converted to use the new gfxlib library.

    Added metronome.bbc in examples/sounds (this is also compatible with BBC BASIC for Windows).

    Modified lemmings.bbc and tower.bbc to use the new audiolib library.
This version may be downloaded, for all the supported platforms, from the usual location. The GitHub repository has been updated (used to build the MacOS, Raspberry Pi, Android, iOS, 64-bit Linux and in-browser editions, currently).
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.26a released

Post by Deleted User 9295 »

Richard Russell wrote:
Fri Nov 19, 2021 1:50 pm
Added metronome.bbc in examples/sounds (this is also compatible with BBC BASIC for Windows).
Here's a screen grab. I considered posting a video, but it could have been one of the most boring and irritating videos ever! You can however run it yourself (without needing to install anything) here.

metronome.png
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.26a released

Post by Deleted User 9295 »

Sadly it would appear that, once again, the latest version of SDL 2.0 (which I used to build the Windows release of BBCSDL v1.26a) has suffered a regression which affects graphics plotting. In particular, but not limited to, RECTANGLE FILL no longer draws a rectangle inclusive of the bounding coordinates, which it should (and did up until this latest release). :(

So I've rebuilt the Windows edition with an earlier version of SDL (2.0.16) and updated the Zip available for download to v1.26b. Sorry about this, but I'm dependent on SDL2 working as it's advertised to, and if it doesn't things inevitably go wrong.

I have reported this regression at the SDL forum; there's been no response so far.
nicolagiacobbe
Posts: 115
Joined: Tue Jul 03, 2007 10:40 am
Location: italy
Contact:

Re: BBC BASIC for SDL 2.0 version 1.26a released

Post by nicolagiacobbe »

Many thanks as always Russell, the FNmul64() is a nice touch that remind me of one thing: is there a BBC basic library for unlimited length arithmetic?
I had to write my own routines for dealing with big numbers but they weren't optimized for sure (I have also to add that even in that form they were well up to the job but finding something more efficient would be nice).
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.26a released

Post by Deleted User 9295 »

nicolagiacobbe wrote:
Sun Dec 05, 2021 8:24 pm
is there a BBC basic library for unlimited length arithmetic?
There's bigint.bbc (supplied with BBCSDL) but it was never finished, for example it has unsigned arithmetic but not signed arithmetic.

Of course there are off-the-shelf libraries like MAPM and GMP and many others which you can call from BBC BASIC.
Soruk
Posts: 987
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

BBC BASIC for SDL 2.0 version 1.27a released

Post by Soruk »

Richard has released version 1.27a 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. BASIC Interpreter / Run Time Engine

Treat hexadecimal pointers in *LOAD commands etc. as unsigned numbers.

Disable ON ERROR when in AUTO line-entry mode (64-bit and ARM editions only).

2. IDEs and Utilities

The compiler utility can now build a 'web application' bundle to deploy online using https://wasm.bbcbasic.co.uk/bbcsdl.html?app=<URL of web bundle>.

Fixed a race-hazard in the debugger which could cause a rare crash during variable listing.

3. Libraries

Updated gfxlib and gfxlib_docs.pdf to add PROC_gfxPlotColumnListScale, PROC_gfxPlotRowListScale and FN_gfxLoadTextureSwapRGB.

Updated audiolib to add PROC_mixCancel (truncates a sound effect) and PROC_mixSoundLevel (plays a sound effect at a specified level).

4. Example Programs

Added candle.bbc (in examples/graphics), an animation of a burning candle, adapted from a program by David Williams.

Added compiler directives to a few examples so they run as web applications without modification.


This version may be downloaded, for all the supported platforms, from the usual location. The GitHub repository has been updated (used to build the MacOS, Raspberry Pi, Android, iOS, 64-bit Linux and in-browser editions, currently).

Richard is unlikely to see any feedback in this thread, this is a repost from here.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress)
Post Reply

Return to “modern implementations of classic programming languages”