From f5923c74a7007ed4e00cd23bddaf7e2312fdc096 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sat, 30 Jan 2016 00:15:05 -0800 Subject: [PATCH] GB: MBC4 does not exist, but MBC6 does --- src/gb/memory.c | 22 ++++++++++------------ src/gb/memory.h | 5 +++-- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/gb/memory.c b/src/gb/memory.c index dc7d61313..121172d3f 100644 --- a/src/gb/memory.c +++ b/src/gb/memory.c @@ -27,8 +27,8 @@ static void _GBMBCNone(struct GBMemory* memory, uint16_t address, uint8_t value) static void _GBMBC1(struct GBMemory*, uint16_t address, uint8_t value); static void _GBMBC2(struct GBMemory*, uint16_t address, uint8_t value); static void _GBMBC3(struct GBMemory*, uint16_t address, uint8_t value); -static void _GBMBC4(struct GBMemory*, uint16_t address, uint8_t value); static void _GBMBC5(struct GBMemory*, uint16_t address, uint8_t value); +static void _GBMBC6(struct GBMemory*, uint16_t address, uint8_t value); static void _GBMBC7(struct GBMemory*, uint16_t address, uint8_t value); static void GBSetActiveRegion(struct LR35902Core* cpu, uint16_t address) { @@ -113,12 +113,6 @@ void GBMemoryReset(struct GB* gb) { gb->memory.mbc = _GBMBC3; gb->memory.mbcType = GB_MBC3; break; - case 0x15: - case 0x16: - case 0x17: - gb->memory.mbc = _GBMBC4; - gb->memory.mbcType = GB_MBC4; - break; default: mLOG(GB_MBC, WARN, "Unknown MBC type: %02X", cart->type); case 0x19: @@ -130,6 +124,10 @@ void GBMemoryReset(struct GB* gb) { gb->memory.mbc = _GBMBC5; gb->memory.mbcType = GB_MBC5; break; + case 0x20: + gb->memory.mbc = _GBMBC6; + gb->memory.mbcType = GB_MBC6; + break; case 0x22: gb->memory.mbc = _GBMBC7; gb->memory.mbcType = GB_MBC7; @@ -427,11 +425,6 @@ void _GBMBC3(struct GBMemory* memory, uint16_t address, uint8_t value) { } } -void _GBMBC4(struct GBMemory* memory, uint16_t address, uint8_t value) { - // TODO - mLOG(GB_MBC, STUB, "MBC4 unimplemented"); -} - void _GBMBC5(struct GBMemory* memory, uint16_t address, uint8_t value) { int bank = value & 0x7F; switch (address >> 13) { @@ -465,6 +458,11 @@ void _GBMBC5(struct GBMemory* memory, uint16_t address, uint8_t value) { } } +void _GBMBC6(struct GBMemory* memory, uint16_t address, uint8_t value) { + // TODO + mLOG(GB_MBC, STUB, "MBC6 unimplemented"); +} + void _GBMBC7(struct GBMemory* memory, uint16_t address, uint8_t value) { // TODO mLOG(GB_MBC, STUB, "MBC7 unimplemented"); diff --git a/src/gb/memory.h b/src/gb/memory.h index fb4fd2eab..5c45c47f1 100644 --- a/src/gb/memory.h +++ b/src/gb/memory.h @@ -58,11 +58,12 @@ enum GBMemoryBankControllerType { GB_MBC1 = 1, GB_MBC2 = 2, GB_MBC3 = 3, - GB_MBC4 = 4, GB_MBC5 = 5, + GB_MBC6 = 6, GB_MBC7 = 7, GB_MMM01 = 0x10, - GB_HuC1 = 0x11 + GB_HuC1 = 0x11, + GB_HuC3 = 0x12, }; struct GBMemory;