The first step is identification. They're usually microcontrollers, but can someitmes (rarely, even) be pure state machines in the form of an ASIC. This does happen, though, and if they're not an MCU, it makes it a lot harder to emulate.
To identify the MCU, the circuit board (which is usually simple, with just a handful of passive components other than the chip itself) is traced out, and "Sean Riddle" of the Bannister forums tries to match the pinout against any known pinouts.
In the event that it matches an MCU model for which there's a known method for dumping the internal ROM, Sean breaks out one of several test jigs and pulls out the data, then wires up the LCD and photographs the segments to be vectorized.
Since the chips themselves usually have all identifying markings scrubbed, this is about the only way to do it in a safe manner. It also assumes the chip is in a normal plastic or ceramic package. If it's unidentifiable or is "globbed" with an epoxy dot, the real fun begins!
In that case, the chip is removed from the board in any way possible, and the whole shebang is dissolved in fuming nitric acid until the silicon die itself is exposed. The silicon die is then cleaned in Whink and put under a microscope.
Multiple photos are taken of the exposed die, then stitched together. At this point, it would be a good time for a small digression about "mask programmed" versus "electrically programmed" silicon chips.
Hand-waving away certain details, the vast majority of modern chips are electrically programmed. The chip starts out blank, and has its program uploaded at the time of manufacturing, usually via pogo pins against the wafer itself, or a custom jig after the chip is packaged.
But, for chips that are going to have a lot of them made, this step costs too much time and money. In these cases, the ROM bits are literally a part of the photolithographic mask used to manufacture the silicon chip itself. So yes, bits in this case are actual physical objects.
The bright side to this is twofold: First, after photographing, the bits can be pulled out of the images however. Computer vision, some unfortunate fellow sitting and manually plugging 0/1 into an editor, whatever method results in the least number of errors.
Second, and most importantly, it means that the actual ROM bits are usually the absolute last thing to break. So, in the event that you have a partly-functioning or non-functioning LCD handheld that you'd like to see dumped, take heart and send me a DM! :-)
He's looking for donations to help him buy a big auction of old handhelds to de-cap and extract.
I understand that MAME can also emulate Pong now, and I'm not even really sure what that means, because Pong was arguably not a computer. It didn't have "code". It didn't have a CPU. It was wire-wrapped out of discrete analog components: a state machine and signal generator made out of relays as big as your thumbnail.
Previously, previously, previously, previously, previously, previously, previously, previously, previously, previously, previously, previously, previously, previously, previously, previously, previously.