Sunday, 26 May 2024

The actual Kempston joystick interface is not the best Kempston compatible joystick interface

I know I have several of these, but I couldn't find any when I was working on the previous post where I looked into Kempston compatible joystick interfaces  - http://blog.tynemouthsoftware.co.uk/2024/05/minstrel-joystick.html

I have now found an actual Kempston joystick interface.

Turns out Kempston Micro Electronics were actually based in Kempston, Bedford, UK.

All the best hardware comes from companies named after their location.....

This is a two chip design. Both slightly unusual choices.

Problem 1

The one on the right is a 4071 CMOS quad OR gate, why not use a 74LS32? Maybe they were cheaper, or they liked the slightly different pinout? (the outputs are all on the middle pins 3,4,10 and 11).

CMOS and TTL do not usually mix, but you can generally drive TTL inputs from CMOS outputs, just not the other way around. The inputs are all direct from the NMOS / CMOS Z80, so it should be OK, but it does no seem ideal.

The chip on the left is a 74LS541, also unusual. Like many of the 500 series, this is a version of another chip with an alternate pinout, in this case a 74LS241. The 500 series often all the inputs on one side, all the outputs on the other, to make PCB layout neater, I like the 573 and 574 for that.

I will give them credit, the layout is indeed very neat. All single sided, with no jumper links.

Problem 2

The decoding is a little lacking. They have used A5, A6, A7 and /IORQ all low, which responds to an IO request over the address range of 00-1F (0-31). However as well as the read requests it needs to respond to, it will also respond to writes and interrupt acknowledge signals. This could cause a bus conflict as both the Z80 and the 541 buffer will be writing to the databus, so is not ideal. They had a spare OR gate, so they could have added /RD low as an extra condition to fix that.

Problem 3

Also unusual is the way the 9 way D joystick port is wired. The common on the joystick port, pin 8, is connected via a 4.7KΩ resistor to 5V, and the autofire power, pin 7 is not connected.

This interface is (by definition) Kempston compatible, so follows the standard protocol of a byte read from address $1F / 31, with the bits set as 0 normally and 1 when active.

To achieve that, with the non-inverting buffer chip they have selected, all the pins are pulled low with 10KΩ resistors, including the three unused bits. The switches in the joystick are used to switch to 5V (via the 4.7KΩ resistor). These signals are then passed though the non-inverting buffer when the port is read.

That arrangement isn't really Atari / Commodore compatible, because the common pin 8 is normally connected to 0V and pin 7 supplies 5V for autofire circuits etc.

Pin
Kempston
Atari / Commodore
1
Up
Up
2
Down
Down
3
Left
Left
4
Right
Right
5
-
- / Paddle / Fire 3
6
Fire
Fire
7
-
5V
8
5V
0V
9
-
- / Paddle / Fire 2

That means most (if not all) autofire circuits will not work. Some will do nothing, others may do odd things like fire continuously, or fire when moved in any direction. Some may even be damaged by the reverse polarity.

What's that you say? you want a blog post with a deep dive into autofire circuits? One day maybe.

Problem 4

Having the common wired directly to 0V would mean you should get pretty much 0V at the input of the logic gates. Any resistance due to the switch contacts, cables and connectors should be insignificant in relation to the pullup resistors that are typically 10KΩ.

In a worst case, with a really poor cable and bad contacts you might get 100Ω combined resistance. With a 10KΩ pullup, that would still give an output of 0.05V, and in practice, it is likely to be only a few ohms, so only a few mV above 0V.

Kempston have fitted a 4.7KΩ current limiting resistor in the common line. The value of this is quite close to the 10KΩ pull downs resistors. This will form a potential divider and the voltage input to the buffer chip will not be 5V when you hit fire or move the joystick. Normally you would plan them to be orders of magnitude apart so the potential divider impact would be insignificant.

With just fire pressed or a movement in a single direction, the potential divider created by the 4.7KΩ resistor and a single 10KΩ pulldown will give about 3.4V. Not 5V as would be ideal, but well in the range of logic 1 for a TTL chip (which should be anything over 2.0V).

With fire pressed at the same time as moving in a direction, or a diagonal movement which will register as two directions at the same time, there will be two 10KΩ pull downs in parallel.

I have redrawn that with the switches removed and replaced by shorts or gaps, so you can see the resistors that are still in circuit and the the ones that are not.

This means the potential divider is now 4.7KΩ and 5K, so the output voltage would be about 2.6V. Again not ideal, but still just about within range.

In the (admitedly rare) case of fire and a diagonal at the same time, would be three 10KΩs in parallel. That would make their combined resistance 3.3KΩ, giving an output voltage or around 2.1V, very close to the 2.0V threshold. If the 5V line dropped only slightly to 4.8V, the input to the logic gate would drop below 2.0V and into the no mans land between logic 0 and logic 1, so it may not always read correctly if you press fire when moving diagonally.

Could they have done it differently?

I am not sure why they decided to deviate from the standard established by Atari in 1977. They could have used a 74LS540 instead of a 541. That is an inverting buffer, so they could have implemented a more standard interface with pin 8 as 0V and pin 7 as 5V, and pullups on the inputs up to 5V.

