B-Em

want to talk about MESS/model b/beebem/b-em/electrem/elkulator? do it here!
User avatar
ThomasAdam
Posts: 91
Joined: Tue Feb 07, 2017 9:35 am
Location: Southampton, England
Contact:

Re: B-Em

Postby ThomasAdam » Sat Feb 25, 2017 6:30 pm

Cool... Dave's changes for 32016 emulation are now complete and have been merged to master. I've no idea what PanOs is, but it appears to be doing something for me! Great work, Dave! :)

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

Re: B-Em

Postby hoglet » Sat Feb 25, 2017 6:58 pm

ThomasAdam wrote:If the test program for allegro is still failing, I want to know why, with -Werror enabled. It's not good enough to just blindly disable it at this point -- so can you add it back in, hoglet, run ./autogen.sh and send the config.log my way if it's still failing for you, please?

This commit a few days ago fixed the autogen issue I was having with allegro:
https://github.com/stardot/b-em/commit/ ... 5eaaa65b47

I've not had any issues since.

Tomorrow I'll ZIP up the MinGW environment that I'm using. It's pretty old though!

Dave

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

Re: B-Em

Postby Coeus » Sat Feb 25, 2017 6:59 pm

ThomasAdam wrote:If the test program for allegro is still failing, I want to know why, with -Werror enabled. It's not good enough to just blindly disable it at this point -- so can you add it back in, hoglet, run ./autogen.sh and send the config.log my way if it's still failing for you, please?


Is this a custom test program? The problem is that the autoconf macos generate test programs that generate warnings. So if you want to use autoconf with -Werror you have to write just about every test yourself and we shouldn't be doing that as it like having a dog and barking yourself.

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

Re: B-Em

Postby ThomasAdam » Sat Feb 25, 2017 7:04 pm

Coeus wrote:
ThomasAdam wrote:If the test program for allegro is still failing, I want to know why, with -Werror enabled. It's not good enough to just blindly disable it at this point -- so can you add it back in, hoglet, run ./autogen.sh and send the config.log my way if it's still failing for you, please?


Is this a custom test program? The problem is that the autoconf macos generate test programs that generate warnings. So if you want to use autoconf with -Werror you have to write just about every test yourself and we shouldn't be doing that as it like having a dog and barking yourself.


The only test program we have right now is the one in allegro.m4, and as far as I am aware, I've fixed all the warnings that were present in it -- certainly for me it's been working for some time now. So if there is a genuine failure with that, the config.log will tell us and we should fix it. There's no guarantee that it's anything to do with allegro -- depending on where autotools is doing it's checking, it could easily be that the allegro check is a convenient stopping point for it.

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

Re: B-Em

Postby hoglet » Sun Feb 26, 2017 11:26 am

Coeus wrote:I did try to see if I could build it on Windows myself in MingW but it is not finding the direct X header file and the previous MS download site seems to have gone away. Do you have either an ZIPable build environment or a crib sheet that would get me started? I was thinking to start with MingW first. Windows 7 or 10 are fine for the target, I don't have access to 8 or 8.1.

Here is a copy of the MinGW environment I'm using:
https://www.dropbox.com/s/t7npyinl5aszr ... W.zip?dl=0

This needs to be unzipped to the root of your C: drive (or you need to change the paths in cleanbem.bat and makebem.bat).

As a test, try building from this commit:
https://github.com/hoglet67/b-em/commit ... cea6f0733c

