On some cartridge-based video game systems (NES, Game Boy Color, etc.) it is possible to remove the cartridge while the game system is still powered on. What kind of damage can this behavior do to the system hardware or game itself?
The NES can be damaged by software, so removing the cartridge at just the wrong timing could theoretically damage the console.
The 2CO2 PPU in the NES normally reads the background color from palette index 0, but this isn't hard-wired into the chip -- it actually reads the palette index of the background from four EXT pins. These pins are grounded on the NES, forcing the palette index to 0, but an arcade board using the 2CO2 or a similar chip could connect these pins to another PPU.
Bit 6 of PPUCTRL selects whether the PPU should run in master or slave mode. If the PPU is in master mode, it reads the palette index from the EXT pins as explained above, but in slave mode, it outputs the palette indices it is currently drawing to the EXT pins.
This way, the images from two PPUs can be layered. The slave PPU draws one image, and the master draws another image on top of that and outputs the combined images.*
The NES didn't use that feature, but the hardware still exists in the PPU. If the PPU is set to slave mode, it will attempt to output the background palette index to the EXT pins. If it outputs a 1 to any of these pins, it will cause a short from Vcc, through the PPU, and to ground (because the EXT pins are grounded).
Suppose the game is writing to its memory, for example address
If the cartridge is removed at just the wrong time and
D7 floats high, that instruction could become
sta $2220, which is mirrored to
$2000. If bit 6 of
A is set, the PPU will be set into slave mode and potentially damaged. It's unlikely that just the right bit will be flipped at just the right time, but it's possible.
*: The image generated by the slave PPU can only use colors from the background palette of the main PPU because there are only 4 EXT pins, not 5.
No damage to the hardware should occur (unless by chance removing the cartridge physically damages the hardware contacts). The reason for this is is that loading a cart basically completes a big circuit the the system hardware. There is no internal storage (at least not on the NES/SNES/N64 and Game Boy), so there is no persistent memory to corrupt. On the N64, removing a cartridge mid game will freeze any instructions and I/O, and the last frame before the disconnect will be displayed.
Some systems (such as the original Game Boy), lock the cartridge into place to prevent improper removal or hot-swapping. I believe this was removed from the Game Boy Pocket onward, but it's also possible the Game Boy Color was the first version to no longer have this lock (I no longer have each system to check). Instructions were added to gracefully shut down the system on improper cartridge removal to these systems.
It is possible that with any improper removal, any game that uses internal memory to save player information (think The Legend of Zelda save files or Mario Kart track times) could become corrupted. This can also occur by powering down the system while a save is in progress. Many games have defensive programming to handle such issues. The player is alerted that internal data has become corrupted, and will reset to some default values. It is also possible that a poorly programmed cart could be rendered useless with corrupted data, rendering it unplayable.
Newer systems, such as the Nintendo DS and above have code in place to gracefully handle improper cartridge removal. In fact, the original DS can actually run if a game is inserted improperly. If the contacts are dirty or blocked somehow, the system menu will load, and a GBA game or PictoChat can run without issue.
In the Nintendo 64 game Banjo-Tooie, Rare originally planned to create a feature where the player would intentionally hot swap Banjo-Kazooie and Banjo-Tooie to transfer items between the two games (or, at least unlock new items in Banjo-Tooie from Banjo-Kazooie) called "Stop 'n' Swop". In development on the SGI Indy Workstations, the RAM lasted much longer, I think about seven seconds, from when the cartridge was removed to when the data would be purged. The SGI boxes turned out to be more powerful than the actual retail hardware, and in production a player would have less than one second to perform a successful hot swap. Thus, the feature was abandoned.
Technically, it could damage the cart and/or the NES or other console. It probably won't, but it could.
Removing (or inserting) a cartridge on a live system is similar to de-bouncing issues with push buttons. See, as the cart edge is being pulled from the edge connector, for a few microseconds, it could produce electric arcs back and forth from any of the pins such as the address bus, data bus, etc.
Because our human hands are so clumsy and slow, compared to the 5V (or whatever) traveling through the pins, the pins can physically "bounce" several times in a few microseconds. Removing a cartridge would be the same.
Anyway, NES carts are actually pretty tough. Again, it probably won't damage it, but it certainly could.
Which is why I don't suggest it.
Most chips do not like to have signals applied when they are not powered or lack a ground connection; how they react may depend upon a variety of factors. Because cartridge card edges generally made no effort to ensure that power and ground would be connected before anything else, inserting or removing a cartridge to a live system could result in a chips having some pins connected and driven while power and ground aren't.
It's unlikely that inserting or removing an Atari 2600 cartridge while a console is powered on would cause such a perfect storm of coincidences as to cause damage to the console or cartridge, but it could certainly stress components momentarily beyond their ratings, and neither Atari nor any other manufacturer would want to guarantee that such stress would never cause failure.
Not cartridge games, but the ZX Spectrum has a big problem with removing peripherals with power on because they have the +5V (pin3) and +9V (pin4) very close to each other; removing the peripherals had a big chance to make a short circuit that would send +9V to TTL circuits, which would damage them and render them unusable.
This problem was solved on Spectrum Plus 2A and Spectrum Plus 3 by moving the +9V output on pin 4.
I broke my first ZX Spectrum 48K two times by moving the printer :(