MBC3 RTC save format

Back to main page

the RTC data is appended after the sav file, 44 or 48 bytes. you can detect its presence by the save data being 44 or 48 bytes bigger than the cart's ram size, or 44 or 48 bytes bigger than a multiple of 8192.

old VBA (from 2005) saves the 44 bytes version, and can load both the 44 and 48 bytes version.

VBA-M saves the 48 bytes version, and can *only* load the 48 bytes version.

one should load both types, and always save the 48 bytes version.

the data consists entirely of little endian (intel order) dwords. as the registers are bytes, it's in the first byte of the field, the other bytes should always be 0.

time is the internal "hidden" version. latched time is what you're reading from the registers.

the unix timestamp is UTC seconds since 1970-01-01 00:00, a very common standard on internet. again, the lowest byte goes first.

An implementation that is unable to save the current time as unix timestamp (for example embedded/hardware) should save the 64 bits value $7fffffff7fffffff, or equivalently, the byte values "ff ff ff 7f ff ff ff 7f" (spanning the 8 bytes in position 40-47). The reason for this is that VBA-M will ignore a timestamp in the future (will then not advance time). while VBA-M loads the timestamp as 64 bits, VBA only loads the first 4 bytes as 32 bits. the above value will be seen as "in the future" for both 32 bits and 64 bits. BGB supports 64 bits timestamps as well as ignoring future timestamps since version 1.5.3.

offset  size    desc
0       4       time seconds
4       4       time minutes
8       4       time hours
12      4       time days
16      4       time days high
20      4       latched time seconds
24      4       latched time minutes
28      4       latched time hours
32      4       latched time days
36      4       latched time days high
40      4       unix timestamp when saving
44      4       0   (probably the high dword of 64 bits time), absent in the 44 bytes version