Which Emulator for BBC Micro on Linux?

want to talk about MESS/model b/beebem/b-em/electrem/elkulator? do it here!
BitSeeker
Posts: 52
Joined: Fri Mar 30, 2018 1:18 pm
Contact:

Which Emulator for BBC Micro on Linux?

Post by BitSeeker » Thu Apr 05, 2018 8:52 am

I have been having a look at emulators for the BBC Micro, particularly ones I can run natively on Linux. I currently run MINT 18.2, Cinnamon. Which emulator is most popular, and actively being developed and supported?

The ones I have discovered so far are B-em, Beeb-Em or perhaps MAME. I downloaded Beeb-Em which seems to be an early 0.0.,, release dated 2006 I cannot get past the .configure script which is looking for a 'gtk+-2.0.pc' file. I have GTK2 installed, but there are a number of GTK2 libraries and add-ons and I have so far not been able to determine which one is required.

B-em seems to have a later file, dated 2012, but requires allegro. A quick 'aptitude search' shows a similar issue with a large number of allegro related libraries and little information on what modules/libraries are actually required.

The Windows version of Beeb-Em is much more up-to-date (2015) as is MAME, which begs the question, have the native Linux versions been abandoned or simply no further developments? In which case, would it be quicker and better (in terms of functionality rather than performance) to run the Windows 4.x version of BeebEm under WINE? Or should I go with MAME for which there seems to be a ready-made package in the Ubuntu repository?

User avatar
sydney
Posts: 2162
Joined: Wed May 18, 2005 9:09 am
Location: Newcastle upon Tyne
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by sydney » Thu Apr 05, 2018 8:55 am

In Linux I use the windows version of beebem under wine. An alternative would be jsbeeb in a browser.

User avatar
richardtoohey
Posts: 3563
Joined: Thu Dec 29, 2011 5:13 am
Location: Tauranga, New Zealand
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by richardtoohey » Thu Apr 05, 2018 9:10 am

It depends, really.

Usually b-em (once you get any dependencies sorted out), but for some games/applications you might find beeb-em works better.

