This commit is contained in:
Lior Halphon 2020-05-23 00:05:43 +03:00
parent ce9114ed55
commit 08ca56eec7
2 changed files with 6 additions and 3 deletions

View File

@ -418,7 +418,7 @@ struct GB_gameboy_internal_s {
struct { struct {
uint8_t bank_low:6; uint8_t bank_low:6;
uint8_t bank_high:3; uint8_t bank_high:3;
uint8_t mode:1; bool mode:1;
} huc1; } huc1;
struct { struct {

View File

@ -174,13 +174,16 @@ static uint8_t read_mbc_ram(GB_gameboy_t *gb, uint16_t addr)
if ((!gb->mbc_ram_enable || !gb->mbc_ram_size) && if ((!gb->mbc_ram_enable || !gb->mbc_ram_size) &&
gb->cartridge_type->mbc_subtype != GB_CAMERA && gb->cartridge_type->mbc_subtype != GB_CAMERA &&
gb->cartridge_type->mbc_type != GB_HUC1 && gb->cartridge_type->mbc_type != GB_HUC1 &&
gb->cartridge_type->mbc_type != GB_HUC3) return 0xFF; gb->cartridge_type->mbc_type != GB_HUC3) {
return 0xFF;
}
if (gb->cartridge_type->mbc_type == GB_HUC1 && gb->huc1.mode) { if (gb->cartridge_type->mbc_type == GB_HUC1 && gb->huc1.mode) {
return 0xc0 | effective_ir_input(gb); return 0xc0 | effective_ir_input(gb);
} }
if (gb->cartridge_type->has_rtc && gb->mbc_ram_bank >= 8 && gb->mbc_ram_bank <= 0xC) { if (gb->cartridge_type->has_rtc && gb->cartridge_type->mbc_type != GB_HUC3 &&
gb->mbc_ram_bank >= 8 && gb->mbc_ram_bank <= 0xC) {
/* RTC read */ /* RTC read */
gb->rtc_latched.high |= ~0xC1; /* Not all bytes in RTC high are used. */ gb->rtc_latched.high |= ~0xC1; /* Not all bytes in RTC high are used. */
return gb->rtc_latched.data[gb->mbc_ram_bank - 8]; return gb->rtc_latched.data[gb->mbc_ram_bank - 8];