You need to use a windows command prompt (git bash doesn't work):

Code: Select all

C:\b-em>cleanem.bat
del *.o *.exe *.res

C:\b-em>makebem.bat
windres.exe -i b-em.rc --input-format=rc -o b-em.res -O coff
gcc.exe -O3 -DBEM  -DVERSION= -c compat_wrappers.c
gcc.exe -O3 -DBEM  -DVERSION= -c 6502.c
gcc.exe -O3 -DBEM  -DVERSION= -c 6502tube.c
gcc.exe -O3 -DBEM  -DVERSION= -c NS32016/32016.c
gcc.exe -O3 -DBEM  -DVERSION= -c NS32016/Decode.c
gcc.exe -O3 -DBEM  -DVERSION= -c NS32016/mem32016.c
gcc.exe -O3 -DBEM  -DVERSION= -c NS32016/Trap.c
gcc.exe -O3 -DBEM  -DVERSION= -c NS32016/Profile.c
gcc.exe -O3 -DBEM  -DVERSION= -c NS32016/NSDis.c
gcc.exe -O3 -DBEM  -DVERSION= -c 65816.c
gcc.exe -O3 -DBEM  -DVERSION= -c acia.c
gcc.exe -O3 -DBEM  -DVERSION= -c adc.c
gcc.exe -O3 -DBEM  -DVERSION= -c adf.c
gcc.exe -O3 -DBEM  -DVERSION= -c arm.c
gcc.exe -O3 -DBEM  -DVERSION= -c cmos.c
gcc.exe -O3 -DBEM  -DVERSION= -c compact_joystick.c
gcc.exe -O3 -DBEM  -DVERSION= -c compactcmos.c
gcc.exe -O3 -DBEM  -DVERSION= -c config.c
gcc.exe -O3 -DBEM  -DVERSION= -c csw.c
gcc.exe -O3 -DBEM  -DVERSION= -c ddnoise.c
gcc.exe -O3 -DBEM  -DVERSION= -c debugger.c
gcc.exe -O3 -DBEM  -DVERSION= -c disc.c
gcc.exe -O3 -DBEM  -DVERSION= -c fdi2raw.c
gcc.exe -O3 -DBEM  -DVERSION= -c fdi.c
gcc.exe -O3 -DBEM  -DVERSION= -c i8271.c
gcc.exe -O3 -DBEM  -DVERSION= -c ide.c
gcc.exe -O3 -DBEM  -DVERSION= -c keyboard.c
gcc.exe -O3 -DBEM  -DVERSION= -c logging.c
gcc.exe -O3 -DBEM  -DVERSION= -c main.c
gcc.exe -O3 -DBEM  -DVERSION= -c mem.c
gcc.exe -O3 -DBEM  -DVERSION= -c model.c
gcc.exe -O3 -DBEM  -DVERSION= -c mouse.c
gcc.exe -O3 -DBEM  -DVERSION= -c music5000.c
gcc.exe -O3 -DBEM  -DVERSION= -c pal.c
gcc.exe -O3 -DBEM  -DVERSION= -c savestate.c
gcc.exe -O3 -DBEM  -DVERSION= -c scsi.c
gcc.exe -O3 -DBEM  -DVERSION= -c serial.c
gcc.exe -O3 -DBEM  -DVERSION= -c sn76489.c
gcc.exe -O3 -DBEM  -DVERSION= -c sound.c
gcc.exe -O3 -DBEM  -DVERSION= -c soundopenal.c
gcc.exe -O3 -DBEM  -DVERSION= -c ssd.c
gcc.exe -O3 -DBEM  -DVERSION= -c sysvia.c
gcc.exe -O3 -DBEM  -DVERSION= -c tape.c
gcc.exe -O3 -DBEM  -DVERSION= -c tapenoise.c
gcc.exe -O3 -DBEM  -DVERSION= -c tube.c
gcc.exe -O3 -DBEM  -DVERSION= -c uef.c
gcc.exe -O3 -DBEM  -DVERSION= -c uservia.c
gcc.exe -O3 -DBEM  -DVERSION= -c vdfs.c
gcc.exe -O3 -DBEM  -DVERSION= -c via.c
gcc.exe -O3 -DBEM  -DVERSION= -c vidalleg.c
gcc.exe -O3 -DBEM  -DVERSION= -c video.c
gcc.exe -O3 -DBEM  -DVERSION= -c wd1770.c
gcc.exe -O3 -DBEM  -DVERSION= -c win.c
win.c: In function 'WindowProcedure':
win.c:614:25: warning: passing argument 3 of 'getfile' from incompatible pointer
 type [enabled by default]
win.c:413:12: note: expected 'char *' but argument is of type 'void (*)(const ch
ar *)'
gcc.exe -O3 -DBEM  -DVERSION= -c win-catalogue.c
gcc.exe -O3 -DBEM  -DVERSION= -c win-keydefine.c
gcc.exe -O3 -DBEM  -DVERSION= -c x86.c
gcc.exe -O3 -DBEM  -DVERSION= -c z80.c
g++.exe -O3 -DBEM  -DVERSION= -c resid.cc
g++.exe -O3 -DBEM  -DVERSION= -c resid-fp/convolve.cc
g++.exe -O3 -DBEM  -DVERSION= -c resid-fp/envelope.cc
g++.exe -O3 -DBEM  -DVERSION= -c resid-fp/extfilt.cc
g++.exe -O3 -DBEM  -DVERSION= -c resid-fp/filter.cc
g++.exe -O3 -DBEM  -DVERSION= -c resid-fp/pot.cc
g++.exe -O3 -DBEM  -DVERSION= -c resid-fp/sid.cc
g++.exe -O3 -DBEM  -DVERSION= -c resid-fp/voice.cc
g++.exe -O3 -DBEM  -DVERSION= -c resid-fp/wave6581__ST.cc
g++.exe -O3 -DBEM  -DVERSION= -c resid-fp/wave6581_P_T.cc
g++.exe -O3 -DBEM  -DVERSION= -c resid-fp/wave6581_PS_.cc
g++.exe -O3 -DBEM  -DVERSION= -c resid-fp/wave6581_PST.cc
g++.exe -O3 -DBEM  -DVERSION= -c resid-fp/wave8580__ST.cc
g++.exe -O3 -DBEM  -DVERSION= -c resid-fp/wave8580_P_T.cc
g++.exe -O3 -DBEM  -DVERSION= -c resid-fp/wave8580_PS_.cc
g++.exe -O3 -DBEM  -DVERSION= -c resid-fp/wave8580_PST.cc
g++.exe -O3 -DBEM  -DVERSION= -c resid-fp/wave.cc
gcc.exe compat_wrappers.o 6502.o 6502tube.o 32016.o Decode.o mem32016.o Trap.o P
rofile.o NSDis.o 65816.o acia.o adc.o adf.o arm.o cmos.o compact_joystick.o comp
actcmos.o config.o csw.o ddnoise.o debugger.o disc.o fdi2raw.o fdi.o i8271.o ide
.o keyboard.o logging.o main.o mem.o model.o mouse.o music5000.o pal.o savestate
.o scsi.o serial.o sn76489.o sound.o soundopenal.o ssd.o sysvia.o tape.o tapenoi
se.o tube.o uef.o uservia.o vdfs.o via.o vidalleg.o video.o wd1770.o win.o win-c
atalogue.o win-keydefine.o x86.o z80.o resid.o b-em.res convolve.o envelope.o ex
tfilt.o filter.o pot.o sid.o voice.o wave6581__ST.o wave6581_P_T.o wave6581_PS_.
o wave6581_PST.o wave8580__ST.o wave8580_P_T.o wave8580_PS_.o wave8580_PST.o wav
e.o -o "b-em.exe" -mwindows -lalleg -lz -lalut -lopenal32 -lgdi32 -lwinmm -lstdc++
C:\b-em>

