Purifying FDS Disk Dumps

Purifying FDS Disk Dumps
by on (#149371)
A lot of Famicom Disk System dumps of games that save information to disk have information saved to disk like save games, high scores and worlds/rounds/levels/games beaten. Unfortunately, for most games there is no way to restore the game to a pristine, never-played state within the game itself. I have always wanted a tool or utility that could take these disk images and do just that, but since none exists I decided to investigate the images and try to fix them myself. Restoring a Famicom Disk System game to a pristine state is more than just deleting or zeroing out the last file. The resulting disk image has to work. I used Nestopia UE 1.46 and FDSExplorer 1.63 and my favorite hex editor.

What made this much easier was the fact that Famicom Disk System games always seem to save to the last file on a disk's side. Sometimes the save file has an obvious name and is so small it could be nothing else, but for other games it is not so obvious. So the first thing I had to do was to observe which side was being written. Nestopia tells you when a disk is being read or written, so I just played until there was a save. Metroid was almost unique among the games I looked at because it saves to both sides.

Once I figured out which side was being saved, I opened the disk image in FDSExplorer and looked at the file. For games with three save slots, I simply deleted two and made a third with a file name that was easy to find like ABCDEFGH. With a little deductive reasoning I could figure out how the file could be corrected so that no save games would be present at startup. Dr. Chaos did not follow the typical rule about writing changes to all files after starting a new game, but its save file is really simple and my image came with one unused file.

On a couple of occasions, I discovered that my image was pristine but the game actually created a file once there was saving. FDSExplorer makes it easy to delete the last file in these cases, but you have to verify that the game creates a file before you delete it. I made it a point to alter no more bytes than was necessary to make the game appear to look pristine. Whether it would actually correspond to a pristine, errorless dump of a sealed Disk Card is an issue that may never be known for some games, but for other games the changes are so obvious and minor that it can hardly be doubted that this is how they should have appeared.

Here is a list of the games and what I did to make them "pure". Please let me know if I overlooked anything before I publish this information more broadly :

Ai Senshi Nicol
Information Saved - Progress in game
Fix : Side A - Zero out last file

Akumajou Dracula (all versions) (Konami, 1986)
Information Saved - Three slots, last stage completed and number of continues
Fix : Side A - Zero out last file
NES/Famicom Port : Castlevania/Akumajou Dracula

All Night Nippon Super Mario Bros. (Nintendo 1986)
Information Saved - Number of times you have beaten the game
Fix : Side A - Zero out last file
NES/Famicom Original : Super Mario Bros.

Bubble Bobble (Taito, 1987)
Information Saved - Allows you to select a starting level up to the last level you completed
Fix : Side A - Game creates a save file when you save your level progress, delete file with FDS Explorer
NES Port : Bubble Bobble

Clu Clu Land - Welcome to New Clu Clu Land (Nintendo, 1992)
Information Saved - High scores
Fix : Side A - In the last file, this pattern must repeat ten times : 14 EF EF EF 24 00 00 00
NES/Famicom Connection : Clu Clu Land

Dr. Chaos (Pony Canon, 1987)
Information Saved - Three slots, progress through game
Fix : Side A - Zero out last file, except for the last eight bytes, should say DR.CHAOS in ASCII
NES Port : Dr. Chaos (NTSC Only)

Dracula II - Noroi no Fuuin (Konami, 1987)
Information Saved - Three slots, items acquired, character level, time taken in game in days
Fix : Side A - Zero out last file
NES Port : Castlevania II : Simon's Quest

Eggerland (HAL Laboratory, 1987)
Information Saved - Rooms completed
Fix : Side B - Start a new game, commit suicide until you see the Game Over screen, then save.
NES/Famicom Connection : Adventures of Lolo 1, 2 & 3, Eggerland - Meikyuu no Fukkatsu

Eggerland - Souzouhe no Tabidachi (HAL Laboratory, 1988)
Information Saved - Allows you to select a starting level up to the last level you completed, saves levels you build with the construction editor in the game.
Fix : Side B - Zero out the last byte in the last file and remove all tiles for all construction levels using the in-game utility, then save.
NES/Famicom Connection : Adventures of Lolo 1, 2 & 3, Eggerland - Meikyuu no Fukkatsu

Hao-Kun no Fushigina Tabi (DOG, 1987)
Information Saved - Three slots, progress through game
Fix : Side A - Delete all three save files in the main menu, then create file one. Immediately close the FDS image in Nestopia. Replace the first seven bytes in the last file with 00 5F 5F 5F 5F 5F 5F.
NES Port : Mystery Quest (NTSC Only)

Hikari Shinwa - Palutena no Kagami (Nintendo, 1986)
Information Saved - Three slots, progress through game, time taken to beat game, high scores
Fix : Side A - Copy hex from REG BACK and paste into REG.SAVE
NES Port : Kid Icarus

Kaettekita Mario Bros. (Nintendo, 1988)
Information Saved - Name, age and gender of players controlling Mario and Luigi, High Scores
Fix : Side A - Rename characters to the default, use hiragana for Mario and Luigi, set the ages to 00 and the gender to male (おとこ). Mario is まりお and Luigi is るいーじ in Nintendo's preferred hiragana spelling.
Side B - Copy over all bytes in file 9 to file 10
NES Port : Mario Bros. Classic Series (PAL Only)
NES/Famicom Connection : Mario Bros.

Knight Move (Nintendo, 1990)
Information Saved - High Scores
Fix : Side A - Save file is split into four sections of 48 bytes. The game uses the first and last section for saving the scores, so copy the second or third section to the first and fourth section.
NES/Famicom Connection : Tetris/Tetris (designed by Alexey Pajitnov)

Legend of Zelda 2, The - Link no Bouken (Nintendo, 1987)
Information Saved - Three slots, progress through game, number of saves
Fix : Side A - Kill all save files on the file select screen, the game will reset each slot as after it is killed. If your find that, after starting a new game, objects like Heart Containers and Magic Potions are not where they should be, delete the file and make a new file.
NES Port : Zelda II - The Adventure of Link

Metroid (Nintendo, 1986)
Information Saved - Three slots, progress through game, time taken in game, ending earned for last game, number of saves
Fix : Side B - Create a new character for file one, then start the game. Immediately close the FDS image in Nestopia. Do the same for file two and three. Do NOT save the game. This causes the game to reset the save information for the world for the three files because the game will write to side B when you create a new character. Side A - Overwrite the first three bytes with 80 and the next forty eight bytes with FF. Zero out the rest of the file. This deletes character information.
NES Port : Metroid

Nazo no Kabe - Block Kuzushi (Konami, 1986)
Information Saved - Three slots, allows you to select a starting level up to the last level you completed
Fix : Side A - Delete all three save files, then create file one. Start the game, lose all your balls, then save and quit. In the last file, replace the first sixteen bytes with the second sixteen bytes. These two sets of bytes should be identical to the third set of sixteen bytes. The last sixteen bytes of the file should be 00.
NES Port : Crackout (PAL Only)

Nazo no Murasamejou (Nintendo, 1986)
Information Saved - Three slots, progress through game
Fix : Side A - Kill all save files on the file select screen, the game will reset each slot as after it is killed.
NES/Famicom Connection : The Legend of Zelda/Zelda no Densetsu 1 - The Hyrule Fantasy (engine)

Section-Z (Capcom, 1987)
Information Saved - Three slots, progress through game
Fix : Side A - Delete all three character saves in the game menu, then create file one. Start the game, get killed, then save and quit. In the last file, replace the first twenty three bytes with the second twenty three bytes. These two sets of bytes should be identical to the third set of twenty three bytes. The last four bytes of the file should be 00.
NES Port : Section Z

Super Mario Bros. 2 (Nintendo 1986)
Information Saved - Number of times you have beaten the game
Fix : Side A - Zero out last file
NES/Famicom Connection : Super Mario Bros. 1, 3

Vs. Excitebike (Nintendo, 1988)
Information Saved - Race times, data for custom tracks 4-7 designed with built in construction editor.
Fix : Side A - Delete the last file
NES/Famicom Connection : Excitebike

Winter Games (Pony Canon, 1987)
Information Saved - Records for each event
Fix : Side B - Zero out last file
NES Port : Winter Games (NTSC Only)

Wrecking Crew (Nintendo, 1989)
Information Saved - Custom level designs for phases 1-4 designed with built in construction editor.
Fix : Side A - Delete all objects on each of the four phases of the design part, then save.
NES/Famicom Original : Wrecking Crew

Yume Koujou Doki Doki Panic (Nintendo/Fuji Television, 1987)
Information Saved - Worlds completed by each character.
Fix : Side A - Zero out first four bytes in last file
NES/Famicom Port : Super Mario Bros. 2/Super Mario Bros. USA

Zelda no Densetsu - The Hyrule Fantasy (Prototype and final) (Nintendo, 1986)
Information Saved - Three slots, progress through game, second quest, number of deaths
Fix : Side B - Kill all save files on the file select screen, the game will reset each slot as after it is killed.
NES/Famicom Port : The Legend of Zelda/Zelda no Densetsu 1 - The Hyrule Fantasy

Nestopia does not save to the disk image by default, but can in its options menu. Make backups when experimenting. Nestopia saves to an image when the image is closed or the user quits Nestopia. Unfortunately, FDSExplorer does not allow you to edit files inside a disk image directly, it is easiest to use a Hex Editor and search for the bytes you wish to alter.

This list really only scratches the surface, but I wanted to focus on games that were ported in some way or form on or related to a NES cartridge. Since my Japanese is "a little rusty", I did not want to tackle the more Japanese text-heavy games.
Re: Purifying FDS Disk Dumps
by on (#149458)
Good job! I always wished there was an easy way to restore the games to factory default. I just wish I could do it on my real disks somehow without having to rewrite the disks (which I can't do). Only way I know of is trying to corrupt the save data by resetting when it's writing to disk and let the game clean the file.

I spotted a typo:
Quote:
Kaettekita Mario Bros. (Nintendo, 1988)
Information Saved - Name, age and gender of players controlling Mario and Luigi, High Scores
Fix : Side A - Rename characters to the default, use hiragana for Mario and Luigi, set the ages to 00 and the gender to male (おとこ). Mario is まりお and Luigi is るいーぎ in Nintendo's preferred hiragana spelling.
るいーぎ can't be right, it should be るいーじ.
Re: Purifying FDS Disk Dumps
by on (#149459)
Pokun wrote:
Good job! I always wished there was an easy way to restore the games to factory default. I just wish I could do it on my real disks somehow without having to rewrite the disks (which I can't do). Only way I know of is trying to corrupt the save data by resetting when it's writing to disk and let the game clean the file.

I spotted a typo:
Quote:
Kaettekita Mario Bros. (Nintendo, 1988)
Information Saved - Name, age and gender of players controlling Mario and Luigi, High Scores
Fix : Side A - Rename characters to the default, use hiragana for Mario and Luigi, set the ages to 00 and the gender to male (おとこ). Mario is まりお and Luigi is るいーぎ in Nintendo's preferred hiragana spelling.
るいーぎ can't be right, it should be るいーじ.


You are quite right and the game agrees with you. It has been changed.
Re: Purifying FDS Disk Dumps
by on (#149864)
I checked the game in an emulator and Mario's name had been changed to Yoyuーda (Luigi was still default though). lol
I guess you can't trust FDS images on the net to be clean.
Re: Purifying FDS Disk Dumps
by on (#149868)
Pokun wrote:
I checked the game in an emulator and Mario's name had been changed to Yoyuーda (Luigi was still default though). lol
I guess you can't trust FDS images on the net to be clean.


That's why I figured the default name for Mario was まりお and changed it accordingly to make it as close to fresh out of the box as it is likely to get. A fair number of these changes required inferences and deductive reasoning.
Re: Purifying FDS Disk Dumps
by on (#149977)
Yeah in some cases it can be hard to know what the initial data is like. In the case of game progress save files for games like Doki Doki one could corrupt the data and let the game purify it, but in the case of F1 Race or Kaettekita that doesn't work.

And there are stuff in the header with info about how many times the disk was rewritten and such, which values I guess might not be initialized if it was dumped from a disk that was rewritten on a Disk Writer.
Re: Purifying FDS Disk Dumps
by on (#150875)
A small thing, and a bit off topic but I noticed this part:
Quote:
Legend of Zelda 2, The - Link no Bouken (Nintendo, 1987)
Information Saved - Three slots, progress through game, number of deaths

It's actually not number of deaths that is counted but the number of times you save. In Zelda 1 I think it actually counts number of deaths though. You can save without dying by pausing and then pressing UP+A on controller II (works in Metroid as well, both FDS and NES version).
Re: Purifying FDS Disk Dumps
by on (#150956)
Pokun wrote:
A small thing, and a bit off topic but I noticed this part:
Quote:
Legend of Zelda 2, The - Link no Bouken (Nintendo, 1987)
Information Saved - Three slots, progress through game, number of deaths

It's actually not number of deaths that is counted but the number of times you save. In Zelda 1 I think it actually counts number of deaths though. You can save without dying by pausing and then pressing UP+A on controller II (works in Metroid as well, both FDS and NES version).


You are right, the Up + A on controller II works for both Zeldas and Metroid, but for Zelda 2 and Metroid, it counts the number of saves, not deaths.

I wanted to give a general overview of the saved information, so I did not list everything every game saved.
Re: Purifying FDS Disk Dumps
by on (#150975)
Yeah I figured. Many people doesn't know about the A+UP trick though, and the English Metroid manual even fails to mention it even though the Japanese one does. Incidentally it doesn't work in Palutena or Kid Icarus, you just have to kill yourself to save.
Palutena counts the number of times you pick continue after dying and it affects the ending (resetting and reloading the save file does not count as a continue though).
Re: Purifying FDS Disk Dumps
by on (#151288)
doki doki panic? I think that would count as it was ported to cartridge format as USA mario 2.
Re: Purifying FDS Disk Dumps
by on (#151290)
Wrong thread? Of course all FDS games count if you know how to purify them. Doki doki is in the list though.
Re: Purifying FDS Disk Dumps
by on (#151586)
There are two sources for FDS Disk Dumps, No-Intro and TOSEC. Both have their value. I was using the No-Intro dump for "Hikari Shinwa - Parthenon no Kagami (Japan) (v1.1) [b]". Often [b] in the No Intro means that it is not pure, there is a save game on it but the game otherwise works fine. In this case, the [b] really meant an error in the disk image, the background graphics for the Overworld stages appeared mostly corrupt because the file SO BG was missing from side B.

The TOSEC image "Hikari Shinwa - Palutena no Kagami (1986)(Nintendo)[a].fds" contains this file, so you should use that. I had a save file in progress, so I copied over the SO BG with FDSExplorer to fix my image.
Re: Purifying FDS Disk Dumps
by on (#151904)
I think I found a game bug in Legend of Zelda 2, The - Link no Bouken. Start a game with the name LINK in the first slot. You will find that all the placeable objects like heart containers, magic potions, keys and special items have disappeared, making the game into a demo. The name LINK seems OK in slots 2 and 3.
Re: Purifying FDS Disk Dumps
by on (#151917)
Oh I remember a guy several years ago on Famicom World Forums having this problem (I believe he played on both a real FDS and an emulator with the same result). I have the disk and never had this problem (I never tried naming my files LINK though) so I thought it was very strange. Later I tried the game in an emulator and the items didn't show up. We thought that it was a problem with the disks.

I just tested Link no Bouken v1.0 (in FCEUX 2.2.1) and named my character LINK and checked the grove close to the north temple for the points bag and sure it wasn't there. Then I erased my file and registered ABC and tried again, it appeared! Seems you are right. But then I tried the same thing with v1.1 and this time the points bag was gone with ABC and appeared when I renamed him LINK.
What's going on here?

I noticed another bug though. Pressing left and right at the same time (no problem in an emulator) made Link skid backwards very fast!
Re: Purifying FDS Disk Dumps
by on (#151930)
My hypothesis is that there were prior saves on the disks and for whatever reason, some data was left behind in the save file. I checked the supposedly pure disk dump and there were some differences between it and a freshly cleaned game's dump. To fix the issue, starting the game, die and save, then delete the file. This appears to clear the save slot.
Re: Purifying FDS Disk Dumps
by on (#154467)
OK I got my FDSStick so I tried purifying Yume Koujou. It seems you can zero out all 6 bytes in the SAV-DAT file. The last two bytes will be written to when you save anyway ($5A, $A5 when I finished the first world with Imajin and saved), but I have no idea what they are for. Maybe a checksum or something?

Anyway FDSExplorer doesn't seem to be able to edit files. It can only add or remove files entirely. I used a normal hex editor and searched for the hex string in the save file to find it and edit it. But is there anyway to calculate the address in the .fds image to the addresses on the disk used by the Famicom?
Re: Purifying FDS Disk Dumps
by on (#154473)
Do the $5A $A5 values ever change?
Re: Purifying FDS Disk Dumps
by on (#154492)
I will keep an eye on them next time I beat a chapter. Annoyingly the only way to save seems to be to get a Game Over according to the manual. I discovered a suicide trick (on pause screen: con II A+B+UP) but you tend to get lots of extra lives from slot machines, so it takes some time.
Re: Purifying FDS Disk Dumps
by on (#154564)
Hi,

I've been using Loopy's FDSStick to do dumps of some sealed games. I have gotten a fair amount so far as I want to eventually get nice clean RAW and FDS images out there instead of the mixture we have currently.

Big crutch is the cost for sealed games naturally, or even finding them in the first place. What I was wanting to know if anybody can compare what I've dumped to games that have been used and dumped with Loopy's device. Look at the differences and see if there's a way to "clean" used copies to look like new. Because honestly I'll never be able to afford new copies of every FDS game :)

If you're interested in the dumps shoot me a PM. Thanks!
Re: Purifying FDS Disk Dumps
by on (#154684)
I'm not sure what you mean. You are dumping games with FDSStick and you want others to compare if their dumps are the same as yours?


Anyway I played some more Yume Koujou and compared the save file after each cleared chapter.


Yume Koujou Doki Doki Panic SAV-DAT file observation ($CC91 in FDS file)

The first four bytes contains information on what chapters are beaten
for each character in order: Imajin, Lina, Mama, Papa.
Each bit in these bytes is a chapter where bit 0 is chapter 1 and bit 7
is chapter 8 (you can beat chapters out of order by warping I guess).
1 = beaten 0 = not yet beaten.

The last two bytes in the file seems to be some kind of checksum. If you
change it, the saved progress seems to be erased. That's why it doesn't
matter what they are when you purge them. They will always revert to
$5A $A5 by the game (I tried saving right after the game had purged it,
and it became: 00 00 00 00 5A A5).

I purged the SAV-DAT file to:
00 00 00 00 00 00

Beat chapter 1 with Imajin:
01 00 00 00 5A A5

Beat chapter 2 with Imajin:
02 00 00 00 5A A5

Beat chapter 3 with Imajin:
07 00 00 00 5A A5

Still no changes to the last to byte. To be continued...


Edit: Oops I realized it's only 7 chapters, not 8.
Re: Purifying FDS Disk Dumps
by on (#154686)
Yep I'm trying to see what the differences are between sealed dumps vs dumps that have been played. I have a dumped sealed copy of Doki Doki Panic with FDS, RAW, and BIN. Was curious to compare them to see if it's really necessary to purchase sealed games for dumps.
Re: Purifying FDS Disk Dumps
by on (#154698)
Hubz wrote:
Yep I'm trying to see what the differences are between sealed dumps vs dumps that have been played. I have a dumped sealed copy of Doki Doki Panic with FDS, RAW, and BIN. Was curious to compare them to see if it's really necessary to purchase sealed games for dumps.


It depends on what you want. A sealed game is not necessary for a dump of Pro Wrestling because that game does not save anything to disk. If your dumping program compares the checksums on the disk and finds good checksums for every file on the disk, then you should be good. For the games that save, a dump of a sealed game that has never been played is ideal. If the dump comes out good, then you can have a pristine experience without any worries that you erased data that you should not have. Or if you find the cartridges that were in the Disk Writers, you could try those :)
Re: Purifying FDS Disk Dumps
by on (#154702)
If you dump two or three disks and they have the same data, you can have pretty good confidence that it's alright. FDS had copy protection too, intending to prevent people from making copies of games with the FDS hardware, but it prevents overwriting the non save-game areas, so someone would have to mod their FDS or have some other kind of hardware failure to corrupt anything but the save area.
Re: Purifying FDS Disk Dumps
by on (#154730)
You may not need to dump multiple disks if one disk gives no checksum errors after a dump. Good dumping tools should alert you to checksum errors.

Now if you have checksum errors, then you need multiple disks. You also need to check the version byte to make sure that you are using the same version of a game. However, if you can get good checksums from every block by using multiple disks, then you should be able to "stitch" them together to make one good game dump.

Finally, as rainwarrior said, your dumping program must dump the whole surface of the disk, not to just the last file number as reported by the official File amount block. That will capture any hidden files used for copy protection purposes.
Re: Purifying FDS Disk Dumps
by on (#154964)
Having compared four dumps from sealed disk images from Hubz with the available TOSEC collection images, I find that the TOSEC dumps are solid in terms of playability. Disk Info Blocks have different or missing information from them, but that does not affect the playability of the image itself. There are repeating patterns of 6C BD found in his images not found in the TOSEC images, but I did not deem them to be important to game playability.

Metroid was a more interesting case. The save files are not named in the TOSEC images, but are in Hubz' dump. Side A is SAVEDATA (and should have an ID of 15) and Side B is MENSAVE. Note that Version 1.1 Side B has only MENSAVE, while Version 1.2's Side B has MENSAVE2 then MENSAVE. Hubz' has Version 1.2, so I am inferring the file name for 1.1. However, once a write to these files occurs, the filenames are turned into 02 02 02 02 02 02 02 02 the ID on side A's file turns to 14. This behavior occurs with an FDS RAM Adapter and an FDSStick and presumably every emulator out there.
Re: Purifying FDS Disk Dumps
by on (#201718)
Sorry to bump an old thread, but I was wondering how much further this project progressed (if at all).

I'm also specifically curious about the Famicom Disk System game Konamic Tennis -- since I have a half-complete translation of the game I've been tinkering with -- and whether circulating images have any lingering save data that should be zeroed, restored, or otherwise neutralized. The image on which I've based my translation hack has a CRC32 of ac4ed201, if that's helpful.
Re: Purifying FDS Disk Dumps
by on (#201735)
goldenband wrote:
Sorry to bump an old thread, but I was wondering how much further this project progressed (if at all).

I'm also specifically curious about the Famicom Disk System game Konamic Tennis -- since I have a half-complete translation of the game I've been tinkering with -- and whether circulating images have any lingering save data that should be zeroed, restored, or otherwise neutralized. The image on which I've based my translation hack has a CRC32 of ac4ed201, if that's helpful.


Nope, and admittedly I have been lazy when it comes to reviewing recently translated games like the Famicom Gran Prix games.
Re: Purifying FDS Disk Dumps
by on (#201768)
I think bumping this thread is a good thing though. The information here should be easily accessible somewhere, like the wiki. Not sure if it has a place on a development wiki though. I guess it can be seen as save file examples for FDS games.