Sunday 5 May 2024

Minstrel Joystick

Introducing the Minstrel Joystick, a Kempston compatible joystick interface.

It could be fitted with an card edge connector to plug directly into the back of a Minstrel 2, Minstrel 3, ZX80 or ZX81, even a ZX Spectrum.

However, it is designed as the first module for the Minstrel Expansion Bus.

You might spot some other things on there, I will get onto those in due course.

"Kempston Compatible"

Kempston Compatible is a term used by lots of very different hardware, so many devices that look something like this. All of which implement pretty much the same interface as far as software is concerned.

Plug in a "standard" 9 way D joystick, a Commodore or Atari (but not a Spectrum +2, Amstrad or Atari 5200).

Or maybe even one of TFW8b's custom build ones.

Read port 31 ($1F in hex) and you will get back 0 if the joystick is not moving.

You will read 1 if the joystick is moving right, 2 for left, 4 for down, 8 for up and 16 if fire is pressed.

If the joystick is held at a diagonal, you will get the sum of both directions (e.g. up and right is 8+1 = 9), or +16 if fire is pressed (e.g. up and fire = 8+16 = 24)

If you are writing code in assembler, it is just a case of

IN A,(31) 

and you have your value to parse as appropriate.

A BASIC IN command was added for the ZX Spectrum, but in ZX81 BASIC land, things are a bit more complicated.

You can create small assembler routines to call from BASIC, and return values via the BC register pair (or HL if you are running ZX80 4K BASIC).

XOR A
LD B,A
IN A,(31)
LD C,A
RET

Thanks to George Beckett for help with that.

You need somewhere to store these 6 bytes of code, and REM statements are traditionally used. You would normally use a loader where you run a program on the ZX81 and type in the bytes and it populates the REM statement for you. In this case, it's easier to just use POKE statements.

16514 is the address of the "J" of "JSREAD" in RAM, and should always be that if it remains the first line of code.

When you run the program, the characters in the REM statement are replaced with the assembled code.

You can then delete lines 10-60 and replace them with your program code, just call USR 16514 when you need to read the joystick. (the REM statement needs to stay as the first line so this address does not change).

The REM statement was modified when the code ran, and the six bytes after it have been overwritten. 

Several of these are symbols, such as "<=" and "TAN" which are stored as a single byte, but displayed as multiple characters. The two "?" represents bytes that do not have a printable equivalent.

The code added in lines 10-30, will display the value read from the port.

The value displayed will be 0 and will change as you move the joystick and press fire.

That single byte input port is all pretty standard, and is implemented by dozens of different devices over the years, but the hardware is often very different. Usually it involves a read buffer IC and some address decoding.

The Read Buffer

There are a few options here. Most often used are things like the 74LS240, an octal inverting buffer, or the 74LS366, a hex inverting buffer.

These are inverting as the joystick is traditionally setup as it is in the Atari 2600 or Commodore 64 etc. with common as 0V.

As you move in a direction, a switch is closed and connects that pin to the common.

If you are lucky, those will be nice microswitches, if not they will be little metal domes that flex down to make contact with the PCB trace below.

The switch inputs are pulled up to 5V normally, so read as a 1, unless the joystick is pushed in that direction and the switch is activated, in which case they read as a 0.

The inverting buffers convert that to the slightly easier to understand 1 when moving, 0 otherwise, which is the standard.

There are some versions of the "Kempston" interface which use non-inverting buffers, 74LS365, 74LS367 or 74LS244 (including one from Kempston themselves, so it must be OK then?) 

These do not invert the signal, but still need to support the same protocol, so they feed the common of the joystick with 5V and pull all the signal down to 0V. This will stop any autofire circuits from working, potentially even damage them if they are not expecting a reverse voltage? But will otherwise give the correct 0s and 1s on the interface bus.

All of theses buffer chips have two enable inputs. Some require both inputs to be low for any of the outputs to be enabled (e.g. 74LS365, 74LS366, 74LS540), but most use one pin for 4 of the outputs and the other other for the remaining 2 or 4 outputs (e.g. 74LS367, 74LS240, 74LS244).

