ZXBaremulator 3.2

Struggling with Fuse or trying to find an emulator with a specific feature. Ask your questions here.
Post Reply
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

ZXBaremulator 3.2

Post by zx81 »

Hi all,

I've released ZXBaremulator v3.2, at last!.

The images can be downloaded from my project web page: ZXBaremulator

Best regards
José Luis
User avatar
Pegaz
Dynamite Dan
Posts: 1209
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator 3.2

Post by Pegaz »

First of all, thanks for this new version, it was worth the wait.
I'm very glad, that there's a possibility to connect Pi to a real spectrum keyboard via GPIO pins.
Finally, I won't have to rely on the Arduino as a converter, which I have had no success with it.
I tried the emulator today briefly and am very happy with how everything works.
btw, I noticed just one minor audio issue.
Occasionally, after inserting a tape file with space, and when I return to the emulator, a strange, buzzing sound is heard for a few seconds.
Sometimes this happens, sometimes not, so I can't reproduce it every time.
I tested the latest allfiles.zip archive on a fat32 formated micro card on Pi 3A+.
In the config.txt file I saw audio_pwm_mode=2 line, which was not used before.
Whether it has an effect on sound through an HDMI cable or just for PCM sound on Pi Zero?
Btw, there's now one great c64 bare metal emulator similar to yours, also based on Circle and Vice emulator core.
The author managed to get HDMI sound in the Zero version as well and I wonder if there's any possibility of something like that in the Baremulator?
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator 3.2

Post by zx81 »

Ho Pegaz

audio_pwm_mode=2 is only for PWM.

Is hard to say what's the reason for your sound problems, I haven't found it in any of my PIs.

I can examine BMC64, but HDMI support isn't easy in ARMv6 based cards. I can't promise anything...
reesy
Drutt
Posts: 2
Joined: Tue Feb 11, 2020 11:05 am

Re: ZXBaremulator 3.2

Post by reesy »

Really impressive emulator, thanks for your hard work.

Have it running in a Spectrum+ case with GPIO keyboard - didn't initially have the extra button to switch keyboard modes, so tried to use the keyboard combo to enter the menu which worked - however I could not then exit the special key mode. Is this a bug or is there a trick to it? I assumed I just use the same combo to exit.

Just worked around it by adding a push button for now which works perfectly and has allowed me to finally enjoy the spectrum case as none of the emulators on linux support the GPIO keyboard correctly (which was most disappointing to find after building the thing... )

Need to sort our PWM sound output for my zero now and it will be perfect

Thanks again!
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator 3.2

Post by zx81 »

Thanks reesy,

Yes, the key combo (Caps+Symbol+ENTER) is the same to enter in extended mode and exit to standard mode. For my testing I has been using a Spectrum +2 keyboard, but I can't test with a Spectrum+ keyboard.

Sadly, the only one method to have sound using PWM in Zero model is across the GPIOs, and the needed GPIOs are devoted to keyboard handling. The Zero model is a pain in the ass, I can't understand the loyalty to these model. A good audio stage for PWM (as in the A+/B+ models) is really complicated, and inside the Spectrum+ you can put a Raspberry 3A+ model, and get HDMI sound.

Thanks to you by your kind words about ZXBaremulator!. ;)
Firefox

Re: ZXBaremulator 3.2

Post by Firefox »

zx81 wrote: Tue Feb 11, 2020 2:42 pm The Zero model is a pain in the ass, I can't understand the loyalty to these model.
£4.65 :D

Well, apart from that, they're really small and sip current - they'll run for many hours off a USB charge bank. I find them really handy for logging data or adding a wifi interface to things (using the 'W' version) .

I must get into bare metal programming for the Pi. They're so handy, but the boot-up time is a pain for many uses...

Anyway, nice work on you emulator! :)
reesy
Drutt
Posts: 2
Joined: Tue Feb 11, 2020 11:05 am

Re: ZXBaremulator 3.2

Post by reesy »

zx81 wrote: Tue Feb 11, 2020 2:42 pm Sadly, the only one method to have sound using PWM in Zero model is across the GPIOs, and the needed GPIOs are devoted to keyboard handling. The Zero model is a pain in the ass, I can't understand the loyalty to these model. A good audio stage for PWM (as in the A+/B+ models) is really complicated, and inside the Spectrum+ you can put a Raspberry 3A+ model, and get HDMI sound.
Yes, didn't research it properly - all of the guides for putting a PI in a speccy case said everything in raspbian would just work but I guess things have moved along since then and the working support has been broken along the way. I then found ZxBaremulator and thought I was on a winner...it was only when I couldn't hear anything via the HDMI that I read your website fully...Zero = v6 arm and no HDMI sound... Zero=pain in ass, correct!

