Matrix Brandy BASIC VI for console and SDL1.2: V1.23.1 released

for discussion of bbc basic for windows/sdl, brandy and more
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by Soruk »

Some better news, I've got networking working on the SharedCLibrary RISC OS build. I have therefore rebuilt my standalone Telstar/Viewdata/Teletext client on this as it's a third of the size of the SharedUnixLib build, and gives me a single application build that runs on anything from a RISC OS 3 Archimedes all the way to a Raspberry Pi.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by Soruk »

Very much an aside and an observation - Debian Bookworm has made the switch from upstream to Matrix Brandy. This should eventually filter down to Ubuntu and Raspian Raspberry OS.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
mike12f
Posts: 77
Joined: Wed Nov 03, 2021 9:40 am
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by mike12f »

That's great to hear. Do you have any more details?...
1. Is it replacing the old Brandy BASIC debian package (i.e. replacing it by matrix-brandy) or is it in addition to the old Brandy BASIC?
2. Do you know what the new package will be called / where we can find out?
Thanks.
Mike
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by Soruk »

It's replacing it entirely, and as of the build I installed a couple of weeks back, it's just 'brandy'. I found it by randomly googling "Matrix Brandy" and ignoring the alcohol-related results, then had a go at installing Bookworm in a VM.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
mike12f
Posts: 77
Joined: Wed Nov 03, 2021 9:40 am
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by mike12f »

I see there's some info on it here: https://packages.debian.org/bookworm/brandy

Also, I see that the latest long-term support version of ubuntu (version 22.04) is based on "bookworm", so Matrix Brandy should have hit ubuntu already.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by Soruk »

mike12f wrote: Sun Jun 19, 2022 4:54 pm I see there's some info on it here: https://packages.debian.org/bookworm/brandy

Also, I see that the latest long-term support version of ubuntu (version 22.04) is based on "bookworm", so Matrix Brandy should have hit ubuntu already.
Downloading the ISO now. According to https://packages.ubuntu.com/jammy/brandy it indeed looks like it has been picked up. Not sure how Debian tracks updates though, perhaps I need to email the package maintainer when I put out an update? (I'm a Red Hat / AlmaLinux / former CentOS man)
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
mike12f
Posts: 77
Joined: Wed Nov 03, 2021 9:40 am
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by mike12f »

Does it all work? The ubuntu link you sent seems to indicate it is the latest version of MatrixBrandy that they've packaged up, is that right?
User avatar
scruss
Posts: 653
Joined: Sun Jul 01, 2018 4:12 pm
Location: Toronto
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by scruss »

Yes, I just tried this on Ubuntu Jammy, and it's Matrix Brandy BASIC VI version 1.22.13 that runs.

Nice work!
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by Soruk »

mike12f wrote: Sun Jun 19, 2022 9:55 pm Does it all work? The ubuntu link you sent seems to indicate it is the latest version of MatrixBrandy that they've packaged up, is that right?
It did work, yes. But, it is the latest release version, not the latest available in git with fixes that I've added since 26th January.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
User avatar
scruss
Posts: 653
Joined: Sun Jul 01, 2018 4:12 pm
Location: Toronto
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by scruss »

True, but to see an Ubuntu package with source even from the current year is pretty amazing. The 26 January release can't be that bad, can it?

They don't seem to package tbrandy or sbrandy, only the graphical version
mike12f
Posts: 77
Joined: Wed Nov 03, 2021 9:40 am
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by mike12f »

What are tbrandy and sbrandy?
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by Soruk »

mike12f wrote: Wed Jun 22, 2022 8:55 am What are tbrandy and sbrandy?
These are the text-only console-mode builds. 'sbrandy' has a very limited VDU driver, but great for running as a scripting language, 'tbrandy' has a somewhat more feature-rich VDU driver, and can optionally emit Tektronix codes for graphics functions.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
mike12f
Posts: 77
Joined: Wed Nov 03, 2021 9:40 am
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by mike12f »

Hi Soruk, that sounds interesting.

I couldn't find tbrandy or sbrandy after running make. Should they have?

Also, I couldn't find any documentation on them. Is there any? Do these products need publicising a bit more?

Thanks!

Mike.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by Soruk »

To build all, do:

Code: Select all

make cleanall; make text; make clean; make
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Grasshopper
Posts: 99
Joined: Fri May 14, 2021 4:21 pm
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by Grasshopper »