Decoding Logic

So you have your buffer, this needs to be enabled in one precise condition - an IO read request at address 31. 

IORQ is low, RD is low, and the lower half of the address bus is 0001 1111, so A7, A6 and A5 are low, and A4-A0 are high.

It should also not respond during an interrupt acknowledge cycle. Here IORQ and M1 are low to indicate the external device should place the interrupt handler address on the bus. The joystick interface should stay out of this. That can be detected by making sure that at the same time as the IO request, that the M1 signal is high, or the read RD signal is low (or both).

The logic used varies a lot, usually one chip, occasionally two are used, although sometimes no additional decoding is employed.

A common theme though is not bothering to decode the whole address. Most only look at A5.

A typical interface looks something like this.

Here the decoding is A5, IORQ and RD are low. This should avoid problems with interrupt acknowledge as RD is not low at this point. But the address decoding means it will respond to IO read events on addresses from $00-$1F, $40-$5F, $80-9F and $C0-$DF (that is 128 out of the 256 available addresses).

Not really a problem as most of these interfaces do not have pass through connectors, so will likely be the only thing plugged into the bus. In that case, it doesn't matter if they use up lots of the address space. 

Remember this is the ZX81, and it has already used up all even addresses by decoding FE as "A0 is low".

It does mean that if you try to read any even address in the decoded range that the buffer chip on the interface and the buffer chip in the ZX81 (well, part of the ULA), will both be writing at the same time.

The three unused inputs are pulled up to 5V, so when inverted, those bits will always read as 0 as expected.

The most complete decoding I have seen is one from Cheetah which decoded A5, A6 and A7 low, and also IORQ and RD low and M1 high.

That covers most of the bases and only responds to IO read requests from $00-$1F, and not interrupt acknowledges.

It uses a different approach to dealing with the unused bits, D5 is driven by the buffer chip, but D6 and D7 are pulled low when the enable signal goes low. Both valid approaches. These days an octal buffer would be cheaper than a hex buffer and two diodes, but probably not in the 1980s.

I did find one interface from "RAM" with only a single chip.

It looks like it was designed for two chips, but at some point they cheaped out and instead of the second chip, they fitted a wire link.

I think I need to reverse engineer the schematic.

One moment please.

This is what I think it was meant to look like, with a 74LS00 as the missing chip.

The 74LS366 is only a hex buffer, so diodes are used to drive the three unused bits from a single output. They can't do it in the same was as the Cheetah one above as their partially decoded enable line only exists within the buffer chip.

The intended circuit deals with things slightly differently, checking for IORQ low, A5 low and M1 high. This will avoid the interrupt acknowledge, and be active over half the address range as above. It will also be active during write cycles, should you try to write to $00-$1F etc. you will get a bus conflict.

The single chip + wire link version just connected IORQ to the enable line, so will only check for IO and A5 low. That means it will respond to read and write and interrupt acknowledge events. Not ideal, but I guess it is functional and someone saved 10p in the 1980s.

It wasn't the only way they cheaped out. You might notice all of these interfaces use the 2x23 way ZX81 edge connector. Most of them were acutally used with ZX Spectrums, which has a larger 2x28 way edge connector. They are not identical, but the few pins that are used here are common between the two systems, so you can use these on a ZX81 or ZX Spectrum as long as you make sure they key way is aligned.

I wonder if the missing M1 signal you find on many Spectrums is what led to changing the decoding on that interface to ignore M1?

Which way did I do it?

Well, I went a bit far, as usual, and fully decoded the address.

I fully decoded address $1F, and also checked for IORQ and RD low and M1 high for good measure.

This is intended to sit with other modules in a bus system, so I didn't want to tie up extra addresses unnecessarily.

The other difference is I have wired up pins 5 and 9 on the joystick as additional fire buttons to bits 5 and 7, as I have done on other interfaces in the past.

Which games support it?

