B-Em

discuss bbc micro and electron emulators (including mame) here!
derek
Posts: 200
Joined: Thu May 07, 2015 8:31 pm
Location: Runcorn, UK
Contact:

Re: B-Em

Post by derek »

Hi,

I have the same setup, Linux Mint 19.3 x64, I thought B-Em was working, but it opens the MMB file but does not run the menu or any games on the MMB image.

Maybe time to upgrade to Mint 20...
Regards,

Derek
Coeus
Posts: 2518
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: B-Em

Post by Coeus »

It’s more likely a change to B-Em that is responsible. Which MMB file are you using?
User avatar
bakoulis
Posts: 360
Joined: Wed Feb 08, 2012 9:45 pm
Location: Athens, Greece
Contact:

Re: B-Em

Post by bakoulis »

I using the old unmodified mmb file without any modification. To beebem for windows works as it should.
Responsible is b-em not Linux mint 19 or 20. Don't upgrade for this reason. I am sure, mmb file don't works anymore for nobody.
2xElectron, 3xBBC B, BBC Master.
2xAcorn A310, A420/1, 2xA3000, 2xA3010, A3020, A4000, A5000.
2xRISC PC, Acorn Pocket Book, Acorn Pocket Book II.
derek
Posts: 200
Joined: Thu May 07, 2015 8:31 pm
Location: Runcorn, UK
Contact:

Re: B-Em

Post by derek »

Hi,

I re-compiled B-Em on Linux Mint 19.3 x64 all works great, B-Em loads SSD files perfectly, but when I try to load the MMB file detailed at:

viewtopic.php?p=288472#p288472

Pressing Shift F12 loads the games menu, but no games ssd file arr loaded, gives a Not Found error message.

I will try other MMB files to see if there is a problem with the file.
Regards,

Derek
Coeus
Posts: 2518
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: B-Em

Post by Coeus »

Coeus
Posts: 2518
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: B-Em

Post by Coeus »

I have created a branch with a fix for this: https://github.com/stardot/b-em/tree/sf/issue163

If you build this from GitHub, make sure to switch to the correct branch first as git by default leaves you at master.
User avatar
bakoulis
Posts: 360
Joined: Wed Feb 08, 2012 9:45 pm
Location: Athens, Greece
Contact:

Re: B-Em

Post by bakoulis »

This fix works and eliminate the problem. You can push the fix at master branch.
P.S. the compiled file bem, is almost 2MB bigger than before fix!
2xElectron, 3xBBC B, BBC Master.
2xAcorn A310, A420/1, 2xA3000, 2xA3010, A3020, A4000, A5000.
2xRISC PC, Acorn Pocket Book, Acorn Pocket Book II.
derek
Posts: 200
Joined: Thu May 07, 2015 8:31 pm
Location: Runcorn, UK
Contact:

Re: B-Em

Post by derek »

Hi,

I downloaded the b-em-sf-issue163.zip file from Git Hub, all compiled and worked perfectly, thank you for the quick fix.

I tried an earlier version of B-em, which worked OK, but I do not know the emulator version number, there seems to be no update in the CHANGES file.

It there any chance of any changes to the emulator to to be documented in a log file included with the downloaded source code?

I am interested in the changes made.
Regards,

Derek
Coeus
Posts: 2518
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: B-Em

Post by Coeus »

derek wrote:
Sun Dec 19, 2021 10:21 am
I am interested in the changes made.
I have not been keeping a separate record, i.e. separate from the commit comments in git. You can read the commit comments in GitHub, for example: https://github.com/stardot/b-em/commits/master

In the case of this spefific bug, this is almost certainly due to work to include multi-chunk MMB file support. See viewtopic.php?f=3&t=23435
User avatar
bakoulis
Posts: 360
Joined: Wed Feb 08, 2012 9:45 pm
Location: Athens, Greece
Contact:

Re: B-Em

Post by bakoulis »

I just tried to build a windows b-em from my linux mint box with mkcross.sh
I took allegro errors and download the suggested allegro and unzip it on same folder with b-em folder.
Same errors again like not find the allegro at all. Some help please?

Code: Select all

# takis @ Ryzen5 in ~/download/b-em-master [1:51:52] 
$ ./mkcross.sh

