You can't copy code with memcpy
In my 1980s version of Empire, all the global variables were kept contiguously in one source file. To save/restore the game, it just took the address of the first one, the address of the last one, and blitted it to a disk file, and blitted it back.<p>Very fast & easy.<p>Of course, it broke when COMDATs were introduced.<p>I did a similar thing with my text editor. The colors were configurable. The usual way was to have a configuration file, which the editor would read upon startup. But floppy disk systems were unbearably slow. So what I did was take the address of the configuration data in the data segment. I'd work backwards to where those bytes were in the EXE file, and patch the EXE file. This worked great!<p>Until the advent of virus scanners, which broke that. Virus scanners hated self-modifying EXE files.