Both cartridge boards can feature an SST39SF040 flash chip for storing the game's data, which allows the game to reflash parts of itself - for instance, using some unused bank area for save data storage.
See this for UNROM-512 docs, and this for a GTROM addendum.
Due to the peculiarities of self-flashing, code that performs flash operations must live in WRAM.
There's two approaches here:
My preferred approach is to use the stack to load a small piece of code (for example, an ASM routine to write a byte of flash), then jump to it. This way, the memory cost is not paid throughout the entirely of the game's execution (and the NES doesn't exactly have a lot of RAM) - however, is the soft/compiled stack capable of ensuring that?
Both cartridge boards can feature an SST39SF040 flash chip for storing the game's data, which allows the game to reflash parts of itself - for instance, using some unused bank area for save data storage.
See this for UNROM-512 docs, and this for a GTROM addendum.