# takis @ Ryzen5 in ~/download/b-em-master [1:51:54] 
$ i686-w64-mingw32-gcc -std=gnu99 -O3 -Wall -DBEM -DVERSION=\"2.2\" -DINCLUDE_DEBUGGER -DUSE_MEMORY_POINTER -I /usr/i686-w64-mingw32/include  -c ../src/6502.c
i686-w64-mingw32-gcc -std=gnu99 -O3 -Wall -DBEM -DVERSION=\"2.2\" -DINCLUDE_DEBUGGER -DUSE_MEMORY_POINTER -I /usr/i686-w64-mingw32/include  -c ../src/6502debug.c
x86_64-w64-mingw32-gcc -std=gnu99 -O3 -Wall -DBEM -DVERSION=\"2.2\" -DINCLUDE_DEBUGGER -DUSE_MEMORY_POINTER -I /usr/i686-w64-mingw32/include  -c ../src/6502.c
x86_64-w64-mingw32-gcc -std=gnu99 -O3 -Wall -DBEM -DVERSION=\"2.2\" -DINCLUDE_DEBUGGER -DUSE_MEMORY_POINTER -I /usr/i686-w64-mingw32/include  -c ../src/6502debug.c
In file included from ../src/6502debug.c:3:0:
../src/b-em.h:7:10: fatal error: allegro5/allegro.h: File or directory not found
 #include <allegro5/allegro.h>
          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from ../src/6502.c:4:0:
../src/b-em.h:7:10: fatal error: allegro5/allegro.h: File or directory not found
 #include <allegro5/allegro.h>
          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
../src/Makefile.win:144: recipe for target '6502debug.o' failed
make: *** [6502debug.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from ../src/6502debug.c:3:0:
../src/b-em.h:7:10: fatal error: allegro5/allegro.h: File or directory not found
 #include <allegro5/allegro.h>
          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
../src/Makefile.win:144: recipe for target '6502.o' failed
make: *** [6502.o] Error 1
../src/Makefile.win:144: recipe for target '6502debug.o' failed
make: *** [6502debug.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from ../src/6502.c:4:0:
../src/b-em.h:7:10: fatal error: allegro5/allegro.h: File or directory not found
 #include <allegro5/allegro.h>
          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
../src/Makefile.win:144: recipe for target '6502.o' failed
make: *** [6502.o] Error 1
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: 2518
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: B-Em

Post by Coeus »

bakoulis wrote:
Tue Dec 21, 2021 11:53 pm
I just tried to build a windows b-em from my linux mint box with mkcross.sh
I was trying to work out what instructions you were following but I assume this is the section in README.md for compiling on Windows but using mkcross.sh instead of makebem.bat.

I wrote mkcross.sh originally for my own purposes and reviewing it, it assumes that there is a cross-compiled Allegro 5 package installed via normal package management, hence this bit:

Code: Select all

        for dll in $dlls $3
        do
            ln -s /usr/$2/bin/$dll $dir
        done
which is copying this set of DLLs:

Code: Select all

dlls='allegro-5.2.dll             allegro_acodec-5.2.dll
      allegro_audio-5.2.dll       allegro_dialog-5.2.dll
      allegro_font-5.2.dll        allegro_image-5.2.dll
      allegro_primitives-5.2.dll  libstdc++-6.dll
      libwebp-7.dll               libwinpthread-1.dll
      OpenAL32.dll                zlib1.dll'
into the directory that will subsequently be zipped up. If these were built in a parallel directory rather than installed as packages then they wouldn't be coming from /usr/$2/bin. That also means the includes files for the cross-compiled Allegro5 will also be coming from a standard system location that the cross-compiler searches by default.

I am on Arch Linux and the package I have installed to support this is: mingw-w64-allegro 5.2.6.0-0. Maybe Mint has a similar package? If not we can probably enhance the mkcross.sh script to be able to cope with things in a user-selected location.
User avatar
bakoulis
Posts: 360
Joined: Wed Feb 08, 2012 9:45 pm
Location: Athens, Greece
Contact:

Re: B-Em

Post by bakoulis »

I can't crosscompiling with my linux box.
Can you compile windows builds every few weeks with new futures and uploaded to github?
I want to play with wine on linux
2xElectron, 3xBBC B, BBC Master.
2xAcorn A310, A420/1, 2xA3000, 2xA3010, A3020, A4000, A5000.
2xRISC PC, Acorn Pocket Book, Acorn Pocket Book II.
User avatar
bakoulis
Posts: 360
Joined: Wed Feb 08, 2012 9:45 pm
Location: Athens, Greece
Contact:

Re: B-Em

Post by bakoulis »

For example, this windows build affected from MMB "file not found" bug!
https://github.com/stardot/b-em/release ... f%2Fspeech
Needs recompilation with the latest fixes.
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: 2518
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: B-Em

Post by Coeus »

I have added a new release with pre-built Windows versions: https://github.com/stardot/b-em/releases/tag/sr/mmbfix
User avatar
bakoulis
Posts: 360
Joined: Wed Feb 08, 2012 9:45 pm
Location: Athens, Greece
Contact:

Re: B-Em

Post by bakoulis »

Coeus wrote:
Sat Dec 25, 2021 5:58 pm
I have added a new release with pre-built Windows versions: https://github.com/stardot/b-em/releases/tag/sr/mmbfix
Very nice.
:D =D>
2xElectron, 3xBBC B, BBC Master.
2xAcorn A310, A420/1, 2xA3000, 2xA3010, A3020, A4000, A5000.
2xRISC PC, Acorn Pocket Book, Acorn Pocket Book II.
User avatar
tricky
Posts: 6017
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: B-Em

Post by tricky »

The slightly off timing seems to make the hang bug happen much more often with the TrickyArcade build, which is great as I couldn't reproduce it in anything that I could debug before :)

PS I think the timing of whatever it is is only off by a cycle or two!
Attachments
CCSpeaking.ssd
(36.5 KiB) Downloaded 5 times
AstroBlaster.ssd
(78.25 KiB) Downloaded 6 times
Coeus
Posts: 2518
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: B-Em

Post by Coeus »

tricky wrote:
Sun Jan 02, 2022 10:54 am
The slightly off timing seems to make the hang bug happen much more often with the TrickyArcade build, which is great as I couldn't reproduce it in anything that I could debug before :)

PS I think the timing of whatever it is is only off by a cycle or two!
Sorry, timing slightly off between what?
User avatar
tricky
Posts: 6017
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: B-Em

Post by tricky »

The display in Astro Blaster jumps quite often, but on real hardware this is extremely rare, and I suspect that the timing of interrupts or the vsync being flagged to the via is off by a few cycles.

PS I have added some candidates to the Astro Blaster thread to try on HW that work much better with B-Em.
Last edited by tricky on Mon Jan 03, 2022 12:53 pm, edited 1 time in total.
User avatar
tricky
Posts: 6017
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: B-Em

Post by tricky »

B-Em has helped me find my bug :)

I have also noticed that all empty SW slots get set to RAM, even in Models that don't have SWRAM. If you reset them back to ROM, a Hard Reset sets them back to RAM again.
Coeus
Posts: 2518
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: B-Em

Post by Coeus »

tricky wrote:
Mon Jan 03, 2022 12:03 pm
B-Em has helped me find my bug :)
That's good to hear. I still suspect there is an inaccuracy in B-Em's emulation but it is clearly one that is not often provoked.
tricky wrote:
Mon Jan 03, 2022 12:03 pm
I have also noticed that all empty SW slots get set to RAM, even in Models that don't have SWRAM. If you reset them back to ROM, a Hard Reset sets them back to RAM again.
This is all determined, or at least should be determined, by which of a number of memory setup functions is associated with the model. The choices are:
  • swram - fill any empty ROM slots with sideways RAM.
  • os01 - all ROM slots contain the ROM specified for slot 15 (usually BASIC).
  • std - slots with no ROM specified remain empty.
  • bp128 - set up sideways RAM In the specific slots for a B+ 128K
  • master - set up sideways RAM In the specific slots for the MAster 128.
