B-Em

want to talk about MESS/model b/beebem/b-em/electrem/elkulator? do it here!
Coeus
Posts: 719
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Re: B-Em

Postby Coeus » Sat Apr 15, 2017 1:32 pm

bakoulis wrote:x86.c:196:4: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (int i = 0; i < MAXOPLEN; i++) {
^
x86.c:196:4: note: use option -std=c99 or -std=gnu99 to compile your code


What has happenned here is that the writer of the X86 disassembler I have incorporated has used a modern C feature, one of of those I think has been imported from C++. It seems on my compiler, gcc version 6.3.1, the C99 standard, which permits that syntax, is enabled by default whereas on older compilers it is not.

Can you try switching to the sf/c99-fix branch in which I have committed what I hope is a fix for this and see if it builds correctly, please?

User avatar
bakoulis
Posts: 255
Joined: Wed Feb 08, 2012 9:45 pm
Location: Athens, Greece
Contact:

Re: B-Em

Postby bakoulis » Sat Apr 15, 2017 1:57 pm

The sf/c99-fix branch works!
Move it at master branch.
:D
2xElectron, 3xBBC B, BBC Master.
2xAcorn A310, A420/1, 2xA3000, 2xA3010, A3020, A4000, A5000.
2xRISC PC, Acorn Pocket Book, Acorn Pocket Book II.

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

Re: B-Em

Postby Coeus » Sat Apr 15, 2017 2:22 pm

Ok, that fix is merged into master. The windows ZIP file in the earlier post is unaffected by this change.

User avatar
Darshan
Posts: 7
Joined: Tue Feb 13, 2018 10:07 pm
Contact:

Re: B-Em

Postby Darshan » Wed Feb 14, 2018 6:33 pm

Hi.

I have a few question about B-em:

- How is the transition to GLFW going?
- Why GLFW and not something like SFML that includes both graphics and audio and controllers?
- Is it possible to build with visual studio?
Talk is cheap, show me the code! (cit.)

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

Re: B-Em

Postby Coeus » Fri Feb 16, 2018 7:07 pm

Darshan wrote:- How is the transition to GLFW going?
- Why GLFW and not something like SFML that includes both graphics and audio and controllers?


Where did you see this transition mentioned? There was some discussion around the fact the Allegro 4 library which B-Em uses being old and in consequence not building easily on modern systems and not making best use of their graphics capabilities and therefore a desire to move to something more modern. Porting to SDL was mentioned but in the end an effort was started to port B-Em to a more recent version of Allego, i.e. one of the Allegro 5 series. Allegro is a cross-patform games writing library that provides facilities for graphics, sound and input, though I don't know how well various non-keyboard, non-mouse controllers are supported.

Despite the fact I have been making most of the commits to the B-Em stardot repository recently none of that has been in connection with that porting. Thomas Alan volunteered to lead that activity and without knowing what he has and has not done it is impossible to help with that without the risk of duplication rather than complimentation.

Darshan wrote:- Is it possible to build with visual studio?


I beleive B-Em has been built with Visual Studio in the past and probably can be again. It is not something I have spent any time on, though. My development platform is Linux but I do generally make sure the changes I make compile and run on Windows using the Mingw compiler. Patches to make B-Em compile in Visual Studio would be welcome, provided they don't break compatibility with gcc in either the Mingw or Linux versions.

User avatar
tricky
Posts: 2309
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: B-Em

Postby tricky » Fri Feb 16, 2018 7:16 pm

I did post visual studio project and solution files along with a few minor changes to build on Windows, but I'm not sure where that was.
The biggest problem was finding the correct versions of the libraries, but otherwise it was fine.

User avatar
kieranhj
Posts: 609
Joined: Sat Sep 19, 2015 10:11 pm
Location: Farnham, Surrey, UK
Contact:

Re: B-Em

Postby kieranhj » Fri Feb 16, 2018 11:42 pm

tricky wrote:I did post visual studio project and solution files along with a few minor changes to build on Windows, but I'm not sure where that was.
The biggest problem was finding the correct versions of the libraries, but otherwise it was fine.

I also have a Visual Studio (2015) dev environment set up and wrote down the 32 (!!) steps needed to get there from scratch. Was at least a year ago mind haven’t dared touch it since, not for the faint hearted. Yes, getting the right version of Allegro built plus OpenAL was the biggest pain - b-em itself compiled quite easily being old school C and Win32 forms.
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/

User avatar
Darshan
Posts: 7
Joined: Tue Feb 13, 2018 10:07 pm
Contact:

Re: B-Em

Postby Darshan » Sun Feb 18, 2018 11:40 am

Where did you see this transition mentioned? There was some discussion around the fact the Allegro 4 library which B-Em uses being old and in consequence not building easily on modern systems and not making best use of their graphics capabilities and therefore a desire to move to something more modern.


Here https://github.com/stardot/b-em/blob/master/TODO.md

Am I following the wrong repository?

BTW, allegro 5 is fully supported on Visual Studio, even in NuGet! Using the 5th version should be a one-click problem.
Same goes for OpenAL.

Switching to the 5th version of Allegro should make compilation way easier on visual studio.
Talk is cheap, show me the code! (cit.)

User avatar
ThomasAdam
Posts: 92
Joined: Tue Feb 07, 2017 9:35 am
Location: Southampton, England
Contact:

Re: B-Em

Postby ThomasAdam » Mon Feb 19, 2018 8:48 pm

Hi,

Thanks for the interest. However, my circumstances have changed and I will no longer be working on b-em.

What I leave behind is a good start, the proper procedures---if followed---will work fine. Time will tell how much of this is actually listened to. I don't necessarily like the direction B-em is taking either.

Best of luck!

Thomas

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

Re: B-Em

Postby Coeus » Tue Feb 20, 2018 12:28 am

ThomasAdam wrote:What I leave behind is a good start, the proper procedures---if followed---will work fine. Time will tell how much of this is actually listened to. I don't necessarily like the direction B-em is taking either.


So where is what you leave behind to which you refer?

User avatar
Darshan
Posts: 7
Joined: Tue Feb 13, 2018 10:07 pm
Contact:

Re: B-Em

Postby Darshan » Sun Feb 25, 2018 8:58 am

Bump! :)
Talk is cheap, show me the code! (cit.)

