** 1 page regular EJP feature / 635 words ** Multi-player mayhem ** JOYPAD.JPG from AC7 here ** This issue, Xav starts to look at the Team Tap hardware The problem: to decode our four joypad "group select" lines into sixteen lines, only one of which is low at any given time. Hmmm... The solution, as it turns out, is quite simple. This particular problem is a common one and as a consequence there are chips designed to perform this task. What we need is a type of demultiplexer - a device which routes an input to one of several outputs depending on the state of some control inputs (compared with the multiplexer, which routes one of several inputs to a single output). Using a normal demultiplexer, we would need to tie our input low to ensure that the selected output goes low. So common is this practice (it's used in address decoding for microprocessor circuits) there are a family of chips, called "decoders", which are effectively multiplexers with their input tied low internally. For this application, we want to decode four control lines into sixteen outputs, so we use a 4-to-16 line decoder - and you thought electronics was complicated! As it turns out, there is only one "standard" 4-to-16 line decoder, the 74154 (Maplin code: YF58N, which costs around £1.40), so we'll use that. No kidding That's pretty much all there is to a Team Tap - well, to the guts of it, at least - naturally there are diodes, resistors and capacitors, but their sole purpose is to keep things clean and tidy from an electrical point of view. We'll consider them in a future instalment when we'll look at a complete circuit diagram for the Tap, but until then, let's examine that decoder more closely. Notice the four control lines on the right of the diagram. These come from the computer, and by writing different masks to the EJPs, we can put up to sixteen different bit patterns onto these, ranging from 0000 to 1111. Each of these bit patterns relates to one of the outputs, with 0000 relating to the first, and 1111 to the last. When a bit pattern is present on the control lines, the associated output is taken low, while all the others are pulled high. In a simple world, the first four bit patterns (0000, 0001, 0010, 0011) would be used to access the four button groups on the first Tap socket, and the last four (1100, 1101, 1110, 1111) would access the last Tap socket. As we've seen in previous issues it's not that simple, the joypad is read by taking one of the four lines low by using 1110, 1101, 1011 or 0111. Clearly these are not the same as those for the first socket - and actually clash with some for the last socket. Our simple world example, therefore, would work but it would mean all the joypads would have to be read using different masks to the standard joypad. This, in turn, would mean the user would have to keep unplugging the Team Tap in order to run "normal" games. The solution is not to use our simple world method. Instead we need to rearrange the order in which the outputs are attached to the four joypads, so one of them is still accessed using 1110, 1101, 1011 and 0111. This puts the rest of them in a more random order, but means any program writing a "normal" joypad mask will still access a single joypad - effectively ignoring the existence of the Team Tap. Therefore in our final design the first Tap port is accessed using masks of 1110, 1101, 1011 and 0111 - just like a normal joypad. The second Tap port is accessed using 0000, 0001, 0010 and 0011. The third uses 0100, 0101, 0110 and 1000. Finally, the fourth uses 1001, 1010, 1100 and 1111. ** IC_74154.GIF here **