Within the MinGW folder is a runtime for B-Em with all the required ROMs, shared libraries, etc. Just replace the b-em executable there with the one you have just built and it should run fine. We can probably avoid this step if we check the windows shared libraries into github.

Dave

User avatar
pstnotpd
Posts: 392
Joined: Wed Jan 20, 2010 11:05 am

Re: B-Em

Postby pstnotpd » Sun Feb 26, 2017 8:14 pm

Well, I've had a go at compiling b-em to native w64 using mingw64 but it didn't succeed.

The main problem now is the allegro 4 dependency. I couldn't find a good description how to "install" allegro 4 on a fresh msys2 w64. Pacman installs allegro 5 but that isn't recognized during configure.

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

Re: B-Em

Postby ThomasAdam » Sun Feb 26, 2017 8:46 pm

Rich Talbot-Watkins wrote:Incidentally I would go with something like GLFW + OpenGL, rather than SDL. If you go straight to OpenGL, this opens up the possibility to use shaders to perform various special effects, such as screen distortion, colour bleeding, that kind of thing :)


I've used GLFW before, and it's a breeze. But it doesn't do anything else in terms of toolkits, as you've noted.

I think at this point I've come to a conclusion: transition to Allegro5.

Allegro5 has native backings to GTK, which will allow for things like menus, etc. There's even example programs in their source:

https://github.com/liballeg/allegro5/bl ... /ex_menu.c

On Windows, it's a native, too.

I suspect this is the way forward, but I'll investigate a bit more for those on !Windows before making a suggestion.

-- Thomas

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

Re: B-Em

Postby hoglet » Sun Feb 26, 2017 9:02 pm

ThomasAdam wrote:I think at this point I've come to a conclusion: transition to Allegro5.

When I did a port of Atomulator to the Raspberry Pi a couple of years ago, I was forced to update to Allergo5, as Allegro 4 didn't support the Pi.

It was quite a big re-write of the UI, not least because Allegro5 on the Pi didn't support native menus. I ended up using a simple widget library called TGUI:
https://github.com/hoglet67/Optima/tree/master/src/tgui