I was getting used to b-em but some recent update to my OS (OpenBSD) has made it unusable (on my TODO list to figure out what's behind that), so I've fallen back to the old-but-(mostly)-gold beeb-em version.

jsbeeb works well, too - just need a browser.

The question before yours also has links to the latest versions: viewtopic.php?f=4&t=14882#p199591

There's been discussion about building both of these (including on Linux), so have a look in the forums.

If I get some time I can have a look on Mint 18.2, got that around somewhere ... 32-bit or 64-bit?

Trying a recent version of MAME also on my TODO list ... :D

BitSeeker
Posts: 52
Joined: Fri Mar 30, 2018 1:18 pm
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by BitSeeker » Thu Apr 05, 2018 10:09 am

Yes, those are the two places I downloaded from. Sorry for the duplicate question, but in my case I am looking at Linux specific software rather than Windows.

I hadn't seen jsbeeb and didn't realise an emulator could run in a web brower under JAVA!. I had a look at the online version and have also downloaded it locally. It seems to run fine but I couldn't get any of the URL commands to work. It seems to work OK from the menu though and I successfully downloaded a couple of games from STH.

It seems then that both B-em and BeebEm are recognized and used by forum members. I now have BeebEm running in WINE and that seems to work fine. Not so with B-em which flickers badly.

Still, thanks to the developers for some excellent emulators!

Coeus
Posts: 884
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by Coeus » Thu Apr 05, 2018 9:48 pm

BitSeeker wrote:...Not so with B-em which flickers badly.
Which version of B-Em were you running and what were you running it on?

I have been working on an Allegro 5 port of B-Em and thus runs very well on my desktop which is an Intel(R) Core(TM) i5-3570K using about 25% of one core. It can't maintain 100% speed on an ageing laptop I have which has an Intel(R) Celeron(R) 900 - the single core sits permanently at 100% so as an experiment I have installed Linux on a laptop my wife abandoned because she found it too slow (running Windows 10) - it's has an AMD A4-4355M APU with Radeon(tm) HD Graphics and that runs it fine - 75% of one core.

BitSeeker
Posts: 52
Joined: Fri Mar 30, 2018 1:18 pm
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by BitSeeker » Fri Apr 06, 2018 7:32 am

Coeus wrote:
BitSeeker wrote:...Not so with B-em which flickers badly.
Which version of B-Em were you running and what were you running it on?

I have been working on an Allegro 5 port of B-Em and thus runs very well on my desktop which is an Intel(R) Core(TM) i5-3570K using about 25% of one core. It can't maintain 100% speed on an ageing laptop I have which has an Intel(R) Celeron(R) 900 - the single core sits permanently at 100% so as an experiment I have installed Linux on a laptop my wife abandoned because she found it too slow (running Windows 10) - it's has an AMD A4-4355M APU with Radeon(tm) HD Graphics and that runs it fine - 75% of one core.
I am trying to run B-em v2.2 for Windows, running in WINE under Linux Mint 18.2 Cinnamon, 64bit. My machine has an older (second generation) i7 processor. It could be that the issue has more to do with WINE/Mono compatibility than B-em itself but I don't know. Other WINE apps seem to run OK.

The 'flickering' relates to the whole B-em window briefly and randomly appearing (periodically flashing up) in another position on the screen then disappearing. The original window does stay where it is but this is still rather distracting. When I have time I might have a go at compiling the native Linux version again.

Coeus
Posts: 884
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by Coeus » Fri Apr 06, 2018 11:58 am

BitSeeker wrote:I am trying to run B-em v2.2 for Windows, running in WINE under Linux Mint 18.2 Cinnamon, 64bit. My machine has an older (second generation) i7 processor. It could be that the issue has more to do with WINE/Mono compatibility than B-em itself but I don't know. Other WINE apps seem to run OK.
Have you tried the native Linux version? WINE seems like a good option for BeebEm because that is now being developed as a Window-only application whereas B-Em is cross-platform. There are also newer versions of both in their Stardot Github repositories.

Diminished
Posts: 88
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by Diminished » Sat Apr 07, 2018 8:19 am

BitSeeker wrote:When I have time I might have a go at compiling the native Linux version again.
I did this on a freshly installed Debian quite recently, and I ended up needing to install the following prerequisite packages:

liballegro4-dev
libopenal-dev
libalut-dev
automake1.11

HTH

Coeus
Posts: 884
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by Coeus » Sat Apr 07, 2018 10:16 pm

Diminished wrote:
BitSeeker wrote:When I have time I might have a go at compiling the native Linux version again.
I did this on a freshly installed Debian quite recently, and I ended up needing to install the following prerequisite packages:

liballegro4-dev
libopenal-dev
libalut-dev
automake1.11
I did have it in mind that we should make easier for B-Em to be packaged so it can be installed on a Linux distribution in the same way as the distributions own packages. There are two issues here - firstly that the file layout B-Em has historically worked with is Windows-esq and doesn't lend itself to the way Linux packages are usually laid out and secondly that there are multiple distributions with varying packaging formats.

Putting the build time dependencies in a Wiki for various Linux distros would certainly be very helpful - I'll see what I can make of the Wiki facility on GitHub.

tom_seddon
Posts: 132
Joined: Mon Aug 29, 2005 11:42 pm
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by tom_seddon » Sun Apr 08, 2018 11:30 pm

Another Linux option is my emulator, b2: https://github.com/tom-seddon/b2

It hasn't yet reached v1.0, and I've been a bit guilty of just piling features into it without necessarily polishing each one as it goes in :) - but there's not too much wrong with it as it stands.

