ZXBaremulator v3.0

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

ZXBaremulator v3.0

Post by zx81 » Sat Mar 03, 2018 6:11 pm

Hi all,

I've released a new version for my bare-metal emulator ZXBaremulator. The enhancement list and binaries can be found on my project web page: zxmini.

Best regards
5 x

User avatar
RMartins
Manic Miner
Posts: 335
Joined: Thu Nov 16, 2017 3:26 pm

Re: ZXBaremulator v3.0

Post by RMartins » Sat Mar 03, 2018 8:14 pm

I think it's the first bare emulalor I have seen for the PI.

Nice work.
0 x

User avatar
Pegaz
Microbot
Posts: 172
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator v3.0

Post by Pegaz » Sat Mar 03, 2018 8:50 pm

I'm glad to see you here zx81, welcome. :)
Its a shame that v3.0 no longer has support for Pi 2 v1.0, (which I have), so at the moment I will not be able to test it, at least until I get pi 3.
Can you tell me why theres no longer support for Arm 6 based Pi 2, because the previous test version worked well with HDMI sound?
I'm still experimenting with the latest Pi Zero test version before the official v2.0 and I can tell you it's the only version with a perfectly smooth scroll, but unfortunately it's missing 128k models, which is very important.
I dont know, what exactly happened in the transition between these two versions, but during all tests, v2.0 again has occasional tearing in horizonal scrolling.
Of course, I didnt test on P2 v1.2 and Pi 3, so I dont know how v2.0 (and v3.0) behaves on them.
Anyway, It's nice to see this great emulator progressing and I hope that someone will test a new version and give a more detailed feedback.
0 x

zx81
Berk
Posts: 47
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator v3.0

Post by zx81 » Sat Mar 03, 2018 9:57 pm

Hi Pegaz,

Any PI2 is ARMv7 based. Only PIs A, A+, B, B+ and Zero/ZeroW are ARMv6 processors. PI2 v1.1 is ARMv7. PI2 v1.2 and PI3 are ARMv8 CPUs. So, any PI-2 or PI-3 can run ZXBaremulator.

It's not possible to have a precise emulation without occasional tearing. The 48k model generate frames at 50.08 Hz and the 128k models at 50.02 Hz. The standard HDMI frame frequencies are 50 or 60 Hz. The new ZXB uses a clock interrupt programmed at, exactly, 19968 ms per frame and the 128k uses an interrupt clocked at 19991 ms per frame. You can't reach two targets in one shot: or the CPU speed is near to perfect or the image is generated at 50 Hz and the Spectrum is a bit slow compared with real machine. I prefer the first, IMHO.

A modern TV set isn't an old CRT and the image generated isn't directly controlled by the PI as does the real machine.

HDMI sound is very CPU demanding and, the worst, needs a very precise timings, so isn't possible to have HDMI sound on single CPUs. I need two CPUs, one for emulation, the other for HDMI sound, USB interrupts and secondary tasks.

Any PI2 is perfectly capable to run ZXB... :)
2 x

User avatar
Pegaz
Microbot
Posts: 172
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator v3.0

Post by Pegaz » Sun Mar 04, 2018 10:06 am

Huh, I was obviously too tired last night, misunderstood the changelog and made a totally wrong conclusion. :)
Also, thanks for the clairification about precize emulation and cpu speed, in that case you are made the right decision.
I'll try v3.0 today and give you some feedback later...
0 x

User avatar
MonkZy
Dizzy
Posts: 88
Joined: Thu Feb 08, 2018 1:01 pm

Re: ZXBaremulator v3.0

Post by MonkZy » Sun Mar 04, 2018 10:50 am

This looks great, I will be flashing an SD with this very soon.

I am in no way an expert but would you be able to get more accurate timing using the composite video output on the Pi?

At some point would you be able to add keyboard support for the Recreated ZX Spectrum? The RZX can hook up via USB so no need for bluetooth support, the output for each key down/up is fairly well documented. I know the RZX is not overly popular for many reasons, but I love using it with FUSE, feels just like using the original.
0 x

zx81
Berk
Posts: 47
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator v3.0

Post by zx81 » Sun Mar 04, 2018 11:24 am

MonkZy wrote:
Sun Mar 04, 2018 10:50 am
This looks great, I will be flashing an SD with this very soon.

I am in no way an expert but would you be able to get more accurate timing using the composite video output on the Pi?

At some point would you be able to add keyboard support for the Recreated ZX Spectrum? The RZX can hook up via USB so no need for bluetooth support, the output for each key down/up is fairly well documented. I know the RZX is not overly popular for many reasons, but I love using it with FUSE, feels just like using the original.
You don't need to flash the SD, decompress allfiles.zip on an empty SD and play. :)

No, the composite output is controlled by the VC4 too, exactly as the HDMI output. Really, isn't a timing problem, is a difference between timings, Spectrum vs screen.