It looks like this is still being developed:
https://github.com/Nooskewl/tgui2

Atomulator and B-Em are very similar, both being written by the same person (Sarah Walker). There might be some leverage.

Dave

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

Re: B-Em

Postby Coeus » Mon Feb 27, 2017 8:20 pm

hoglet wrote:It was quite a big re-write of the UI, not least because Allegro5 on the Pi didn't support native menus...


I wonder what is different about the Pi compared to other Linux systems. I know GNOME is generally too heavyweight to use on the Pi and that a desktop environment would usually be a lightweight one but does that mean GTK+ cannot be installed if that is what allegro relies on? Or is the issue that you are trying to run the emulator with just the framebuffer, i.e. without a windowing/desktop environment at all and toolkit-based UIs assume some kind of Windows system running like X11 or Wayland?

What is hardware acceleration useful for in B-Em? Is it limited to hardware scaling of the emulated BBC micro screen to a different size (maybe full-screen) on the host? I'm just raising the issue that one doesn't necessarily need the library that provides the best feature set for accelerated graphics, just the one that does what you need.

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

Re: B-Em

Postby tricky » Tue Feb 28, 2017 6:50 am

Being able to go full screen at 50hz and sync with the monitor is worth having and some people like to have various effects applied like some temporal blurring or smoothing to look more like a CRT.

harrowm
Posts: 121
Joined: Sun Nov 30, 2014 11:07 pm
Location: Singapore

Re: B-Em

Postby harrowm » Sun Mar 05, 2017 11:23 am

AtomulatorOSX is a port to Allegro5 too as Allegro4 doesn't work on Mac. It uses native menus. It reuses some of the clever bits from Optima too ! if you search the Atom forum for AtomulatorOSX you'll find a link to the code on GitHub.

With Allegro5 you can call down to OpenGL shaders etc to mimic a CRT monitor blur btw. If you google, you can find some examples for an NES emulator iirc.

Allegro5 is also trivial to install under the latest Visual Studio using nupkg (again iirc).

Cheers
Malcolm

User avatar
fordp
Posts: 923
Joined: Sun Feb 12, 2012 9:08 pm
Location: Kent, England

Re: B-Em

Postby fordp » Sun Mar 12, 2017 1:41 pm

hoglet wrote:Here is a copy of the MinGW environment I'm using:
https://www.dropbox.com/s/t7npyinl5aszr ... W.zip?dl=0

This needs to be unzipped to the root of your C: drive (or you need to change the paths in cleanbem.bat and makebem.bat).

As a test, try building from this commit:
https://github.com/hoglet67/b-em/commit ... cea6f0733c

You need to use a windows command prompt (git bash doesn't work):
[code]
C:\b-em>cleanem.bat
del *.o *.exe *.res

C:\b-em>makebem.bat
Dave


I just got round to trying this using the page from the Wiki. I found the page a little confusing as:
1) I use the "Atlassian Source Tree" mainly to drive git and already had git installed. Can we not just say clone b-em and then point to say this page: https://help.github.com/articles/cloning-a-repository/. This is a wiki on Github after all!

2) The clean batch file is not called cleanbem.bat as far as I can see. I have updated the wiki to reflect the current name there is a typo somewhere.

Anyway I have a WIndows Exe thanks Dave and everybody else for your efforts.
FordP (Simon Ellwood)
Time is an illusion. Lunchtime, doubly so!

User avatar
fordp
Posts: 923
Joined: Sun Feb 12, 2012 9:08 pm
Location: Kent, England

Re: B-Em

Postby fordp » Sun Mar 12, 2017 1:48 pm

Well my home build EXE works, yay.

My first comment on opening it is within a minute I miss MMFS.

It is very strange to me that my real Master is easier to use as I can change virtual floppies much easier.
FordP (Simon Ellwood)
Time is an illusion. Lunchtime, doubly so!

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

Re: B-Em

Postby hoglet » Sun Mar 12, 2017 2:14 pm

I'm pleased you have it working Ford.

BTW, the cleanbem.bat / cleanem.bat confusion is just a typo in the script name (it should be cleanbem.bat).

I'll correct this in due course.

Dave

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

Re: B-Em

Postby Coeus » Sun Mar 12, 2017 6:46 pm

fordp wrote:My first comment on opening it is within a minute I miss MMFS.

It is very strange to me that my real Master is easier to use as I can change virtual floppies much easier.


I have yet to use MMFS, though I do have an SD interface with MMFS on order. What makes it more convenient to change floppies compared to choosing an image file from the B-Em menu?

