ZXBaremulator 3.2

Struggling with Fuse or trying to find an emulator with a specific feature. Ask your questions here.
Post Reply
XoRRoX
Manic Miner
Posts: 233
Joined: Wed Jul 11, 2018 6:34 am

Re: ZXBaremulator 3.2

Post by XoRRoX »

Firstly, thank you very much for creating ZXBaremulator, a great accomplishment :)

I can understand if you're not really motivated to support sound on the Pi-Zero. But I do like to shine some light on the BMC64 implementation, as there are some incorrect ideas.
BMC64 includes a so-called BMC64-Lite version which is being booted if a Pi-Zero is detected. I tested it yesterday and I have sound from my monitor's output jack - no need to do something with GPIO. More info on what concessions are made in the lite version, you can find here: https://accentual.com/bmc64-lite/
dim
Drutt
Posts: 5
Joined: Thu Mar 19, 2020 10:04 am

Re: ZXBaremulator 3.2

Post by dim »

Hi, great emulator. I use Raspberry Pi models B +, I connected a 5x8 physical keyboard, there is a problem. If you press C.S. and hold, then the buttons A, Q, 1,0, P all the others that are in the same line stop working. If you hold the S.S. button then K, O, 9.2 and the rest who are on the same line do not work.
Is it just me on my PI B + model ???
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator 3.2

Post by zx81 »

dim wrote: Thu Mar 19, 2020 10:20 am Hi, great emulator. I use Raspberry Pi models B +, I connected a 5x8 physical keyboard, there is a problem. If you press C.S. and hold, then the buttons A, Q, 1,0, P all the others that are in the same line stop working. If you hold the S.S. button then K, O, 9.2 and the rest who are on the same line do not work.
Is it just me on my PI B + model ???
Is your keyboard a standard Spectrum keyboard?. The ZXB code don't prevents such key combinations.
dim
Drutt
Posts: 5
Joined: Thu Mar 19, 2020 10:04 am

Re: ZXBaremulator 3.2

Post by dim »

I have a clone of the standard keyboard made on reed, contact buttons, a 5x8 matrix, as in MagPI67, I think that the emulator cannot process two buttons simultaneously.
dim
Drutt
Posts: 5
Joined: Thu Mar 19, 2020 10:04 am

Re: ZXBaremulator 3.2

Post by dim »

If I press only one button, on the KB1-1 and KB1-2 lines, then all the buttons work.
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator 3.2

Post by zx81 »

dim wrote: Thu Mar 19, 2020 12:33 pm I have a clone of the standard keyboard made on reed, contact buttons, a 5x8 matrix, as in MagPI67, I think that the emulator cannot process two buttons simultaneously.
I've tested the emulator using an Amstrad 128k (grey case) and all works correctly, testing it with this program:

https://spectrumcomputing.co.uk/index.p ... 6&id=17613

I can't find any limitation reading keys.
dim
Drutt
Posts: 5
Joined: Thu Mar 19, 2020 10:04 am

Re: ZXBaremulator 3.2

Post by dim »

Thank you for your time, I will try this test, I will write the result later.
I noticed one more feature of my raspbery, it does not load TAP files, stop screen and work.
I started a topic about ZXB on my forum, I ask that other users check, then I will report the results.
The emulator would be complete, you need:
1. hardware reset, via GPIO
2. Input reading tape through GPIO
3. The ability to substitute your ROM and select which ROM to load at startup.
dim
Drutt
Posts: 5
Joined: Thu Mar 19, 2020 10:04 am

Re: ZXBaremulator 3.2

Post by dim »

I’m an old fool, I didn’t notice the diodes in the photos, looked from a smartphone, put together a new keyboard, everything worked as it should, note in the instructions on the ZXB page for idiots like me.
User avatar
Pegaz
Dynamite Dan
Posts: 1210
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator 3.2

Post by Pegaz »

