GB MBC: Add more TAMA6 commands

This commit is contained in:
Vicki Pfau 2022-08-30 23:01:27 -07:00
parent 0d8e7efff4
commit 9b35e76416
2 changed files with 14 additions and 0 deletions

View File

@ -138,6 +138,8 @@ enum GBTAMA6Command {
GBTAMA6_HOUR_WRITE = 0x5,
GBTAMA6_MINUTE_READ = 0x6,
GBTAMA6_HOUR_READ = 0x7,
GBTAMA6_DISABLE_ALARM = 0x10,
GBTAMA6_ENABLE_ALARM = 0x11,
};
enum GBHuC3Register {

View File

@ -1719,6 +1719,18 @@ void _GBTAMA5(struct GB* gb, uint16_t address, uint8_t value) {
tama5->rtcTimerPage[GBTAMA6_RTC_PA0_HOUR_1] = out & 0xF;
tama5->rtcTimerPage[GBTAMA6_RTC_PA0_HOUR_10] = out >> 4;
break;
case GBTAMA6_DISABLE_ALARM:
tama5->rtcTimerPage[GBTAMA6_RTC_PAGE] &= 0xB;
tama5->rtcAlarmPage[GBTAMA6_RTC_PAGE] &= 0xB;
tama5->rtcFreePage0[GBTAMA6_RTC_PAGE] &= 0xB;
tama5->rtcFreePage1[GBTAMA6_RTC_PAGE] &= 0xB;
break;
case GBTAMA6_ENABLE_ALARM:
tama5->rtcTimerPage[GBTAMA6_RTC_PAGE] |= 0x4;
tama5->rtcAlarmPage[GBTAMA6_RTC_PAGE] |= 0x4;
tama5->rtcFreePage0[GBTAMA6_RTC_PAGE] |= 0x4;
tama5->rtcFreePage1[GBTAMA6_RTC_PAGE] |= 0x4;
break;
}
break;
case 0x4: // RTC access