Available on
gb_pak_rtc and crate feature pak only.Expand description
The MBC3 clock: seconds to days, running on the cartridge battery.
The clock keeps time while the console is off, so a game can tell how long the player was away.
§Latching
The counters inside the controller are not readable. What the window shows is
a snapshot of them, and latch takes a fresh one. Reading straight through
without one would mix an old second with a new minute, since the five
registers arrive one at a time and the clock does not wait.
ⓘ
let (h, m) = gb_pak::rtc::latch(|c| (c.hours(), c.minutes()));§Trusting the time
A cartridge whose clock has never been set may hold noise.
Structs§
- Latch
- One snapshot of the clock.
- Time
- What the clock counts: time since it was set, not a calendar date.
Functions§
- clear_
overflow - Acknowledge a day-counter wrap.
- latch
- Snapshot the clock, switch the RAM on, and read it inside
f. - set
- Set the clock. Starts it if it was stopped, and clears
Latch::overflowed. - set_
halted - Stop the clock, or start it again.
- time
- Snapshot the clock and read all of it.