There are a few ZX81 games which already support a Kempston joystick, such as Paul Farrow's ZX81 Kong (and other games).

http://www.fruitcake.plus.com/Sinclair/ZX80/FlickerFree/ZX80_Kong.htm

And David Stephenson's Minossss Knossosssss.

https://www.zx81keyboardadventure.com/2024/04/zx81-game-minoss-knossoss.html


The Minstrel Joystick is available as assembled - https://www.sellmyretro.com/offer/details/64329

Full kit - https://www.sellmyretro.com/offer/details/64328

Or PCB only - https://www.sellmyretro.com/offer/details/64330

As are some of the other new things, posts on those to follow shortly.

There is an introductory post with all the links you need - http://blog.tynemouthsoftware.co.uk/2024/04/lots-of-new-things-for-minstrel-3.html



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.

Sunday 28 April 2024

Lots of new things for the Minstrel 3

I have listed lots of new things for the Minstrel 3.

Yes, I know, great time to announce new things for the Minstrel 3 now that the Z80 has been end of lifed. Yeah well, the world keeps changing beyond my control but I can't or won't go along with it.

It seems sensible to go ahead and list all of these now, and then follow with the more detailed posts on each one.

Micro ZXpand Minstrel

I have a few Patreon posts on this to follow, but in short it is a cut down version of the Minstrel ZXpand, based on ZXpand by Charlie Robson (sirmorris).

Unlike previous versions, this plugs directly on to the expansion header on recent Minstrel 3 boards. It is a microSD card disk drive, which uses a ROM overlay to replace the LOAD and SAVE commands and adds CAT and CONFIG commands. It does not feature the joystick or serial ports of the larger version.

This is only suitable for more recent Minstrel 3 boards with the pads by the edge connector (V3.5.5 and V3.5.8). I will, as is customary, state this is not suitable for use with a ZX81, but can now add also unsuitable for Minstrel 2 and older Minstrel 3 boards.

That is now listed on SellMyRetro.

Best speak to be more ordering to make sure the right connector is fitted. It can have pins or sockets, if you have one of the few Minstrel 3's that have a pin header fitted.

The 2 pin header picks up on the ROM select jumper block, so will always expect pins on the board.

The full size version is still available, and there are still actual ZXpand and ZXpand pluses out there.

Minstrel Expansion Bus

That 2x23 pin header can now be had on it's own backplane. This can be plugged into a Minstrel 2, Minstrel 3 or a real ZX81.

This can be powered from the host if you are not using many modules or they use little additional power. Alternatively, you can fit it's own 9V in, 5V out power supply.

You can feed 9V into both the expansion bus and into the Minstrel 3, or fit the jumper and pass 9V between them. You should only fit the 5V jumper you have not fitted a 7805 on the board.

The kit includes all the parts, omit them if you don't need them.

Available in assembled, kit and PCB only versions. If ordering assembled, let me know which options you would like.

But what can you plug in?

Well, how about a Kempston compatible joystick module.

Minstrel Joystick

This is a simple Kempston compatible joystick interface, but fully decoded at address 31 (0x1F).

(there is a very long deep dive into Kempston interfaces currently on Patreon)

Also available in assembled, kit and PCB only versions.

That makes up for the lack of joystick on the Micro ZXpand Minstrel.

You can also build the standard Minstrel ZXpand to fit into this backplane. The same as the version shown here plugged directly into the Minstrel 3. (yes, I am going to have to build another one to get a photo).

David Stephenson has some modules which will also fit into the Minstrel Expansion Bus backplane, such as ZXIO. You will need to be careful about positioning of the card if you fit the voltage regulator components, as these sit lower that my modules.

I am currently building up one of those (waiting for connectors).

I am sure more modules will follow.

I did consider fitting RC2014 slots on there, but all the even addresses are tied up with the ZX81 port 0xFE, which is decoded as "any even address". I did look at rewiring the address bus to the RC2014 connectors so that the even addresses from 01 to FD were mapped to 00-7E or 80-FE on the RC2014 bus, but I thought that would just confuse things.