Well, to add RZX support I need a real RZX to test it. I don't have a RZX keyboard...
0 x

User avatar
Pegaz
Microbot
Posts: 172
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator v3.0

Post by Pegaz » Mon Mar 05, 2018 3:47 pm

Ok, I made a quick test with v3.0 last night and the overall impression was really good.
Sound quality through HDMI is excellent.
I only noticed that the loading tape sound level is much weaker than the standard beeper/AY.
It would be good to equalize the volume, as in the original Spectrum if possible.
I love the original tape loading sound noise, but if I raise loudness on my TV, I always have to reduce it later, because the music gets too loud.
On the other hand, some demos and loaders, sounds much better if the tape loading sound is weaker or completely turned off, but then we lose the authenticity of original hardware, so maybe this is a compromise.
About new color palette, let's say that the black color is no longer pitch black, but something brighter, but this can be solved by adjusting the contrast and brightness on the TV set.
Also, theres one thing I noticed about the emulator boot time.
At Pi 2 boot time is about 5 seconds, and on Pi Zero only 3 seconds.
I dont know what is the reason for slower boot time on Pi 2, but this has happened in earlier versions too, not only on this latest one.
We have already clarified the reasons for occasional small tearing when scrolling, but I just like to say, that it occurs more often on the 48K model (about every 15 seconds), while on 128K models it occurs approximately once in almost 50 seconds.
I also think, it would be a good idea to have a fully controlled virtual tape player (especially with the auto start/stop tape feature), because some games failed to load.
Sword of Ianna is one such example, where I had to make certain corrections in the tap file with ZX-Blockeditor, to make load successfully.
All in all, emulator works great, so far I havent noticed any bugs and I think everything is in place.
As always, great job zx81, well done! :)
0 x

zx81
Berk
Posts: 47
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator v3.0

Post by zx81 » Mon Mar 05, 2018 6:59 pm

The loading sound volume is weaker on real 48k Spectrum than beeper, at least on my Spectrum+.

The WoS user 'rga24' say this about color palette:
I made a spreadsheet which takes Chris Smith’s YUV voltages and generates RGB24 values for the 16K/48K/+ ULA. It models one interesting aspect of the Spectrum ULA in particular - that the reference voltage for the U signal is not the same as the reference voltage for the V signal.

The Issue 3 circuit samples the U and V signals during the sync pulses (when they are outputting the reference voltage for black) and applies the average of these two values to the LM1889 colour encoder as the reference voltage.

The reference voltage for U is slightly higher than the average and the reference voltage for V is slightly lower - but these values are all inverted so that U ends up being slightly negative when flipped the right way up and V ends up being slightly postive. Also note there are in fact two everso slightly different reference voltages for V - the version for V on +V lines is very slightly different from the version for V on -V lines - but this difference is smaller than the difference from the U reference or the average.

I model these effects in the spreadsheet and the result is colours that look very similar to my real 48K Spectrum colours - blue and bright blue are quite similar to each other and quite dark, there is a slight overall yellow cast to white, and the bright colours get more different from the normal colours with higher numbered colours.

In B R G format:

0 6 8
A7 D 13
7 BD 7
AF C3 12
C 7 BA
B4 D C6
14 BC B9
BC C2 C4
0 6 8
B0 16 1C
18 CE 18
C8 DC 2C
2D 28 DC
DE 36 EF
46 EE EB
F7 FD FF
And that's the palette used by ZXB and by the next JSpeccy version (unreleased, code updated on github).

The code executed by the PI is exactly the same for PI-2 and PI-3. Could exist any difference at library devel, but I can't see how change this.

I should develop a tape browser, I know. But I have very limited free time.

Anyway, no serious bugs are good news... :)
1 x

User avatar
Pegaz
Microbot
Posts: 172
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator v3.0

Post by Pegaz » Thu Mar 08, 2018 5:33 pm

Today I tested the latest v3.0 version again and I can only say that my first impression hasnt changed.
Emulator works fine, stable and without bugs or at least I havent noticed them, for now. :)
Also, I can confirm that the boot time on Pi Zero is nearly twice as fast, as on Pi 2.
For testing, I used the same fresh formatted (FAT 32) micro SD card on both models, which contains the entire content of the allfiles30.zip archive.
At Pi Zero, the boot time is about 2.5 seconds, and on Pi 2 about 5 seconds, from the moment I switched on, until the Sinclair message appears on the screen.
This boot time is really impressive (almost like the real Spectrum), even if the ARM6 version doesnt have HDMI sound support.
I also tried to connect the Pi Zero and Spectrum original keyboard, via Arduino Pro Micro, but unfortunately, Baremulator doesnt seem to support this microcontroller and I always get a message that the keyboard is not connected.
Alternatives are various mini usb keyboards but this can never be a true retro solution.
I'm still thinking which combination would be the best, but for now I havent found the ideal solution...
0 x

Post Reply