Commit 039f8e9
committed
Improve GBA RTC
Implements various improvements to GBA RTC. Primarily, this allows for RTC to actually be reset and set by games, instead of it being forced into matching host time. Time registers are now just incremented as host time increases, like other RTC implementations in mGBA (e.g. MBC3 / HuC3).
"Test mode" is also implemented to the degree it seems to do anything (which just seems to prevent commands from working, except exit test mode and reset commands). It is internally stored in bit 7 of the seconds byte, as documented in spec sheets (although this is impossible to verify it seems, due to get time commands no longer working).
Invalid / write-only commands now return a stream of 1-bits (rather than 0-bits), as on hardware.
The PM flag is now properly implemented (so software can actually use 12 hour mode fully).
Only valid RTC control bits can actually be written now (unused bits are always 0; power-off bit is not settable but it is clearable).
The alarm command is "implemented" here as a stub (the alarm registers are just write only here, so nothing to do without alarms actually being implemented with cartridge IRQ; although I haven't verified yet if cartridge IRQ should actually be triggered or whatever).1 parent 8740f3d commit 039f8e9
3 files changed
Lines changed: 337 additions & 86 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | | - | |
| 41 | + | |
41 | 42 | | |
42 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
43 | 55 | | |
44 | 56 | | |
45 | 57 | | |
| |||
57 | 69 | | |
58 | 70 | | |
59 | 71 | | |
60 | | - | |
61 | 72 | | |
62 | 73 | | |
63 | 74 | | |
| |||
100 | 111 | | |
101 | 112 | | |
102 | 113 | | |
| 114 | + | |
| 115 | + | |
103 | 116 | | |
104 | 117 | | |
105 | 118 | | |
| |||
0 commit comments