ZXBaremulator v3.0

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

ZXBaremulator v3.0

Post by zx81 »

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
User avatar
RMartins
Manic Miner
Posts: 776
Joined: Thu Nov 16, 2017 3:26 pm

Re: ZXBaremulator v3.0

Post by RMartins »

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

Nice work.
User avatar
Pegaz
Dynamite Dan
Posts: 1209
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator v3.0

Post by Pegaz »

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.
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator v3.0

Post by zx81 »

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... :)
User avatar
Pegaz
Dynamite Dan
Posts: 1209
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator v3.0

Post by Pegaz »

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...
User avatar
MonkZy
Manic Miner
Posts: 278
Joined: Thu Feb 08, 2018 1:01 pm

Re: ZXBaremulator v3.0

Post by MonkZy »

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.
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator v3.0

Post by zx81 »

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...
User avatar
Pegaz
Dynamite Dan
Posts: 1209
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator v3.0

Post by Pegaz »

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! :)
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator v3.0

Post by zx81 »

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... :)
User avatar
Pegaz
Dynamite Dan
Posts: 1209
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator v3.0

Post by Pegaz »

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...
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator v3.0

Post by zx81 »

The Pi2 needs to initialize more hardware than Pi Zero and 4 CPUs. I can do nothing to speed the boot process, I fear.

Obviously, the emulator knows nothing about an Arduino connected to the PI. Tomorrow comes a Recreated ZX keyboard, kindly donated by Hikoki. I want to support it. Another solution can be a keyboard connected to GPIO, as shows the MagPi #67.

The "ideal" solution always will be a real Spectrum... :D
User avatar
Pegaz
Dynamite Dan
Posts: 1209
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator v3.0

Post by Pegaz »

Of course, I understand that, I'm just saying that this faster boot time is more suited to me, if I put Pi inside a Spectrum case.
When I say "ideal" solution, I mean specifically on such a hardware project, nothing else. ;)
Recreated ZX keyboard support is certainly a good thing, the problem that I have is the same as it was yours - It's really difficult to get this keyboard outside of the UK.
UK online shops that sells it at a reasonable price does not send anywhere abroad, so I'm stuck.
The MAG Magazine solution cant be applied to the Baremulator, because it requires Linux based system, with Python support, which software scans the Spectrum keyboard connected to the GPIO port.
hikoki
Manic Miner
Posts: 576
Joined: Thu Nov 16, 2017 10:54 am

Re: ZXBaremulator v3.0

Post by hikoki »

[mention]Pegaz[/mention]
Amazon Spain provides RZX though more expensive than the ones from UK (42£ versus 25£). You may know someone who can send one from UK to your homeland? BTW I don't have any more Amazon e-gift card :)

Another interesting option would be that you talked to the man behind Retroradionics.co.uk, Djordje Mitic is a serbian who can be contacted on facebook. He sells repro cases for less than 60$ including laser cutting for a number of different hardware projects. I wonder if he'd be interested in designing a laser cutting to fit a RPi inside.
User avatar
Pegaz
Dynamite Dan
Posts: 1209
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator v3.0

Post by Pegaz »

hikoki wrote: Fri Mar 09, 2018 10:35 am @Pegaz
Amazon Spain provides RZX though more expensive than the ones from UK (42£ versus 25£). You may know someone who can send one from UK to your homeland? BTW I don't have any more Amazon e-gift card :)

Another interesting option would be that you talked to the man behind Retroradionics.co.uk, Djordje Mitic is a serbian who can be contacted on facebook. He sells repro cases for less than 60$ including laser cutting for a number of different hardware projects. I wonder if he'd be interested in designing a laser cutting to fit a RPi inside.
Yes, I know that Djordje is making repro cases, but I already have the one spare original Spectrum case for that purpose.
The problem is that I dont know how to connect Spectrum keyboard and Pi, to work with Baremulator.
RZX is another option, I will see if there is a way to get one for a resonable price.
If not, I will get some suitable mini pc usb keyboard and try to insert Pi Zero inside.
I know, in this case, I'm losing HDMI sound with Baremulator v3.0, but we cant have everything...
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator v3.0

Post by zx81 »

Pegaz wrote: Fri Mar 09, 2018 7:27 am The MAG Magazine solution cant be applied to the Baremulator, because it requires Linux based system, with Python support, which software scans the Spectrum keyboard connected to the GPIO port.
False. I can read the GPIOs perfectly from bare-metal, I don't need Linux or Python, neither. But I should to program the GPIO reading and translating the IOs to emulated keyboard. For that, I need the circuit and a working original keyboard (keyboard on my Spectrum+ don't works very well).
User avatar
Pegaz
Dynamite Dan
Posts: 1209
Joined: Mon Nov 13, 2017 1:44 pm

Re: ZXBaremulator v3.0

Post by Pegaz »

zx81 wrote: Fri Mar 09, 2018 3:08 pm
Pegaz wrote: Fri Mar 09, 2018 7:27 am The MAG Magazine solution cant be applied to the Baremulator, because it requires Linux based system, with Python support, which software scans the Spectrum keyboard connected to the GPIO port.
False. I can read the GPIOs perfectly from bare-metal, I don't need Linux or Python, neither. But I should to program the GPIO reading and translating the IOs to emulated keyboard. For that, I need the circuit and a working original keyboard (keyboard on my Spectrum+ don't works very well).
That's great news.
The MAG magazine has a complete guide for the circuit (which is quite simple), and here's more details on how to connect the GPIO pins to the Spectrum keyboard.
https://github.com/mrpjevans/zxscanner
If Baremulator gets support for this, I would gladly try it out.
User avatar
adonet
Drutt
Posts: 22
Joined: Tue Apr 10, 2018 7:52 pm
Location: Netherlands
Contact:

