User:Blaziken257/T1 Save file research

From Wikifang, a definitive guide to Telefang, Dino Device and Bugsite
Jump to navigation Jump to search

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.

Terminology:

b:xxxx -- b = External RAM bank, xxxx = RAM address.
To map this to an address in a .sav file, take the bank and multiply by 0x2000. Take the RAM address, subtract 0xA000 from this, and add to the previous result.
Examples:

  • 0:A000
    • External RAM bank is 0, so we start with 0 * 0x2000 = 0.
    • RAM address is 0xA000. Subtract 0xA000 from this, and we get 0.
    • Add 0+0 to get 0, and this maps to 0x0 in a .sav file.
  • 2:B200
    • External RAM bank is 2, so we start with 2 * 0x2000 = 0x4000.
    • RAM address is 0xB200. Subtract 0xA000 from this, and we get 0x1200.
    • Add 0x4000+0x1200 to get 0x5200, and this maps to 0x5200 in a .sav file.

Save file header[edit]

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[edit]

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[edit]

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[edit]

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).

Denjuu data[edit]

  • Saved to 0:A410-0:BD0F
  • When continuing a saved game, this data is always transferred to 2:A000-2:B8FF. During gameplay, this area in RAM is used when Denjuu data is needed. While technically part of save data, it is treated as if it were volatile RAM, since it is read and written to even without saving on the D-Shot screen. When saving on the D-Shot screen, it is transferred back to 0:A410-0:BD0F.
  • Note: This may not all be Denjuu data. Look at this some more!

Nicknames[edit]

  • Saved to 0:B610-????
  • Upon continuing a saved game, this is written to 2:B200-????.
  • 6 bytes per nickname.

Level, phone number, etc.[edit]

  • Saved to 0:A410-????
  • Upon continuing a saved game, this is written to 2:A000-????.
  • 0x10 bytes per Denjuu:
    • 0 - Species, added by 1
    • 1 - Level
    • 2 - FD
    • 3 - Personality
    • 4-5 - Experience (little endian), divided by 2
    • 6-7 - ???
    • 8 - Origin
    • 9 - ???
    • A-D - Numerical value of phone number (ignoring *, #, and -), little endian -- last byte (D) is reduced mod 4, although if high bit is 1 and millions digit of decimal number is 5, then it becomes 7
    • E - Placement of *, #, and - symbols in phone number (see here to find out how it works)
    • F - ???

Player's name[edit]

  • Stored at 0:A03C in RAM.