18

Back in the early 1980s when my friends and I all had Commodore 64s, we all knew never to plug a cartridge in with the power on.

I once got a tape from someone with lots of utility programmes, one of which was supposedly a cartridge to tape dumper. When run it displayed a screen with the border cycling through colours and the message 'Insert Cartridge And Press F1'

Even at 13 years old I thought "Hmmmm ... is someone trying to prank me into frying this computer?" and I didn't do it.

Question is - is there any programmatic setup you could do on a 64 that would make it safe to insert a cartridge with the power on ?

Alan B
  • 4,235
  • 19
  • 30
  • 1
    have you tried to press F1 without inserting the cartridge, see what happens? – Jean-François Fabre Nov 22 '23 at 10:31
  • 5
    No, as per the question "I didn't do it" - and this was in 1983 or 1984 – Alan B Nov 22 '23 at 11:27
  • 2
    When using the expansion port, leaning the cart towards middle of the computer (left as seen from computer's front) while inserting it will make Vcc and GND to be connected first, protecting the wimpy data pins from accidentally serving as power source/sink for the entire circuit, which is the most common cause of frying circuitry when you plug it in live. – SF. Nov 23 '23 at 14:21

4 Answers4

15

is there any programmatic setup you could do on a 64 that would make it safe to insert a cartridge with the power on ?

This calls for a clear No, But :)


Why is it Risky?

In general it's unhealthy for two reasons:

  1. Pluggin may disrupt a running program by changing addressed content
  2. A cartridge may damage computer parts due
    • being electrostatic charged or
    • generate unexpected signal combinations.

Thus, no a cartridge should not be plugged or removed while the machine is powered on. Powering the C64 with a cartridge will always start that cartridge due its build in auto-start / auto-configuration feature (*1) the memory mapper uses to bank ROM in and Kernel uses to detect and start it.

Risk Assessment

While it's a general issue that one should never plug any stuff when powered unless explicit made to work that way (*2), depending on device and care taken it's usually way less risky than expected (*3). Just, we talk about a consumer class device sold in millions to non trained laymen. So it's mandatory for manufacturers to educate their customers whenever interfaces are mentioned.

But I Want to Copy Carts.

This will put any program (*4) intended to copy that cartridge at a problem: It must be in control prior to the cartridge and stay in control, not letting it take over the computer.

A safe way to allow copying goes by disabling that auto-start / auto-configuration feature. At hardware level this can be done by pulling the /EXROM and /GAME signals high, as nicely described here. Countless boards have been made using this. At minimum it's only a board with two resistors to be plugged in between C64 and cartridge-to-be-read, most had switches, so it could be used either/or, while some went all the way to luxurious(*5). But all following the same basic scheme of disabling the way the Kernel detects presence of a cartridge.

To copy one one needs to:

  1. Insert the 'copy' board
  2. Switch it to 'no detection'
  3. Insert the cartridge to be copied
  4. Power the C64 as usual
  5. Load and start the copy software
  6. Wait for a prompt (*6)
  7. Switch to 'regular operation'
  8. Start the copy process

Even with such a board risk isn't completely eliminated as switching under power may still produce glitches. Although it's be mostly a low risk.

But I Want a Cheap Hack

Yeah, spending money for hardware when C15 cassettes are already eating up most of the allowance is hard. Someone needs to come up with a software only way ... and best one that can be pirated as well, so all it costs is another C15 ;))

But a pure software based solution can't do all of the above as it got no chance to survive a power on with a cartridge inserted. Being 13 and strapped on cache makes one take a bit more risk. In this case living with risk #2 and use some software executing above sequence as

  1. Power the C64 as usual
  2. Load and start the copy software
  3. Wait for a prompt (*6)
  4. Insert the cartridge to be copied
  5. Start the copy process

With some careful handling chances are good that it will work - most of the time (*3).

Bottom line

No,it's not guaranteed to be safe, but risks are minimized and can be kept at bay with proper handling.


Bonus Question

is there any programmatic setup you could do on a 64 that would make it safe to insert a cartridge with the power on

The 'programmatic setup' here is the same as for the board based solution: have the CPU execute a loop that is completely contained in RAM accessible when either ROM mode is enabled and access only resourced which are as well enabled in all of those modes. Those are:

  • RAM at 0000-0FFF
  • IO at Dxxx

Doing so doesn't eliminate all hardware related risk (#2) but gives a pretty good chance.


*1 - Always good to keep in mind that the C64 was originally developed as a game console. The way cartridges are handled is one of the left overs.

*2 - This includes not just computers but all devices including hair dryers :)

*3 - And add a minute of silent for the poor slobs that fried their C64 one way or another :))

*4 - At least as long it's supposed to be reliable.

*5 - Including solutions that present them self as cartridge, loading the copying program from ROM into RAM before copying whatever was plugged in, automating copying all the way.

*6 - Given when the program moved itself to a secure location and entered a wait loop so that avoids touching any resource where the cartridges would be.

Raffzahn
  • 222,541
  • 22
  • 631
  • 918
  • 1
    Incidentally, I've done this back in the day. Copying the game Gyruss posed an interesting problem; loading it and then doing SYS 64738 wouldn't work unless/until I added a few extra bytes at $C000, patched the startup vector to that, and then saved a version with the extra bytes included. – supercat Nov 22 '23 at 17:36
10

