ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

User avatar
pgimeno
Top Contributor
Posts: 609
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 218 times
Been thanked: 184 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by pgimeno »

My Recreated will take a while to arrive because brexit, so I can't test myself for now, but here's an untested core. Please check if it works as expected.

I tried my best to keep the normal keys that didn't conflict with the Recreated working, but it was a hell to isolate those without breaking anything so I've finally given up: if you have both the PC keyboard and the Recreated keyboard connected, the extra keys in the PC keyboard like the arrows won't work when in Recreated mode, so you need to use caps+5,6,7,8 etc.
Attachments
ZX-Spectrum-recr.rbf
(3.03 MiB) Downloaded 97 times
User avatar
_paul_
Posts: 54
Joined: Mon Aug 31, 2020 4:44 pm
Has thanked: 9 times
Been thanked: 12 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by _paul_ »

pgimeno wrote: Thu Nov 18, 2021 9:06 pm My Recreated will take a while to arrive because brexit, so I can't test myself for now, but here's an untested core. Please check if it works as expected.

I tried my best to keep the normal keys that didn't conflict with the Recreated working, but it was a hell to isolate those without breaking anything so I've finally given up: if you have both the PC keyboard and the Recreated keyboard connected, the extra keys in the PC keyboard like the arrows won't work when in Recreated mode, so you need to use caps+5,6,7,8 etc.
Had a go at this but in my first pass it seems to behave the same as the original core? And the arrow keys on the PC keyboard work fine, can you check if you shared the correct (modified) core?
User avatar
pgimeno
Top Contributor
Posts: 609
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 218 times
Been thanked: 184 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by pgimeno »

Yes, I've verified it to be sure. You need to go to the menu and set the Keyboard option to Recreated ZX. Take into account that this patch is not Recreated-specific, but should be applicable to the current core so that the default is the normal keyboard.

My Recreated arrived today, my wife was hiding that as a surprise :) I've checked it and it seems to work fine. Here's a simple BASIC program you can try to check that all key press/release combinations work:

Code: Select all

10 LET a=254
20 PRINT IN (a*256+254);"  "
30 LET a=a+a+255
40 IF a>0 THEN GO TO 20
50 PRINT AT 0,0;: GO TO 10
I've noticed that the Recreated keyboard does NOT include ghosting support. I'm not sure if that's good or bad. I'll look into adding an option to the core next.

Attached is the complete patch. Now the problem is that I'm not in GitHub, so this patch can't be merged into the core unless someone submits a PR with the patch for me.
Attachments
ZX-Spectrum-recreated.patch.zip
(3.78 KiB) Downloaded 94 times
User avatar
_paul_
Posts: 54
Joined: Mon Aug 31, 2020 4:44 pm
Has thanked: 9 times
Been thanked: 12 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by _paul_ »

pgimeno wrote: Fri Nov 19, 2021 11:46 am Yes, I've verified it to be sure. You need to go to the menu and set the Keyboard option to Recreated ZX. Take into account that this patch is not Recreated-specific, but should be applicable to the current core so that the default is the normal keyboard.
...
Sorry, completely missed the keyboard selection option, I had assumed you had simply created an alternate "Recreated" core as a PoC.

It works brilliantly, many thanks for doing this!!
Hetzen
Posts: 117
Joined: Thu Oct 14, 2021 1:55 pm
Has thanked: 63 times
Been thanked: 36 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by Hetzen »

So what do I need to do with this .patch file? I've got one of these keyboards incoming based on the back of this thread.
User avatar
pgimeno
Top Contributor
Posts: 609
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 218 times
Been thanked: 184 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by pgimeno »

Hetzen wrote: Tue Nov 30, 2021 10:19 pm So what do I need to do with this .patch file? I've got one of these keyboards incoming based on the back of this thread.
You need to grab the core from this post: viewtopic.php?p=37717#p37717 then install (copy) it in the _Computer folder of the SD card.

The patch file is for submitting the changes to GitHub.
Hetzen
Posts: 117
Joined: Thu Oct 14, 2021 1:55 pm
Has thanked: 63 times
Been thanked: 36 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by Hetzen »

Thank you, I appreciate that. Looking forward to getting that nostalgic RSI when it arrives.
User avatar
pgimeno
Top Contributor
Posts: 609
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 218 times
Been thanked: 184 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by pgimeno »

