From 4111bb5e4fe7dd1ec8da4b1d3e1fe3257de78a0c Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Fri, 21 Oct 2022 05:13:00 -0300 Subject: [PATCH] fix: RTC day is 6 bits wide, not 3 --- src/core/bus/GamePak.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/bus/GamePak.zig b/src/core/bus/GamePak.zig index f41a18a..b75d934 100644 --- a/src/core/bus/GamePak.zig +++ b/src/core/bus/GamePak.zig @@ -511,7 +511,7 @@ pub const Clock = struct { const now = DateTime.now(); self.year = toBcd(u8, @intCast(u8, now.date.year - 2000)); self.month = toBcd(u5, now.date.month); - self.day = toBcd(u3, now.date.day); + self.day = toBcd(u6, now.date.day); self.weekday = toBcd(u3, (now.date.weekday() + 1) % 7); // API is Monday = 0, Sunday = 6. We want Sunday = 0, Saturday = 6 self.hour = toBcd(u6, now.time.hour); self.minute = toBcd(u7, now.time.minute);