User:Blaziken257/T1 Save file research
Telefang has four external RAM banks (each bank is 8KB), resulting in 32KB external RAM. Save data is used in bank 0 (which corresponds to 0-1FFF in a .sav file), and possibly other banks.
Save file header
Each version of Telefang has a header at the beginning, in the form of a string, denoting the game's version. This appears at ROM offset 0xF61-F70 in both versions, and is compared to 0:A000-A00F in RAM (0-F in a .sav file).
- In Power Version, this is " TELEFANG POWER\x00" (without the quotes).
- In Speed Version, this is " TELEFANG SPEED\x00" (without the quotes).
If this header is not present, the save file will be erased. There won't even be a message stating that the game is corrupt -- probably because it's not present the first time you play the game.
Checksum
After the title screen, the game runs a checksum, adding up each byte from 0:A000-BFEF (0-1FEF in a .sav file). The result is a 16-bit number. This is compared to a 16-bit, big endian integer at 0:BFFE-BFFF (1FFE-1FFF in a .sav file). If this doesn't match, a save file corruption message will appear afterwards, with Crypto crying, and the data will be erased.
Save file bit
At 0:BFFD in RAM (1FFD in a .sav file), this value is 00 if a save file is not present, and 01 if it is.
Converting saves across versions
Due to the difference in save file headers, save files from one version to another are not compatible.
To convert a Power Version save to a Speed Version save:
- Change the POWER string at the beginning to SPEED.
- Subtract 0x1C from the checksum at 0:BFFE-BFFF (1FFE-1FFF in a .sav file).
To convert a Speed Version save to a Power Version save:
- Change the SPEED string at the beginning to POWER.
- Add 0x1C to the checksum at 0:BFFE-BFFF (1FFE-1FFF in a .sav file).