BBC BASIC
« BBC BASIC for Linux (86) v0.07a »

Welcome Guest. Please Login or Register.
Apr 28th, 2017, 9:39pm


Cross-platform BBC BASIC (Win32, Linux x86, Android, Mac OS-X, Raspberry Pi)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: BBC BASIC for Linux (86) v0.07a  (Read 650 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 437
xx BBC BASIC for Linux (86) v0.07a
« Thread started on: Jan 7th, 2016, 11:03pm »

Should anybody be interested, BBC BASIC for Linux (86) version 0.07a is now available for download from the usual place. This contains the changes that were necessary to make it work under Android (86), most importantly switching OpenGL from single-buffering (which seems not to be supported in Android/SDL) to double-buffering.

This change had a number of significant consequences, not least revealing a very nasty bug in SDL 2.0.3 (which, on investigation, proved to be a known issue). I've had to incorporate a very ugly workaround for this bug, which will break if and when the bug is fixed (it would appear not to have been fixed in SDL 2.0.4).

Version 0.07a has not been extensively tested in Linux so apologies in advance if something which used to work no longer does. Please let me know if that is the case.

Richard.
User IP Logged

jbk
New Member
Image


member is offline

Avatar




PM


Posts: 10
xx Re: BBC BASIC for Linux (86) v0.07a
« Reply #1 on: Jan 8th, 2016, 1:49pm »

thank you Richard
User IP Logged

RajivTyagi
New Member
Image


member is offline

Avatar




PM


Posts: 2
xx Re: BBC BASIC for Linux (86) v0.07a
« Reply #2 on: Sep 16th, 2016, 10:13am »

I use Ubuntu Linux 16.04. But after trying out many solutions, I selected BBC4WDEMO and used it with Wine to create a graphical application consisting of a radar screen that takes serial input from a COM port and some parallel connectivity with a radar simulator.

Then I discovered BBCSDL for Linux, thinking a native Linux app would run faster. To my horror, BBCSDL for Linux, apart from no longer supporting the serial port in either the Win format (COMx) or the Linux format (/dev/ttyS0), does not support the Inpout32 library as well.

The graphics commands have changed as well, while there isn't any documentation for the SDL library as implemented in the version. After finally getting the interpreter to work, I found my program running about half as fast as the bbc4wdemo.

Is there a place where I can work out how to use the serial and parallel ports? And the SDL graphics commands?

Sincerely,
Rajiv

on Jan 7th, 2016, 11:03pm, Richard Russell wrote:
Should anybody be interested, BBC BASIC for Linux (86) version 0.07a is now available for download from the usual place. This contains the changes that were necessary to make it work under Android (86), most importantly switching OpenGL from single-buffering (which seems not to be supported in Android/SDL) to double-buffering.

This change had a number of significant consequences, not least revealing a very nasty bug in SDL 2.0.3 (which, on investigation, proved to be a known issue). I've had to incorporate a very ugly workaround for this bug, which will break if and when the bug is fixed (it would appear not to have been fixed in SDL 2.0.4).

Version 0.07a has not been extensively tested in Linux so apologies in advance if something which used to work no longer does. Please let me know if that is the case.

Richard.
smiley
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 437
xx Re: BBC BASIC for Linux (86) v0.07a
« Reply #3 on: Sep 16th, 2016, 11:29am »

on Sep 16th, 2016, 10:13am, RajivTyagi wrote:
To my horror, BBCSDL for Linux, apart from no longer supporting the serial port in either the Win format (COMx) or the Linux format (/dev/ttyS0), does not support the Inpout32 library as well.

I don't think that's entirely fair, because you are comparing a mature product (BBC BASIC for Windows) with a work-in-progress development (BBCSDL) which is barely at an 'alpha' release stage and isn't mentioned anywhere on my website!

Having said that, even a fully-developed SDL 2.0-based version of BBC BASIC isn't going to be able to support access to serial ports in a cross-platform way, because SDL 2.0 itself doesn't provide such support. Nevertheless there should be no reason why you cannot open a serial port using the Linux-style /dev specification, albeit that you would have to set parameters such as baud rate in your own code.

And of course there's no way a Windows DLL like inpout32 could ever run in native Linux; the same applies to any BBC BASIC library which is dependent for its operation on a Windows DLL.

Quote:
The graphics commands have changed as well

Not really. The graphics commands in BBCSDL, as in BB4W, are as close a match to the original BBC Microcomputer and Acorn Archimedes commands as it is practical to make them. You will find that the graphics example programs supplied with BBCSDL are either identical, or nearly so, to the equivalent examples supplied with BB4W.

If there is a specific difference you have noticed please tell us the particular statement you are using and what the difference is.

Quote:
while there isn't any documentation for the SDL library as implemented in the version.

I have asked here before, at least twice, for help in creating documentation, libraries and utilities for BBCSDL. I do not have the time, inclination or ability to do everything myself, and BBCSDL is totally dependent on volunteer effort to progress from its current state.

Quote:
I found my program running about half as fast as the bbc4wdemo.

The BBC BASIC interpreter itself, of course, is basically the identical code in BB4W and BBCSDL so will run at virtually the same speed (any differences being due to subtleties like code alignment). However Operating System features like file handling and graphics are inevitably quite different: in one case using Wine as the interface layer between my code and Linux, and in the other case SDL.

As I have demonstrated previously, BBCSDL can run significantly faster than BB4W, for example the FERN graphics demo typically runs about twice as fast. But the relative speed will depend very much on the detail of what your program happens to do.

Richard.
« Last Edit: Sep 16th, 2016, 11:54am by Richard Russell » User IP Logged

RajivTyagi
New Member
Image


member is offline

Avatar




PM


Posts: 2
xx Re: BBC BASIC for Linux (86) v0.07a
« Reply #4 on: Sep 16th, 2016, 12:54pm »

Thank you very much for the prompt and detailed response, Richard. It's after office hours here in India. But I will send you my code tomorrow. Running it in BBCSDL will show the various errors that result. The code is very much work in progress so you will find the display a little awry on account of logical errors, but the code runs without syntax errors in BBC4WDEMO.

Successively commenting out lines reported with errors by BBCSDL, removes functionality but finally begins running the code...

Sincerely,
RT
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 437
xx Re: BBC BASIC for Linux (86) v0.07a
« Reply #5 on: Sep 16th, 2016, 3:05pm »

on Sep 16th, 2016, 12:54pm, RajivTyagi wrote:
Running it in BBCSDL will show the various errors that result.

Just to reiterate that BB4W and BBCSDL share the same BBC BASIC interpreter so as far as 'pure BASIC' code is concerned the compatibility is 100%. Of course once one moves outside the realm of BASIC into OS-dependent features then they aren't, and can never be, fully compatible.

It's best not to think of BBCSDL to be in some way a development of BB4W, it isn't. They are both implementations of the BBC BASIC language but for completely different platforms: MS Windows in one case and SDL 2.0 in the other. Writing programs that will run on both is possible (the three 'IDEs': touchide.bbc, BBCEdit.bbc and SDLIDE.bbc are examples) but requires a very different approach from writing programs for BB4W.

So whilst I'm happy to see your program I'm not able to provide a 'conversion service', if that was your hope.

Richard.
User IP Logged

PatrickM
New Member
Image


member is offline

Avatar




PM


Posts: 3
xx Re: BBC BASIC for Linux (86) v0.07a
« Reply #6 on: Apr 5th, 2017, 9:26pm »

Hi,

BBC Basic is my favorite language to work in, I do most of my programming in it. Until now I've only used the Brandy basic interpreter. Tonight I've been trying out BBCSDL, and it's good.
Though I'm having a couple of problems with it:

* SDLIDE doesn't work, it seems to crash with error "No such font".
* It seems like I can't open files with OPENIN unless the file's name ends in .bbc.

I'm using Debian GNU/Linux 8, AMD64 version.

-PM
« Last Edit: Apr 5th, 2017, 9:26pm by PatrickM » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 437
xx Re: BBC BASIC for Linux (86) v0.07a
« Reply #7 on: Apr 6th, 2017, 10:15am »

on Apr 5th, 2017, 9:26pm, PatrickM wrote:
SDLIDE doesn't work, it seems to crash with error "No such font".

Can I assume that you are running the latest version of BBCSDL (v0.16)? The subject line refers to v0.07a, which is very old, but that may simply be because you are replying to an old thread.

One possible reason for a 'No such font' error is a corrupted or invalid 'sdlide.ini' file (in your @usr$ directory). Try deleting that file first.

Failing that you can always debug the issue yourself (SDLIDE.bbc is an ordinary BASIC program). If you find something that I need to fix let me know.

Quote:
It seems like I can't open files with OPENIN unless the file's name ends in .bbc.

That's no different from BB4W and all the other versions of BBC BASIC from my 'stable' for the last 35 years! The extension defaults to '.bbc' but you can of course specify any other extension, or none by adding a trailing dot to the filename:

Code:
      file% = OPENIN(@dir$ + "noextension.") 

Richard.
User IP Logged

rpc
New Member
Image


member is offline

Avatar




PM


Posts: 1
xx Re: BBC BASIC for Linux (86) v0.07a
« Reply #8 on: Apr 7th, 2017, 12:35pm »

I can confirm that the "No such font" error is caused if you first run the application from one location and then move it to another. The solution is to delete the sdlide.ini. At least in Ubuntu 16.04 this is in .local/Share/BBCBasic.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 437
xx Re: BBC BASIC for Linux (86) v0.07a
« Reply #9 on: Apr 7th, 2017, 12:53pm »

on Apr 7th, 2017, 12:35pm, rpc wrote:
I can confirm that the "No such font" error is caused if you first run the application from one location and then move it to another.

Yes, exactly the same thing happens in Mac OS; it's because the absolute path to the font's TTF is stored in the ini file, which of course ceases to be valid if you move the application.

Some while ago I looked into what would be involved in working around this issue but I judged the complication to be out of proportion to the benefit, considering that deleting the sdlide.ini file is such a straightforward fix. Discovering its location is simply a matter of typing 'PRINT @usr$' in immediate mode.

Richard.
User IP Logged

PatrickM
New Member
Image


member is offline

Avatar




PM


Posts: 3
xx Re: BBC BASIC for Linux (86) v0.07a
« Reply #10 on: Apr 7th, 2017, 8:28pm »

Thanks, deleting sdlide.ini fixed the problem.

Quote:
That's no different from BB4W and all the other versions of BBC BASIC from my 'stable' for the last 35 years!


Right, I see, I didn't know that. I actually haven't used BB4W, up until now I've only used BASIC on the BBC Micro and in RISC OS, and the Brandy interpreter on linux, which behave differently in this regard. Thanks for letting me know.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 437
xx Re: BBC BASIC for Linux (86) v0.07a
« Reply #11 on: Apr 7th, 2017, 9:18pm »

on Apr 7th, 2017, 8:28pm, PatrickM wrote:
I've only used BASIC on the BBC Micro and in RISC OS, and the Brandy interpreter on linux, which behave differently in this regard.

It is usual in CP/M, MS-DOS and Windows for a 'default' extension to be assumed if none is explicitly supplied; the idea being that the application knows what file type is most appropriate for the particular operation. So if the filename you provide contains no 'dot' that default extension will be appended. In the special case of a file with no extension (which is rare in those Operating Systems, but less so in Unix) that is indicated by adding a trailing dot.

Admittedly I have on many occasions questioned whether defaulting to .bbc was sensible for OPENIN, OPENOUT and OPENUP, since that extension is supposed to indicate a tokenised program file. The conclusion I invariably come to is that it wasn't - probably something like .dat would have been a better choice - but that making a change now would break far too many existing programs.

You may well encounter more differences that have resulted from the divergence between the 'Wilson' and 'Russell' branches of BBC BASIC (a divergence which started very early on, for example in that 'suffixless' variables are numeric variants not floats). I hope you won't find the transition too traumatic!

Richard.

User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Donate $6.99 for 50,000 Ad-Free Pageviews!


This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls