Skip to content

Modification

SukkoPera edited this page Aug 13, 2023 · 16 revisions

TL;DR

If you want to equip your C16 with an external User Port that is compatible with that of the Plus/4 you will need to perform a small modification inside your computer. But even if you couldn't care less about having a User Port, you should do the mod anyway as it fixes an inherent design flaw of the machine that slowly kills your precious CPU.

The problem

When C= engineers were designing the Plus/4, they needed a way to read the Cassette Sense signal coming from the Datassette, in order to know when a key was pressed on it (this is what allows the KERNAL to clear the screen and start the Datassette motor when you actually press Play upon the Press Play on Tape message).

They had no better idea than sticking the signal on pin 2 of the User Port (P2, which gets reflected on line D2 of the data bus), rendering it unusable whenever a key on the Datassette is pressed (it will be held low).

They did even worse when they scaled down the design to make the C16: since it wouldn't include a User Port, they had to find another way to read that signal. They put it behind a spare 3-state gate (U11) that gets enabled by the same Chip Select signal (generated by the PLA) that controls the MOS 6529 chip implementing the User Port on the Plus/4. This seems clever at first sight, as it allowed them to use the same KERNAL routines for both machines, but it also comes with drawbacks.

The most obvious drawback is the impossibility to add a User Port to the C16 without major hacks: while building an expansion card for that is theoretically possible, as all the required signals are available on the Expansion connector, if you wanted to make it fully compatible with the one built into the Plus/4 it would have to respond to the same addresses, of course. Unfortunately, that gate of U11 will also respond to that address, creating a "clash" (more properly: bus contention) on D2 every time the User Port would be accessed, since they would both try to drive it at the same time, possibly at opposite levels.

(Incidentally, this was probably not seen as a drawback by C=, as it would push people who wanted a User Port to just get/upgrade to the Plus/4, exactly as the - alleged - difficulty of expanding the RAM to 64k would do.)

A Solution?

If we wanted to make it possible to create a User Port expansion card for the C16 that would be fully compatible with the Plus/4, we could design a modification to be performed inside the C16 that would allow an expansion card able to disable U11 when inserted (there's even a spare gate on U11 itself that could be used for that). This would be a clean solution but it would probably require to cut a track on the mainboard and to add a few wires and a resistor, which might not be an easy thing for everybody (not to mention that personally I don't like to cut tracks).

Not Really

Before you think: "Screw that, I'm not going to add a User Port to my C16", you should be aware of another problem: the User Port is bidirectional by nature, which means it can either be read or written to. The MOS 6529 driving the User Port on the Plus/4 is smart enough to only send data to the CPU while it is being read, but U11 is not: the way it is connected will make it write to the data bus both when it is read AND when it is written to. What this means is that if you happened to issue a particular POKE command (which I'm not going to disclose), even on a stock C16 with no peripherals connected, you would have the CPU driving D2 to a logic level and the 3-state gate driving it to the opposite level, creating a short-circuit on the data bus, which is definitely going to harm one of them in the long run (most likely your precious CPU).

Now you might think "Fine, I'm not going to do random POKEs on my C16" and sleep well, but keep in mind that any software you run might do it, unbeknownst to you, maybe just trying to check if a particular peripheral is present on the User Port.

It Might Get Worse

I can guess what you're thinking now: "I perfectly know every piece of software I run and I know it doesn't write to the User Port!". Unfortunately there's a surprise for you: Mr. KERNAL himself does it straight away at power-on, in order to initialize all the pins of the User Port as high-level outputs (i.e.: the CPU will drive all the data lines high). This means that every time you power on (or reset) your C16, if you happen to do so while a key on your Datassette is pressed (which would result in U11 wanting to bring D2 low), you are creating a short-circuit on the address bus. Even if this only happens for a short time, it's likely to slowly kill your CPU and might be one of the causes of the so many dead 8501 around.

As if this wasn't enough, note the modification mentioned above wouldn't be of any help with this issue.

See? This happens ~200 microseconds after power-on! BTW, it was only possible to take this picture *after* the mod detailed below was performed, so it also shows it works to prevent the problem! It also shows how bad signal integrity is, on the C16, but let's pretend we don't see that...

A New Hope

So, ideally, we would need a fix that could first of all protect the CPU from these internal short-circuits on the address bus, while possibly allowing a card plugged in the Expansion connector to control (or safely override) U11.

It turns out that such a fix can be carried out much easier than expected:

  1. Desolder U11 (and don't throw the chip away)
  2. Solder a 14-pin socket in its place
  3. Lift pin 8 of the chip (Rightmost pin of the top row) and plug it back into the socket making sure pin 8 does NOT make contact
  4. Solder a 1k resistor (Do NOT use other values!) between the lifted pin and the D2 line, which you can find at any of the following spots (see picture):
    • Pad where the pin was originally soldered
    • Via a few millimeters straight above the pad
    • Top right pad of the D2 solder jumper between U11 and U7

Image taken through the LittleSixteen Project, but it'll match a stock C16 pretty closely. Note that the not-highlighted bottom pads of the D2 solder jumper (labeled JP2 here) are also good, as they are shorted with the top right one on a stock machine.

This is the recommended way to perform the mod, which is fully reversible (no cut tracks, just remove the resistor and plug the pin back into the socket to undo), but you can perform it even without removing the mainboard from the case, by just cutting pin 8 flush to the mainboard and soldering the other leg of the resistor to the D2 pads.

While this mod might not look as clean as the one mentioned above, it will effectively let U11 drive D2 only when there is nothing else doing so. This will prevent the short circuit at power-on and will allow expansion cards to take full control of the data bus, D2 included, without any danger, while allowing normal operation of the Datassette. As it is very easy, introduces no limitations and fixes an inherent issue of the design, I recommend every C16 owner to perform it.

Please ignore the red wire, it's for the 64k RAM mod.

Do It With Style

If you can solder SMD stuff, there is a more elegant way of performing the mod:

  1. Desolder U11
  2. Take a 14-pin socket and a 0805 1k resistor
  3. Solder the latter so that one end gets on the via right above U11 pin 8 (which is still D2) while the other end goes to leg 8 of the socket, which must be bent and cut so that it no longer connects to its designed hole
  4. Solder the rest of the socket legs normally
  5. Put the chip back into the socket

This makes the whole thing really solid and pretty invisible.

Ignore the clip, it's for yet another RAM expansion.

Clone this wiki locally