So the model "BBC B w/8271 FDC" should have empty slots as empty as it has:

Code: Select all

[model_03]
name=BBC B w/8271 FDC
fdc=i8271
...
romsetup=std
whereas "BBC B w/8271+SWRAM" would have sideways RAM In all empty slots as it has:

Code: Select all

[model_04]
name=BBC B w/8271+SWRAM
fdc=i8271
...
romsetup=swram
User avatar
tricky
Posts: 6017
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: B-Em

Post by tricky »

Thanks, I'll see if I can find out what was happening. Just to confirm, it was the speech build.
User avatar
tricky
Posts: 6017
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: B-Em

Post by tricky »

List of "B" models by romsetup=

romsetup=std
BBC B w/8271 FDC
BBC B US
BBC B German

romsetup=swram
BBC B w/8271+SWRAM
BBC B w/1770 FDC
BBC B wo/FDC w/SWRAM
BBC B w/Solidisk 1770 FDC
BBC B w/Opus 1770 FDC
BBC B w/Watford 1770 FDC
BBC B with 65C02, no FDC
BBC B, 65C02, Acorn 1770
BBC B w/Test ROM
BBC B w/1770 FDC + Integra B
BBC B w/8271 FDC + Integra B

romsetup=os01
BBC B w/OS 0.1

Looks like there are quite a few with swram that don't have it in the name, so I was probably using one of them.
User avatar
tricky
Posts: 6017
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: B-Em

Post by tricky »

It looks like when the speech stops working, it is because it is never flagging that there is room for more data.
It must be doing it for a while otherwise there would be no speech.
I don't know why starwars works OK.
User avatar
tricky
Posts: 6017
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: B-Em

Post by tricky »

I tried building the speech version from source and have hit a few problems:
The speech and mmb files are excluded from the build in the .vcxproj.
Allegro seems to be using unix functions on windows:
Build started...

Code: Select all