This sounds like an interesting alternative to running a BBC MIcro emulator, if you only want to mess around in BBC BASIC.

Can someone tell me whether the graphical version of Brandy BASIC will run in a virtual terminal i.e. the terminals you access by pressing CTRL-ALT-F1, CTRL-ALT-F2, etc?

I'd rather avoid the overhead of X-Windows when running Brandy BASIC, and having the graphics output appear in a separate window on a GUI desktop would kill the illusion that I'm using a BBC Micro.

Also, I'm a bit confused about the tbrandy and sbrandy variants. Are they completely separate programs? Or does Brandy BASIC work like gvim i.e. there is a single executable that can run either on the desktop, or in a terminal, by setting different command line options (or renaming the executable)?
User avatar
scruss
Posts: 653
Joined: Sun Jul 01, 2018 4:12 pm
Location: Toronto
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by scruss »

No, Matrix Brandy requires X.

I don't run it to pretend to be a BBC Micro, I run it to write software. It won't look like a Beeb because it shells out to a separate editor, typically vi (or I use micro, because it is a text editor). The window you type immediate commands in in Matrix Brandy is a graphical window, but the editing is done in the calling terminal window.

tbrandy and sbrandy are separate executables, yes. They have different dependencies from Brandy
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by Soruk »

You can edit your programs in "immediate mode", but you don't have the BBC Micro cursor copying. Instead, you can do EDIT <line number> to edit a line like you would edit a line in a text editor.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Grasshopper
Posts: 99
Joined: Fri May 14, 2021 4:21 pm
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by Grasshopper »

I'm perfectly fine with editing programs using a regular editor like vi.

But it's a shame that graphics can't be displayed directly on the framebuffer without needing X-Windows. I though that was possible with SDL1.2, but I could be wrong.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by Soruk »

It can be, but your user needs write permissions to the framebuffer or SDL will fail to initialise.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
mike12f
Posts: 77
Joined: Wed Nov 03, 2021 9:40 am
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by mike12f »

Soruk,
I tried sbrandy and tbrandy - thanks they worked.

1. Is there any documentation for them?
2. What's the difference?

3. Why not bundle tbrandy into the brandy executable but it runs with a command-line argument flag instead e.g. "./brandy --tbrandy". Then tbrandy would be automatically get bundled into the next release of the brandy package on Debian.

4. Also, unrelatedly, if I install brandy using "apt get", will I be able to run a text-file BBC basic program from linux by double-clicking on it if I put a header comment at the top of the file, e.g. something like "#!/bin/bash", but adapted for brandy?

Sorry to pile the questions onto you today!
User avatar
scruss
Posts: 653
Joined: Sun Jul 01, 2018 4:12 pm
Location: Toronto
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by scruss »

mike12f wrote: Sat Jul 02, 2022 7:08 pm 4. Also, unrelatedly, if I install brandy using "apt get", will I be able to run a text-file BBC basic program from linux by double-clicking on it if I put a header comment at the top of the file, e.g. something like "#!/bin/bash", but adapted for brandy?
That works from the command line with something like #!/usr/bin/env brandy. I've had it do something messy with the terminal settings sometimes if the window immediately opens and closes, so I had to type reset to get the terminal window usable again.

Many Linux desktops have made it hard to double click an executable script without having an associated .desktop file. I call it annoying, they call it security
mike12f
Posts: 77
Joined: Wed Nov 03, 2021 9:40 am
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by mike12f »

scruss wrote: Sun Jul 03, 2022 1:40 pm That works from the command line with something like #!/usr/bin/env brandy. I've had it do something messy with the terminal settings sometimes if the window immediately opens and closes, so I had to type reset to get the terminal window usable again.

Many Linux desktops have made it hard to double click an executable script without having an associated .desktop file. I call it annoying, they call it security
Thanks! That worked. The "security" problem wasn't an issue for me after I did the chmod +x on the file.

As I haven't got a proper install of brandy in my system, I just copied a symbolic-link file to my brandy executable into my ~/bin folder, and now the #!/usr/bin/env brandy header works well.
Grasshopper
Posts: 99
Joined: Fri May 14, 2021 4:21 pm
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by Grasshopper »

Soruk wrote: Mon Jun 27, 2022 12:53 pm It can be, but your user needs write permissions to the framebuffer or SDL will fail to initialise.
Interesting. So it will work, at least in theory.