Something like this:

I have left it with a 4071, but ideally a 74LS32 would be more appropriate.

This version has no extra parts (in fact there is one fewer part as there is no need for the contentious 4.7KΩ resistor) and makes it more compatible with other 9 pin D joysticks. I guess they must have had their reasons.

I also used the spare gate to add /RD to the decoding to stop it responding to writes and interrupt acknowledges. Again, that's for free if they had chosen to, it would not add any additional propagation delay, and I think would have routed neatly without a need for a jumper link.

Actually, I've just checked and the 541 has two enable inputs which are ORed together, so both have to be low to enable the buffer. They have them both wired to the output of the OR gate address decoder, so they could have just wired one of them directly to /RD and not even needed the spare gate.

So in several ways, the Kempston joystick interface is not the best Kempston compatible joystick interface.

Problem 5

This particular example also has one more thing against it, a damaged edge connector.

I have picked up a few interfaces of various type with edge connectors that are broken like this one. The material seems to be quite brittle and the connector cracks all the way along one side. I guess someone left this connected to their Spectrum and then it got knocked.



Advertisements

My own take on a Kempston compatible joystick interface is the Minstrel Joystick.

This is available from my SellMyRetro store

This can be fitted with an edge connector and used directly on a Minstrel 2 or 3, or a ZX80, ZX81 or ZX Spectrum. Or it can be used as part of the Minstrel Expansion Bus.

Those and the full range of Minstrel and Mini PET kits and accessories are available form my SellMyRetro store.

All the links can be found here:

Patreon

You can support me via Patreon, and get access to advance previews of posts like this and behind the scenes updates. These are often in more detail than I can fit in here, and some of these posts contain bits from several Patreon posts. This also includes access to my Patreon only Discord server for even more regular updates.

Sunday, 19 May 2024

The Micro ZXpand Minstrel

This post is a combination of new material and material from 4 Patreon posts, covering the development of a new product. (I think using bits from 5 separate posts must be a record for me)

I'll cut to the chase, this is the new Micro ZXpand Minstrel. I know, awful name. I have been using the name µZXp in my notes. That's probably worse, but at least it's shorter.

This will allow you to load and save files to microSD card, overloading the BASIC LOAD and SAVE commands and adding new ones such as CAT to show a list of files on the SD card and CONFIG to change settings.

It is a minimal implementation of the Minstrel ZXpand, which itself is a cut down version of the ZXpand Classic (which was designed by Charlie Robson).

Feature
Micro ZXpand Minstrel
Minstrel ZXpand
ZXpand Classic
ZXpand+
LOAD and SAVE .P files
ZXpand Joystick
Kempston Joystick
FTDI Serial Port
32K RAM
ROM
AY-3-8192 Audio

In short, this is only suitable for use with one of the stand alone versions of recent Minstrel 3 boards, V3.5.5 onwards, which have the appropriate expansion connector.

It will not work with earlier Minstrel 2 or 3 boards, or anything in a ZX81 case.

In long, here is a more detailed list of supported machines:

Machine
Micro ZXpand Minstrel
Minstrel ZXpand
ZXpand Classic
ZXpand+
Minstrel 3 V3.5.5 and later stand alone
Older Minstrel 3 stand alone
Minstrel 3 in ZX81 Case
ZX81
Minstrel 2 stand alone
*
Minstrel 2 in ZX81 case
*
ZX80
**
  • * - Requires mods to the ZXpand
  • ** - Requires mods to ZX80 and ZXpand

Back to March 2024....

Minstrel ZXpand in kit and assembled form is now available in my Sell My Retro store.

This available in as a pre-assembled version ready to plug into a Minstrel 3, complete with replacement ROM.

And a kit version to build yourself.

That plus into the edge connector on the back of the Minstrel 3.

With the recent Minstrel 3 boards, there is now potentially an alternate option, mounting it vertically on the pin header.

It looks like it will fit, even with sockets on the logic chips.

If anyone wants to try that with a built one or a kit, let me know and I will include the appropriate connector.

It will still need a wire to the ROM select jumper block, but that would be on a short cable like the edge connector version.

A few days later.....

In the previous post, I considered the option of a vertical mounting.

It had to be tried.

Works rather well, and still leaves access to the expansion edge connector, should you need it.

The only quandary is which way to do the header. I have been fitting pins to the board, but it seems to make sense for that to actually be a socket and have the pins on the expansion card.

What do you think?

ROM Select

The ZXpand needs to control the ROM settings on the mainboard, to switch in and out the ZXpand ROM code. Traditionally, I had used A15 to switch that, giving 4 ROM set options (4K and 8K ZX80 and 8K ZX81). That required a 27C512 EPROM, which, at the time, were available. A wire connected to the jumper block, leaving A13 and A14 available for ROM selection.

With the updated ZXpand, I didn't have many 27C512's left, so I was looking to move to a 27C256 (which I at least have more of). But that meant changing to one of the other pins. But it just didn't look right, blocking off the other two jumpers.

Just on the off chance, I checked, and was amazed to see they were actually available again. New EPROMs! Never thought I would live to see the day. So, the ZXpand can continue with A15 switching.