B-em does support emulated SCSI and IDE hard disks as well as direct access to the host FS via VDFS.

User avatar
fordp
Posts: 923
Joined: Sun Feb 12, 2012 9:08 pm
Location: Kent, England

Re: B-Em

Postby fordp » Sun Mar 12, 2017 7:15 pm

You have over a hundred floppies on hand which are just a "*DIN" command away.

I booted in to the 32016 and my muscle memory wanted to type:
*DIN 86
*BAS32

Which would have loaded basic.
FordP (Simon Ellwood)
Time is an illusion. Lunchtime, doubly so!

startape
Posts: 3
Joined: Sun Feb 19, 2017 6:05 pm

Re: B-Em

Postby startape » Sun Mar 12, 2017 9:45 pm

Hi,

Can i ask what the dev model is for contributing to b-em?

i would like to submit a patch to fix emulation in *TAPE command - but i see on github that some pull-requests are blocked until a review? why?

there is one pull request still blocked (to do with logs or something) - would that stop my request when i submit it?

- StarTape

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

Re: B-Em

Postby Coeus » Sun Mar 12, 2017 11:08 pm

startape wrote:Hi,

Can i ask what the dev model is for contributing to b-em?

i would like to submit a patch to fix emulation in *TAPE command - but i see on github that some pull-requests are blocked until a review? why?

there is one pull request still blocked (to do with logs or something) - would that stop my request when i submit it?

- StarTape


ThomasAdam reviews pull requests and merges them if he feels like it. For why pull request #17 is not merged you'd have to read the comments to get both sides of the story. That doesn't stop you putting your own request in.

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

Re: B-Em

Postby tricky » Sun Mar 19, 2017 11:18 am

I love b-em, but can't use it in fullscreen mode as it flickers, as if there is a white window behind the emulator that keeps breaking through every second or two for part of a frame. Occasionally it is fine, but mostly, it does the flickering thing. Sometimes the flickering settles down and sometimes not. It seems worse the sooner I swap to full screen after starting the emulator, but this may just be my imagination.
I am running windows7 64 bit using the i5 (HD 2000) graphics with the latest driver and nothing I do seems to stop it.
Everything else is fine, so I am suspecting an allegro issues as it is very old.

Does anyone have any suggestion?

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

Re: B-Em

Postby hoglet » Sun Mar 19, 2017 11:38 am

Hi Tricky
tricky wrote:Does anyone have any suggestion?

It sounds like what you are experiencing is much worse than what I'm seeing.

Does the Video/Display Type setting make any difference?

When I change to full screen there is one white flash, but then it's fine.

However, there are two other issues:
- The screen is the wrong aspect ratio (i.e. not 4:3)
- There doesn't see to be any access to the menus in full screen mode

Can you post the b-em.exe file you are using, and I'll give it a try on my system.

Dave

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

Re: B-Em

Postby tricky » Sun Mar 19, 2017 12:52 pm

It seems to have stopped again, it isn't even flashing once now!
You can run it with -fullscreen to swap after a fraction of a second!
On windows, you can use ALT and the first letter of the sub-menu to bring up the menu in full screen mode.
I'll try and reproduce it, but it isn't happening through my launcher now either and I haven't changed anything!
The same thing was happening with the m5000 one you posted, but that isn't doing it either, so something must have changed on my end - WINDOWS!!!
Attachments
b-em-joymap.zip
(230.4 KiB) Downloaded 10 times

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

Re: B-Em

Postby tricky » Sun Mar 19, 2017 3:23 pm

I was doing some more digging and it looks like about half an hour after i tried Windows update to check my drivers, the driver was updated even though the update didn't find anything!
So, it looks like i owe Allegro an apology, sorry.

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

Re: B-Em

Postby hoglet » Sun Mar 19, 2017 4:28 pm

Hi Tricky,

Glad you got it sorted.

Dave

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

Re: B-Em

Postby Coeus » Sun Mar 19, 2017 6:53 pm

tricky wrote:I was doing some more digging and it looks like about half an hour after i tried Windows update to check my drivers, the driver was updated even though the update didn't find anything!
So, it looks like i owe Allegro an apology, sorry.


Some things never change. I remember 20 years ago when people complained their PC used to crash fairly regularly the most likely thing to resolve the issue was to update the graphics card driver. That was at a time when the manufacturers used to publish them on their own websites rather than have a co-ordinated update mechanism.

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

Re: B-Em

Postby Coeus » Sun Mar 19, 2017 7:20 pm

