New: in-browser BBC BASIC for SDL 2.0

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

Re: New: in-browser BBC BASIC for SDL 2.0

Post by Deleted User 9295 »

BigEd wrote: Sat Sep 26, 2020 5:57 pm I think that's a bit obscure.
But you don't say why! You ask for the default file listing (*.) and it lists the files with the extension that is associated with the app (.bbc). You ask it to list all the files that don't have an extension (*..), and it lists the subdirectories. You change directory to the parent directory and ask it to list all the .bbc files there; there are none. You ask it to list all the files with no extension, it lists the subdirectories. Finally you issue a non-existent command.

As far as I can see everything works logically and as it should. Somewhat significantly (I would say) it behaves exactly the same as all my versions of BBC BASIC have for something like 30 years, and I don't think anybody else in all that time has ever previously suggested that it's "obscure". :)
Maybe that's just an opinion, but I offer it in good faith as feedback.
You are fully entitled to your opinion. But if you think I'm going to consider changing something that has worked the same way for 30 years you are an optimist! Since it's a command that can be (and often is) issued from a program with the output being spooled to a file and later parsed, it's not an option anyway. But it's open source, you can legitimately fork the project and edit the code to work the way you want. :wink:
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: New: in-browser BBC BASIC for SDL 2.0

Post by BigEd »

Well, indeed, if it's always worked that way, then fair enough! I was expecting something more similar to Acorn's MOS.

(I'd still say that listing directories, as well as files with a given extension, would be better, for me.)
Deleted User 9295

Re: New: in-browser BBC BASIC for SDL 2.0

Post by Deleted User 9295 »

BigEd wrote: Sat Sep 26, 2020 7:21 pm I was expecting something more similar to Acorn's MOS.
Why? To the extent that my BASICs emulate any filing-system commands they emulate those of CP/M and MS-DOS, not anything from the Acorn stable (hence the command to list the directory being *DIR and not *CAT). That shouldn't be surprising given that Acorn were probably the first 'home computer' manufacturer to make a clear distinction between the 'language' and the 'OS', and it's only the language (BBC BASIC) that I have implemented.

It's because my products have nothing at all to do with Acorn that they are strictly speaking off-topic for this forum. It's only through the kindness of the admin that I can post here at all, so I apologise for causing so much irritation. I will take a break from the forum for a while to let things calm down.
(I'd still say that listing directories, as well as files with a given extension, would be better, for me.)
My listing doesn't distinguish between a file and a directory; so if you create a directory with a name ending in .bbc it will be listed along with files with that extension, and files with no extension will be listed along with (conventionally named) directories. This stems from the CP/M days when there was no such thing as directories.
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: New: in-browser BBC BASIC for SDL 2.0

Post by BigEd »

Oh no, don't worry at all about being off-topic or irritating - I'm not irritated and I shouldn't think anyone else is. I'm only voicing my perspective, as someone who came into active computing through Acorn land and only much later and more superficially have touched DOS and CP/M. When I see * commands I just default to certain expectations. I can readily enough learn other languages.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: New: in-browser BBC BASIC for SDL 2.0

Post by Soruk »

Richard Russell wrote: Sat Sep 26, 2020 8:03 pm It's because my products have nothing at all to do with Acorn that they are strictly speaking off-topic for this forum. It's only through the kindness of the admin that I can post here at all, so I apologise for causing so much irritation. I will take a break from the forum for a while to let things calm down.
Richard, I must disagree with you here. This section "Modern implementations of classic programming languages" precisely describes BB4W, BBCSDL, BB4C, BB4WWW(?!) and of course Matrix Brandy. I would also disagree that your products have nothing at all to do with Acorn, at least in my opinion it's the popularity and power of BBC BASIC as found on Acorn kit that has brought some (I won't say all) users to your implementations of BBC BASIC (and dare I say it, even a few to my fork of Dave Daniels' implementation).

And, what irritation? Certainly a small element of surprise where the functionality was different to what was expected for someone coming from the Acorn world, but I saw no irritation. Though, I would say he does have a point in one respect. Picking up on your earlier example that for example Notepad only shows *.txt files, it also shows any directories present regardless of extension. You may disagree with me (as is your right) but I would have thought that behaviour to be useful, instead of only showing directories if you tell it to list files without extension. But the last word is that it is your implementation, and you should implement it as you feel is the correct way (as I have with Matrix Brandy, even when we have sometimes disagreed on the approach!)
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
FourthStone
Posts: 1527
Joined: Thu Nov 17, 2016 2:29 am
Location: Brisbane, Australia
Contact:

Re: New: in-browser BBC BASIC for SDL 2.0

Post by FourthStone »

Was playing around with this today to see if I could get TelePaint to work, and it does! Some functions are quite slow but most things work as expected. The load dialog seems to crash the program so would need to work out why that is.

Well done on another absolutely amazing implementation of BBC Basic =D>

https://wasm.bbcbasic.co.uk/bbcsdl.html ... BBCSDL.bbc
Last edited by FourthStone on Sun Dec 06, 2020 8:13 pm, edited 1 time in total.
User avatar
pixelblip
Posts: 4050
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: New: in-browser BBC BASIC for SDL 2.0

Post by pixelblip »

it would be very useful if anyone can help here! ...this art package could be a boon for teletext artists as there is nothing around as good as this ....working a web browser is nice and quick...
From what I can see most of it is working apart from saving....

Alternatively Fourthstone maybe there is a a way of outputting the pictures as TT to a site....or opening an HMTL page...
Deleted User 9295

Re: New: in-browser BBC BASIC for SDL 2.0

Post by Deleted User 9295 »

pixelblip wrote: Fri Dec 04, 2020 8:00 pm it would be very useful if anyone can help here!
Only just found this question by chance. Slightly surprised you didn't ask me.....

The explanation for the crash is that, for some reason I cannot fathom, the program doesn't use the sortlib library but instead has a replacement for that library (FN_sortinit) embedded in the program. But libraries are typically platform-dependent (that's one reason for libraries existing) and the code which has been embedded is for x86/ARM CPUs and is completely incompatible with Emscripten/WebAssembly.

Had the supplied sortlib library program been used it would have worked fine, why wasn't it?
User avatar
pixelblip
Posts: 4050
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: New: in-browser BBC BASIC for SDL 2.0

Post by pixelblip »

Thanks for your reply Richard and for looking at the code.
I imagine it is because Forthstone tried to implement a file sorter....let us see what he has to say. I did ask him if this could be done.....

I would have pmd you but I thought lets ask out loud incase anyone has an issue in future like this.

What a shame your talk isnt going ahead this Saturday. Hopegully you can do it again soon.
Last edited by pixelblip on Sat Dec 05, 2020 9:50 am, edited 2 times in total.
User avatar
FourthStone
Posts: 1527
Joined: Thu Nov 17, 2016 2:29 am
Location: Brisbane, Australia
Contact:

Re: New: in-browser BBC BASIC for SDL 2.0

Post by FourthStone »

Richard Russell wrote: Fri Dec 04, 2020 10:19 pm The explanation for the crash is that, for some reason I cannot fathom, the program doesn't use the sortlib library but instead has a replacement for that library (FN_sortinit) embedded in the program. But libraries are typically platform-dependent (that's one reason for libraries existing) and the code which has been embedded is for x86/ARM CPUs and is completely incompatible with Emscripten/WebAssembly.