PET Dual Userport Joystick with Piezo

Oh, and I listed an alternate version of the PET Dual Userport Joystick.

This version has a piezo for PET 2001 and 2001N machines that do not have an internal sounder.

Fits perfectly in the corner that was artistically snipped off in the other version.

As before, Assembled, Kit and PCB versions.



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.

Sunday 21 April 2024

(Not a) VIC 20 Top 20

When Robin (8 bit Show and Tell) released the video on the Penultimate + 2 cartridge refresh, it was, as you would expect, well received. Looking through the comments most were appreciative, but there was one from a user who disliked the idea of the Penultimate Cartridge altogether, and insisted the only way to properly appreciate the VIC20 was to load from tape or their (Raspberry Pi emulation of a) disk drive.

(I was going to insert a screen grab here of the full conversation, but the comments seem to have been deleted by the original poster now. I did find one I took of the original post.)

Robin had a bit of fun trying to understand their arguments, which continued that "none of their favourite games were in the cartridge anyway". Really? So Robin asked for their top 20.

They duly responded with a list of their top 20 games (actually top 23), so I thought it would be fun to go through this list and check out all these hidden gems we have been overlooking all this time.

The first thing to note is I recognise quite a lot of those as already being in the cartridge, but never mind, lets get started.

(hums Top of the Pops theme music)

Quadrant

OK, in at number one is Quadrant. This one from Romik games. We will be hearing a lot from them today....

This is one I had previously looked at and it was in the "to be converted folder". 

Sort of Moon Patrol, but with a guy running instead of a moon buggy.

It was a multipart loader for the unexpanded VIC, so would need some conversion, and I guess didn't score highly enough to warrant that. Maybe one for the next round of conversions?

Lucy Lizard

I don't know if this list was in order, but top 2 in the list is, well, quite a game.

You play the eponymous lizard, and you need to press return at the right time to catch the bug which is moving across the top of the screen.

OK, it's not great, a very simple BASIC game. But I did spend a good few minutes trying to get the timing right.

Yay, got one!

It sure was.

Space Fortress

Here was have a game from Romik Software. I like the "S", very "Superior Software"

I wonder who this one is written by?

Ah yes, Darren Hall in big flashing letters. Noted.

It seems to be quite a large multipart game for the unexpanded VIC, which promises four sections, although I couldn't get past the first one to see what the rest were like.

Seems to be a lot going on, some kind of space invaders with a space dog at the top of the screen?

Space Escort

I assume this was a game about a 1980s Ford Escort being driven around space?

Oh look, Romik Software again.

Oh look, also by Darren Hall.

I wonder if the guy in the comments was Darren Hall?

I found two versions, neither of which would load, so I guess I will never know. Will see if TFW8b has a version of tape.

If I understood the modern world, I am sure I could ask some AI to generate me a picture of a Mark 1 Ford Escort floating around in space, but I will leave that to your imagination.

Trap-Man

Here is another title from Romi..... Oh wait, it isn't. This is from Nanuq.

I always like a maze game.

This one is written in BASIC, so is a bit slow generating the maze, but at least you get to watch it being generated so you don't get bored waiting (#foreshadowing)

This one has you (pink dot) moving around the maze, eating the dots before the Trap-Man (asterisk) catches you. The AI driving the Trap-Man seems to always move towards you, so I haven't quite worked out how to hide from it.

Ha, got it, think I am going to make it out of this one.

OK, that wasn't bad. I will play this one again.

Bullet

This was another multipart tape game that was previously looked at for conversion. 

You drive around a three lane track, moving lanes to avoid the car in the other lanes.

Nah, not for me. Will leave that conversion for another day.

Downhill Skiing

Another Nanuq release.

This is a very flickery BASIC skiing game.

Nice ambulance, but sorry, but it's a no from me.

Amok!

This one is OK, reminds me of Robotron and Shamus.

Either way, it's already in the Penultimate Cartridge.

Rockman

This one is also already in the cartridge.

I wrote a blog post about converting this one.

Lunar Leaper

