BBC BASIC
« BBC BASIC for SDL 2.0 v0.16a released »

Welcome Guest. Please Login or Register.
Jun 24th, 2017, 08:51am


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

« Previous Topic | Next Topic »
Pages: 1 2  Notify Send Topic Print
 hotthread  Author  Topic: BBC BASIC for SDL 2.0 v0.16a released  (Read 923 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 470
xx BBC BASIC for SDL 2.0 v0.16a released
« Thread started on: Feb 1st, 2017, 08:52am »

I'm pleased to announce a new release of BBCSDL, the cross-platform edition of BBC BASIC for Windows, Linux (x86), Mac OS-X and Android. Version 0.16a may be downloaded as follows:
The main changes in this version are as follows:

SDL 2.0:
  • The Android edition has been rebuilt using the latest version of SDL: 2.0.5. It should install and run on any modern Android device, whether using an Intel (x86) CPU or an ARM CPU, although please note that ARM does not support 80-bit extended-precision floats.
Interpreter:
  • As discussed in the 'bug alert' thread, a test has been added to detect the unstable state that can arise if a user-defined function, passed as an 'actual' parameter to a FN/PROC, modifies a string variable used as a 'formal' paramater of that same FN/PROC. In that event the 'Incorrect arguments' error (code 31) is raised.

  • Also as discussed elsewhere, two issues related to addresses being 'unsigned', when they should be 'signed' (a structure in the first case and the address-of operator in the second), have been fixed.
OS/VDU emulation:
  • Support for 256-colour palettes has been improved.

  • The SOUND pitch accuracy, especially the lower notes, has been improved.

  • Added a workaround for an SDL bug affecting PLOT codes 8-15 ('omit last point' or more correctly 'plot last point twice'). However they still do not work exactly as they should on Linux.sad
IDEs:
  • The 'Touch IDE' used by the Android edition of BBCSDL now supports changing the size of the font using a 'pinch' zoom gesture. The new size is remembered and will be used in future sessions.

  • SDLIDE now incorporates a 'File... Compare' menu selection to list the differences between a program and an earlier version (very similar to the BB4W 'Differences' add-in utility).

  • BBCEdit has been updated to version 0.31.0.
Example Programs:
  • New in the 'games' directory: 2048.bbc, dibley.bbc and triples.bbc

  • New in the 'general' directory: optics.bbc, polyfit.bbc and solve.bbc

  • New in the 'graphics' directory: bounce.bbc, scarab.bbc, snowscene.bbc and squares.bbc

  • The DLGDEMO and OPENGL example programs are now also included with the Android edition of BBCSDL.
Libraries:
  • The DLGLIB library has been adapted to allow buttons and other controls to be used on the 'main window' rather than in a dialogue box (although this is rather a kludge). This library is now also included with the Android edition of BBCSDL.

  • The SORTLIB library has been adapted to be suitable for both x86 and ARM-based systems.
I still need volunteers to contribute to the documentation, help viewer, addin utilities and libraries.

Richard.
User IP Logged

michael
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 52
xx Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #1 on: Feb 2nd, 2017, 01:32am »


Quote:
SDL 2.0:
The Android edition has been rebuilt using the latest version of SDL: 2.0.5. It should install and run on any modern Android device, whether using an Intel (x86) CPU or an ARM CPU, although please note that ARM does not support 80-bit extended-precision floats.


AWESOME!! I have been waiting for years to get a proper IDE for my Samsung Galaxy Tablet..

I will get on this right away
User IP Logged

I like reinventing the wheel, but for now I will work on tools for D3D
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 470
xx Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #2 on: Feb 4th, 2017, 09:17am »

I've updated the Android edition to address a couple of issues as follows:
  • Support for very high resolution displays is improved. Previously, any display with more than 2048 pixels in the longer dimension gave rise to an unwanted 'scaling' error in graphics coordinates.

  • A fault which could, in rare circumstances, result in an 'Unfortunately BBC Basic has stopped' message has been fixed.
If you are not affected by either of these issues there is no benefit in upgrading. But if you are, or you think you might be, the new version (0.16c) is in the usual place:

http://www.rtr.myzen.co.uk/BBCBasic.apk

Android should recognise this as an upgrade and your personal files should not be affected.

Richard.
User IP Logged

mavison
New Member
Image


member is offline

Avatar




PM


Posts: 27
xx Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #3 on: Feb 5th, 2017, 2:16pm »

I was alerted to the new SDL version of Basic by your post about the Andriod version on the RISC OS Open website.

I have used BBC Basic for Windows in a small way for some years now - is code written for that compatible with the new SDL version for Windows? If not, is there any documentation of the differences?

Will code that runs on the Windows SDL version also run on the MacOS SDL version? Assuming of course that no Windows SYS calls are used!

I am considering moving some programs that currently run under Basic in RISC OS to Windows SDL Basic for development, but they will be used on MacOS! They only read & write sequential files, and display messages - nothing fancy!
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 470
xx Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #4 on: Feb 5th, 2017, 5:51pm »

on Feb 5th, 2017, 2:16pm, mavison wrote:
Is code written for that compatible with the new SDL version for Windows? If not, is there any documentation of the differences?

With very few exceptions, code written for BBC BASIC for Windows will run unmodified in BBCSDL so long as it doesn't call any Windows API functions and doesn't rely on any libraries that are not supplied with BBCSDL.

One exception is the *FONT command, which if used will need to be modified to select one of the fonts supplied with BBCSDL (or one which you provide yourself) and to specify the full path to its .ttf file. Look at the example programs supplied with BBCSDL for guidance.

Obviously if the code does call Windows API functions then it will require some conversion. Unfortunately it's impossible to give general guidance on this: APIs range from ones that have trivial equivalents at one extreme to being almost impossible to emulate at the other.

Quote:
Will code that runs on the Windows SDL version also run on the MacOS SDL version? Assuming of course that no Windows SYS calls are used!

Generally yes, the degree of compatibility is very good. However you can get caught out by 'sillies', like using backslashes rather than forward-slashes in path names (Windows is happy with forward-slashes, but Mac OS isn't happy with backslashes).

Compatibility with the Linux and Android versions is very good too, but with them you have to be careful about case-sensitivity in file and path names. And of course if you want your program to run on an ARM-based Android device you must avoid assembly language code (or provide both x86 and ARM code, which is possible).

Quote:
I am considering moving some programs that currently run under Basic in RISC OS to Windows SDL Basic for development, but they will be used on MacOS!

If you don't have a Mac on which to test them I can't guarantee that they will run flawlessly, but if you are careful about the issues discussed above they should.

Unfortunately BBCSDL does not yet support creating standalone Mac applications. It actually isn't difficult - it's probably the easiest of all the platforms supported by BBCSDL on which to achieve that - but it hasn't been a high priority for me. If necessary I can give you some guidance on how to do it manually, or you can tell your end-user(s) to install BBCSDL.

Richard.
User IP Logged

mavison
New Member
Image


member is offline

Avatar




PM


Posts: 27
xx Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #5 on: Feb 5th, 2017, 10:10pm »

Thanks Richard for that comprehensive and quick reply.

I think I can do what I want in pure Basic without using Windows or SDL APIs - even if I have to Spool some *dir output and read it back to get a list of files in a directory!

If I get my slashes sloping in the right way it could even run on Windows & Mac. Just in case, is there a way for a program to discover which it is running on? (apart from cheating by recognising the @dir$ value!)

I will have access to the Mac for testing, and I can install BBCSDL there, but most development would be done on Windows.

The programs are currently being run on the Mac using RPCEmu to emulate a RISC PC, then running RISC OS 5 under that, then running the programs - so even using BBCSDL would be a big improvement!

You have given me the confidence to try some experimenting, and to remind myself how to move a program from RISC OS to BB4W.

Thanks for your work, and your help.
Martin


User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 470
xx Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #6 on: Feb 6th, 2017, 08:49am »

on Feb 5th, 2017, 10:10pm, mavison wrote:
even if I have to Spool some *dir output and read it back to get a list of files in a directory!

You can 'borrow' code for doing that from either touchide.bbc or SDLIDE.bbc (they use basically the same code). Using a sneaky trick with WIDTH 20 they even manage to parse the *dir output to cope with filenames containing spaces!

Quote:
is there a way for a program to discover which it is running on? (apart from cheating by recognising the @dir$ value!)

INKEY(-256) will tell you if it is running in RISC OS, BB4W or BBCSDL. Having ascertained that it is running in BBCSDL you can test the least-significant byte of the @platform% variable which is 0 for Windows, 1 for Linux, 2 for MacOS and 3 for Android.

Quote:
to remind myself how to move a program from RISC OS to BB4W.

BB4W will read and automatically convert Acorn's tokenised program format, but BBCSDL won't. So if you want to import that format go through BB4W first. Otherwise spool your program to plain text (.bas); both BB4W and BBCSDL will read that.

Richard.
User IP Logged

mavison
New Member
Image


member is offline

Avatar




PM


Posts: 27
xx Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #7 on: Feb 6th, 2017, 10:18am »

Thanks for all the hints. Most useful.

Is the only current way to run a program using SDL is to start an IDE, navigate to the program.bas and then run it?

I only realised double-clicking it externally simply used BB4W - hard to tell the difference until I used INKEY(-256)!

Thanks
Martin
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 470
xx Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #8 on: Feb 6th, 2017, 1:53pm »

on Feb 6th, 2017, 10:18am, mavison wrote:
Is the only current way to run a program using SDL is to start an IDE, navigate to the program.bas and then run it?

On most platforms you can simply specify the name of a BASIC program (as a tokenized .bbc file) on the command line. For example on both Windows and Linux you can do:

Code:
bbcsdl path/to/program.bbc 

and it will run that program. Indeed if you omit the command-line argument BBCSDL will search for the file bbcsdl.bbc in the current directory and run it if found. That's the mechanism by which the 'choose IDE' launcher is executed.

I have to confess that Mac OS is more of a mystery to me, because rather than a simple executable file like bbcsdl there is an 'application package', and I'm not sure whether the concept of 'command line arguments' applies.

If the worst comes to the worst and that facility isn't directly available on the Mac all you would need to do is take a copy of the BBC Basic application, navigate 'inside' the package using Finder, and replace the supplied bbcsdl.bbc with your own program of the same name.

BBC BASIC will not realise your subterfuge and will automatically run your program when the application is executed. The only 'gotcha' is that the resulting application won't have a valid digital signature which might cause issues during deployment.

Quote:
I only realised double-clicking it externally simply used BB4W - hard to tell the difference until I used INKEY(-256)!

I'm not too sure what you mean. BBCSDL has no dependence on BB4W, and the latter doesn't even need to be installed.

Edit: Unless you mean double-clicking on a .bbc file, when of course what application gets executed depends entirely on the 'file associations'. It could be BB4W or it could be BBCSDL, depending on how you've configured Windows.

Richard.
« Last Edit: Feb 6th, 2017, 3:31pm by Richard Russell » User IP Logged

mavison
New Member
Image


member is offline

Avatar




PM


Posts: 27
xx Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #9 on: Feb 6th, 2017, 5:27pm »

Thanks for the parameter info. I will include that when I do some experiments - and if I discover anything about the Mac I will post again.

Quote:
It could be BB4W or it could be BBCSDL, depending on how you've configured Windows.
Yes - obvious when you realise what is happening!

Martin
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 470
xx Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #10 on: Feb 8th, 2017, 9:28pm »

I've updated the Android edition of BBC BASIC once again, this time to version 0.16d. Changes in this release are:
  • Fixed another issue affecting displays with a resolution in excess of 2048 pixels.

  • Fixed pasting BBC BASIC code put on the clipboard by another Android app.
Version 0.16d may be downloaded from the usual place:

http://www.rtr.myzen.co.uk/BBCBasic.apk

Android should recognise this as an upgrade and your personal files should not be affected.

Richard.
« Last Edit: Feb 8th, 2017, 9:33pm by Richard Russell » User IP Logged

DDRM
Global Moderator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 10
xx Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #11 on: Feb 9th, 2017, 12:44pm »

Hi Richard,

Upgrading to 0.16d for Android results in BBC Basic failing to start with a "couldn't allocate memory" error on my Google Nexus 7. Any ideas about why? I'm currently running Android 4.4.4.

Best wishes,

David
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 470
xx Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #12 on: Feb 9th, 2017, 2:35pm »

on Feb 9th, 2017, 12:44pm, DDRM wrote:
Any ideas about why?

It means what it says! I'm surprised that there isn't enough memory available on your device for BBC BASIC (it tries to allocate 256 Mbytes initially, but will fall back to smaller amounts if it has to). It probably means you have several apps open 'in the background'.

The first thing to try is closing all those background apps (press on the 'square' or 'menu' button; depending on the version of Android there may be a 'close all' selection or you may have to close each one individually). Failing that a full reboot is the next step.

I'm no Android expert, but it may be that Java apps are able to cooperate more closely in their use of memory, but a native app like BBC BASIC gets what it is given and no more. sad

I've put a program 'mmap.bbc' in the tools directory which you can use to get more information than you could possibly want about the current memory map.

Richard.
« Last Edit: Feb 9th, 2017, 3:02pm by Richard Russell » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 470
xx Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #13 on: Feb 10th, 2017, 10:32am »

on Feb 9th, 2017, 2:35pm, Richard Russell wrote:
The first thing to try is closing all those background apps (press on the 'square' or 'menu' button; depending on the version of Android there may be a 'close all' selection or you may have to close each one individually). Failing that a full reboot is the next step.

Did that fix the problem?

Once it's working again you can get a (very) rough feel for how close you are to running out of memory by checking the value of PAGE. e.g. by running 'about.bbc'. BBC BASIC tries to allocate memory starting from the bottom, so the higher the resulting address the nearer you were to getting the error message.

Different versions of Android seem to be quite variable in how they allocate memory, and on the machines I have here BBC BASIC seems typically to end up at a lower address in Marshmallow (Android 6.0) than it does in KitKat (Android 4.4).

Richard.
User IP Logged

DDRM
Global Moderator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 10
xx Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #14 on: Feb 11th, 2017, 6:19pm »

Hi Richard,

No, even with all apps shut and after a restart .16d wouldn't run. I've uninstalled it and reinstalled .16a, which runs fine, though I haven't had much chance to play with it.

That reports PAGE=&20031700, and HIMEM as &20231700, with available memory as 2,097,152 bytes.

I make that PAGE value a bit over 500MB. The Nexus has 2GB of memory, so there shouldn't be an issue...

Best wishes,

D
User IP Logged

Pages: 1 2  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