x.1sav.rtc.s3511a
Owner: these specifications, under a reserved name · Applies to: the bundle header and a part · Status: normative schema, optional to carry
The GBA’s clock is a Seiko S-3511A on the cartridge. x.1sav.rtc carries the
instant a consumer needs to display it; this key carries what the chip itself holds, which is what a producer handing
the cartridge back byte for byte needs.
Every emulator that keeps this clock keeps the same two values, so the representation belongs to no one of them and the
name sits in the x tree for the reason
x.1sav.rtc gives, under that key rather than beside it.
Schema
Section titled “Schema”; ============================================================================; x.1sav.rtc.s3511a - the latched state of a Seiko S-3511A real-time clock;; An extension key for the Universal Saves Format, defined by these; specifications under a name reserved in the Vendor Names registry because; every emulator that keeps this clock keeps the same two values.;; The root here is the value carried under the key, not a bundle. A bundle; validates against the format's own schema whatever this holds, since an; extension value is `any` there; this file is what makes the shape checkable.; ============================================================================
rtc-s3511a = { 0 => bstr .size 7, ; components - latched BCD: year, month, day, weekday, hour, minute, second 1 => uint, ; control - the control register as read}
; 24-hour mode is bit 6 of the control register and does not get a field of its; own. Two spellings of one value let a bundle contradict itself, which the; format rules out everywhere else; see "One encoding per bundle".Key 0 is what the chip latches on a read: year since 2000, month, day, weekday, hour, minute and second, one BCD byte each and in that order. Bit 7 of the hour byte carries PM, and only when 24-hour mode is off. Key 1 is the control register as read, whose bit 6 is that 24-hour flag and whose bit 7 is the power-off status.
24-hour mode is not a field of its own
Section titled “24-hour mode is not a field of its own”It is bit 6 of key 1. A boolean beside the register would be a second spelling of one value, and a producer that set the two differently would write a bundle contradicting itself. The format keeps one encoding per value everywhere else. Read the flag out of the register.
What does not go here
Section titled “What does not go here”How an emulator keeps the clock running between the moments a game reads it. One derives the current time from an offset against the host clock, another holds an absolute base, and neither is chip state. A schema every producer has to satisfy can only require what the chip itself holds. An emulator with a model worth preserving carries it beside this key under a name of its own.
When to set it
Section titled “When to set it”Only for a GBA cartridge carrying this chip. Pokemon Ruby, Sapphire and Emerald use it, as do the Boktai games. A Game
Boy cartridge keeps a different clock and takes x.1sav.rtc.mbc3.
This key’s placement follows x.1sav.rtc’s
scope rules, including the prohibition on a
bundle part. A producer SHOULD carry
x.1sav.rtc on the same map: a consumer that only wants to know what time the
game thinks it is should not have to decode BCD to find out, and the two
may disagree without either being
wrong.