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

Re: Introduction to BBC BASIC

Tue Sep 15, 2020 6:55 pm

scruss wrote:
Tue Sep 15, 2020 6:41 pm
Richard - you might want to update the installation file, as it's missing the libsdl2-net-2.0-0 requirement.
Not according to what I see here it isn't! This is what it says in the install-rpi.txt file:

Code: Select all

 sudo apt-get install libsdl2-2.0-0
 sudo apt-get install libsdl2-ttf-2.0-0
 sudo apt-get install libsdl2-net-2.0-0
 sudo apt-get install mesa-utils
(I didn't know when I wrote the file that you could include multiple packages in the same line).

User avatar
scruss
Posts: 4581
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Introduction to BBC BASIC

Tue Sep 15, 2020 9:02 pm

Yes, but after installing just those, the user will see:

Code: Select all

./bbcsdl 
./bbcsdl: error while loading shared libraries: libSDL2_net-2.0.so.0: cannot open shared object file: No such file or directory
The libSDL2_net library is definitely required:

Code: Select all

ldd bbcsdl | grep -i sdl
	libSDL2-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libSDL2-2.0.so.0 (0xb6deb000)
	libSDL2_ttf-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libSDL2_ttf-2.0.so.0 (0xb6dd4000)
	libSDL2_net-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libSDL2_net-2.0.so.0 (0xb6dc0000)
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

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

Re: Introduction to BBC BASIC

Tue Sep 15, 2020 9:27 pm

scruss wrote:
Tue Sep 15, 2020 9:02 pm
The libSDL2_net library is definitely required:
Well, I've never installed it and BBC BASIC works here (RPi 3 and RPi 4). My system doesn't even recognise the underscore variety of the library, only the hyphen one that my install file specifies:

Code: Select all

sudo apt-get install libsdl2-net-2.0-0
libsdl2-net-2.0-0 is already the newest version (2.0.1+dfsg1-4).

sudo apt-get install libsdl2_net-2.0-0
E: Unable to locate package libsdl2_net-2.0-0
Are you running regular 32-bit Raspbian Buster or something different?

User avatar
hitsware
Posts: 298
Joined: Sat Mar 26, 2016 10:12 pm
Location: sacramento , california , usa
Contact: Website

Re: Introduction to BBC BASIC

Tue Sep 15, 2020 9:50 pm

Thank You Richard .
Works fine now .
( 3 B + ....... Stretch )

Suggestion for install-rpi.txt :

make a folder " foo "" <<<<<<<<<<<<<<<<<<
extract bbc-rpi.zip into " foo " <<<<<<<<<<<<

Update your Raspberry Pi:
sudo apt-get update
sudo apt-get dist-upgrade

Install SDL 2.0:
sudo apt-get install libsdl2-2.0-0
sudo apt-get install libsdl2-ttf-2.0-0
sudo apt-get install libsdl2-net-2.0-0
sudo apt-get install mesa-utils
cd / / foo/ <<<<<<<<<<<<<<<<<<< the important part
chmod +x bbcsdl
chmod +x mkicon.sh

Enable the 'experimental' GL Driver (may require a reboot):
sudo raspi-config
Advanced Options... GL Driver... GL (Full KMS)... Ok... Finish

To start BBC BASIC:
./bbcsdl

To create a desktop shortcut:
./mkicon.sh
http://www.hitswares.com/

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

Re: Introduction to BBC BASIC

Tue Sep 15, 2020 10:27 pm

hitsware wrote:
Tue Sep 15, 2020 9:50 pm
Suggestion for install-rpi.txt :

make a folder " foo "" <<<<<<<<<<<<<<<<<<
extract bbc-rpi.zip into " foo " <<<<<<<<<<<<
So you want install-rpi.txt to contain the instructions for extracting install-rpi.txt... :lol: :roll:

Anyway I don't like to be that prescriptive. Whilst I would personally choose to install it in a new folder, not everybody might and there's no actual necessity to do so: if you install it in your home directory it will work fine. So I'd rather leave the instructions as they are and let the user choose how and where they want to install it.

User avatar
scruss
Posts: 4581
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Introduction to BBC BASIC

Wed Sep 16, 2020 1:37 am

RichardRussell wrote:
Tue Sep 15, 2020 9:27 pm
Are you running regular 32-bit Raspbian Buster or something different?
Yup. On a system that had never had BBC BASIC on it, so there were no lurking libraries. I'd just pasted in your apt-get lines, put of course couldn't paste them back from history as they start with a space and hence disappear. (bash assumes any entry that starts with a space is something you want forgotten and won't commit it to history.)

I wouldn't have reported it if it weren't a real problem under Raspberry Pi OS.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

User avatar
hitsware
Posts: 298
Joined: Sat Mar 26, 2016 10:12 pm
Location: sacramento , california , usa
Contact: Website

Re: Introduction to BBC BASIC

Wed Sep 16, 2020 3:48 am

> So you want install-rpi.txt to contain the instructions for extracting install-rpi.txt... :lol: :roll:

Here ' s the way I see it :
For ....

Code: Select all

chmod +x bbcsdl

chmod +x mkicon.sh

 ./bbcsdl

 ./mkicon.sh
To work one needs be
in the same directory
as ( I don't know which )
files from the .bbc . zip
It clutters the home directory
to have all those files .
Vs .
1 folder .......
PLUS !
It is easy for a newb ( like me )
to get confused when terminal
commands stop working ......
http://www.hitswares.com/

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

Re: Introduction to BBC BASIC

Wed Sep 16, 2020 4:49 am

scruss wrote:
Wed Sep 16, 2020 1:37 am
I wouldn't have reported it if it weren't a real problem under Raspberry Pi OS.
So you say, but you still haven't told me what you want me to change! My existing install-rpi.txt file does install libsdl2-net, as it always has, so I neither understand what the problem is nor how I am supposed to fix it. I did install BBC BASIC from scratch on a brand new RPi 4 using only the instructions in that file (although I would have typed them in, not copied-and-pasted), and it worked correctly here. Nobody else has reported a similar problem.

If you want me to remove the leading spaces (I had no idea they were significant in bash) or even put the multiple libraries in a single command I can consider that, but neither explains why the existing file is not working for you.

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

Re: Introduction to BBC BASIC

Wed Sep 16, 2020 5:16 am

hitsware wrote:
Wed Sep 16, 2020 3:48 am
It is easy for a newb ( like me ) to get confused when terminal commands stop working ......
I'm afraid it's the nature of Linux that the installation process requires you to be more knowledgeable and experienced than when installing on the other OSes supported by BBCSDL. The instructions in install-rpi.txt aren't visible until you've figured out how to unzip the downloaded file, and by then you've already committed yourself to what directory they are in! I really don't think it would be helpful to add something like "if you've just unzipped the files into your home directory, delete them and start again"!

The only foolproof solution to your problem would be for me to supply BBC BASIC in a more 'automated' format such as a .deb file that can be installed using apt. I could do that for the Raspberry Pi edition, probably, but not for the generic Linux editions, which I don't want to be specific to any particular 'flavour' of Linux.

User avatar
hitsware
Posts: 298
Joined: Sat Mar 26, 2016 10:12 pm
Location: sacramento , california , usa
Contact: Website

Re: Introduction to BBC BASIC

Wed Sep 16, 2020 2:56 pm

The problem easily arises if one ( as I often do )
extract into the downloads folder .

> "if you've just unzipped the files into your home directory,
> delete them and start again" !

? " place these ( extracted ) files into a folder named " bbc " "

The .deb ( especially if in the RPi repository ) would
certainly gain some usage of BBCBasic ....
http://www.hitswares.com/

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

Re: Introduction to BBC BASIC

Mon Sep 21, 2020 2:06 pm

With the portfolio of 'my' versions of BBC BASIC now being quite large I have created this grid showing which version has which capabilities. The boxes marked ? indicate features of which the version is theoretically capable, but I haven't yet attempted an implementation:

feature_table.png
feature_table.png (40.39 KiB) Viewed 6187 times

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

Re: Introduction to BBC BASIC

Thu Oct 01, 2020 2:40 pm

I've released version 1.16a of BBC BASIC for SDL 2.0 - the cross-platform programming language for Windows, MacOS, Linux, Raspbian, Android, iOS and in-browser. This is an interim release to fix a bug and a regression, it affects the 64-bit, ARM and Browser editions only, the 32-bit x86 editions have not been updated:

  1. Fixed a bug affecting the ON ... PROC statement (it could report a Syntax Error when there was nothing wrong).
  2. Fixed a regression in the ellipse.bbc library (causing filled ellipses not to plot if the GCOL mode was OR, AND, XOR or invert).
This new version may be downloaded from the usual location. The GitHub repository has been updated.

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

Re: Introduction to BBC BASIC

Wed Oct 07, 2020 9:02 am

I have updated the Console Mode editions of BBC BASIC to version 0.28, to fix a couple of bugs:

  • ON ... PROC did not work correctly and could report a Syntax error even with valid code.
  • ON ERROR LOCAL could, in rare circumstances, misbehave if used in a nested function.
Version 0.28 may be downloaded as follows:

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

Re: Introduction to BBC BASIC

Sun Oct 11, 2020 4:31 pm

The webgllib.bbc library has been written primarily to support 3D graphics on the in-browser (Emscripten / Web Assembly) edition of BBC BASIC for SDL 2.0. Here are some of its features:

  • Substantially compatible with the D3DLIBA (for BB4W), ogllib (for desktop BBCSDL) and gleslib (for mobile BBCSDL) libraries.

  • Implemented using shader programs rather than the legacy Fixed Function Pipeline used by the other libraries.

  • Uses retained mode rather than immediate mode; there are no client-side arrays and all objects are stored in GPU memory. This is necessary for compatibility with WebGL and OpenGLES 2.0, and also offers some performance benefits.

  • Alpha-blending and specular reflections are always enabled, they can only be disabled by explicitly setting the alpha to 1.0 and the specular component of lights and/or textures to 0.0. However the alpha value is taken only from the vertex parameters or a texture, not from a material.

  • Lighting calculations always take account of the sign of the normal vector. This is different from the way the Fixed Function Pipeline works and you may need to reverse the direction of the normal to achieve compatibility. Face culling works as expected so you may need to arrange that the direction of the normal corresponds to the vertex winding order. Two-sided textures are not supported

  • There is a maximum of five lights (although this could be increased). These may be point-source, directional or spotlight, but there is currently no support for falloff with distance, and the spotlight cone has a hard boundary.

  • Although the library is primarily intended to be used with the in-browser edition of BBCSDL (WebGL) it is compatible with OpenGL and OpenGLES 2.0 so should also work on other platforms including the Raspberry Pi. This may provide some performance benefits, such as per-pixel lighting calculations.

I would be interested in your experiences of using this library.

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

Re: Introduction to BBC BASIC

Fri Oct 23, 2020 1:45 pm

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

  1. BASIC Interpreter / Run Time Engine

    Updated the in-browser (Emscripten / Web Assembly) edition to support shader graphics, 3D graphics and the Box2D physics engine.

    Fixed a subtle bug which could cause unwanted behaviour when using ON ERROR LOCAL in nested functions (ARM and 64-bit editions only).

    Fixed a one-byte buffer overrun in the *KEY command (ARM and 64-bit editions only).

  2. IDEs and Utilities

    Updated BBCEdit to version 0.37.1 (with thanks to Andy Parkes); amongst other changes this has a new light-mode option.

    Fixed a regression causing the profiler not to work on the Raspberry Pi (D'oh!).

  3. Libraries

    Added shaderlib.bbc to facilitate writing shader-based programs, and to aid compatibility with the in-browser edition.

    Added webgllib.bbc which is substantially compatible with ogllib and gleslib but uses shaders rather than the Fixed Function 3D Pipeline.

    Updated some other libraries to improve compatibility with, and performance in, the in-browser edition.

  4. Example Programs

    Modified Ceefax.bbc (again!) to track changes the BBC is making to its web pages and to improve performance in the in-browser edition.

    The shader-based programs (fluid.bbc, mandel.bbc, seascape.bbc, slitscan.bbc) have been re-written to use the shaderlib library.

    Updated some other example programs to improve compatibility with, and performance in, the in-browser edition.
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, Android, iOS, 64-bit Linux and in-browser editions, currently).

Please remember that if you use the BBC2APK Android Application Generator you should download a new APK template to ensure that any updates to the run-time engine are incorporated in your own apps.

ejolson
Posts: 8922
Joined: Tue Mar 18, 2014 11:47 am

Re: Introduction to BBC BASIC

Fri Oct 23, 2020 4:58 pm

I'm sorry if this is something that can easily be discovered from the manual, but I'm wondering if matrices can be passed as arguments to functions and procedures in current versions of BBC Basic. If so, when was this capability added? In particular, any historical information about which versions support passing matrices as arguments would be appreciated.

Again sorry to bother with such an obvious question, but the historical timeline seems difficult to discover just from web searching.

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

Re: Introduction to BBC BASIC

Fri Oct 23, 2020 5:51 pm

ejolson wrote:
Fri Oct 23, 2020 4:58 pm
I'm wondering if matrices can be passed as arguments to functions and procedures in current versions of BBC Basic. If so, when was this capability added?
Yes, it was added (along with array arithmetic) in BBC BASIC 5, so quite some time ago (1986 or thereabouts was it?). Since then you've been able to pass arrays/matrices as parameters, make them LOCAL and so on. My 'recent' versions (post 2000) have added the capability of passing an 'undimensioned' array as a parameter and DIMming it in the function or procedure, which can be useful (I don't know why that doesn't work in BBC BASIC 5, but it doesn't).

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

Re: Introduction to BBC BASIC

Sat Oct 24, 2020 9:20 am

RichardRussell wrote:
Fri Oct 23, 2020 1:45 pm
Fixed a regression causing the profiler not to work on the Raspberry Pi (D'oh!).
Nobody reported that regression, I noticed it myself, so evidently the profiler is not widely used. I would commend it (Run... Profile in SDLIDE) for identifying code bottlenecks, especially on a relatively slow machine like the Pi.

Of course identifying a bottleneck doesn't necessarily mean a solution will present itself, but it may; and if there isn't a solution in BASIC you have the option of dropping into assembler code or shader code for that time-critical segment. Incorporating assembler code will inevitably make your program platform-specific, but shader code (which is very much like C but runs on the GPU) is cross-platform.

Judicious use of inline assembler or shader code can result in a program which outperforms most other languages, even if (say) only 1% of the code is converted and the rest remains in interpreted BASIC. It's one of the things that makes BBC BASIC 'noteworthy'.

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

Re: Introduction to BBC BASIC

Sat Oct 24, 2020 11:54 am

RichardRussell wrote:
Fri Oct 23, 2020 1:45 pm
Added webgllib.bbc which is substantially compatible with ogllib and gleslib but uses shaders rather than the Fixed Function 3D Pipeline.
I've noted this elsewhere, but just to clarify: the webgllib library (although written to support 3D graphics in the in-browser edition, hence the name) is compatible with all editions of BBCSDL, including the Raspberry Pi. If you want to benefit from the per-pixel specular reflection or spotlight calculations simply change library references from ogllib to webgllib. For example if you change teapot.bbc as below it will significantly improve the rendering quality:

Code: Select all

      INSTALL @lib$+"webgllib"

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

Re: Introduction to BBC BASIC

Mon Oct 26, 2020 4:00 pm

RichardRussell wrote:
Sat Oct 24, 2020 11:54 am
For example if you change teapot.bbc as below it will significantly improve the rendering quality
Here's a YouTube video showing the result.

ejolson
Posts: 8922
Joined: Tue Mar 18, 2014 11:47 am

Re: Introduction to BBC BASIC

Mon Oct 26, 2020 5:17 pm

RichardRussell wrote:
Mon Oct 26, 2020 4:00 pm
RichardRussell wrote:
Sat Oct 24, 2020 11:54 am
For example if you change teapot.bbc as below it will significantly improve the rendering quality
Here's a YouTube video showing the result.
Did you record the video animation on the Raspberry Pi or using a separate HDMI recording device?

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

Re: Introduction to BBC BASIC

Mon Oct 26, 2020 6:05 pm

ejolson wrote:
Mon Oct 26, 2020 5:17 pm
Did you record the video animation on the Raspberry Pi or using a separate HDMI recording device?
The YouTube video? It was recorded off-screen with a camcorder (the moiré patterning from the different sampling grids is visible).

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

Re: Introduction to BBC BASIC

Mon Oct 26, 2020 10:49 pm

RichardRussell wrote:
Mon Oct 26, 2020 6:05 pm
The YouTube video? It was recorded off-screen with a camcorder (the moiré patterning from the different sampling grids is visible).
Funnily enough I had not even thought about recording the HDMI output of the RPi, so thanks for the suggestion. For comparison purposes, here's a video recorded that way: https://www.youtube.com/watch?v=3WWOWUjZYDE

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

Re: Introduction to BBC BASIC

Tue Nov 03, 2020 2:16 pm

When the proposal to extend the functionality of the PTR() pseudo-variable was first made I was persuaded - admittedly somewhat reluctantly - to go further by supporting not only specifying a structure parameter but also an array. So currently, in BBCSDL and the Console editions, we have:

Code: Select all

      address = PTR(struct{})
      address = PTR(array())
      address = PTR(string$)
      PTR(struct{}) = address
      PTR(array()) = address
      PTR(string$) = address
It has recently occurred to me that it's somewhat inconsistent to support these options without also being able to do the same with a function or procedure:

Code: Select all

      address = PTR(FNmyfunc)
      PTR(PROCmyproc) = address
I don't suggest that this usage would be particularly valuable, but then nor are some of the other extended uses for PTR(), but it would be difficult to justify arbitrarily omitting it. So I propose to add this extension-to-the-extension in a future release, unless anybody has an objection.

This rather contrived test program shows one way in which it could be used:

Code: Select all

      PROC0
      PTR(PROC0) = PTR(PROC1)
      PROC0
      PTR(PROC0) = PTR(PROC2)
      PROC0
      END

      DEF PROC0
      ENDPROC

      DEF PROC1
      PRINT "One"
      ENDPROC

      DEF PROC2
      PRINT "Two"
      ENDPROC
which prints:

Code: Select all

One
Two

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

Re: Introduction to BBC BASIC

Mon Nov 09, 2020 11:18 pm

I have updated the Console Mode editions to v0.29, details at the website.

Return to “Other programming languages”