Can you tell me how to obtain the necessary write permissions? I'm presuming that running as root would work, but for obvious reasons, that's not a good long term solution.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by Soruk »

Grasshopper wrote: Mon Jul 04, 2022 11:21 am
Soruk wrote: Mon Jun 27, 2022 12:53 pm It can be, but your user needs write permissions to the framebuffer or SDL will fail to initialise.
Interesting. So it will work, at least in theory.

Can you tell me how to obtain the necessary write permissions? I'm presuming that running as root would work, but for obvious reasons, that's not a good long term solution.
Running as root will work, but as you said, it's not exactly ideal. Otherwise, it's rather distro-dependent. On a Raspberry Pi, the 'pi' user is likely to work, though I haven't tested that in a while, it did work on a several-years-old installation.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
User avatar
scruss
Posts: 653
Joined: Sun Jul 01, 2018 4:12 pm
Location: Toronto
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by scruss »

It all depends on whether the user is a member of the video group, because that's who owns the framebuffer device:

Code: Select all

ls -la /dev/fb*
crw-rw---- 1 root video 29,   0 Jun 10 17:57 /dev/fb0
On Raspberry Pi OS with the default user*:

Code: Select all

sudo usermod -G video pi
Notes:
  1. you have to log out and back in again for the effects of usermod to be seen. Check with the groups command
  2. As of about three weeks ago, there is no longer a default 'pi' user on new installations of Raspberry Pi OS
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by Soruk »

Earlier today I've checked in an important bug fix / workaround for the sdl12-compat library. Some distros (notably RHEL 9 and its derivatives) ship with this instead of the real SDL-1.2.15 library. sdl12-compat is a binary and source compatibility library that an SDL 1.2 app can link against, but under the lid it's using SDL 2.
I spotted an issue with that when tinkering with AlmaLinux 9 where the keysym.unicode value isn't correctly populated when the CTRL key is used. I have raised an issue on their github, but in the meantime I've added a workaround as this situation is detectable (keysym.unicode is zero), to use the keysym.sym value to work out what should be returned and use that instead. If it's supposed to be zero for a particular key sequence, the workaround can return this and all is good. Once it's fixed in the library and it's trickled down to the distros, I'll remove the workaround.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by Soruk »

Having realised (after HOW long?!) that I can run the Raspberry Pi OS 64-bit version on a 3B (I don't have an RPi4), and from a thread over at the Distillery, I set about getting Matrix Brandy to build on it. It worked out of the box, only needing a small tweak to label the CPU as ARM-64bit instead of "Unknown".
Additionally, from that Distillery thread I discovered that, on ARM32 (and ARM26) setting a%%=2^63 gave me a negative number! Clearly incorrect, so added some checks that if the sign bit flipped unexpectedly, it's to be handled as a number out of range. (It was correctly handled on x86 and x86-64 by itself. Something different about the ARM.)
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
User avatar
dhr2
Posts: 173
Joined: Tue Oct 25, 2016 8:37 pm
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by dhr2 »

-
Last edited by dhr2 on Sat Nov 05, 2022 5:50 pm, edited 2 times in total.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by Soruk »

dhr2 wrote: Thu Aug 18, 2022 9:06 pm Hello,
I've been dabbling in BBC BASIC programming again lately, writing code tweets to send to the BBCMicroBot on twitter (here's one of them https://twitter.com/bbcmicrobot/status/ ... 6398552064 )

I just built the latest version of Matrix Brandy from github and ran into a bug:

Code: Select all

PRINT 0.5 AND 1
This is giving a "number out of range" error.
Specifically it seems to cause this error for any kind of bitwise operator given any value > 0.0 and < 1.0 (or any value > -1.0 and < 0.0)
The previous versions of brandy that I have been using (which are a few years old by now) didn't behave this way, it definitely seems to be new, so I thought I'd let you know.
Oops. This came in due to an issue on ARM platforms where large numbers might get its sign flipped unexpectedly, so catch and issue an out of range error. Bascically, if the sign of the float and the sign of the int64 cast differed, then complain.

But I forgot to take into account zero. So, now, don't raise an error if the sign of the int64 cast is zero.

This fix is checked into git so please pull the change and rebuild.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
User avatar
dhr2
Posts: 173
Joined: Tue Oct 25, 2016 8:37 pm
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by dhr2 »

-
Last edited by dhr2 on Sat Nov 05, 2022 5:49 pm, edited 1 time in total.
Post Reply

Return to “modern implementations of classic programming languages”