This one is a 16K cartridge for a change. This one was in the Penultimate, or was at least in one of the release candidates.

I have absolutely no idea what is going on here.

It is all happening too fast and I don't know what I am meant to do.

I guess that explains why it was removed.

Hangman

Which one? there are loads. (note to self, did I check for "Romik Software presents Darren Hall's Hangman"?)

OK, this one is annoying me straight away. You serious cannot code to check for Y? Do I actually have to type in YES?

For the sake of decency, I shall omit the screen captures of most of the things I typed in.

It didn't seem to like that. I just followed the instructions, my world PEDANT, followed by RETURN......

OK, it seems to be broken anyway, and has made a 20 letter word out of "pedantic"?

Oooh, I see HangMath. Maybe that's what they meant. I bet that will be fun.

OK, is that long division........

......errr.....oh, is that someone at my front door? sorry I will have to leave this one here.

Donkey Kong

This one has been in since the very first menu driven Penultimate Cartridge.

Not a bad port.

Duck Shoot

This one is also in the cartridge, but under it's original title of Kwazy Kwaks.

There is also a blog post on that conversion.

Avenger

This has been in since the very first DIP switch driven Penultimate Cartridge.

Time-Bomb

Ah, another maze game.

This time, one where we don't get to see the maze generation, which is taking a while as it is written in BASIC.

Initial thoughts are that is must be designed for 3D, the way there is red and blue fringing on the blocks.

You move around the maze, which scrolls up and down until you find the bomb, or run out of time (although no timer is shown).

Hmm, I wonder if that is code up there at the top of the maze?

Not bad, have played that a bit and got as far as "round 4", but it just keeps going back to the same maze I think, with you and the bomb in slightly different positions. Not sure if anything changes as you progress.

It looks like this was a type in game, rather than a commercial release, so I think it's fair game for an upgrade? Might have a go at speeding things up, maybe get rid of the visible code as graphics at the top of the screen and add in a countdown timer.

Deadly Skies

This is another of the very few games to be removed from the Penultimate Cartridge.

In PAL mode, the horizon was very flickery and not easy to look at. But the screen was at least sort of centered.

In NTSC, the horizon was perfectly stable, but the screen was too far to the right.

Battlezone

Got that one already. Quite impressive that they even attempted a wire frame tank game on the VIC20.

Death Star

Oooh, this looks exciting.

A bit of exposition to get us started.

Getting ready.

This is going to be an exiting space shoot-em-up, right?

Ah, it's one of those.

It looks nice, I love the colours and the clear text, but it's going to take a bit of work to convert, so I will pass for now.

Demolition

This one has a very slowly animated title screen. Not in the mood for that right now. You know when you start something, and really think you shouldn't have, but now that you have, you may as well keep going until the end?

And there we go, lets see what this is.

Breakout. A very slowly animated version I'm afraid.

Nice touch that the ball bounces on the bottom of the screen and stays in play.

But time for me to break out.

Ah, it's written in BASIC.

Of course it is.

Miniature Golf

Does what it says on the tin.

Golf simulator, type in the strength, direction etc. and be thrilled as the ball is slowly animated.

Another one that's not for me.

Pedes and Mutants

Ah, a Romik title, haven't seen one of those for a while.

OK, this sounds complicated.

OK, I admit it's getting late, and I am getting a bit tired. But I have no idea what is going on here.

Nope, sorry.

Tank War

OK, here we go.

And it's a tank game.

Not bad, just a little slow and unresponsive.

Vegas Jackpot!

And finally, one that is already in the next update.

Blog post on that one as well.


Phew, that took longer than expected.

Still, I think a few of those will actually make it into the next refresh of the Penultimate Cartridge.

Assuming they get through the TFW8b quality control......


Advertisements

If you want to a "Top 250 VIC20 Games", then you can order a PU+2 from The Future Was 8 bit, currently on offer for £49.99 + tax

https://tfw8b.com/product/vic20-penultimate-plus-two/


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.

https://www.patreon.com/tynemouthsoftware