It saved on a small memory chip inside the cartridge. They had a small battery (much like, probably even identical to, the ones you find on computer motherboards).
After a long enough period of time those batteries do die and you do lose saved progress and the ability to save until you replace the battery (particularly anything you save is lost as soon as you remove power).
Latest Answers