I was just reflecting on various outstanding things with B-Em. These are the ones I know about:

1. The the work to support debugging on tube processors: 6502, Z80 and NS32016 done, 65816, ARM and X86 to go.
2. I have another small bug-fix to VDFS.
3. Simon's idea abount *command passthrough.
4. Simon's idea about implementing something like MMFS.
5. I have an old branch with some improvements to the 1770 and disc access to support non-Acorn DFSs, e.g. Watford,. Opus, Solidisk.
6. I'd still like to get to the bottom of the Music 5000 behaving differently on Windows/Linux.
7. There is Thomas's idea of a port to Allegro5.

What do we want to do about releases? Do we have anything resembling a test suite that should run successfully before declaring a release? I know there are a couple of CPU test programs but what about I/O filesystem tests? Are there games that are considered a good test, for example Elite with the split screen mode?

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

Re: B-Em

Postby ThomasAdam » Sun Mar 19, 2017 7:52 pm

Coeus wrote:I was just reflecting on various outstanding things with B-Em. These are the ones I know about:

1. The the work to support debugging on tube processors: 6502, Z80 and NS32016 done, 65816, ARM and X86 to go.
2. I have another small bug-fix to VDFS.
3. Simon's idea abount *command passthrough.
4. Simon's idea about implementing something like MMFS.
5. I have an old branch with some improvements to the 1770 and disc access to support non-Acorn DFSs, e.g. Watford,. Opus, Solidisk.
6. I'd still like to get to the bottom of the Music 5000 behaving differently on Windows/Linux.
7. There is Thomas's idea of a port to Allegro5.


Should any of these go into the TODO.md file? If so, that's what it's there for -- feel free to update it.

Coeus wrote:What do we want to do about releases? Do we have anything resembling a test suite that should run successfully before declaring a release?


No test suite that I've seen, and certainly no CI as yet -- as I've probably mentioned, until Travis-CI get back to me, it's a best-efforts for now not to break master -- hence why it's a protected branch for the time-being.

Making a release will require me to update Autotools -- it has such a feature. I'll do that this week, and document it, such that it spits out a tarball and zip file, etc.

Kindly,
Thomas

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

Re: B-Em

Postby Coeus » Sun Mar 19, 2017 8:05 pm

ThomasAdam wrote:Should any of these go into the TODO.md file? If so, that's what it's there for -- feel free to update it.


I hadn't spotted that. I did look to see if GitHub had a feature request feature or whether to just treat outstanding work as issues. I am happy to try adding to a TODO.md file.

What do we want to do about releases? Do we have anything resembling a test suite that should run successfully before declaring a release?[/quote]

ThomasAdam wrote:No test suite that I've seen, and certainly no CI as yet -- as I've probably mentioned, until Travis-CI get back to me, it's a best-efforts for now not to break master -- hence why it's a protected branch for the time-being.


Ok, let's see what others come up with. When I very first started and discovered the 6502 bug a couple of people on here pointed me to CPU tests suites that were very useful. I think these could probably be automated because they could be started as an autoboot and write text output at the end which could be redirected to a file. On the other hand, just because a test is not easy to automate, for example it might be "Play Revs and check for smooth screen rendering" that doesn't mean it isn't worth listing it and doing it manually prior to release.

ThomasAdam wrote:Making a release will require me to update Autotools -- it has such a feature. I'll do that this week, and document it, such that it spits out a tarball and zip file, etc.


Thanks.

User avatar
fordp
Posts: 923
Joined: Sun Feb 12, 2012 9:08 pm
Location: Kent, England

Re: B-Em

Postby fordp » Sun Mar 19, 2017 9:10 pm

Coeus wrote:3. Simon's idea abount *command passthrough.
4. Simon's idea about implementing something like MMFS.


I have been reading ssd.c I think I can see what I would like to do. I dare not say here as the pixies will have it written overnight :(

If the pass through feature is added then I will get cracking ;)
FordP (Simon Ellwood)
Time is an illusion. Lunchtime, doubly so!

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

Re: B-Em

Postby hoglet » Sun Mar 19, 2017 9:15 pm

Ford,

Are you aware of the way that MMFS (and the earlier MMBEEB) is supported in BeebEm?

It's not commonly used, but it does in fact work.

How are you thinking of doing it here?

Dave

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

Re: B-Em

Postby hoglet » Sun Mar 19, 2017 9:22 pm

For reference, here is the MMBEEB.DLL source code:

Code: Select all

