When you shake the system, you shake the cartridge in the slot. This causes the connections to the pins to be broken, which causes the game to freeze. The system must always have a solid connection to the game ROM, since it can read from it very quickly at any time. Like RAM I/O, ROM I/O is immediate, unlike CD drives or hard drives.
Basically, imagine if you opened up your PC and shook the RAM sticks. The same thing would happen; your computer would immediately crash.