Re: ZXBaremulator v3.0

Post by adonet »

Hi there,

is there a version that runs on 32 bit Intel architecture? I would like to make a ZX Spectrum of my old 32 bit intel based laptop.
now I am running Batocera (sort of Retropie) on this machine and that is very nice, but making a spectrum would be very interesting.
https://batocera-linux.xorhub.com/
I am Using ZX Machines since 1981.
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator v3.0

Post by zx81 »

[mention]adonet[/mention]

No, ZXBaremulator is for PI hardware. I don't have any plan to port it to another platform.
ricky006
Drutt
Posts: 2
Joined: Sun May 06, 2018 1:58 pm

Re: ZXBaremulator v3.0

Post by ricky006 »

Hello , I have just found out about this stand alone ZXBaremulator, I have a 32'' Samsung LCD HDMI and I'm just getting a Black screen , I need to know what to change in the Config.txt, I'm on a PI 3 .
Thanx 4 UR Time.

:D
ricky006
Drutt
Posts: 2
Joined: Sun May 06, 2018 1:58 pm

Re: ZXBaremulator v3.0

Post by ricky006 »

It's OK I was using the Allfiles instead of the ZXMini zips , I can see the the picture now , Now to test . Thankyou
User avatar
adonet
Drutt
Posts: 22
Joined: Tue Apr 10, 2018 7:52 pm
Location: Netherlands
Contact:

Re: ZXBaremulator v3.0

Post by adonet »

Is there anyone who got this Baremulator working with a conversion kit from here: http://blog.tynemouthsoftware.co.uk/201 ... -kits.html
I build this into my old Lo>>profile keyboard, but it doesn't work really well. In FUSE, FBZX, Eighty-one and ZEsarUX this keyboard performs fine.
I am Using ZX Machines since 1981.
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator v3.0

Post by zx81 »

adonet wrote: Tue Jun 05, 2018 11:25 am Is there anyone who got this Baremulator working with a conversion kit from here: http://blog.tynemouthsoftware.co.uk/201 ... -kits.html
I build this into my old Lo>>profile keyboard, but it doesn't work really well. In FUSE, FBZX, Eighty-one and ZEsarUX this keyboard performs fine.
ZXBaremulator don't uses an operating system and nothing is magical. The last beta (3.H.6) supports the ZX Recreated keyboard. I don't know how works these new conversion kit. Hard to add support for it.
User avatar
adonet
Drutt
Posts: 22
Joined: Tue Apr 10, 2018 7:52 pm
Location: Netherlands
Contact:

Re: ZXBaremulator v3.0

Post by adonet »

Hi ZX81, I do understand that. It is just the case that this conversion kit converts the old Spectrum keyboard to an USB keyboard and makes outputs in 2 modes. The first one is an ordinairy ZX Spectrum. Other emulators interpret the keypresses right. And the secons one is a USB keyboard mode for use in other cases than emulators.
I already contacted the maker of this converion kit to ask him more technical details of his output.

for now I only have this:
Spectrum Mode
Image

keyboard mode
Direct
Image

CAPS shift
Image

Symbol shift
Image

Can you give me a clue which file contains the keyboard layout in your baremulator? I am willing to try myself to make a usable keyboard interpretation function if that is possible.
I am Using ZX Machines since 1981.
User avatar
adonet
Drutt
Posts: 22
Joined: Tue Apr 10, 2018 7:52 pm
Location: Netherlands
Contact:

Re: ZXBaremulator v3.0

Post by adonet »

adonet wrote: Tue Jun 05, 2018 9:17 pm Hi ZX81, I do understand that. It is just the case that this conversion kit converts the old Spectrum keyboard to an USB keyboard and makes outputs in 2 modes. The first one is an ordinairy ZX Spectrum. Other emulators interpret the keypresses right. And the secons one is a USB keyboard mode for use in other cases than emulators.
I already contacted the maker of this converion kit to ask him more technical details of his output.

for now I only have this:
Spectrum Mode
Image

keyboard mode
Direct
Image

CAPS shift
Image

Symbol shift
Image

Can you give me a clue which file contains the keyboard layout in your baremulator? I am willing to try myself to make a usable keyboard interpretation function if that is possible.
I 'd like to add one more point of information. The conversion kit 's output is the same as the output of a brittish UK english keyboard.
I am Using ZX Machines since 1981.
zx81
Microbot
Posts: 138
Joined: Sat Feb 17, 2018 9:33 pm

Re: ZXBaremulator v3.0

Post by zx81 »

adonet wrote: Tue Jun 05, 2018 9:17 pm Hi ZX81, I do understand that. It is just the case that this conversion kit converts the old Spectrum keyboard to an USB keyboard and makes outputs in 2 modes. The first one is an ordinairy ZX Spectrum. Other emulators interpret the keypresses right. And the secons one is a USB keyboard mode for use in other cases than emulators.
I already contacted the maker of this converion kit to ask him more technical details of his output.

Can you give me a clue which file contains the keyboard layout in your baremulator? I am willing to try myself to make a usable keyboard interpretation function if that is possible.
An ordinary USB keyboard don't have a "ZX Spectrum mode". To work with ZXBaremulator the keyboard needs to be a civilized HID USB device with a boot descriptor. Has you tried the USB keyboard mode?

The keyboard handling is developed in C++, don't uses any table.

You can try this kernel image, suitable for PI-2/3. This kernel shows on the screen the keys sended by the keyboard. You can see the difference between keyboard modes.
Post Reply