Hetzen wrote: Wed Dec 01, 2021 12:02 am Thank you, I appreciate that. Looking forward to getting that nostalgic RSI when it arrives.
Well, after having tried it for a while now, I can say that the experience was superb! And I'm now convinced that it's the right approach for replicating classic computers. Adding emulation hardware to it may seem like a closer replication on the surface, but in the end it loses in flexibility. The Recreated ZX creators did it right, by making only a keyboard and not a full computer. I just wish the same approach was used for other computers, like the C64, instead of having all-in-one solutions devoted to a single computer like the Ultimate 64. I'd love to have a recreated C64 USB keyboard, a QL USB keyboard and so on.

On the technical side, I have to "scold" the creators of the Recreated ZX for choosing to make shift+key combinations part of the protocol, which is a shame, but not a horribly big issue. At least they did use a unique mapping for each key.

Also many thanks to _paul_ for getting me started, by posting the link to zx81keyboardadventure.com explaining the protocol.
User avatar
pgimeno
Top Contributor
Posts: 609
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 218 times
Been thanked: 184 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by pgimeno »

I've just reviewed some posts in GitHub. Apparently there isn't much interest in adding support for the Recreated keyboard: https://github.com/MiSTer-devel/ZX-Spec ... -711439558 (and it seems I'm not the first person to write a patch).

I don't agree with Sorgelig's argument though, as many cores get support for controllers that match the device they are for, like spinner controls for certain arcade cores. (Edit: or the 2600daptor for... guess what) ;)
Hetzen
Posts: 117
Joined: Thu Oct 14, 2021 1:55 pm
Has thanked: 63 times
Been thanked: 36 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by Hetzen »

pgimeno wrote: Wed Dec 01, 2021 12:59 am Well, after having tried it for a while now, I can say that the experience was superb! And I'm now convinced that it's the right approach for replicating classic computers. Adding emulation hardware to it may seem like a closer replication on the surface, but in the end it loses in flexibility. The Recreated ZX creators did it right, by making only a keyboard and not a full computer. I just wish the same approach was used for other computers, like the C64, instead of having all-in-one solutions devoted to a single computer like the Ultimate 64. I'd love to have a recreated C64 USB keyboard, a QL USB keyboard and so on.
That's good to hear, because I agree with you 100%, the emulation doesn't stop at the code. I'm currently looking at mechanical keyboards that would cover the 8bit/16bit era to build a case around. The Spectrum needs those printed overlays to make any sense of the way it worked. Like you, I'd put the C64/Vic20/Pet in that category too.
Hetzen
Posts: 117
Joined: Thu Oct 14, 2021 1:55 pm
Has thanked: 63 times
Been thanked: 36 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by Hetzen »

pgimeno wrote: Wed Dec 01, 2021 1:57 am I've just reviewed some posts in GitHub. Apparently there isn't much interest in adding support for the Recreated keyboard: https://github.com/MiSTer-devel/ZX-Spec ... -711439558 (and it seems I'm not the first person to write a patch).

I don't agree with Sorgelig's argument though, as many cores get support for controllers that match the device they are for, like spinner controls for certain arcade cores.
I don't understand that. Is it a control thing about the code? If someone makes a solution I guess it's hard to bug fix with multiple authors.
cathrynmataga
Posts: 101
Joined: Fri Aug 06, 2021 5:30 pm
Has thanked: 106 times
Been thanked: 15 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by cathrynmataga »

Is it possible to go the other way, and get the ZX Spectrum Recreated people to add a mapping that matches what the Mister Spectrum cores use? Those guys might be motivated since they'll want to sell keyboards.
User avatar
pgimeno
Top Contributor
Posts: 609
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 218 times
Been thanked: 184 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by pgimeno »

It's likely that they won't. https://www.eurogamer.net/articles/2016 ... x-spectrum

I'm not sure but I think that it's no longer for sale. It's been out of stock every time I checked, for a long time. I got mine from eBay, used.

From the way it works (having to unlock the standard keyboard mode with a code in their page, having a custom special mapping) it seems clear that by design they don't want people to use it for anything else but their app, and that they took every precaution they could against it being adapted for use with other emulators (but people managed to do it anyway).
rhester72
Top Contributor
Posts: 759
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 8 times
Been thanked: 95 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by rhester72 »

I am VERY confused.

Why does Sorg have a problem with this, but not the C64 Maxi interface over USB?
User avatar
Chris23235
Top Contributor
Posts: 729
Joined: Sun May 24, 2020 8:45 pm
Has thanked: 85 times
Been thanked: 137 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by Chris23235 »

