Joystick Interfaces on +2A

edited April 2014 in Hardware
Just found out that my DK'Tronics joystick interface doesn't want to play with my +2A (black). The Kempston port works OK, but not the Sinclair port.

I swapped the address lines in the interface to make it operate keys B-SPACE instead of 6-0, as discussed here:
http://www.worldofspectrum.org/forums/showthread.php?t=33802
Which works on a 48K, but not on my +2A. The original aim was to get four separate joystick inputs, but that doesn't seem likely.

As well as correcting up/down, as discussed here:
http://www.worldofspectrum.org/forums/showthread.php?t=42517
(Interestingly, the inside of the interface I just worked on was a much newer green PCB than the brown one in the other one I opened).

Also, a Kempston Pro interface operates neither of the Sinclair keysets, nor the cursor keys, but still registers on IN 31 no problem.

Anyone know why? Is this common to all keypress-substituting joystick interfaces? I haven't tried the ComCon yet, but will that turn out to be incompatible too?
Post edited by joefish on
Joefish
- IONIAN-GAMES.com -
«1345

Comments

  • edited April 2013
    joefish wrote: »
    Anyone know why? Is this common to all keypress-substituting joystick interfaces? I haven't tried the ComCon yet, but will that turn out to be incompatible too?

    Yes, the +2A/+3,+2B and +3B have proper bus multiplexing within the logic array so you can't override the value on the data bus like you can with the sinclair designed machines.
  • edited April 2013
    That's a bit of an embuggerance then.

    So four joysticks is only going to work with a 48K machine using either a through-port interface or a ?Slot. Either that or invent a new IN protocol and bodge a Kempston interface.
    Joefish
    - IONIAN-GAMES.com -
  • edited April 2013
    [strike]Well if you didn't mind adding modifying the joystick ports inside and building a suitable adapter you could have up to 8 joysticks :D[/strike]

    EDIT: I'm being slightly dense, you could totally do it as an external interface. It would just have to plug in on the edge connector like any normal keyboard/cursor joystick interface, but instead of placing the data onto the edge connector data lines, have a little tail that goes around to one of the joystick ports. It's a little ungainly certainly but it would mean you could have up to 8 "sinclair style" joysticks with no internal modification needed
  • edited April 2013
    joefish wrote: »
    That's a bit of an embuggerance then.

    So four joysticks is only going to work with a 48K machine using either a through-port interface or a ?Slot. Either that or invent a new IN protocol and bodge a Kempston interface.
    • Or design a new interface (say using 3 x 8 bit buffer chips or a 8255 chip) that respond to a range of I/O ports.
    • Or use a "port expander" type arrangement. You mod the Kempston interface so that a 4 bit output latch can select which joystick to read. The program has to output a value to I/O port 31 to select which joystick to read. It then reads the joystick from I/O port 31.
    • Or if you are using a Sinclair with "serial" and "Aux" port, between them they have 4 outputs and four inputs. A "port expander" could be built to use these. The only snag being that they work at +12V and -12V logic levels.

    Mark
    Sinclair FAQ Wiki
    Repair Guides. Spanish Hardware site.
    WoS - can't download? Info here...
    former Meulie Spectrum Archive but no longer available :-(
    Spectranet: the TNFS directory thread

    ! Standby alert !
    “There are four lights!”
    Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb!
    Looking forward to summer in Somerset later in the year :)
  • edited April 2013
    If the goal is simply to get more joysticks then you could do an "extended" kempston interface that fully decodes the port instead of just 0x1F. Then you could theoretically support as many joysticks as you want all the way up to 256! The lazy way would be to use each bit of the high byte for a joystick 1-8.
  • edited April 2013
    guesser wrote: »
    [strike]Well if you didn't mind adding modifying the joystick ports inside and building a suitable adapter you could have up to 8 joysticks :D[/strike]

    EDIT: I'm being slightly dense, you could totally do it as an external interface. It would just have to plug in on the edge connector like any normal keyboard/cursor joystick interface, but instead of placing the data onto the edge connector data lines, have a little tail that goes around to one of the joystick ports. It's a little ungainly certainly but it would mean you could have up to 8 "Sinclair style" joysticks with no internal modification needed

    I don't get it. Do you mean you detect the 'I/O, READ' operations in the keyboard range on the edge connector, but supply the bottom 5 DATA bits in response in through one of the joystick ports? Would that work?
    Joefish
    - IONIAN-GAMES.com -
  • edited April 2013
    joefish wrote: »
    I don't get it. Do you mean you detect the 'I/O, READ' operations in the keyboard range on the edge connector, but supply the bottom 5 DATA bits in response in through one of the joystick ports? Would that work?

    Yep, the inputs on the joystick ports are connected directly to the keyboard column inputs. I would think you simply have to Decode an IO read with bit 0 low and gate the eight upper address lines through. Each of those bits is one keyboard row or joystick "common" pin.

    Do note though that the keyboard matrix on the +3 etc works the opposite way around to the 48k. Where on the 48k all rows apart from the one being read are at 5v and the keyboard membrane pulls a pressed key on the selected row low, the +3 makes the row line high and pulls the input up. The logic array must invert the bits before it passes them on to the z80, but it is rather complicated anyway since it has 11 keyboard input lines instead of 5!
    Presumably therefore you need to invert the 8 row bits as you gate them through, or invert the 5 data bits coming from the joystick.
  • edited April 2013
    guesser wrote: »
    If the goal is simply to get more joysticks then you could do an "extended" kempston interface that fully decodes the port instead of just 0x1F. Then you could theoretically support as many joysticks as you want all the way up to 256! The lazy way would be to use each bit of the high byte for a joystick 1-8.
    Or, presumably, nobble a Kempston joystick interface and change one of the address lines. So if IN 31 is A7,A6,A5 set low then maybe A7,A6,A4 go low, so IN 47? That would also work for crude ones that only check for A5 going low, as they'd instead have to pick up on A4 going low.

    I'll have to try it out on an old Kempston interface. Then I can daisy-chain it with another Kempston. I was really looking for an easy mod rather than a whole new system.

    But using the high bits on a Kempston port read to pick 1 of 8 joysticks sounds like a great way of doing a multi-tap system without too much extra logic.
    Joefish
    - IONIAN-GAMES.com -
  • edited April 2013
    joefish wrote: »
    Or, presumably, nobble a Kempston joystick interface and change one of the address lines. So if IN 31 is A7,A6,A5 set low then maybe A7,A6,A4 go low, so IN 47? That would also work for crude ones that only check for A5 going low, as they'd instead have to pick up on A4 going low.

    I'll have to try it out on an old Kempston interface. I was really looking for an easy mod rather than a whole new system.

    Yes you could certainly add extra decoding in a partially decoded kempston interface, though that could then make you clash with devices that are compatible with a fully decoded 0x1F. Does this not include divide or is it divide plus?
    EDIT: just checked, the divide certainly wouldn't so long as you were decoding both A7 and A6 at least.

    If you are adding extra decoding for extra joysticks anyway I would strongly suggest using the high lines since nothing assumes that a "fully decoded" kempston decodes those as far as I know.
  • edited April 2013
    So long as it works with a DivIDE I'm not that bothered. I think the biggest problem there was not distinguishing between port I/O and memory I/O, wasn't it? And that was with what was termed at the time the 'DivvyMinus'; absolutely nothing to do with the DivIDE. Joystick interfaces that simply check at least A5, I/O and READ all work fine.

    The drawback seems to me in nobbling an interface that there isn't one with two Kempston joysticks ready side-by-side to start from!

    Taking the DK'Tronics one as an example, it only detects the one address line going low for Kempston. That's bit A5, matching 0x1f, but it's not checking bits 6 & 7 are low, nor that the others are still high, so there are 128 possible values for IN that would still work with it (e.g. 0x5f = IN 95, 0xdf = IN 223, 0x0f = IN 15).

    But so long as things only use one bit going low (in this case, A5) to determine what they are, it's fine. Incidentally, are there known things which commonly rely on one of the other bits going low? Besides Sinclair themselves with 0xfe (A0 low, or IN 254)?

    For Sinclair#1, the interface detects two lines going low; A0 and A12, matching 0xeffe. By diverting the higher one to A8,A9...A15 I can move its effect around the keyboard groupings. But I could also move them both to the low address lines, e.g. A4 and A6. Then it would respond to 0x2f = IN 47 (and also 0x0f, 0x4f, 0xaf, etc.) but not 0x1f = IN 31.

    The only drawback then is the up/down/left/right bits would be inverted and follow the keyboard order. But that could be managed in software.

    I'm really not into designing a whole new interface, though the 8-way Kempston one sounds good. The drawback is, an existing game that uses IN 31 it would address joysticks at random! I'm only interested in hacking an interface I already have for the moment.

    The main question is, is shifting the address line(s) used to detect Sinclair#1 down to the lower addresses so I can use, e.g. IN 47, going to get around the +2A's buffering?
    Joefish
    - IONIAN-GAMES.com -
  • edited April 2013
    joefish wrote: »
    The main question is, is shifting the address line(s) used to detect Sinclair#1 down to the lower addresses so I can use, e.g. IN 47, going to get around the +2A's buffering?

    Not entirely sure what you mean, but as long as you don't do a read with bit 0 low (i.e. an even address) then the logic array won't try to put anything on the data bus.
  • edited April 2013
    guesser wrote: »
    Not entirely sure what you mean, but as long as you don't do a read with bit 0 low (i.e. an even address) then the logic array won't try to put anything on the data bus.
    Ah, OK. So any odd-numbered address is OK.

    What I mean is, the cheapo joystick interfaces just look for one or two bits going low and respond by handing over the 5 bits of joystick data. It's pretty easy to see which bit of the IN address they're targetting, cut that wire off, and reconnect it to a different address pin.

    So I can take a joystick interface that normally responds to IN 61438 (keys 6-0) and make it respond when you do IN 47 or something instead. So with just one or two crossed wires I can make a Sinclair or Kempston/Sinclair - compatible interface work on a +2A and give you two more joystick ports.
    Joefish
    - IONIAN-GAMES.com -
  • edited April 2013
    +2A/+3 models are incompatible with:
    - external keyboard interfaces (or keyboad based joysticks = SINCLAIR1, SINCLAIR2, CURSOR, etc...)
    - external interfaces with external memory designed for orig ZX48/128/+2 = all devices using only one ROMCS signal (divide, divide plus, betadisc, disciple, +d, MB02+, etc...

    But exist easy way for connection standard ZX interfaces to +2A/+3 without problems. Here is my idea: make small interface with external Z80CPU and throught zx bus connector. Can contain only one small CPLD + one Z80CPU. It enable connect data bus between computer and external CPU via resistors and external data 1:1 with external CPU. External device will work with higher priority on data bus and all collision on data bus will removed.
  • edited April 2013
    That's the EASY way? Build another computer on the back? :-o What's the HARD way? :-P

    I hate to start a debate, but I think swapping one or two wires over in an old interface off eBay is slightly easier!

    Anyway, it's not much use making a Sinclair Interface II or something work as you already have those joystick ports implemented on the +2A. You'd still have to shift their address lines so they operated keys CAPS-V and B-SPACE or something so they could work as independent joysticks. It'd need new or hacked games to use them, but then there aren't any games for the Spectrum that can be played with four joysticks anyway.
    Joefish
    - IONIAN-GAMES.com -
  • edited April 2013
    joefish wrote: »
    That's the EASY way? Build another computer on the back? :-o What's the HARD way? :-P
    Remove the +2A PCB and fit a +2 one? :)
    Rip up all the tracks to the gate array and add resistors in the bus like sinclair's sloppy design? ;)
  • edited April 2013
    joefish wrote: »
    That's the EASY way? Build another computer on the back? :-o What's the HARD way? :-P

    Yes, this is easy way :-) . Interface can contain only one chip = Z80CPU (price is 2USD) and 8 resistors. External CPU replace internal CPU. It's only CPU, not computer. And price of components is very low. Connection extremely easy. This device/interface can remove big part of problems with incompatibility and external devices can work more stable. (according to the type of involvement)
  • edited April 2013
    Hmm. On the subject of cheap incomplete decoding, what other devices are known that rely on just detecting one bit from the low byte of the IN address for their reads?

    A0, e.g. IN 254 or any even = Internal; Keyboard, EAR, MIC
    A1, e.g. IN 1 or IN 253 = ?
    A2, e.g. IN 3 or IN 251 = ?
    A3, e.g. IN 7 or IN 247 = ?
    A4, e.g. IN 15 or IN 239 = ?
    A5, e.g. IN 31 or IN 223 = Kempston Joystick, various
    A6, e.g. IN 63 or IN 191 = ?
    A7, e.g. IN 127 = ?
    Joefish
    - IONIAN-GAMES.com -
  • edited April 2013
    joefish wrote: »
    Hmm. On the subject of cheap incomplete decoding, what other devices are known that rely on just detecting one bit from the low byte of the IN address for their reads?

    A0, e.g. IN 254 or any even = Internal; Keyboard, EAR, MIC
    A1, e.g. IN 1 or IN 253 = ?
    A2, e.g. IN 3 or IN 251 = ?
    A3, e.g. IN 7 or IN 247 = ?
    A4, e.g. IN 15 or IN 239 = ?
    A5, e.g. IN 31 or IN 223 = Kempston Joystick, various
    A6, e.g. IN 63 or IN 191 = ?
    A7, e.g. IN 127 = ?

    A0, e.g. IN 254 or any even = Internal; Keyboard, EAR, MIC
    A1, e.g. IN 1 or IN 253 = ports +3 fdd, AY
    A2, e.g. IN 3 or IN 251 = zx printer
    A3, e.g. IN 7 or IN 247 = ?
    A4, e.g. IN 15 or IN 239 = ?
    A5, e.g. IN 31 or IN 223 = Kempston Joystick
    A6, e.g. IN 63 or IN 191 = light pen
    A7, e.g. IN 127 = Kempston joystick on DIDAKTIK M (zx clone)

    http://velesoft.speccy.cz/other/zx-ports-full-table.txt
  • edited April 2013
    OK, so there are two lines that aren't commonly used?

    I liked guesser's idea of adding 8 joysticks by using the low-byte to select Joystick input (like you do with IN 31) and decoding the high byte to select the stick. But maybe it could be Sinclair style instead of Kempston?

    What I propose is where you set the high byte to indicate a row of keys, then read from port $FE (254), you set the high byte and read from port $EF (239) instead. That way up to 8 joysticks or any input device can be mapped onto a virtual second keyboard.

    And it would be easy to take any Sinclair compatible joystick interface and just swap its A0 and A4 address lines over to make it compatible with this scheme (though you might have to watch you didn't bugger up any cartridge port).
    Joefish
    - IONIAN-GAMES.com -
  • edited April 2013
    joefish wrote: »
    I liked guesser's idea of adding 8 joysticks by using the low-byte to select Joystick input (like you do with IN 31) and decoding the high byte to select the stick. But maybe it could be Sinclair style instead of Kempston?

    What I propose is where you set the high byte to indicate a row of keys, then read from port $FE (254), you set the high byte and read from port $EF (239) instead. That way up to 8 joysticks or any input device can be mapped onto a virtual second keyboard.

    This would be a trivial thing to design and construct. Alas I have no edge connectors left unless I cut up more ISA slots :-(
  • edited April 2013
    Well I can do it right now with my spare DK'Tronics interface. I'll put the high address line back onto A15 (for keys 6-0) and divert the low address line from A0 onto A4 instead.

    You could have a mini-board that goes in front of an Interface II, Kempston Pro, RAM Turbo etc. interface that swaps A0 with A4.

    Or swap the wiring round inside any of these interfaces by cutting a few pins of the edge connector short of where they connect to the circuit board.

    You'd bugger up the addressing of the ROM cartridge, but it's no use on a +2A anyway. And you could always fit a switch to set it back again. Might also mess up the through-port on a RAM Turbo, depending what else you wanted to attach...

    Or just build an entirely new 8-way interface from scratch.

    My original concept was a two-player twin-stick shooter or simulator, but it looks like now we need someone to write a 10-player Bomberman!
    Joefish
    - IONIAN-GAMES.com -
  • edited April 2013
    Ah, but this 'alternate' Sinclair joystick standard now needs a name. I'm thinking 'Railscan' as it's an almost anagram and hints at a bit of meaning? And a bit of my name of course, though I don't know guesser's actual name to try and crowbar into a witty portmanteau.

    The ports would start with the same numbering as Sinclair and proceed left and down on each row of the keyboard. So #1 is 6-0, #2 is 1-5, #3 is Y-P, #4 is Q-T, #5 is H-ENTER, #6 is A-G, #7 is N-SPACE and #8 is Z-B. Though it's a bit of a drawback that Sinclair numbering gives us a funny order, and also that pairs of joysticks on each row don't have the same bit-arrangment of up/down/left/right - but then I suppose that doesn't really matter as it's just wires on a board.
    Joefish
    - IONIAN-GAMES.com -
  • edited April 2013
    Or how about calling it the "SubLayer Joystick Protocol by Joefish and Guesser"?
    Joefish
    - IONIAN-GAMES.com -
  • edited April 2013
    don't think I want my name on anything that doesn't do full port decoding, or I'll get the blame when it collides with something ;)
  • edited April 2013
    Well you can always do full-port decoding if you design one from the board up. Certainly that'd be the case if anyone was going to set out and build an 8-port joystick interface. You could be the first!

    It just leaves it open as a cheap and easy route to add two more joysticks to a 128, just to swap one wire inside an existing interface. I'm already thinking of something like a 2-player tank battle, or a game like Cyber Sled.

    If anyone knows of anything that relies on port $EF though it'd need a re-think.

    As for IN 127 on the DIDAKTIK M clone, is that an otherwise exact copy of the Kempston protocol?
    Joefish
    - IONIAN-GAMES.com -
  • edited April 2013
    It's rather annoying that phil's freebase thing doesn't work any more. Otherwise I could tell you in seconds what things a particular port mask will clash with :(
  • edited April 2013
    What's dodgy then?

    According to this list, the +D interface uses both $F7 and $EF, which would be equivalent to a crude detection of either of the two address lines A3 or A4 going low (the two gaps in Velesoft's list):
    http://www.worldofspectrum.org/faq/reference/ports.htm

    And it looks like the 'BETA 128' has a direct clash with Kempston to begin with. This is the TR-DOS that the Russian clones are based on, isn't it? Is that why they use a shifted Kempston protocol, $7F? But it wouldn't clash with $EF, nor trigger a false reading on a partial-decode as bits 0-4 are set in all its ports.

    But that list is wrong as the Interface 2 doesn't do full decoding for the joystick ports - it only looks for A0 going low in conjunction with either A11 or A12. And most Kempston interfaces just look for A5 going low, not A6 and A7 as well.

    There's nothing defined if you consider A3 and A4 going low in the sense of ports $07 and $0F, so presuming the +D does full decoding then one of those could work as the low byte of the port address without clashing.

    These settings though would clash with the Interface 1/Microdrive which are defined only by the middle two bits, but then so would the +D.
    Joefish
    - IONIAN-GAMES.com -
  • edited April 2013
    The IF1 uses A3 and A4 according to that list, so if either are low then the IF1 would put data on the bus.

    Pretty much anything will collide with something if you just switch lines, you just have to be selective about which things you care about.

    Decoding an extra line from the upper byte would be best but that would mean modifying both interfaces rather than just one of them.
  • edited April 2013
    What I meant to say is, there are spare gates in the kempston to use, and the interfaces would remain compatible with software that uses kempston so long as only one is plugged in at a time.

    You could make up to eight modified kempston interfaces this way that would work on ports 0xFE1F, 0xFD1F, 0xFB1F, 0xF71F, 0xEF1F, 0xDF1F, 0xBF1F, and 0x7F1F.

    (i.e. making one of A8-15 low for each)
  • edited April 2013
    True, and it makes the definition a lot simpler, but a lot of older Kempston interfaces didn't come with through-ports to be able to daisy chain them like that. Ben's new one does. Perhaps he'd consider a redesign with a DIP selector on it? Or at least two ports to each board?

    But I don't see how the modified interface would continue to be Kempston compatible - it could be rather random how it responds. If you've just programmed in an IN 31 in machine code, the high byte could be anything left over from a previous operation, so the read would be unpredictable. It may take data from several sticks at once, or miss the one you have plugged in. Just like my alternate keyboard idea, once you'd modified the interface you'd either need custom software to read it or a switch to set it back to normal.

    My other thought was, if you really only want a fourth joystick input and it comes to nobbling a cheap Kempston interface (that only detects on A5), why not just move its detect line down one or two places to say A3, then it's on IN 7, or various other combinations like $F7?

    The only reason I'd go for Sinclair style over Kempston is you can add two ports at once by hacking an old interface. Kempston interfaces would need a more detailed circuitry mod and only add one port each, and that's if they have a through-port.

    As for my port, it could be officially defined as $6F, with $EF being a lazy one-bit interpretation of it that may clash with a +D but then I don't care.
    Joefish
    - IONIAN-GAMES.com -
Sign In or Register to comment.