1>------ Build started: Project: b-em, Configuration: Debug Win32 ------
1>gui-allegro.obj : error LNK2019: unresolved external symbol _pclose referenced in function _file_print_close_pipe
1>gui-allegro.obj : error LNK2019: unresolved external symbol _popen referenced in function _file_print_pipe
1>D:\DATA\BBC\Emulators\20211225_b-em-b9e77b2-w64-speech_src\b-em-sf-speech\b-em.exe : fatal error LNK1120: 2 unresolved externals
1>Done building project "b-em.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I'll investigate further and add a dummy lib if necessary.
User avatar
tricky
Posts: 6017
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: B-Em

Post by tricky »

I've had a quick debug of speech and it looks like the fifo gets empty, which it shouldn't unless the speech is running at wall clock speed as the debug build is running at 1/4 speed. Somehow, the fifo fills again, but doesn't start speaking again.

Code: Select all

		speech_fifo_count	12
		speech_TALKD	false
		speech_TALK	false
...
OK, I think the problem is that B-Em in the speech build isn't always running at full frame rate.
If I run the emulator at 150% it is fine as the speech still runs at normal speed and the FIFO will still have data in it for longer from the 6502's point of view.
I suspect that it is when there is a lot on screen, or maybe when the palette is reprogrammed.
Anyway, I have an i7, so there should be plenty of performance there - I would hope.
...
A quick and dirty profile gives:
25% in video_poll, with nearly 1/3 of that in nula_putpixel, but there is a fair amount of work there.
9% in m6502_exec which again seems reasonable as it has a lot to do.
1% sound_poll pretty good
0.5% speech very good
However as only 47% of the time is spent in main() and its children, there is probably a second thread not doing much so those %s could be doubled!
Coeus
Posts: 2518
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: B-Em

Post by Coeus »

tricky wrote:
Tue Jan 04, 2022 12:57 pm
It looks like when the speech stops working, it is because it is never flagging that there is room for more data.
It must be doing it for a while otherwise there would be no speech.
I don't know why starwars works OK.
So which game/demo is it in which speech stops working? I used the starwars speech demo as the test case for the speak external feature.
tricky wrote:
Tue Jan 04, 2022 12:57 pm
The speech and mmb files are excluded from the build in the .vcxproj.
I think that just means you're the first person to build it with VS since these were added. Can you commit the new .vcxproj file?
tricky wrote:
Tue Jan 04, 2022 5:22 pm
gui-allegro.obj : error LNK2019: unresolved external symbol _pclose referenced in function _file_print_close_pipe
1>gui-allegro.obj : error LNK2019: unresolved external symbol _popen referenced in function _file_print_pipe
That should be within conditional compilation but either isn't or the test isn't quite right. I'll have a look at that.
tricky wrote:
Tue Jan 04, 2022 6:05 pm
I've had a quick debug of speech and it looks like the fifo gets empty, which it shouldn't unless the speech is running at wall clock speed as the debug build is running at 1/4 speed. Somehow, the fifo fills again, but doesn't start speaking again.
My first attempt had the speech processor's regular polling being driven by the Allegro sound system, i.e. it did the synthesis when Allegro wanted more sound samples. That worked very well for speaking from the PHROM but not for speak external and the starwars demo as it would fill the FIFO then, when the event happened to feed more data to the sound system, the speech synthesis would run out of data before the 6502 emulation got to run again and thus give a chance for the FIFO to be re-filled.

So in the current version there is a call from otherstuff_poll in 6502.c
tricky wrote:
Tue Jan 04, 2022 6:05 pm
OK, I think the problem is that B-Em in the speech build isn't always running at full frame rate.
If I run the emulator at 150% it is fine as the speech still runs at normal speed and the FIFO will still have data in it for longer from the 6502's point of view.
There is something strange going in here then. If the emulation was host CPU limited it should not run any faster when you increase the speed in the UI as this just reduces the amount of waiting between frames - if the CPU was fully busy there should be no waiting anyway.

One suspicion is that is may be connected with al_flip_display which is documented as maybe waiting for sync and maybe not. IIRC we added a hint to try to get it to do one or the other but it doesn't seem to be an easy API to work with. If Allegro is waiting for frame sync in al_flip_display and then B-Em is waiting one frame period in its main loop then it would run at about half speed.

On the speech speed remaining constant despite variations in emulator speed, that is presumably because there is still a dependency on the sample rate. One idea would be to run the speech_poll function a little more often, i.e. after fewer 6502 cycles, to see if that resolves it.
tricky wrote:
Tue Jan 04, 2022 6:05 pm
However as only 47% of the time is spent in main() and its children, there is probably a second thread not doing much so those %s could be doubled!
47% of CPU time used, or 47% of wall-clock time?
User avatar
tricky
Posts: 6017
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: B-Em

Post by tricky »

Sorry, I don't do git.

It wasn't constantly slow, just some slow frames.

47% of CPU cycles, but it was probably two threads.

I'm not sure how the poll time would help unless it is very infrequent.
Post Reply

Return to “8-bit acorn emulators”