Had the supplied sortlib library program been used it would have worked fine, why wasn't it?
Thanks for the tip, I originally tried to get the sortlib and filedlg libs working but for some reason they didn't work on the iPad due to a path issue, I think we have previously discussed it but I could never get it properly working. So that's when I decided to import the libraries into the main program, obviously this introduced the more recent issue.

What we really want is a custom sort routine for sorting the most recent files at the top of the list as this is generally what pixelblip is looking for. I did notice a sort demo included in the examples folder and I was going to at some stage look at adapting that for our file list sort and removing the need to use the sort lib.

If you have a better solution or any idea's why when using the sort libraries it wasn't working on the iPad it would be most helpful.

If I imported the latest sortlib into Telepaint would that resolve the issue for now?

Many thanks O:)

EDIT: The Telepaint files are date and time stamped in chronological format so sorting by most recent should be fairly straight forward, I just haven't had the time to rewrite the file dialog routine to support it.

EDIT2: I added sortlib and now I get the same error as on the iPad, Path not found
https://www.bbcbasic.co.uk/bbcsdl/wasm/ ... BBCSDL.bbc
I think there is something I'm not doing right when installing libraries, it does work on a Windows PC though so perhaps the syntax is different on iPad and WASM?
Last edited by FourthStone on Sun Dec 06, 2020 8:13 pm, edited 1 time in total.
Deleted User 9295

Re: New: in-browser BBC BASIC for SDL 2.0

Post by Deleted User 9295 »

