Moving Basic Programme from MacOS to iPad

Discussions specifically related to the Android and iOS editions of BBCSDL
Posts: 1
Joined: Wed 01 Sep 2021, 16:14

Moving Basic Programme from MacOS to iPad

Post by djhpk »

I have several BBC Basic Programmes written on Acorn devices that I would like to get running on iPad & iPhone. Mostly, I have the programme files in tokenised form which I have been able to load and successfully run on BBCBasic for Mac.

But, I not been able to get any to run using BBC Basic for SDL 2.0, version 1.24a on my iPad Pro.

On the iPad, I can run the demos, create, run and save a new programme. But when I copy a programme file from the Mac to the iPad, either in tokenised file format or text file format, The file seems to get corrupted.

Trying to edit a tokenised file, it appears that only the first line is visible with the first few characters corrupted. But saving the file with a new name and sending it back to the Mac it runs correctly!

Loading a tokenised file into the Mac, saving as .txt or .bas leads to a file with line numbers but when loaded into BBCBasic on the iPad, a set of additional line numbers are added and so the programme will not run

How do I overcome this problem?

Posts: 261
Joined: Wed 04 Apr 2018, 06:36

Re: Moving Basic Programme from MacOS to iPad

Post by KenDown »

Sorry, I don't know anything about Apple's products, but might the problem lie in the tokenised bit? I mean, PRINT may have the value &E7 on your Mac but &CD on the iPad and obviously the two are not compatible. That would also explain why characters seem to be corrupted!

Another possible problem might be if there are a couple of bytes at the beginning of the program which tell the computer that "this is a BASIC program, treat it accordingly". If Mac requires &163 &16 &127 and iPad requires &217 &1A8 &F7, then it would fail to recognise the program and try to treat it as text or C++ or something. (You get a similar problem with UTF-8 text, which has three special characters at the beginning to signal that the text is UTF. Try to read the text in as text and you will get what appear to be three corrupted characters at the start.)

Anyway, I'm just speculating as I don't use Apple.

Posts: 398
Joined: Mon 02 Apr 2018, 18:04

Re: Moving Basic Programme from MacOS to iPad

Post by DDRM »

Hmm. I'd be surprised if it's to do with the tokenisation: I imagine the translation from tokens is being done by the interpreter, which I'd expect to be the same in all versions of BBC-SDL. I suppose some differences in file encoding between the two operating systems is possible, but it would be surprising for Apple to make files incompatible between two current products....

I also am not an Apple user, so I can't easily try things out, but on a PC, saving a file in .BAS (i.e.text) format doesn't result in the addition of line numbers. Is that to do with the way you have configured your copies of BBC-SDL, i.e. to use line numbers? Try switching that off.

As a final fall-back, you could write a little program to strip the line numbers out of the .BAS file, and then loading that? It's a clunky solution, but not a difficult one, I would guess. OK if there are a modest number of files you want to move... Otherwise you could get it to batch-process a whole directory, with its subdirectories, but that would be a little trickier...

Otherwise, why don't you just drop Richard Russell an email ( )? Though he's not currently contributing to this forum, he's still responding to direct approaches, I think, and these kind of complex interactions between different versions are something he's best placed to address.

Best wishes,


Hated Moron
Posts: 136
Joined: Thu 07 Apr 2022, 10:10

Re: Moving Basic Programme from MacOS to iPad

Post by Hated Moron »

DDRM wrote:
Thu 30 Sep 2021, 07:51
these kind of complex interactions between different versions are something he's best placed to address.
What "complex interactions" between different versions are you talking about?

BBC BASIC for SDL 2.0 is a cross-platform product, it runs in Windows, MacOS, Linux, Raspberry Pi, Android, iOS and in-browser. The whole point is that SDL2 is used as an abstraction layer, allowing the same code to run on each platform and largely hiding the differences between the different Operating Systems from the point of view of the BBC BASIC programmer.

So if a tokenised (.bbc) program is suffering some kind of corruption when being copied from one platform to another it doesn't have anything to do with BBC BASIC, but must be as a result of the method of copying used. So long as it is performing a 'binary' copy, i.e. transferring the file byte-by-byte without making any changes (such as line endings), it will be fine.

The most straightforward and reliable way to copy a tokenised BBC BASIC (.bbc) program from a Mac to an iPad (as indeed it is from a PC to an Android device), or the reverse, is via a USB cable. You could also use a USB memory stick, or Dropbox as an intermediary, although that's been made harder in recent versions of Android.
If you are unhappy with any aspect of this post, please report it to the forum administrator (click on the exclamation mark icon in the top-right corner) rather than complaining on the open forum or by private email.