// MMBeeb Interface DLL
// August 2005 - Martin Mather
// http://mmbeeb.mysite.wanadoo-members.co.uk/
// Based in part on code by Richard Gellman

// This is not intended to be a full emulation of the MMC card,
// just enough for the patched DFS to work.

// Note: Had to modify windef.h such that BOOL is always defined (Line 229) (Open Watcom)

#include <windows.h>
#include <stdio.h>
#include "mmbeeb.h"

char *MMBeebName = "MMBeeb Extension board for BBC Model B";

const int FileNameSize = 256;
char MMBImageName[FileNameSize] = "C:\\beeb.mmb";

enum MMCprocess {
        MMCidle = 1,
        MMCcmd0 = 2,
        MMCcmd1 = 3,
        MMCreaddata = 4,
        MMCwritedata = 5,
        MMCcardid = 6,
        MMCsetblklen = 7
};

enum MMCstatus {
        MMCnogo = 0,
        MMCcmd0ok = 1,
        MMCcmd1fail = 2,
        MMCcmd1ok = 3
};

static unsigned char shiftreg = 0xff;

// Card ID - I'm familiar with these numbers
static unsigned char CardID[] = {
        0xff, 0xfe, 0x01, 0x00, 0x00,
        0x33, 0x32, 0xff, 0xff, 0xff,
        0xff, 0xff, 0x19, 0x88, 0x4f,
        0x7a, 0x34, 0xff, 0x6a, 0xca
};

const unsigned long BufferSize = 0x200;
static unsigned char Buffer[BufferSize];
static unsigned long BufferAddress;
static BOOL BufferEmpty = TRUE;

static unsigned char MMCprocess = MMCidle;
static unsigned char MMCstatus = MMCnogo;
static unsigned int MMCcounter = 0;
static unsigned long MMCaddress = 0;
static unsigned long MMCaddresslimit = 0;
static unsigned int MMCblocklength = 0x0200;
const unsigned int MMCwritelength = 0x0200;

static BOOL DoSetup = TRUE;


// Write MMC
EXPORT unsigned char SetDriveControl(unsigned char value) {
        writeMMC (value);
        return 0;
}

// Read MMC
EXPORT unsigned char GetDriveControl(unsigned char value) {
        return shiftreg;
}

// Beebem seems to call this twice when initialising
EXPORT void GetBoardProperties(struct DriveControlBlock *FDBoard) {
        FDBoard->FDCAddress = 0x0000; // Not used
        FDBoard->DCAddress = 0xfe18; // MMC Board
        FDBoard->BoardName = MMBeebName;
        FDBoard->TR00_ActiveHigh = TRUE;

        // Initialise code
        if (DoSetup == TRUE) {
            SetAddressLimit();
            DoSetup=FALSE;
        }
}