FourthStone wrote: Sat Dec 05, 2020 8:00 am If I imported the latest sortlib into Telepaint would that resolve the issue for now?
Please don't do that! It is entirely contrary to how libraries are supposed to be used. Not only is there the issue that by doing so you make a program platform-specific (for example although it might then work in BBCSDL and WebAssembly, it wouldn't work in BB4W) but also you 'freeze' the library and future bugfixes won't be automatically incorporated.
If you have a better solution or any idea's why when using the sort libraries it wasn't working on the iPad it would be most helpful.
There's no problem with the library path on the iPad that I am aware of. If there was, a large number of the supplied example programs would not work! I don't believe that you have ever reported a problem to me previously (I do not monitor the Telepaint thread, so if it's been mentioned there I would have no reason to know).
EDIT2: I added sortlib and now I get the same error as on the iPad, Path not found
It would have been helpful to list the relevant code, or to have linked to a copy that I could download! But in the absence of that I did this:

telepaint_bug.png
The error there is very obvious: SORTLIB not sortlib (iOS path names are of course case-sensitive). :roll:
User avatar
FourthStone
Posts: 1527
Joined: Thu Nov 17, 2016 2:29 am
Location: Brisbane, Australia
Contact:

Re: New: in-browser BBC BASIC for SDL 2.0

Post by FourthStone »

A simple case of er... case then, yes thank you that appears to now work with the 'sortlib' library and the load dialog shows correctly now.

I must admit I often find myself tripping over the case trap and so I tend to use BBCSDL with caps lock on most of the time [-X

I really like the 'LIST IF' command, that is quite a neat feature.
Deleted User 9295

Re: New: in-browser BBC BASIC for SDL 2.0

Post by Deleted User 9295 »

FourthStone wrote: Sat Dec 05, 2020 7:47 pm I really like the 'LIST IF' command, that is quite a neat feature.
It's a BASIC 4 feature, so quite ancient in BBC BASIC terms.
User avatar
pixelblip
Posts: 4050
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: New: in-browser BBC BASIC for SDL 2.0

Post by pixelblip »

Thank you for your help here Richard :)
Mike
Deleted User 9295

Re: New: in-browser BBC BASIC for SDL 2.0

Post by Deleted User 9295 »

I've noticed today that Firefox Nightly for Android now seems to support WebAssembly Threads and will run BBC BASIC for SDL 2.0. So it provides an alternative to Chrome for those who want to run BBCSDL in-browser on an Android device. The mainstream Firefox still doesn't, but hopefully features that are in Nightly now will appear in that version in due course.

Sadly neither Chrome nor Firefox will run BBCSDL in iOS; like all other browsers on that platform they are actually Safari (i.e. WebKit) under the hood, because Apple does not permit any true competition when it comes to browsers. How that is allowed by the authorities beats me.
Deleted User 9295

Re: New: in-browser BBC BASIC for SDL 2.0

Post by Deleted User 9295 »

As a 'parting shot' before finally leaving this forum I thought I would take the opportunity to post a reminder of how to run a BBC BASIC for SDL 2.0 program 'online' in a browser. This isn't new, but few people seem to be taking advantage of it.

If the program is self-contained (i.e. a single .bbc file) store it somewhere online (Dropbox is suitable) and run it as follows:

https://wasm.bbcbasic.co.uk/bbcsdl.html?chain=<url-of-your-bbc-file>

Here's an example:

https://wasm.bbcbasic.co.uk/bbcsdl.html?chain=http://www.rtr.myzen.co.uk/wobbly.bbc

If your program requires additional resource files, such as images and sounds, you will have to load those as well. If there are only a few, you can load them individually in the URL:

https://wasm.bbcbasic.co.uk/bbcsdl.html?load=<url-to-resource>&load=<url-to-resource>&chain=<url-to-program>

If the resource files and BBC program are in the same folder you don't need to repeat the full URL each time, just specify the filename for the second and subsequent files, for example:

https://wasm.bbcbasic.co.uk/bbcsdl.html?load=http://www.rtr.myzen.co.uk/clouds.png&chain=voronoi.bbc

If there are several resource files, or they are in sub-directories, it is probably preferable to write a loader program to fetch them and store them as required, for example:

https://wasm.bbcbasic.co.uk/bbcsdl.html?load=http://www.rtr.myzen.co.uk/xd2_resources.dat&load=xd2.bbc&chain=xd2_loader.bbc

Finally if the program is short enough you can embed it in its entirety within the URL:

https://wasm.bbcbasic.co.uk/bbcsdl.html?embed=<base64url-encoded-program>

Here's the full set of URL parameters currently supported:
  • ?chain=<remote file URL>
  • ?load=<remote file URL>
  • ?run=<local filename>
  • ?dir=<local directory>
  • ?embed=<base64url-encoded program>
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: New: in-browser BBC BASIC for SDL 2.0

Post by BigEd »

Thanks for the instructions!
Post Reply

Return to “modern implementations of classic programming languages”