User avatar
vanekp
Posts: 534
Joined: Thu Nov 30, 2000 7:09 am
Location: The Netherlands
Contact:

Re: B-Em

Postby vanekp » Sun Feb 25, 2018 10:10 am

I would think here https://github.com/stardot/b-em
Peter.

User avatar
Darshan
Posts: 7
Joined: Tue Feb 13, 2018 10:07 pm
Contact:

Re: B-Em

Postby Darshan » Sun Feb 25, 2018 3:37 pm

vanekp wrote:I would think here https://github.com/stardot/b-em
Peter.


That is the one I'm following.
Too bad I don't see any commit by Thomas Adams in this one.

I had a quick look at the sources, the codebase needs some refactoring to decrease the coupling with allegro.

Many internal modules (like Z80.C ) link to allegro just to do stuff like append_filename and other stuff that can be rewritten in modern C with less than 10 lines of code.
I would suggest to do an internal helper module with these kind of functions and directly include allegro only in the modules that actually use graphics or I/O features.

Anyway... I don't want to start a fork. If it's possible i want to collaborate with the active one.
Talk is cheap, show me the code! (cit.)

User avatar
hoglet
Posts: 6993
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: B-Em

Postby hoglet » Sun Feb 25, 2018 3:48 pm

Darshan wrote:That is the one I'm following.
Too bad I don't see any commit by Thomas Adams in this one.

Thomas's involvement was Feb/March 2017:
https://github.com/stardot/b-em/search? ... =%E2%9C%93

Most of the work since then has been done by Steve (coeus).

Let's just say there were some differences of opinion between those involved and leave it at that.

Dave

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

Re: B-Em

Postby Coeus » Sun Feb 25, 2018 4:31 pm

Darshan wrote:I had a quick look at the sources, the codebase needs some refactoring to decrease the coupling with allegro.


Allegro attempts to provide a layer on top of the OS to make writing a game (or emulator) that works on multiple OSes easy and, as such, it doesn't restrict its API to graphics but includes other things, like filename handling, that could vary between one OS and another. It is not that filename handling is hard, just OS-specific, though interestingly one can usually do Unix/Linux and Windows by using Unix conventions.

So the API for these non-graphics functions has changed from Allegro 4 to Allegro 5 and you're absolutely right that adds effort to any porting. I don't think that is the dominating factor, though, and I have managed to get a version of B-Em to compile and run with Allegro 5 with the filename issues resolved. To be fair I am starting from the sf/linux-pkg branch and not master as that already reduces dependency on Allegro's filename handling as a side effect of implementing a search for certain files rather than simply assuming they are in the same folder as the executable. That makes it easier to package B-Em into an installable package on Linux which has been requested in the past.

I will be happy to share what I have done when I am back in front of the PC which will probably be later today.

The biggest difference between Allegro 4 and 5 is that Allegro 5 is event driven and I was going to tackle making the keyboard work with events next but I have been hampered because it is currently using too much CPU on other things at the moment for reliable delivery of the keyboard events.