(My original feature list is pretty much now in place, to one degree or another, and my goal this year is to tighten up what's there and improve the UX in a few places.)

--Tom

ThomasHarte
Posts: 465
Joined: Sat Dec 23, 2000 5:56 pm
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by ThomasHarte » Mon Apr 09, 2018 5:45 pm

Seconded for B2!

Re: awkward dependencies, per the repository it's not in any way an Allegro project. There are other dependencies too, but it's SDL for video.

Coeus
Posts: 884
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by Coeus » Tue Apr 10, 2018 9:50 am

ThomasHarte wrote:Seconded for B2!
Thomas could you expand on that?

There are certainly things about b2 I like. The GUI has lots of nice touches beyond just a simple menu. It has the ability to clone a machine that is already running so you have two machines which then both continue from that point. Internally that means each machine has to be an object rather than a bunch of global variables. One can also define a custom machine, i.e. a combination of disk controller and the set of ROMs. B-Em is more limited in this respect - you can change the set of ROMs used by one of the machines B-Em knows about but you can't have two otherwise identical machines differing only in the set of ROMs used.

I have commented before about the way the CPU emulation works being stepped on from outside which means the CPU module doesn't have to have lots of hooks for making other non-CPU bits of the machine work in sync. It also makes is easy to feed the CPU a set of instructions that don't exist in the memory of the emulated machine if it suits the emulator to do that.

It also has features B-Em does not including the ability to control it from outside via HTTP and, compared to the Allegro 4 version, the ability to interact with the host clipboard, i.e. paste text in as if it were typed and copy text output to the clipboard. (The Allegro 5 does work with the host clipboard, though this could be improved still further). B-Em also does things b2 does not - Music 5000, a big selection of tube processors, all of which support debugging, etc.

It does use more CPU time than B-Em but that is more evenly distributed across threads so it may nevertheless work on a machine with a multi-core CPU where each core itself is not particularly fast.
ThomasHarte wrote:Re: awkward dependencies, per the repository it's not in any way an Allegro project. There are other dependencies too, but it's SDL for video.
b2 seems to solve the dependency issue by including anything that is not likely to be part of the OS installation as a sub-module to be compiled from source. The issue with Allegro as an awkward dependency AFAIK only applies to Allegro 4. There is now an Allegro 5 port of B-Em and Allegro 5 is available pre-compiled for Windows and as a Visual Studio Nugget.

ThomasHarte
Posts: 465
Joined: Sat Dec 23, 2000 5:56 pm
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by ThomasHarte » Tue Apr 10, 2018 2:54 pm

Coeus wrote:
ThomasHarte wrote:Seconded for B2!
Thomas could you expand on that?

... The issue with Allegro as an awkward dependency AFAIK only applies to Allegro 4. There is now an Allegro 5 port of B-Em and Allegro 5 is available pre-compiled for Windows and as a Visual Studio Nugget.
For me it's a lot about being able to use the same thing in both Linux and on my Mac; Allegro 4 for the Mac was a complete misfire* and has been unbuildable since 2012, causing me to avoid the other options when last I was looking around. That's not a relevant concern to the poster but is the reason that I am familiar with B2, which I have found properly to emulate the relatively few BBC things I am interested in, as an Electron person.

* used a deprecated API pretty much from day one; it isn't available for 64-bit applications, header files are no longer available. Though it was workable for a while. Not only does one of the demo games I wrote for Allegro 4 using Xcode survive as part of the Allegro 5 code base, but in one case I forgot to delete the default Xcode header, apparently to prove the point.

BitSeeker
Posts: 52
Joined: Fri Mar 30, 2018 1:18 pm
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by BitSeeker » Tue Apr 10, 2018 10:04 pm

Just to add to this topic of Linux tools, I have found that running the MMC Manager tool and FSImager on Linux in WINE has one serious limitation. Drag and drop does not work. Both of these tools are drag and drop dependent and do not seem to provide an alternative option to save out or copy into/from the MMC or disk image file from the menus. A pointer to alternative tools running natively under Linux, if such exist, would be appreciated.

Coeus
Posts: 884
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by Coeus » Tue Apr 10, 2018 10:16 pm

BitSeeker wrote:Just to add to this topic of Linux tools, I have found that running the MMC Manager tool and FSImager on Linux in WINE has one serious limitation. Drag and drop does not work...
I don't know which distro you are using but worth checking if it has made Wayland the default display server. There have been drag and drop issues with Wayland. I thought they were mostly solved now but depending on which version you have that may not be true. Usually you can override the default and select X11 or Wayland explicitly.

User avatar
pau1ie
Posts: 528
Joined: Thu May 10, 2012 9:48 pm
Location: Bedford
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by pau1ie » Wed Apr 11, 2018 9:07 am

I don't think wayland is the issue here. See this thread for a discussion of the problem, and the linked post has a possible solution to download.

I noticed the same problem, but always solved it by booting into windows, which is a bit of a faff at best, and may not be possible in all situations!
I'm working on http://bbcmicro.co.uk

Coeus
Posts: 884
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by Coeus » Wed Apr 11, 2018 10:58 am

pau1ie wrote:I don't think wayland is the issue here. See this thread for a discussion of the problem, and the linked post has a possible solution to download.
That thread seemed to be talking about explicit saving, not drag & drop.
pau1ie wrote:I noticed the same problem, but always solved it by booting into windows, which is a bit of a faff at best, and may not be possible in all situations!
Another option if you need to run the odd Windows program is to have Windows installed in a virtual machine rather than dual boot. VirtualBox works well with Linux as the host and Windows as the guest and also the other way round.

User avatar
pau1ie
Posts: 528
Joined: Thu May 10, 2012 9:48 pm
Location: Bedford
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by pau1ie » Wed Apr 11, 2018 11:04 am

Coeus wrote:That thread seemed to be talking about explicit saving, not drag & drop.
2 posts above the one I linked to:
msknight wrote:the process of drag and drop, to import and export SSD images, isn't working.
I'm working on http://bbcmicro.co.uk

User avatar
pau1ie
Posts: 528
Joined: Thu May 10, 2012 9:48 pm
Location: Bedford
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by pau1ie » Wed Apr 11, 2018 11:10 am

Coeus wrote: have Windows installed in a virtual machine
I am not sure my 8 year old laptop is up to that any more, but one would need to purchase an additional license for the VM (If you didn't have one spare). You can't have windows installed for the host and VM at the same time with the OEM license which typically comes with retail computers.

Are you aware of any good/cheap options to do this?
I'm working on http://bbcmicro.co.uk

Coeus
Posts: 884
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by Coeus » Wed Apr 11, 2018 11:19 am

pau1ie wrote:I am not sure my 8 year old laptop is up to that any more, but one would need to purchase an additional license for the VM (If you didn't have one spare). You can't have windows installed for the host and VM at the same time with the OEM license which typically comes with retail computers.
I believe I am ok, license-wise, because I have Windows in a VM instead of as a parallel OS to dual boot so there is still only one instance of Windows on the machine. Consequently I am not up to date with cheap ways to get an extra Windows license.

Hardware-wise, the big thing is if the CPU supports hardware assisted virtualisation and it may also be necessary to enable it within the BIOS.

I am not saying this is the best option for everyone but it's worth knowing that it is an option.

BitSeeker
Posts: 52
Joined: Fri Mar 30, 2018 1:18 pm
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by BitSeeker » Wed Apr 11, 2018 11:32 am

I'm using Linux MINT version 18.2 with Cinamon desktop. I was not aware of what Wayland is, but doing a quick search I find that wayland libraries are installed on my system (mostly version 1.12.0-1 but version 17.2.8-0 of the egl1-mesa library). I had a look at the referenced thread. The MMBImager download is the same version that I am already using and which was on the TurboMMC CD. This does allow me to Save/Load .ssd images into the MMB file. If there was also an updated version of FSImager.exe or FSmanager with this right-click menu feature added that would solve the problem of extracting/importing individual files. I did find 'BBC disk content extractor' by W.A Steer (bbcdisk.exe) which provides the ability to extract individual files from an .ssd image (you have to rename to .img), which provides a solution in one direction, but I don't yet have a solution for the reverse.

Booting into Windows (whether dual boot or VM, licence notwithstanding) is an alternative but one I would rather avoid if possible, although it is a solution at a push. Is there is any documentation of the .MMB and .ssd file formats anywhere? It might be possible to write something if the documentation exists and is accessible.

What I am trying to achieve is to be able to copy files to/from an emulator such as BeebEm and also int a GUI environment to work on. With this in mind I had hoped to be able to use BBC Basic (http://www.bbcbasic.co.uk/bbcbasic.html) as it has a GUI editor and an emulator, but it turns out that this saves out files in a non-Acorn format. I can copy files from the Beeb and import them, but I cannot save out the edited result and copy it back to the Beeb or another emulator. I can, of course, just work on the Beeb, but it would be far easier and quicker if I could work in a GUI editor on the PC. If I can get BeebEm working in native mode I might just work using that and simply copy out complete .SSD files rather than individual files. BeebEm also has an RS432 feature so I might look into the feasibility of serial transfer of files between emulator and Beeb.

Coeus
Posts: 884
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by Coeus » Wed Apr 11, 2018 11:59 am

BitSeeker wrote:...Is there is any documentation of the .MMB and .ssd file formats anywhere? It might be possible to write something if the documentation exists and is accessible.
If you're happy with a command line tool check out Steve Harris's MMB utilties:
https://sweh.spuddy.org/Beeb/mmb_utils.html
https://github.com/sweharris/MMB_Utils

Coeus
Posts: 884
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by Coeus » Wed Apr 11, 2018 12:06 pm

BitSeeker wrote:What I am trying to achieve is to be able to copy files to/from an emulator such as BeebEm and also int a GUI environment to work on. With this in mind I had hoped to be able to use BBC Basic (http://www.bbcbasic.co.uk/bbcbasic.html) as it has a GUI editor and an emulator, but it turns out that this saves out files in a non-Acorn format. I can copy files from the Beeb and import them, but I cannot save out the edited result and copy it back to the Beeb or another emulator.
I am not an expert on the PC version of BBC BASIC but does it have the equivalent of *SPOOL/*EXEC? The usual way to get around binary file compatibility here is to use a plain text version. You can create this on the BBC itself by:

Code: Select all

*SPOOL filename
LIST
*SPOOL
and then when you want to re-load it, by:

Code: Select all

NEW
*EXEC filename
The other issue is how you transfer the text from emulator to host and vice versa. If you do alot of this then the easiest way is probably VDFS. This allows the emulated BBC micro to see (part of) the filing system of the host mapped to a normal Acorn filing system, i.e. something that works a bit like DFS or ADFS but shares the host files directly rather than SSD images. Both B-Em and BeebEm have this feature, though I don't know if the BeebEm version is in the GitHub master yet. I wrote the host side of VDFS for B-Em and J.G.Harston did the same for BeebEm so you could ask him about that.

Another possibility is copy/paste via the clipboard. I don't know how well that works with Wine but BeebEm allows you to "paste" the clipboard into the emulated BBC micro where it appears as if typed and likewise you can export text a similar way - I don't have it in front of me but I think it does this by making clipboard behave like a printer, i.e. you print your program listing to the clipboard and then paste into a program on the host. Have a look at the "Edit" menu and see what's there.

BitSeeker
Posts: 52
Joined: Fri Mar 30, 2018 1:18 pm
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by BitSeeker » Wed Apr 11, 2018 6:56 pm

Well I finally was able to compile BeebEm for Linux but as the version number indicates, this appears to be at a very early development stage. It loads up with the emulator window and the status of ROMs is listed in the command window at startup , but there are no menu options in the GUI. There do appear to be some config files for ROM, media (disc, tape, SCSI) and Econet and there are also some .ssd images located in a directory, but I have no idea how to load them. The README does not seem to be of much help. It looks like it is better to stick to the Windows version in WINE.
Coeus wrote:I am not an expert on the PC version of BBC BASIC but does it have the equivalent of *SPOOL/*EXEC? The usual way to get around binary file compatibility here is to use a plain text version. You can create this on the BBC itself by:

Code: Select all

*SPOOL filename
LIST
*SPOOL
and then when you want to re-load it, by:

Code: Select all

NEW
*EXEC filename
The other issue is how you transfer the text from emulator to host and vice versa. If you do alot of this then the easiest way is probably VDFS. This allows the emulated BBC micro to see (part of) the filing system of the host mapped to a normal Acorn filing system, i.e. something that works a bit like DFS or ADFS but shares the host files directly rather than SSD images. Both B-Em and BeebEm have this feature, though I don't know if the BeebEm version is in the GitHub master yet. I wrote the host side of VDFS for B-Em and J.G.Harston did the same for BeebEm so you could ask him about that.
Thanks for the information on the *SPOOL command. This will be very helpful if I can find a way to get text files back onto the Beeb in Linux. If not, then I will just have to work with Windows. I couldn't see any mention of VDFS in BeebEm so I will need to contact J.G.Hartson. If and when I get Bem compiled then I will have a look in there as well as well.
Coeus wrote:Another possibility is copy/paste via the clipboard. I don't know how well that works with Wine but BeebEm allows you to "paste" the clipboard into the emulated BBC micro where it appears as if typed and likewise you can export text a similar way - I don't have it in front of me but I think it does this by making clipboard behave like a printer, i.e. you print your program listing to the clipboard and then paste into a program on the host. Have a look at the "Edit" menu and see what's there.
I tried this in BeebEm which does have Copy and Paste menu items and it does work. A 'Copy' does exactly what you say. It does a LIST and 'prints' the result to the clipboard from where it can be pasted into any program. Conversely, Paste copies BASIC text back into the Beeb. Existing line numbers are overwritten and new ones are added. This does provide a two way transfer between emulator and a GUI editor, but there are a couple of caveats. The first is added spaces: the output of COPY is indented and spaces are added at the beginning of each line. Conversely, editors such as BBC BASIC also automatically insert spaces between line number and text. I cannot see a way to turn the automatic line formatting off in BBC Basic, nor do I see a LIST option to turn off the indent in the output. This option does work in principle though so thanks for mentioning it. I was so focused on the standalone file transfer tools that I didn't even consider this possibility.

Using *SPOOL filename | LIST | *SPOOL provides another option once the issue of line endings is addressed. I presume that the Beeb, like DOS/Windows, uses CRLF and opposed to just LF on Linux. Some editors show lines of text in the exported file on every other line. In the opposite direction using *EXEC command on a file created in that editor resulted in everything being added to one line. Running unix2dos or dos2unix on the file is one option. However this step can be avoided by using Notepad (on Linux MINT not Windows) which seems to handle this OK and the contents can then be copied/pasted to/from BBC Basic. Also, if memory becomes tight, unwanted automatically inserted spaces can probably be removed prior to import to the emulator using a fairly simple script.

In order to import and export files to/from the emulator, I discovered the 'Import Files to Disc' and 'Export Files From Disc' function in BeebEm. I can create a new 'disk' to save programs onto within the emulator and this creates a fresh .ssd file. Using 'Export Files from Disc' I can export programs created in the emulator to the PC. Using the Import Files to Disc function I can add files to this disc image from the PC. Finally, the created .ssd image file can then be added to the MMB file on memory card in the Beeb, which solves the problem of getting the file onto the real Beeb.

So with these caveats notwithstanding, I think I now have a way forward for moving BASIC program files back and forth between PC, emulator and Beeb, so thanks for all of the suggestions which have combined to provide a solution!

User avatar
Elminster
Posts: 2582
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by Elminster » Thu Apr 12, 2018 12:16 am

For those who know what Linux Containers are I have been playing around and put Tom's Linux version of B2 into a container.

The build file sucks the source, installs the dependancies, builds it and pushes the binary to another container. Will run on windows, mac or linux x86 currently (tested against docker 18.03 & 18.04 CE). Need vncviewer, so no sound but I may have a play at doing the others, and quite a few tweaks can be made to reduce the size further, larger than a single binary but much smaller than a VM.

https://hub.docker.com/r/elminster/b2_build/

Brief instructions on running the container on the site.

Coeus
Posts: 884
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by Coeus » Thu Apr 12, 2018 2:00 am

BitSeeker wrote:Well I finally was able to compile BeebEm for Linux but as the version number indicates, this appears to be at a very early development stage...
The history is actually bit more complicated than that. BeebEm started as a Unix/Linux program which was then ported to Windows but rather than add Windows as another possible target the program was converted to use the WIn32 API directly and would therefore only work on Windows. Then it was ported back again by adding a certain amount of emulation of the Win32 API but this port back to Unix/Linux has always lagged behind the Windows version.

If you want a native emulator for Linux B-Em and b2 are each a better bet. See the previous posts for some (probably incomplete) discussion of the differences.
BitSeeker wrote:...The first is added spaces: the output of COPY is indented and spaces are added at the beginning of each line.
These should not cause an issue as BASIC does not store any spaces before the line number,
BitSeeker wrote:Conversely, editors such as BBC BASIC also automatically insert spaces between line number and text. I cannot see a way to turn the automatic line formatting off in BBC Basic, nor do I see a LIST option to turn off the indent in the output.
Do you mean the Windows version? BASIC on the BBC has the LISTO command to control listing options. Does that work on the windows version too? LISTO 0 should remove both extra spaces and indentation.

As you mention, you could process BASIC listings to remove the spaces between the line number and the first word - this is where regular expressions would work well so you could use sed (or Perl) for this.

If memory is really tight there are some BASIC "crunchers" on here that aim to minimise the memory consumption by removing anything optional including spaces, comments, optional keywords, shortening variable names etc. I think the idea is you keep the version before crunching as this will be readable, but run the crunched version.
BitSeeker wrote:...I presume that the Beeb, like DOS/Windows, uses CRLF and opposed to just LF on Linux. Some editors show lines of text in the exported file on every other line. In the opposite direction using *EXEC command on a file created in that editor resulted in everything being added to one line.
Normally, files on the BBC micro have just a CR as the line terminator, the same as on the MacIntosh (pre-OS/X which is a kind of Unix) but *SPOOL output is the exception - that will contain CRLF. As you've discovered, some programmers' editors can handle the line endings of other platforms transparently. As well as Notepad on Linux, Emacs does this on all platforms, and Notepad++ does on Windows.[/quote]

BitSeeker
Posts: 52
Joined: Fri Mar 30, 2018 1:18 pm
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by BitSeeker » Thu Apr 12, 2018 8:24 am

Elminster wrote:For those who know what Linux Containers are I have been playing around and put Tom's Linux version of B2 into a container.

The build file sucks the source, installs the dependancies, builds it and pushes the binary to another container. Will run on windows, mac or linux x86 currently (tested against docker 18.03 & 18.04 CE). Need vncviewer, so no sound but I may have a play at doing the others, and quite a few tweaks can be made to reduce the size further, larger than a single binary but much smaller than a VM.

https://hub.docker.com/r/elminster/b2_build/

Brief instructions on running the container on the site.
Thanks for the link, which in turn points to the source code. I had been looking for it, but unfortunately the name 'B2' is too short to make any search meaningful, even when the words emulator or BBC are added!

BitSeeker
Posts: 52
Joined: Fri Mar 30, 2018 1:18 pm
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by BitSeeker » Thu Apr 12, 2018 8:56 am

Coeus wrote:
BitSeeker wrote:...The first is added spaces: the output of COPY is indented and spaces are added at the beginning of each line.
These should not cause an issue as BASIC does not store any spaces before the line number,
Coeus wrote:
BitSeeker wrote:Conversely, editors such as BBC BASIC also automatically insert spaces between line number and text. I cannot see a way to turn the automatic line formatting off in BBC Basic, nor do I see a LIST option to turn off the indent in the output.
Do you mean the Windows version? BASIC on the BBC has the LISTO command to control listing options. Does that work on the windows version too? LISTO 0 should remove both extra spaces and indentation.
Yes, I am aware of LISTO, but there did not seem to be an option number that removed the two space indent preceding each line. I think it more to do with formatting, i.e. consistently allowing up to 4 digits for the line number (1s 10s 100s 1000s) and maintaining a clean line of code down the screen. For anything less than 4 digits it translates into preceding hard spaces which are ported over to a GUI text editor. However, these do not seem to be an issue when the saved file that contains them is imported back.

While BBC Basic automatically deals with this presentation-wise in its editor, what it also automatically does is maintain a uniform space between the line number and the start of the BASIC statement. This is treated as a hard space when pasting directly to the emulator or saving to a BAS text file for import. Either way, these spaces are ported back to and retained by BASIC in the the Beeb emulator, which is evidenced by a space appearing when LISTO0 is used and two spaces appearing when LISTO1 is used. As far as I can tell, no more than one space is added per line though, just as if it were typed.

Unfortunately BBC Basic (both the Windows and Linux SDL version) do not seem to support LISTO or equivalent or otherwise provide for the removal of that space when saving the file. Since it can be worked around, it is not a major issue. There are probably other editors I could use as well but there are not many that will highlight the BASIC syntax, provide debugging facilities and run the code to test it.
Coeus wrote:If memory is really tight there are some BASIC "crunchers" on here that aim to minimise the memory consumption by removing anything optional including spaces, comments, optional keywords, shortening variable names etc. I think the idea is you keep the version before crunching as this will be readable, but run the crunched version.
I will have a look at that. No point re-inventing the wheel!
Last edited by BitSeeker on Thu Apr 12, 2018 9:40 am, edited 1 time in total.

User avatar
Elminster
Posts: 2582
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by Elminster » Thu Apr 12, 2018 9:33 am

BitSeeker wrote:
Coeus wrote:If memory is really tight there are some BASIC "crunchers" on here that aim to minimise the memory consumption by removing anything optional including spaces, comments, optional keywords, shortening variable names etc. I think the idea is you keep the version before crunching as this will be readable, but run the crunched version.
I will have a look at that. No point re-inventing the wheel!
e.g. this post talked about various cruncher tools

viewtopic.php?f=55&t=13129#p170628

BitSeeker
Posts: 52
Joined: Fri Mar 30, 2018 1:18 pm
Contact:

Re: Which Emulator for BBC Micro on Linux?

Post by BitSeeker » Thu Apr 12, 2018 9:41 am

Thanks. I have bookmarked that for reference and will have a more detailed look at it later.

Post Reply