Skip to content

Commit

Permalink
Activision Cart support. Fixes #45
Browse files Browse the repository at this point in the history
  • Loading branch information
drhelius committed Dec 28, 2023
1 parent 12ea4ac commit ae32838
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions platforms/desktop-shared/emu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ static const char* get_mapper(Cartridge::CartridgeTypes type)
case Cartridge::CartridgeMegaCart:
return "MegaCart";
break;
case Cartridge::CartridgeActivisionCart:
return "Activision";
break;
case Cartridge::CartridgeNotSupported:
return "Not Supported";
break;
Expand Down
32 changes: 32 additions & 0 deletions src/Memory_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ inline u8 Memory::Read(u16 address)
return pRom[(address & 0x3FFF) + m_RomBankAddress];
}
}
else if (m_pCartridge->GetType() == Cartridge::CartridgeActivisionCart)
{
if (address < 0xC000)
{
return pRom[address & 0x3FFF];
}
else
{
if (address >= 0xFF80)
{
Log("--> ** EEPROM read: %X %X", address);
}
return pRom[(address & 0x3FFF) + m_RomBankAddress];
}
}
else
{
if (address >= (romSize + 0x8000))
Expand Down Expand Up @@ -131,6 +146,23 @@ inline void Memory::Write(u16 address, u8 value)
m_RomBank = address & (m_pCartridge->GetROMBankCount() - 1);
m_RomBankAddress = m_RomBank << 14;
}
else if ((m_pCartridge->GetType() == Cartridge::CartridgeActivisionCart) && (address >= 0xFF90))
{
if ((address == 0xFF90) || (address == 0xFFA0) || (address == 0xFFB0))
{
m_RomBank = (address >> 4) & (m_pCartridge->GetROMBankCount() - 1);
m_RomBankAddress = m_RomBank << 14;
}

if (address == 0xFFC0)
Log("--> ** EEPROM write SCL=0: %X %X", address, value);
if (address == 0xFFD0)
Log("--> ** EEPROM write SCL=1: %X %X", address, value);
if (address == 0xFFE0)
Log("--> ** EEPROM write SDA=0: %X %X", address, value);
if (address == 0xFFF0)
Log("--> ** EEPROM write SDA=1: %X %X", address, value);
}
else
{
Log("--> ** Attempting to write on ROM: %X %X", address, value);
Expand Down

0 comments on commit ae32838

Please sign in to comment.