I am very happy for other for other people to contribute any way they feel like.

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

Re: B-Em

Postby Coeus » Sun Feb 25, 2018 6:01 pm

Following on from my last post, I have pushed what I have done so far to a new branch in the Stardot B-Em repository: sf/allegro5

Please note, when I said it compiles, that means it compiles for me and I am using Linux. I don't know if it compiles on MingW on Windows or on Visual Studio. Please don't take that as a bad omen - as far as I am concerned working on Windows is important it is simply that, as that is not by main development platform, my priority was to get it to compile and see how well it runs rather than trying a second compiler/platform. if someone else wants to look at that, be my guest, if not I'll get round to it later.

If you do decide to try compiling it on Windows and find issues with config file-related functions no longer defined this is another area in which the Allergo API has changed. The config.h file in this version of B-Em exports functions with the old API, written on top of the new one, so it just a case of #including config.h

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

Re: B-Em

Postby Coeus » Mon Feb 26, 2018 3:53 am

In the latest version I have pushed I have tamed the CPU usage in video.c by using locked bitmaps and now the keyboard works.

Possible tasks are:

Get the joystick working.
Get the mouse working
Compile on Windows.
Anything else you can think of.

This for the Allegro 5 port - perhaps we should push that into a new thread?

User avatar
Darshan
Posts: 7
Joined: Tue Feb 13, 2018 10:07 pm
Contact:

Re: B-Em

Postby Darshan » Mon Feb 26, 2018 3:50 pm

I'll try to compile it within visual studio as soon as i have time. Thanks
Talk is cheap, show me the code! (cit.)

User avatar
Darshan
Posts: 7
Joined: Tue Feb 13, 2018 10:07 pm
Contact:

Re: B-Em

Postby Darshan » Sun Mar 04, 2018 12:07 am

I managed to compile on Linux. It seems to me that the configure script still wants allegro4, as i can't build according to him.

But i can run make if i have allegro5 installed and it will compile. Too bad i just get a segmentation fault when i try to run it.
Still no idea on how to get it built on visual studio, I'll try to take a closer look tomorrow.

>> This for the Allegro 5 port - perhaps we should push that into a new thread?

I think so.

Maybe a thread inside github?
Talk is cheap, show me the code! (cit.)

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

Re: B-Em

Postby Coeus » Sun Mar 04, 2018 10:02 pm

Darshan wrote:I managed to compile on Linux. It seems to me that the configure script still wants allegro4, as i can't build according to him.


Good point. I didn't change that and, as I have Allegro 4 installed too it didn't complain.

Darshan wrote:But i can run make if i have allegro5 installed and it will compile. Too bad i just get a segmentation fault when i try to run it.
Still no idea on how to get it built on visual studio, I'll try to take a closer look tomorrow.


Can you post a backtrace please?

Darshan wrote:Maybe a thread inside github?


OK, after some fumbling around in GitHub I found the project feature so I have created a project associated with B-Em to cover the porting as a whole. It looks like it uses Issues as the individual tasks so I have created a number for the things I think are outstanding. Feel free to comment on any of them, tackle any of them, or add any others you think I have missed. See https://github.com/stardot/b-em/projects/1

User avatar
Darshan
Posts: 7
Joined: Tue Feb 13, 2018 10:07 pm
Contact:

Re: B-Em

Postby Darshan » Sat Mar 10, 2018 10:26 pm

The error is in model.c line 87, if i just comment the

Code: Select all

set_config_string(models[curmodel].cfgsect, "name", models[curmodel].name);


b-bem will run.
The stack trace is:

Code: Select all

config_set_value () at null:
al_set_config_value () at null:
set_config_string (sect=<optimized out>, key=<optimized out>, value=<optimized out>) at /home/darshan/Codice/bem-allegro5/src/config.c:136
model_init () at /home/darshan/Codice/bem-allegro5/src/model.c:87
main_init (argc=<optimized out>, argv=<optimized out>) at /home/darshan/Codice/bem-allegro5/src/main.c:270
main (argc=1, argv=0x7fffffffe638) at /home/darshan/Codice/bem-allegro5/src/linux.c:141


My linux version is Linux 10.0.0.8 4.15.6-300.fc27.x86_64
Talk is cheap, show me the code! (cit.)

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

Re: B-Em

Postby Coeus » Sun Mar 11, 2018 8:31 pm

Darshan wrote:The error is in model.c line 87, if i just comment the

Code: Select all

set_config_string(models[curmodel].cfgsect, "name", models[curmodel].name);


b-bem will run.


Ok, I can reproduce this if I have no b-em.cfg file available. Then it tries to write to a non-existent config in memory. I am working on a fix but a temporary work-around would be to create an empty b-em.cfg file which it can read. It should be looking for this in the current directory or at ~/.config/b-em/b-em.cfg

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