If you have access to a ZX Spectrum (or an empty replica case) and a soldering iron you can convert the Speccy to an USB keyboard relatively easy.

https://www.instructables.com/ZX-Spectr ... rd-Part-1/
User avatar
pgimeno
Top Contributor
Posts: 609
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 218 times
Been thanked: 184 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by pgimeno »

I couldn't find these connectors anywhere though. Any references/links? Edit: Oops, I didn't see the link in the article.

Also, I guess the software needs to produce the same keyboard layout as MiSTer (SHIFT for caps shift, CTRL for symbol shift). If not, then it will need to be customized.
User avatar
pgimeno
Top Contributor
Posts: 609
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 218 times
Been thanked: 184 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by pgimeno »

Okay, so as I said in an earlier post, I wasn't happy about the lack of ghosting in the Recreated keyboard (or in the core in general), so I've added it to the core as an option. I must say that I'm somewhat perplexed that the Recreated keyboard does not suffer from ghosting.

To avoid clobbering the menus too much, I've used the Keyboard option for both purposes, so it cycles between four choices: Normal, Ghosting, Recreated ZX, Rec.+Ghosting.

In addition to that, this version also fixes an out-of-specs issue with the TZX loader, where the duration of the leading tone of the standard blocks was a fixed value instead of depending on bit 7 of the first byte in the block. You know, ~5s of leading tone, header data, 1s pause, ~2s of leading tone, payload.

As always, the patch is included. The license mandates me to distribute the source code; I hope that including only the patch suffices, as it's otherwise identical to the GitHub version.

Edit: Note that most PC keyboards will suffer from key jamming, which will mask the ghosting. Also if you make your own USB keyboard using the link posted by Chris23235, you'll get ghosting for free due to the membrane design :)

Edit2: Removed attachments because of an important bug, see viewtopic.php?p=39308#p39308 for the fixed core.
caffeinekid
Posts: 72
Joined: Wed Nov 04, 2020 10:03 am
Has thanked: 21 times
Been thanked: 12 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by caffeinekid »

Great fixes and additions. I hope this will be added to the official repo... I can't understand why it wouldn't be.
Hetzen
Posts: 117
Joined: Thu Oct 14, 2021 1:55 pm
Has thanked: 63 times
Been thanked: 36 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by Hetzen »

Just had a chance to load and use this. So far it's working really well. Thank you. Great work!
Higgy
Posts: 72
Joined: Mon May 25, 2020 9:37 am
Has thanked: 1 time
Been thanked: 23 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by Higgy »

If you don't have access to Minimus then you can use cheap Arduino Pro Micro's.
The project info is on these pages:
https://mrpjevans.com/building-the-zx-r ... -part-two/

Nice thing with this one is you have keyboard mapping via a switch, so you get PC style and Spectrum layout.
I was using this method for some years until I fixed the broken Spectrum (ram chips!) the keyboard came from.
akeley
Top Contributor
Posts: 1113
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 337 times
Been thanked: 310 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by akeley »

pgimeno wrote: Fri Dec 03, 2021 11:04 pm Note that most PC keyboards will suffer from key jamming, which will mask the ghosting.
Whoa, I had never heard about that before! And I've played quite a lot of PC games using KB+M.

Coincidentially, I was playing Renegade on teh ZX core yesterday using keyboard (instead of my usual DS4-as-Kempston) and could not execute the jump kick-right move (left one was fine). My keys were W/S for Up/Down, O/P for left right and ] for Hit. Could it be because of that "jamming" issue?
User avatar
pgimeno
Top Contributor
Posts: 609
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 218 times
Been thanked: 184 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by pgimeno »

akeley wrote: Tue Dec 07, 2021 7:40 pm Coincidentially, I was playing Renegade on teh ZX core yesterday using keyboard (instead of my usual DS4-as-Kempston) and could not execute the jump kick-right move (left one was fine). My keys were W/S for Up/Down, O/P for left right and ] for Hit. Could it be because of that "jamming" issue?
If it involves three keys, then most probably, yes. You can try to find a combo of keys that you can press at the same time with that keyboard without any jamming. Can't offer advice on that as it's different with every keyboard.

I guess MAME chose Ctrl, Alt and Shift as preferred buttons mainly for that reason - they are usually separate buttons and don't suffer from jamming.
User avatar
_paul_
Posts: 54
Joined: Mon Aug 31, 2020 4:44 pm
Has thanked: 9 times
Been thanked: 12 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by _paul_ »