You can not programmatically setup safe insert/remove cartridges. But there are hardware for enabling/disabling cartridge. By disabling a cartridge on startup, one can prevent cartridge software from taking over the computer. This allows the "backup" programme to run prior the cartridge itself.

There are cartridge expanders and backup cards working this way. Those cards has enabled/disable toggles on them.

I've added a few images for you.

enter image description here

Aprotek User Port Expander

enter image description here

PSIDAC Kartridge Kracker

wizofwor
  • 2,788
  • 2
  • 14
  • 38
  • 2
    How does the ability to 'enable' or 'disable' cartridges by a switch infer the ability to remove/insert them from/into the connector when the power is applied? – lvd Nov 22 '23 at 11:59
  • IIRC the Psidiac board and software called itself Kartridge Kracker. – Raffzahn Nov 22 '23 at 12:33
  • @lvd Sounds more like a question in it's own right. Short answer: The PLA only output the chip select signals for cartridge ROMs (/ROML, /ROMH) when /GAME and/or /EXROM are active. By pulling them high via switch the C64 starts normally. With the copying program loaded it makes the CPU stay within the first 4 KiB. That select is independent from those signals, so the program can wait 'there' until the enable (switching them in again) is done – Raffzahn Nov 22 '23 at 12:43
  • 1
    @Raffzahn this is not my point completely. If you're gonna attach/detach a cartridge to the running computer in a way that computer continues working normally (let's assume "enable" switch is off), you face the following problems: 1. power supply voltage dip due to capacitors on the cartridge creating a momentary short-circuiting while charging, 2. Signal pins connecting earlier than power ones thus probably disturbing logic levels on the powered on part of the system. You need to thoroughfully circumvent at least those problems. – lvd Nov 23 '23 at 14:20
  • 1
    And the correct solving of at least those two issues is no simple task. You need a 'slow start' circuit to slowly raise the voltage on cartridge, you need to isolate every cartridge IO pin during that process, you need to set chip select/strobes pins to the inactive levels before finally connecting a cartridge to the main system. – lvd Nov 23 '23 at 14:23
  • 1
    @lvd There seems to be a misunderstanding of the purpose of those devices. They are in no way about allowing hot plugging a cartridge. Their purpose is to suppress detection/configuration during power up. That's why my description notes powering on (#4) after pluggin in (#3). Same goes for all kind of 'multi cartridge' expanders I've ever seen: No Hot-Pluggin. Adding such facility would (as youknow) need way more than a few connecters and a PCB. – Raffzahn Nov 23 '23 at 14:34
  • @Raffzahn - The first line of the answer kind of implies that this is a hardware solution to safe insert/remove cartridges... hence, maybe, the source of the confusion. The ad itself does not mention hot-swapping, i.e. "insert" and 'remove", per se. Maybe that first line should be changed, as this is clearly not the case..? – Greenonline Nov 23 '23 at 21:22
  • @Greenonline Then again, the answer explicit talks about enabling/disabling cartridges (second para) not inserting/removing. But I see where what you mean. A clarification about not being about insertation would be a defining improvement. – Raffzahn Nov 23 '23 at 21:45
  • 1
    @Raffzahn, Thanks for comments. I've added details to avoid incorrectly implying hot-plugging. – wizofwor Nov 24 '23 at 08:00
5

From my experience back in the day, inserting a cartridge after loading and running a machine language monitor would more often than not disrupt machine operation, but would occasionally work in such a manner as to allow the cart to be dumped. Years later, having fried a different machine (Atari 2600jr) while working with a cartridge design (accidentally drive A9 hard high), I recognize dangers beyond what I was unaware of BITD. The risk level is probably low enough that it could be justifiable if there were no other means of dumping cartridges, or if one wants to recreate the "back-in-the-day" experience of doing so, but one has a cartridge that hasn't already been dumped by someone, it's probably rare enough to justify a greater degree of care in archiving its contents.

supercat
  • 35,993
  • 3
  • 63
  • 159
2

Working on the assumption that cartridges are basically PCBs.

PCBs (and other connectors) can be designed to be hotplugged, and can be recognised as such by having fingers of different lengths such that as they are slid in the ground connects first, followed by power, and then finally logic.

It would, in principle, be possible to have some sort of interposer board which mimicked that: possibly by having a special edge connector or possibly by clever switching electronics. But I have never heard of anything like that being available for a home or personal computer: it's more like the sort of thing used by telephone exchange electronics.

I have been told, by somebody who either worked on this stuff directly or had seen it done, that if you have suitable testgear you can measure the inrush current on the logic signals of a board being hotplugged without special design precautions. Basically, you get a current spike of eyewatering magnitude for a miniscule amount of time as the gates in the CMOS chips charge, and doing that to a chip which is not expecting it is guaranteed to cause problems.

Plus, of course, there's the ever-present static charge problem.

Mark Morgan Lloyd
  • 2,428
  • 6
  • 22
  • 1
    That method is technically sound and has of course be used with many systems. It just not fit the way the C64 eco-system acts. The simple way to make it work would mean to add different length fingers to the PCB, but that's the part of the cartridge, not the add on board. doing so on the connector side would require more expensive connectors - something that the extreme low cost home market does not appreciate. – Raffzahn Nov 24 '23 at 13:12
  • Which is what I said. As I also said- or at least intended to say explicitly, it /might/ be possible to use a standard connector with careful design of buffers on an add-in card to simulate staggered fingers. – Mark Morgan Lloyd Nov 24 '23 at 13:45