Re: B-Em

Postby Coeus » Sun Mar 11, 2018 9:32 pm

With reference to https://github.com/stardot/b-em/issues/48

Allegro looks like it moves from proving an M4 macro file for GNU autoconfig to using pkg-config. Anyone know how this integrates with GNU autoconf?

User avatar
Norbert
Posts: 9
Joined: Sat Mar 17, 2018 7:25 pm

Re: B-Em

Postby Norbert » Sat Mar 17, 2018 7:56 pm

I think the § Hardware emulated section of README.md needs to have its

Code: Select all

</code></pre>
moved somewhere else.
Same issue, but less noticable, at the end of the § Video section.

User avatar
Norbert
Posts: 9
Joined: Sat Mar 17, 2018 7:25 pm

Re: B-Em

Postby Norbert » Sat Mar 17, 2018 8:38 pm

Double-posting because this post is of a different nature.

I'm very much an outsider here.
I have no nostalgic feelings towards any Acorn hardware or software.
I've never used any of the actual hardware, I've only tried the B-em and BeebEm emulators.

In my opinion, the loading/ticking/room noises that this emulator makes are truly horrible. I cannot believe that someone thought this is a good idea. :shock: The program's users need to suffer through all the noise even while the program's audio is already playing. I tried both the Linux and Windows (via Wine) versions, the former coming straight from GitHub, and... the noise is on by default. So, it's not just an option that can be turned on, but it's the default!

I suggest turning it off.

(Also, if the "BITSHIFTERS" logo is just part of this emulator and didn't actually show up when booting certain Acorn hardware, I suggest turning that off as well. Although I think perhaps it is, seeing BeebEm is also showing it.)

User avatar
vanekp
Posts: 534
Joined: Thu Nov 30, 2000 7:09 am
Location: The Netherlands
Contact:

Re: B-Em

Postby vanekp » Sat Mar 17, 2018 8:50 pm

what noise are we talking about here, I have not heard any constant noise while the emulator is running, only noise is the tape or disc noise if you have them turned on.

User avatar
Norbert
Posts: 9
Joined: Sat Mar 17, 2018 7:25 pm

Re: B-Em

Postby Norbert » Sat Mar 17, 2018 9:24 pm

vanekp wrote:what noise are we talking about here


Really.

vanekp wrote:if you have them turned on.


Which is the default.

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

Re: B-Em

Postby richardtoohey » Sat Mar 17, 2018 9:29 pm

So are you talking about the disk noises or not?

You don't have to use b-em, and if you do choose to, it's open source, so feel free to change the code and build your own version. Or add a disk noises on/off switch and share your code for the benefit of other people.

User avatar
hoglet
Posts: 6993
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: B-Em

Postby hoglet » Sat Mar 17, 2018 9:53 pm

There already is a disk noise switch in the Settings/Sound menu.

Just turn it off.

This will then be remembered in the config file as the new "default".

Problem solved. :D

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

Re: B-Em

Postby Coeus » Sat Mar 17, 2018 9:58 pm

Norbert wrote:...In my opinion, the loading/ticking/room noises that this emulator makes are truly horrible. I cannot believe that someone thought this is a good idea...


There is certainly more than one school of thought represented here in these forums and I was certainly surprised how much effort people were prepared to devote to emulating not only the functionality but the imperfections of the BBC and hardware it was connected to, for example TVs and various monitors to get a completely authentic experience. All this, while others are designing modern hardware add-ons to get the experience they would have liked to have had, back in the day, like fast SD storage instead of floppies, more colours in the palette etc.

There is nothing new in that, though. Skeuomorphism is a similar concept and appears in commercial products, like calendar apps that have fake rings to represent an old flip calendar or a filofax.

So back to the disc noises, these are an option. From the menu (F11 on Linux, permenently displayed on Windows) choosing Settings->Sound->Disk Drive Noise. It's a toggle and furthermore it saves the setting to the config file so next time you start it, it remembers your preference. We do need a default on the very first time it is started and I don't think anyone has done a survey to see if more people would like it on or off. It only takes a few seconds to change and then you don't have to do it again.

As for the logo, the only place I know B-Em to use a logo that is presented by the emulator itself rather than by the OS is as the icon used for the system menu and when the emulator is minimised. It needs an icon for that purpose, the OWL logo was very familiar from back in the day so why not use that? What would you use instead? Unlike the disc noise that isn't an option but, as Richard says, it is open source so you can easily build it with an alternative you prefer.
Last edited by Coeus on Sat Mar 17, 2018 10:10 pm, edited 2 times in total.