As you say the 3A+ will handle it, so I'll just suck it up and swap it out since the PWM sound is a non starter - thank you for the heads up that has saved me a lot of messing about.
User avatar
Pegaz
Dynamite Dan
Posts: 1209
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator 3.2

Post by Pegaz »

Pi Zero is a great mini board, extremely convenient for many projects, you can literally put it anywhere, even in one place where it can really become pain in the ass. ;)
As I said before, if a Vice-based BMC emulator (with a bunch of features) can support HDMI sound on Zero, under Circle, then it's not clear to me why it can't Baremulator.
Also, Baremulator boot time is a whole 6 seconds on Pi3+, while on BMC it is only 3.5 seconds?
If optimized Raspbian packages (like Combian, Sedai etc) have a boot time of 5 sec, with a bunch of background processes, then I really don't understand what the problem is.
Again Pi Zero shines here, because Baremulator boots in about 3 seconds, at least on older versions, which I have tested before.
Last but not least, all new Baremulator versions have a certain scroll tearing, which spoil the perfect look & fell of the original machine, except for the old Zero versions already mentioned.
BMC on the other hand has a perfectly smooth scroll, even at the exact refresh rate at 50.125Hz
The differences between the two emulators are understandable (Vice is more matured) but Pi Zero cannot be blamed for everything.
I use often old Baremulator v1.3 on Zero with pwm sound, no scroll tearing, 3 sec boot time and it still a great fun. :)
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator 3.2

Post by zx81 »

In Spain we have a saying: "cheap is expensive". A Zero can be convenient for some projects but when you need to solder the pins, or build an external circuit to have PWM sound, the cheap board turns expensive. I can't find in Spain a Zero for less than 19.95€. By a few bucks more I can buy a PI 3a+, can't compare it with a Zero.

I can't test BMC64 because I know nothing about C64, so I can't say if can output sound using HDMI or not. I've watched a presentation from his developer talking about BMC64 ans his problems with Armv6 based boards.

What I can understand is that 6 seconds to boot can induce to suicide to any user. Intolerable!. But, if I'm not wrong, the Zero board should be overcloked to cope with the CPU needs for BMC64....

Clearly, the problem is I'm a bad programmer, of course, I never discuss that. ZXBaremulator v1.3 have fewer tasks to execute on boot than later versions. And the USB bus initialization lasts more than a second by himself. And the SD initializacion another half second. Before the multicolour square I can do nothing to speed the boot process and after this, ZXB lasts around 3.5/4 secs to show the Sinclair copyright on my PI-2 at 600 Mhz. The Pi firmware takes his time to execute at boot.

Probably, BMC64 synchronize his time with start of image, but that's something I can't and wan't to do. With 50 Hz or 60 Hz display modes, BMC64 is slower or faster than the real C64. The Spectrum models works with very different CPU frequencies (3.5 or 3.5469 Mhz), and his refresh rates are 50.08 or 50.02 hz. None of those frequencies are standard refresh rates for HDMI modes, so you get tearing at 60 Hz (another small glitches at 50hz). The HDMI refresh rate is configured when PI starts and I can't change his values after boot. Anyway, a 50.125 Hz needs a very special configuration on config.txt file and not all users can do this correctly, specially when a TV set don't work properly with non-standard values.

On ARMv6 models, the PWM sound samples acts as a metronome, but in ARMv7/ARMv8 models I program an interrupt to trigger exactly as in a real Spectrum. The Circle scheduler is cooperative and the HDMI sound needs near to realtime attention to work properly. With emulator blocking up until the audio buffer is empty, I can't attend to VC4 to get HDMI sound in ARMv6 models. On ARMv7/8 models, I have a CPU for emulation and another to handle sound, USB, etc. That's all. Different decisions, different results.

I'm very sure that emulation speed is really precise compared with the real thing. That's a main target to me, more than a few glitches in some horizontal scrolling. Vice is an emulator embedded on a baremetal structure. ZXBaremulator is a new emulator from the start, I don't take anything from other emulators.

But using v1.3 is a shame.

My two cents...
User avatar
Pegaz
Dynamite Dan
Posts: 1209
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator 3.2

Post by Pegaz »

I understand your point and I can agree with almost everything you wrote except two things:

- You're not a bad programmer (on the contrary, I am)
- Using different versions of the same program, depending on my preferences is certainly not a shame

Cheers
XoRRoX
Manic Miner
Posts: 231
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: 1209
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: 278
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: 1209
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: 1209
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.
Post Reply