I finally had the time and made the cables to attach the real Spectrum keyboard to the Raspbery Pi with Baremulator.
Everything worked very well, each key works normally, there is virtually no latency, everything is like a real Spectrum.
Just a few questions:
I mentioned before the weird buzzing sound comes up occasionally on my setup.
I noticed that this happens almost regularly, after I enter the file selection menu (F1) or keyboard info ALT-K and then return to normal Spectrum mode again.
The sound lasts briefly, about 5 seconds and then stops.
It happens no matter which Spectrum model I choose, on the three Pi models I tested (Zero, Pi3B, Pi3 A+).
Interestingly, if I do a reset with the ALT-R during that buzzing sound, the sound disappears instantly.
There is a possibility that there is some problem or conflict with my LCD TV, I also checked the soldering contacts on the cables, everything looks and works fine, although the sound occurs even without them.

The other thing that interests me, when I turn on an emulator with a Spectrum keyboard, I get a message at the bottom, that I need to have a GPIO keyboard attached (though I already have one).
Is this normal behavior?
As I said, the Spectrum keyboard attached to the Pi works perfectly with the BM.
Here are some pictures of what it looks, I want to thank you again zx81 for all your hard work, you did the stunning job, really. :)

Image Image Image
User avatar
MonkZy
Manic Miner
Posts: 279
Joined: Thu Feb 08, 2018 1:01 pm

Re: ZXBaremulator 3.2

Post by MonkZy »

Pegaz wrote: Wed Apr 22, 2020 3:23 pm I get a message at the bottom, that I need to have a GPIO keyboard attached (though I already have one).
Is this normal behavior?
I use a GPIO keyboard and also get this message at start up. Nothing to worry about.

I would also like to thank [mention]zx81[/mention] for this awesome emulator.
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator 3.2

Post by zx81 »

Pegaz wrote: Wed Apr 22, 2020 3:23 pm I finally had the time and made the cables to attach the real Spectrum keyboard to the Raspbery Pi with Baremulator.
Everything worked very well, each key works normally, there is virtually no latency, everything is like a real Spectrum.
Just a few questions:
I mentioned before the weird buzzing sound comes up occasionally on my setup.
I noticed that this happens almost regularly, after I enter the file selection menu (F1) or keyboard info ALT-K and then return to normal Spectrum mode again.
The sound lasts briefly, about 5 seconds and then stops.
It happens no matter which Spectrum model I choose, on the three Pi models I tested (Zero, Pi3B, Pi3 A+).
Interestingly, if I do a reset with the ALT-R during that buzzing sound, the sound disappears instantly.
There is a possibility that there is some problem or conflict with my LCD TV, I also checked the soldering contacts on the cables, everything looks and works fine, although the sound occurs even without them.
That's a problem with some TV sets, really hard to catch, because my TV don't have these problem. I'm using a 32 Khz audio sample rate and I suspect that some TVs don't handle it very well. I'll try to look for the problem, following your Alt+R observation. But with the Zero model, you don't have any HDMI or PWM sound, neither, so no sounds should output to your TV.
Pegaz wrote: Wed Apr 22, 2020 3:23 pm The other thing that interests me, when I turn on an emulator with a Spectrum keyboard, I get a message at the bottom, that I need to have a GPIO keyboard attached (though I already have one).
Is this normal behavior?
As I said, the Spectrum keyboard attached to the Pi works perfectly with the BM.
Here are some pictures of what it looks, I want to thank you again zx81 for all your hard work, you did the stunning job, really. :)
That's a simple warning message. I can't know when a GPIO keyboard is connected, so I warn to the user that needs it.

Thanks by your words about ZXBaremulator.
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator 3.2

Post by zx81 »

MonkZy wrote: Wed Apr 22, 2020 3:29 pm
Pegaz wrote: Wed Apr 22, 2020 3:23 pm I get a message at the bottom, that I need to have a GPIO keyboard attached (though I already have one).
Is this normal behavior?
I use a GPIO keyboard and also get this message at start up. Nothing to worry about.

