RTC accuracy fix
This commit is contained in:
parent
a2d3b8c174
commit
ac5b0aca2c
@ -543,7 +543,7 @@ struct GB_gameboy_internal_s {
|
|||||||
GB_SECTION(rtc,
|
GB_SECTION(rtc,
|
||||||
GB_rtc_time_t rtc_real, rtc_latched;
|
GB_rtc_time_t rtc_real, rtc_latched;
|
||||||
uint64_t last_rtc_second;
|
uint64_t last_rtc_second;
|
||||||
bool rtc_latch;
|
GB_PADDING(bool, rtc_latch);
|
||||||
uint32_t rtc_cycles;
|
uint32_t rtc_cycles;
|
||||||
uint8_t tpp1_mr4;
|
uint8_t tpp1_mr4;
|
||||||
);
|
);
|
||||||
|
@ -541,10 +541,7 @@ static void write_mbc(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
|
|||||||
gb->mbc3_rtc_mapped = value & 8;
|
gb->mbc3_rtc_mapped = value & 8;
|
||||||
break;
|
break;
|
||||||
case 0x6000: case 0x7000:
|
case 0x6000: case 0x7000:
|
||||||
if (!gb->rtc_latch && (value & 1)) { /* Todo: verify condition is correct */
|
|
||||||
memcpy(&gb->rtc_latched, &gb->rtc_real, sizeof(gb->rtc_real));
|
memcpy(&gb->rtc_latched, &gb->rtc_real, sizeof(gb->rtc_real));
|
||||||
}
|
|
||||||
gb->rtc_latch = value & 1;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -781,7 +778,7 @@ static void write_mbc_ram(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
|
|||||||
if (gb->mbc_ram_bank == 0) {
|
if (gb->mbc_ram_bank == 0) {
|
||||||
gb->rtc_cycles = 0;
|
gb->rtc_cycles = 0;
|
||||||
}
|
}
|
||||||
gb->rtc_latched.data[gb->mbc_ram_bank] = gb->rtc_real.data[gb->mbc_ram_bank] = value;
|
gb->rtc_real.data[gb->mbc_ram_bank] = value;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user