Author |
Topic: BBC BASIC for SDL 2.0 v0.16a released (Read 2501 times) |
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
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.
|
|
|
|
mavison
New Member
member is offline


Posts: 27
|
 |
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
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
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.
|
|
|
|
DDRM
Global Moderator
member is offline


Posts: 36
|
 |
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
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
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: 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. 
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.
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
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.
|
|
Logged
|
|
|
|
DDRM
Global Moderator
member is offline


Posts: 36
|
 |
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
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #15 on: Feb 11th, 2017, 7:55pm » |
|
on Feb 11th, 2017, 6:19pm, DDRM wrote:| I've uninstalled it and reinstalled .16a, which runs fine, though I haven't had much chance to play with it. |
|
UNDER NO CIRCUMSTANCES must you use 0.16a. It has a MAJOR BUG which is liable to crash your device.
Are you saying that 0.16d does not run after a full reboot? I would find that surprising, but if it is the case it unfortunately means that your device is not suitable for running BBC BASIC since it cannot make available the necessary memory.
It may be worth upgrading to a newer version of Android, if available, to see if that helps.
Richard.
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #16 on: Feb 12th, 2017, 11:45am » |
|
I've updated BBCSDL once again (all editions), this time to v0.16e. This version uses an even more aggressive memory-allocation strategy - it will attempt to squeeze itself into a smaller gap - in the hope that it may solve the reported "Couldn't allocate memory" message.
Version 0.16e may be downloaded for the various platforms as follows:It's not impossible that the new memory allocation strategy might itself cause problems so if you notice anything untoward please report it.
Richard.
|
|
Logged
|
|
|
|
DDRM
Global Moderator
member is offline


Posts: 36
|
 |
Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #17 on: Feb 13th, 2017, 1:02pm » |
|
Hi Richard,
I've found out how to check my memory, and .16d won't run even when there is 1.4GB of RAM free!
However, I downloaded .16e, and that appears to run fine - so thanks for that. I'll let you know if I run into any problems.
Best wishes,
D
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #18 on: Feb 13th, 2017, 1:57pm » |
|
on Feb 13th, 2017, 1:02pm, DDRM wrote:| I've found out how to check my memory, and .16d won't run even when there is 1.4GB of RAM free! |
|
It's the old fragmentation problem. It doesn't matter how much memory is free if there isn't a contiguous block big enough to contain BBC BASIC's heap/stack (it attempts to allocate 256 Mbytes). It's a problem on Windows too, but Android has a less sophisticated memory management system so is likely to suffer more.
Quote:| However, I downloaded .16e, and that appears to run fine |
|
It takes more liberties than 0.16d! As I mentioned previously, you can run mmap.bbc (in the tools directory) to get a feel for how fragmented your memory is. If the screen fills with allocations you can tap on it to scroll through more; if that proves to be necessary it gives you an idea of the problem!
Richard.
|
|
Logged
|
|
|
|
DDRM
Global Moderator
member is offline


Posts: 36
|
 |
Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #19 on: Feb 14th, 2017, 08:34am » |
|
Hmm. Obviously I couldn't run mmap until I had a recent working version. It's certainly a sobering insight into a modern operating system!
I note that you said "reboot" the device. Is that different from turning it off (i.e. power down, not just sleep) and back on? IS there a generic Android way of doing that? I'm guessing that things might then take consecutive blocks of memory, rather than being scattered all over.
I don't really want to put it back to factory defaults, deleting all apps etc...
Best wishes,
D
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #20 on: Feb 14th, 2017, 11:28am » |
|
on Feb 14th, 2017, 08:34am, DDRM wrote:| IS there a generic Android way of doing that? |
|
Usually achieved by holding down the on/off button until it prompts you to power it down. The crucial thing is that when you next power up it should take quite a long time, probably initially displaying the Android logo (or the manufacturer's logo if customised) whilst it reboots, so it can't easily be mistaken for waking from sleep.
Mind you the Facebook app regularly crashes so badly that it causes my phone to reboot, so it happens whether I want it to or not!
Quote:| I don't really want to put it back to factory defaults, deleting all apps etc... |
|
No, of course not. That should definitely not be necessary.
If you do have many apps that run automatically at boot-up, because they need to monitor things 'in the background' (and an awful lot of apps seem to think they do) it's unlikely that you can - or would want to - do anything about that.
My Android phone is short of memory and quite often fails to install new apps for that reason, but it's all the 'pre-installed' apps that I don't want, but can't get rid of (other than by 'rooting' it), that are responsible. It's annoying, but presumably the manufacturer gets a lucrative deal from the vendors of those apps in exchange for forcing them on their users.
Richard.
|
|
Logged
|
|
|
|
DDRM
Global Moderator
member is offline


Posts: 36
|
 |
Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #21 on: Feb 15th, 2017, 08:07am » |
|
OK, thanks - that's what I did, and it still didn't help. I hoped that when it started up "from cold" they'd all take contiguous memory,and leave a nice big chunk at the end for BBCSDL. Anyway, .16e seems to have done the trick!
I have rather few apps installed (by me) - but you're right, there are a ridiculous number that I can't even delete, mostly trying to get me to buy things from the Play store...

D
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: BBC BASIC for SDL 2.0 v0.16a released
« Reply #22 on: Feb 15th, 2017, 08:17am » |
|
on Feb 15th, 2017, 08:07am, DDRM wrote:| I hoped that when it started up "from cold" they'd all take contiguous memory,and leave a nice big chunk at the end for BBCSDL. |
|
Me too, but the fly in the ointment is quite possibly ASLR (Address Space Layout Randomization) which is a security measure implemented by all modern operating systems:
https://en.wikipedia.org/wiki/Address_space_layout_randomization
Richard.
|
|
Logged
|
|
|
|
|