I would also like to thank @zx81 for this awesome emulator.
Thanks by share your build to connect the keyboard and joystick at the same time.
User avatar
Pegaz
Dynamite Dan
Posts: 1210
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator 3.2

Post by Pegaz »

[mention]zx81[/mention]

Yes, I also thought that there could be a problem in some conflict with my TV, but I never had a problems with it, so i wasnt sure.
Who knows, you might discover something new about that, later.
I'm very glad this interface worked for me right away, because I'm not really into hardware and soldering iron. :)
Now, I just have to figure out a way to put everything in an empty 48k case, but most importantly, everything works fine and stable.
User avatar
Pegaz
Dynamite Dan
Posts: 1210
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator 3.2

Post by Pegaz »

Today I tested again BM v3.2 on my Pi 2B, Pi 3B and Pi 3A+ and I can only confirm what I wrote yesterday.
I will try to be as detailed as possible this time, maybe some of this may be useful for further analysis.
The easiest way to reproduce this buzzing sound is this:
After I press a key to initiate any sound, such as a key pressed click, pressed F1, select a game and quickly go back.
The buzzing sound disappears after about five seconds and it doesn't happen at all, until I access the F1 or perform ALT-K menu again.
If there was no sound from the emulator for a while, the buzzing sound doesn't happen, even when I go and back from the F1 menu.
The buzzing sound can be suppressed anytime by using any other option in the emulator: Reset, Pause, NMI, Fast / Slow tape etc.
I noticed that this effect occurs much more often on 48k emulation than in 128 / 2A mode.
I also tested two older versions (v3.0 and v2.0), to make a comparison.
In version v3.0, buzzing sound occurs in the same way, but is quieter and shorter, usually 2-3 seconds.
Interestingly, in v2.0 I failed to reproduce this sound issue, despite all my attempts.
I also tried to change some settings on my LCD TV, turned on game mode, but there was no particular difference.
Unfortunately, at the moment I dont have the opportunity to try the emulator on another TV, but I hope this will be of some use.
jokin
Drutt
Posts: 2
Joined: Fri Apr 24, 2020 3:47 pm

Re: ZXBaremulator 3.2

Post by jokin »

