mirror of https://github.com/mgba-emu/mgba.git
GB MBC: Partial HuC-1 support
This commit is contained in:
parent
18065c8b62
commit
c04d627de8
1
CHANGES
1
CHANGES
|
@ -15,6 +15,7 @@ Features:
|
||||||
- Ability to select GB/GBC/SGB BIOS on console ports
|
- Ability to select GB/GBC/SGB BIOS on console ports
|
||||||
- Optional automatic state saving/loading
|
- Optional automatic state saving/loading
|
||||||
- Access to ur0 and uma0 partitions on the Vita
|
- Access to ur0 and uma0 partitions on the Vita
|
||||||
|
- Partial support for MBC6, TAMA and HuC-1 GB mappers
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
- GB Audio: Make audio unsigned with bias (fixes mgba.io/i/749)
|
- GB Audio: Make audio unsigned with bias (fixes mgba.io/i/749)
|
||||||
- GB Serialize: Fix audio state loading
|
- GB Serialize: Fix audio state loading
|
||||||
|
|
|
@ -52,14 +52,14 @@ The following mappers are fully supported:
|
||||||
|
|
||||||
The following mappers are partially supported:
|
The following mappers are partially supported:
|
||||||
|
|
||||||
|
- MBC6
|
||||||
- Pocket Cam
|
- Pocket Cam
|
||||||
- TAMA5
|
- TAMA5
|
||||||
|
- HuC-1
|
||||||
- HuC-3
|
- HuC-3
|
||||||
|
|
||||||
The following mappers are not currently supported:
|
The following mappers are not currently supported:
|
||||||
|
|
||||||
- MBC6
|
|
||||||
- HuC-1
|
|
||||||
- MMM01
|
- MMM01
|
||||||
|
|
||||||
### Planned features
|
### Planned features
|
||||||
|
|
32
src/gb/mbc.c
32
src/gb/mbc.c
|
@ -27,6 +27,7 @@ static void _GBMBC3(struct GB*, uint16_t address, uint8_t value);
|
||||||
static void _GBMBC5(struct GB*, uint16_t address, uint8_t value);
|
static void _GBMBC5(struct GB*, uint16_t address, uint8_t value);
|
||||||
static void _GBMBC6(struct GB*, uint16_t address, uint8_t value);
|
static void _GBMBC6(struct GB*, uint16_t address, uint8_t value);
|
||||||
static void _GBMBC7(struct GB*, uint16_t address, uint8_t value);
|
static void _GBMBC7(struct GB*, uint16_t address, uint8_t value);
|
||||||
|
static void _GBHuC1(struct GB*, uint16_t address, uint8_t value);
|
||||||
static void _GBHuC3(struct GB*, uint16_t address, uint8_t value);
|
static void _GBHuC3(struct GB*, uint16_t address, uint8_t value);
|
||||||
static void _GBPocketCam(struct GB* gb, uint16_t address, uint8_t value);
|
static void _GBPocketCam(struct GB* gb, uint16_t address, uint8_t value);
|
||||||
static void _GBTAMA5(struct GB* gb, uint16_t address, uint8_t value);
|
static void _GBTAMA5(struct GB* gb, uint16_t address, uint8_t value);
|
||||||
|
@ -259,8 +260,7 @@ void GBMBCInit(struct GB* gb) {
|
||||||
gb->memory.mbcWrite = _GBMBC1;
|
gb->memory.mbcWrite = _GBMBC1;
|
||||||
break;
|
break;
|
||||||
case GB_HuC1:
|
case GB_HuC1:
|
||||||
mLOG(GB_MBC, WARN, "unimplemented MBC: HuC-1");
|
gb->memory.mbcWrite = _GBHuC1;
|
||||||
gb->memory.mbcWrite = _GBMBC1;
|
|
||||||
break;
|
break;
|
||||||
case GB_HuC3:
|
case GB_HuC3:
|
||||||
gb->memory.mbcWrite = _GBHuC3;
|
gb->memory.mbcWrite = _GBHuC3;
|
||||||
|
@ -821,6 +821,34 @@ static void _GBMBC7Write(struct GBMemory* memory, uint16_t address, uint8_t valu
|
||||||
mbc7->eeprom = value;
|
mbc7->eeprom = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _GBHuC1(struct GB* gb, uint16_t address, uint8_t value) {
|
||||||
|
struct GBMemory* memory = &gb->memory;
|
||||||
|
int bank = value & 0x3F;
|
||||||
|
switch (address >> 13) {
|
||||||
|
case 0x0:
|
||||||
|
switch (value) {
|
||||||
|
case 0xE:
|
||||||
|
memory->sramAccess = false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
memory->sramAccess = true;
|
||||||
|
GBMBCSwitchSramBank(gb, memory->sramCurrentBank);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x1:
|
||||||
|
GBMBCSwitchBank(gb, bank);
|
||||||
|
break;
|
||||||
|
case 0x2:
|
||||||
|
GBMBCSwitchSramBank(gb, value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// TODO
|
||||||
|
mLOG(GB_MBC, STUB, "HuC-1 unknown address: %04X:%02X", address, value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void _GBHuC3(struct GB* gb, uint16_t address, uint8_t value) {
|
void _GBHuC3(struct GB* gb, uint16_t address, uint8_t value) {
|
||||||
struct GBMemory* memory = &gb->memory;
|
struct GBMemory* memory = &gb->memory;
|
||||||
int bank = value & 0x3F;
|
int bank = value & 0x3F;
|
||||||
|
|
Loading…
Reference in New Issue