// MMC code
void writeMMC(unsigned char value) {
        shiftreg = 0xff;
        MMCcounter++;

        // Read command address
        if (MMCprocess != MMCidle && MMCcounter < 6) {
            MMCaddress = (MMCaddress << 8) | value;
            return;
        }

        switch (MMCprocess) {
            case MMCidle: // Wait for valid command
                MMCcounter = 1;
                MMCaddress = 0;
                if (value == 0x40 && MMCaddresslimit > 0) {
                    MMCstatus = MMCnogo;
                    MMCprocess = MMCcmd0;
                } else if (MMCstatus >= MMCcmd0ok) {
                    if (value == 0x41)
                        MMCprocess = MMCcmd1;
                    else if (MMCstatus == MMCcmd1ok) {
                        switch (value) {
                            case 0x4a:
                                MMCprocess = MMCcardid;
                                break;
                            case 0x50:
                                MMCprocess = MMCsetblklen;
                                break;
                            case 0x51:
                                MMCprocess = MMCreaddata;
                                break;
                            case 0x58:
                                MMCprocess = MMCwritedata;
                                break;
                        }
                    }
                }
                break;
            case MMCreaddata: // Read data block
                if (MMCcounter > 9) {
                    if (MMCcounter < (MMCblocklength + 10))
                        shiftreg = Buffer[MMCcounter - 10];
                    else if (MMCcounter == (MMCblocklength + 12))
                        MMCprocess = MMCidle;
                } else if (MMCcounter == 9)
                    shiftreg = 0xfe;
                else if (MMCcounter == 8) {
                    if (MMCaddress < MMCaddresslimit) {
                        // read sector from file
                        ReadSector();
                        if (BufferEmpty) {
                            shiftreg = 0xff; // read error?
                            MMCprocess = MMCidle;
                        } else
                            shiftreg = 0x00;
                    } else {
                        shiftreg = 0x40;
                        MMCprocess = MMCidle;
                    }
                }
                break;
            case MMCwritedata: // Write data block
                if (MMCcounter > 11) {
                    if (MMCcounter < (MMCwritelength + 12))
                        Buffer[MMCcounter - 12] = value;
                    else if (MMCcounter == (MMCwritelength + 14)) {
                        shiftreg = WriteSector();
                        MMCprocess = MMCidle;
                    }
                } else if (MMCcounter == 8) {
                    if ((MMCaddress & 0x1ff) != 0) { // Must be aligned to sector
                        shiftreg = 0x40;
                        MMCprocess = MMCidle;
                    } else
                        shiftreg = 0x00;
                }
                break;
            case MMCcmd0: // CMD 0 (Reset card)
                if (MMCcounter == 8) {
                    shiftreg = 0x01;
                    MMCstatus = MMCcmd0ok;
                    MMCprocess = MMCidle;
                }
                break;
            case MMCcmd1: // CMD 1 (Initialise card)
                if (MMCcounter == 8) {
                    if (MMCstatus == MMCcmd0ok) {
                        shiftreg = 0x01;
                        MMCstatus = MMCcmd1fail;
                    } else {
                        shiftreg = 0x00;
                        MMCstatus = MMCcmd1ok;
                    }
                    MMCprocess = MMCidle;
                }
                break;
            case MMCcardid: // Read Card ID
                if (MMCcounter == 8) {
                    shiftreg = 0x00;
                } else if (MMCcounter > 8) {
                    if (MMCcounter == 28) {
                        MMCprocess = MMCidle;
                    } else {
                        shiftreg = CardID[MMCcounter - 9];
                    }
                }
                break;
            case MMCsetblklen: // Set (Read) Block Length
                if (MMCcounter == 8) {
                    if (MMCaddress != 0 && MMCaddress <= BufferSize) {
                        shiftreg = 0x00;
                        MMCblocklength = MMCaddress;
                    } else
                        shiftreg = 0x40;
                    MMCprocess = MMCidle;
                }
                break;           
        }
}

// Return size of image
void SetAddressLimit() {
        FILE * ImageFile;
        FILE * pFile;
   
        MMCaddresslimit=0x0;

        // Optional mmc.cfg file (in beebem folder)
        // containing path to image file
        pFile = fopen("MMC.cfg","rt");
        if (pFile!=NULL)
        {
            fread (MMBImageName, FileNameSize, 1, pFile);
            fclose (pFile);
        }

        // Check if image exists & get its size
        ImageFile=fopen(MMBImageName, "rb");
        if (ImageFile != NULL) {
            fseek (ImageFile, 0, SEEK_END);
            MMCaddresslimit = ftell(ImageFile);
            fclose (ImageFile);
        } else {
            // Report image not found
            char errstr[200];
            sprintf (errstr, "Can't find image: %s!", MMBImageName);
            MessageBox (0, errstr, "MMB", MB_OK|MB_ICONERROR);
        }
}

// Read data into buffer from image
void ReadSector() {
        int itemsread;
        FILE *ImageFile;

        if (BufferEmpty | MMCaddress != BufferAddress) {
            BufferEmpty = TRUE;

            ImageFile = fopen(MMBImageName, "rb");
            if (ImageFile != NULL) {
                fseek (ImageFile, MMCaddress, SEEK_SET);
                // Note; BufferSize >= MMCblocklength
                itemsread = fread (Buffer, BufferSize, 1, ImageFile);
                fclose (ImageFile);
                if (itemsread == 1) {
                    BufferAddress = MMCaddress;
                    BufferEmpty = FALSE;
                }   
            }
        }
}

// Write data from buffer to image
unsigned char WriteSector() {
        int itemswritten;
        FILE *ImageFile;

        BufferEmpty = TRUE;
       
        ImageFile = fopen(MMBImageName, "r+b");
        if (ImageFile != NULL) {
            fseek (ImageFile, MMCaddress, SEEK_SET);
            itemswritten = fwrite (Buffer, MMCwritelength, 1, ImageFile);
            fclose (ImageFile);
            if (itemswritten == 1)
            {
                BufferAddress = MMCaddress;
                BufferEmpty = FALSE;         
                return 0x05;
            }
        }
       
        return 0xff;
}           


Return to “emulators”

Who is online

Users browsing this forum: No registered users and 1 guest