hello guys, I just tested ZXBaremulator 3.2 with a GPIO keyboard and a PI Zero (as written in MagPI 67) it works very well. I'm happy to find the spectrum with its own keyboard :D . Well done for this emulator, it's the best and the fastest (although I haven't tested many games yet). I would like to know if anyone knows of a way to change 2 pins of the GPIO in order to recover the GPIO13 and GPIO18 pins to try to put audio?
Thanks for help.
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator 3.2

Post by zx81 »

Hi Jokin,

No, I'm sorry, the Zero have reserved all GPIOs to keyboard handling.

Really, a Zero isn't the best option to run ZXBaremulator. The best choice is 3A+ or the cheaper A+. With 3A+ you have HDMI sound, and with A+ you have PWM sound.

Thanks by test my humble emulator.
jokin
Drutt
Posts: 2
Joined: Fri Apr 24, 2020 3:47 pm

Re: ZXBaremulator 3.2

Post by jokin »

Hi zx81,
thanks for reply.
Sorry but i don't understand, spectrum keyboard use 12 GPIO pins (there are 28 pins available in wiringpi), GPIO12, 16, 20 are free no? (GPIO21 can be free if we remove the button for alternate keyboard)
am i wrong?
I found many tutos to use GPIO 13, 18 for sound in Pi Zero.

I know that Zero is not the best for emulation but it's fits perfectly in the spectrum keyboard case and i like that.

I’ll test it later with the zxscanner (cf MagPI 67) in python by modifying the pins and see if it’s possible.

Thanks for your time.
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator 3.2

Post by zx81 »

From the start, the idea was to use the same pins that printed in MagPi #67. Many people have his circuits wired like these, so I can't rewire the pins without cause problems to some users.
User avatar
MonkZy
Manic Miner
Posts: 279
Joined: Thu Feb 08, 2018 1:01 pm

Re: ZXBaremulator 3.2

Post by MonkZy »

jokin wrote: Fri Apr 24, 2020 9:19 pm I know that Zero is not the best for emulation but it's fits perfectly in the spectrum keyboard case and i like that.
Take a look at the A+ boards. They will fit quite neatly in a 16/48k case, due to the removal of Ethernet and USB ports. You can get the audio from the headphone socket.

Image

Adafruit Link to the Model 3:
https://www.adafruit.com/product/4027

https://www.adafruit.com/product/4027#Slide3

Model 2 boards can be found on eBay quite cheaply.

I am about to make a 3D printed harness to attach an A+ to the 48k case, without any case cutting. The HDMI, audio and 5v ports will be exposed via the edge connector opening. Should be quite neat.
User avatar
Pegaz
Dynamite Dan
Posts: 1210
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator 3.2

Post by Pegaz »

Is this a Pi3 A+ model (I have one), which normally sends audio and video through hdmi?
What makes it necessary to take sound/video from audio jack or GPIO connector from it, then?
What's the difference between Pi3 A+ and Pi1 A+ in that audio/video part anyway?
When it comes to Baremulator, I agree that Pi3 A+ is now the best solution with a very decent price of $25.

btw, I have a couple suggestions for zx81 to consider, if possible to implement it in the future.
I think it would be nice if we could save the user custom settings in some .ini file, for example.
Then the emulator could boot directly into 128K mode by default, instead of 48K mode.
Or we can save the location of our Games folder or last used games, making normal tape loading as default choice, etc.

The other thing is already mentioned earlier in the thread and I also wonder if its technically possible, to hook up a real tape recorder to Pi and load games in the old-fashioned way?

Also, Is it possible to add support for another model, say Russian Pentagon clone, to cover almost all existing Spectrum software?
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator 3.2

Post by zx81 »

Pegaz wrote: Sat Apr 25, 2020 10:27 am Is this a Pi3 A+ model (I have one), which normally sends audio and video through hdmi?
What makes it necessary to take sound/video from audio jack or GPIO connector from it, then?
The PI firmware chooses one when the board boots. When don't find a TV on the HDMI connector, switch the image/sound to 3.5mm jack. But a PI 3A+ should send the audio through HDMI without any problem.
Pegaz wrote: Sat Apr 25, 2020 10:27 am What's the difference between Pi3 A+ and Pi1 A+ in that audio/video part anyway?
When it comes to Baremulator, I agree that Pi3 A+ is now the best solution with a very decent price of $25.
The PI 3A+ can send video/audio through HDMI or composite/pwm, at your wishes or needs. The PI A+ only can send audio through 3.5mm jack. In the A+/B+ the PWM sound is using the GPIOs 40/45, not exposed on the board connector, so you can have GPIOs and PWM sound. Anyway, the 3A+ is an ARMv8 quad-core CPU, and ZXBaremulator uses only two CPUs by now. The A+ is an ARMv6 one core CPU. Sooner or later I could need to use another CPU from the PI-2/3 and the ARMv6 boards will be unsupported again and forever.

The most crazy for me with the Zero models is that you need to build a really complex circuit to have acceptable sound quality, see the A+/B+ audio circuit here: https://learn.adafruit.com/introducing- ... io-outputs
For me, it's easy to buy an 3A+ and you get HDMI sound for free.
Pegaz wrote: Sat Apr 25, 2020 10:27 am btw, I have a couple suggestions for zx81 to consider, if possible to implement it in the future.
I think it would be nice if we could save the user custom settings in some .ini file, for example.
Then the emulator could boot directly into 128K mode by default, instead of 48K mode.
Or we can save the location of our Games folder or last used games, making normal tape loading as default choice, etc.
Any emulator can't be a "decent" emulator without some user settings, save snapshots/tapes, a tape browser and other bunch of options. The problem is that's a one man project. In a bare-metal project the hardest part to understand by the users is that I have nothing to program a GUI for the user, with a file dialog, menus, checkboxes, radio buttons and other graphical widgets usually found in popular libraries. I can't use SDL, Qt, GTK, WxWidgets or any other. I should to program all I can need, and these tasks consumes many time and work. ZXBaremulator can't save snapshots because I need to program first a box to take the file name to save (I don't want to mention a full save dialog...).
Pegaz wrote: Sat Apr 25, 2020 10:27 am The other thing is already mentioned earlier in the thread and I also wonder if its technically possible, to hook up a real tape recorder to Pi and load games in the old-fashioned way?
Read a tape is a realtime task and no emulator works like this. I can't envision a method that works with all tape loader types and not only with standard ROM loader. Anyway, you need too some adapter level circuit, you can't attach directly an analog tape output to the GPIO pins. Design and build this circuit is far beyond my capabilities.
Pegaz wrote: Sat Apr 25, 2020 10:27 am Also, Is it possible to add support for another model, say Russian Pentagon clone, to cover almost all existing Spectrum software?
By now, I'm not interested in Russian models or other variants as Sam Coupe.
User avatar
Pegaz
Dynamite Dan
Posts: 1210
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator 3.2

Post by Pegaz »

Thanks for the answer, it's all much clearer to me now.
Regarding the choice of Pi model for Baremulator, its now more than obvious that Pi3 A+ is the best solution for the hardware project due to its size and future support.
btw, it was not my intention to look for some fancy options, I just wish we could choose a different model to boot by default, as well as saving location of the software folder, nothing more.
User avatar
Pegaz
Dynamite Dan
Posts: 1210
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator 3.2

Post by Pegaz »

[mention]zx81[/mention]

Today I was playing a little more with Baremulator and I think we might be one step closer to locating the cause of that sound issue.
I plugged the small speaker into the audio jack, disconnected the hdmi cable and got that crackling sound again.
The easiest procedure I can almost always reproduce this sound is this.
Just press any key, then go to the menu with F1 and go back after a few seconds.
I did all this blindly, without any connection between my Pi3 A+ and TV.
Does this mean that maybe this is not a problem in some conflict with my TV and what else could cause something like this. :?
btw, is it possible to use hdmi just for video output and pwm audio for sound at the same time?
I tried adding the command amixer cset numid=3 1 (and force pwm through audio jack) to config.txt, but still got sound through hdmi output.
Only when I disconnect the hdmi cable, I get sound through the audio jack...
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator 3.2

Post by zx81 »

Thanks by your investigations, Pegaz. The 'amixer' command is an ALSA command, so only works under Linux.

As I said before, all the video/audio management is done by the PI firmware at boot.With a HDMI TV connected, sound outputs through HDMI. When no HDMI TV is connected audio/video are redirected to 3.5mm jack.

I don't know any method to change the audio output.

I'll investigate the sound problem. Thanks again.
User avatar
PeterJ
Site Admin
Posts: 6873
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: ZXBaremulator 3.2

Post by PeterJ »

Hi [mention]zx81[/mention],

Very many thanks for ZXBaremulator 3.2. I tried it for the first time today, and I'm very impressed! Nice work.

Can I ask a few questions. As I say, I have not been following the project, so sorry if these have been answered elsewhere:
  • Would it possible to allow SSH connectivity into the Pi so I can upload files from my PC?
  • Would it be possible to set a default machine type rather than having to set each time you switch on
  • On the tape loader screen is it possible to have some indication there that the file has loaded. I know it appears when you go back to the emulator screen.
  • I can't seem to use Keyboards with a USB dongle such as the one below. Is that what you mean by no USB hot-plug?
    https://www.logitech.com/en-gb/product/ ... us?crid=27
  • I like the full screen 16:19 stretched format rather than 4:3 (Sorry [mention]Ast A. Moore[/mention]!) Is this possible?
Many thanks in advance.
Post Reply