A little later after that......

When I brought back the Minstrel ZXpand, I kept the design pretty much as the previous batch, just updating the font.

Now that is back in the game, I had been looking at some changes.

I have added the expansion pin header to the Minstrel 3 boards, I am liking the idea of making this one of a series of modules. (  Edit - thus was born the Minstrel Expansion Bushttp://blog.tynemouthsoftware.co.uk/2024/05/minstrel-expansion-bus.html )

I was considering another version of the ZXpand, one that sits above the Minstrel 3, as suggested by Mark71 on my discord.

I had been considering something similar to try and provide a version for the version of the Minstrel which fits in a ZX81 case (edit: well, that was the idea....)

I put together a few designs, initially I was looking to try to change the logic around to use fewer chips.

The idea being this would sit on top of the Minstrel board and plug into the pin headers and ROM select jumper block, and mount on some of the existing pillars.

The "reduced" chip count didn't seem to help much as two of the replacements were 20 pin instead of 14, so I went back to the previous design.

I started to lay things out, but before I got too far into that, I wanted to double check I had all the holes and connectors in the right places. And also to have a think about the heights, would it clash with the video connector?

Big, isn't it.

Hmm don't like it.

Doesn't seem right to take up more than half of the board below.

So, I made a smaller one.

This is surface mount, so would be supplied assembled.

The idea of this will be a "fit and forget" version to go inside the ZX81 case. (Edit: yes, I know, that was the idea. Just wait OK.)

I went for a microSD as that fitted the smaller form factor and infrequent need to change it.

There is one big omission here, the joystick connector. If you want a joystick port, there are various ways to add a Kempston style port to the rear, including the original Kempson interfaces, and if there is a particular demand, I might do one myself. ( Edit: there wasn't, but I did anywayhttp://blog.tynemouthsoftware.co.uk/2024/05/minstrel-joystick.html )

I went though quite a few variations trying to reduce the chip count, now that I did not need the additional address decoding for the joystick port.

In the end, I ended up back pretty much where I was with the existing design. I don't like that three of the chips are half used, and a forth is 3/4 used, but I couldn't quite make it work with fewer chips without using larger chips or ending up with something overly convoluted that introduced four propagation delays rather that two as in this design. I think I made the layout work, so I am happy with that.

I did have to do a quick bit of testing to check one change would be OK, but it seems to work.

I will get some of those boards made and try them out.

Much later (April 2024)

The new boards have arrived and are looking good.  (my only complaint is Texas Instruments markings on the 5 ICs use 3 different designs, which is disappointing to a picky perfectionist like me)

They sit nicely on the expansion pin header on the Minstrel 3, and also plug into the top of the ROM address jumper block (which was a wire on the normal ZXpand Minstrel).

The plan was this would fit into the ZX81 case, so I was very careful to make sure it was lower than the RF modulator, so that it would fit. (Edit, yeah, right....)

Perfect, so that's going to fit, isn't it.

Well, no. Because I am an idiot.

I forgot about the pillars in the ZX81 case.

How could I forget about the pillars on the ZX81 case!?

tumbleweeds slowly roll past

OK, so as I was saying, this version is designed solely to fit on the Minstrel 3 standalone edition.

(Edit - I started designing a version that would actually fit in the ZX81 case, and for that I went to check the footprint of the surface mount Z80, and it was at that point I saw the end of life notification for the Z80 which unfortunately killed that and another 4 or 5 projects I was working on)

(long section about getting Microchip ICSP to work has been snipped out, check out Patreon for the gory details)

But will it work?

Well of course it did.

Have you ever known me to make a mistake....... ( Edit, looks in the other direction)

First test is CAT, the replacement keyword on the Z key.

Looks good.

And what do you think was the first game loaded via a micro ZXpand Minstrel?

Minoss Knossoss, the sequel to Tut-Tut from David Stephenson.

Of course, immediately after that....

Well, I had to.

Now I just need to finish my new joystick interface so I can continue trying to beat Minoss Knossoss.

A bit more testing to do, and I should be back with the final part of this post, some better pictures of the unit itself and a full post the joystick interfaces, and the accompanying SellMyRetro listings for both.

Back to today

The µZXp is listed on SellMyRetro, assembled and complete with the replacement ROM.

The standard version will come with pins on the back.

All Minstrel 3 kits will be going out with sockets for the board, ready to fit this.

For the small number of owners of V3.5.5 and V3.5.8 boards, if you are ordering, let me know what type of connector you need. If you have fitted a pin header, I can fit a socket to the board. If you have not installed anything in the expansion connector holes, I can supply the appropriate sockets.

This works well in an expanded Minstrel 3 system, with a Minstrel Expansion Bus backplane and an assortment of add in cards.


Advertisements

The full range of Minstrel and Mini PET kits and accessories are available form my SellMyRetro store.

All the links can be found here:

Patreon

You can support me via Patreon, and get access to advance previews of posts like this and behind the scenes updates. These are often in more detail than I can fit in here, and some of these posts contain bits from several Patreon posts. This also includes access to my Patreon only Discord server for even more regular updates.