pgimeno wrote: Fri Dec 03, 2021 11:04 pm Okay, so as I said in an earlier post, I wasn't happy about the lack of ghosting in the Recreated keyboard (or in the core in general), so I've added it to the core as an option. I must say that I'm somewhat perplexed that the Recreated keyboard does not suffer from ghosting.
….
I may well be missing something but the tzx version does not work for me; I get this screen.
Attachments
1D3C32DA-B080-4438-A22A-7979294C6E65.jpeg
1D3C32DA-B080-4438-A22A-7979294C6E65.jpeg (152.42 KiB) Viewed 8120 times
Hetzen
Posts: 117
Joined: Thu Oct 14, 2021 1:55 pm
Has thanked: 63 times
Been thanked: 36 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by Hetzen »

Did you change the keyboard type in the core menu?
User avatar
pgimeno
Top Contributor
Posts: 609
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 218 times
Been thanked: 184 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by pgimeno »

_paul_ wrote: Fri Dec 10, 2021 7:51 pm I may well be missing something but the tzx version does not work for me; I get this screen.
Sorry but I have absolutely no idea where that may be coming from. It looks like a test pattern of some sort; maybe it's not detecting boot.rom correctly for you and boots from a built-in test ROM that displays that pattern? I haven't found any evidence of such ROM though.
User avatar
_paul_
Posts: 54
Joined: Mon Aug 31, 2020 4:44 pm
Has thanked: 9 times
Been thanked: 12 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by _paul_ »

On start-up it always has this screen for me. If I reset the core (with or without making any changes to the core settings) the core boots fine.

Edit: found this in the ZX Spectrum manual
The Spectrum 128 has a built-in TV test screen to ensure that you get the best possible picture and sound. You turn it
on by holding down the [BREAK] key and pressing the reset button or switching on the power. When your TV is
tuned correctly, you will see a multi-coloured pattern and hear an intermittent tone.
I could not trigger this with the default ZX Spectrum core.

With the tzx variant I found that, with the "Normal" keyboard setting in the core settings, a key often gets stuck in auto repeat, both with my normal USB keyboard as well as with the Recreated keyboard set to PC config. It does not do that with the earlier core.

With the Recreated keyboard setting selected in the core options it works fine.
User avatar
pgimeno
Top Contributor
Posts: 609
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 218 times
Been thanked: 184 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by pgimeno »

_paul_ wrote: Sat Dec 11, 2021 8:29 am With the tzx variant I found that, with the "Normal" keyboard setting in the core settings, a key often gets stuck in auto repeat, both with my normal USB keyboard as well as with the Recreated keyboard set to PC config. It does not do that with the earlier core.
I guess it's the ghosting option that is causing problems, then. Does setting/clearing it help in any way? What's it set to by default?

Edit: Never mind, I can reproduce the issue and I think I have identified the cause. Yes, it's about the ghosting option. I'll post the fixed core soon.
User avatar
pgimeno
Top Contributor
Posts: 609
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 218 times
Been thanked: 184 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by pgimeno »

Here's the fixed core and corresponding patch.
Attachments
ZX-Spectrum-recreated-tzx-ghosting.patch.zip
(6.42 KiB) Downloaded 80 times
ZX-Spectrum-recr-tzx.rbf
(3.06 MiB) Downloaded 85 times
User avatar
_paul_
Posts: 54
Joined: Mon Aug 31, 2020 4:44 pm
Has thanked: 9 times
Been thanked: 12 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by _paul_ »

pgimeno wrote: Sat Dec 11, 2021 1:21 pm Here's the fixed core and corresponding patch.
Seems to work! I no longer get the test screen and could not reproduce the sticky keys issue.
EeDee
Posts: 202
Joined: Thu Dec 24, 2020 12:33 pm
Has thanked: 3 times
Been thanked: 36 times

Re: ZX Spectrum Recreated Would Work as Bluetooth Keyboard With MiSTer?

Unread post by EeDee »

MiSTer_Kirk wrote: Thu Nov 18, 2021 2:25 pm The beauty of the Mister is that we can finally ditch that god-awful rubber keyboard, and use a modern keyboard....
I also have a few 48k spectrums here, and I try to use the keyboard less, and less. I now use a Comcon Joystick interface that allows keyboard-only games to be mapped to this device - just to avoid that keyboard.
:lol:
Post Reply