HuC-1 mode is not a thing, fixes Robopon Japanese prototype

This commit is contained in:
Lior Halphon 2022-06-11 20:57:02 +03:00
parent d41c188cfd
commit 4d90504688
4 changed files with 5 additions and 14 deletions

View File

@ -504,8 +504,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;
bool mode:1; bool ir_mode;
bool ir_mode:1;
} huc1; } huc1;
struct { struct {

View File

@ -138,14 +138,8 @@ void GB_update_mbc_mappings(GB_gameboy_t *gb)
} }
break; break;
case GB_HUC1: case GB_HUC1:
if (gb->huc1.mode == 0) { gb->mbc_rom_bank = gb->huc1.bank_low;
gb->mbc_rom_bank = gb->huc1.bank_low | (gb->mbc1.bank_high << 6); gb->mbc_ram_bank = gb->huc1.bank_high;
gb->mbc_ram_bank = 0;
}
else {
gb->mbc_rom_bank = gb->huc1.bank_low;
gb->mbc_ram_bank = gb->huc1.bank_high;
}
break; break;
case GB_HUC3: case GB_HUC3:
gb->mbc_rom_bank = gb->huc3.rom_bank; gb->mbc_rom_bank = gb->huc3.rom_bank;

View File

@ -888,7 +888,6 @@ static void write_mbc(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
case 0x0000: case 0x1000: gb->huc1.ir_mode = (value & 0xF) == 0xE; break; case 0x0000: case 0x1000: gb->huc1.ir_mode = (value & 0xF) == 0xE; break;
case 0x2000: case 0x3000: gb->huc1.bank_low = value; break; case 0x2000: case 0x3000: gb->huc1.bank_low = value; break;
case 0x4000: case 0x5000: gb->huc1.bank_high = value; break; case 0x4000: case 0x5000: gb->huc1.bank_high = value; break;
case 0x6000: case 0x7000: gb->huc1.mode = value; break;
} }
break; break;
case GB_HUC3: case GB_HUC3:

View File

@ -261,7 +261,7 @@ static size_t bess_size_for_cartridge(const GB_cartridge_t *cart)
case GB_MMM01: case GB_MMM01:
return sizeof(BESS_block_t) + 8 * sizeof(BESS_MBC_pair_t); return sizeof(BESS_block_t) + 8 * sizeof(BESS_MBC_pair_t);
case GB_HUC1: case GB_HUC1:
return sizeof(BESS_block_t) + 4 * sizeof(BESS_MBC_pair_t); return sizeof(BESS_block_t) + 3 * sizeof(BESS_MBC_pair_t);
case GB_HUC3: case GB_HUC3:
return sizeof(BESS_block_t) + 3 * sizeof(BESS_MBC_pair_t) + sizeof(BESS_HUC3_t); return sizeof(BESS_block_t) + 3 * sizeof(BESS_MBC_pair_t) + sizeof(BESS_HUC3_t);
case GB_TPP1: case GB_TPP1:
@ -489,8 +489,7 @@ static int save_bess_mbc_block(GB_gameboy_t *gb, virtual_file_t *file)
pairs[0] = (BESS_MBC_pair_t){LE16(0x0000), gb->huc1.ir_mode? 0xE : 0x0}; pairs[0] = (BESS_MBC_pair_t){LE16(0x0000), gb->huc1.ir_mode? 0xE : 0x0};
pairs[1] = (BESS_MBC_pair_t){LE16(0x2000), gb->huc1.bank_low}; pairs[1] = (BESS_MBC_pair_t){LE16(0x2000), gb->huc1.bank_low};
pairs[2] = (BESS_MBC_pair_t){LE16(0x4000), gb->huc1.bank_high}; pairs[2] = (BESS_MBC_pair_t){LE16(0x4000), gb->huc1.bank_high};
pairs[3] = (BESS_MBC_pair_t){LE16(0x6000), gb->huc1.mode}; mbc_block.size = 3 * sizeof(pairs[0]);
mbc_block.size = 4 * sizeof(pairs[0]);
case GB_HUC3: case GB_HUC3:
pairs[0] = (BESS_MBC_pair_t){LE16(0x0000), gb->huc3.mode}; pairs[0] = (BESS_MBC_pair_t){LE16(0x0000), gb->huc3.mode};
pairs[1] = (BESS_MBC_pair_t){LE16(0x2000), gb->huc3.rom_bank}; pairs[1] = (BESS_MBC_pair_t){LE16(0x2000), gb->huc3.rom_bank};