added E7 support for 12K ROMs

This commit is contained in:
Thomas Jentzsch 2021-09-24 23:38:15 +02:00
parent 3fa692dee2
commit 187979a2ae
4 changed files with 25 additions and 5 deletions

View File

@ -30,13 +30,16 @@ CartridgeE7Widget::CartridgeE7Widget(
ostringstream info;
info << "E7 cartridge, "
<< (myCart.romBankCount() == 4 ? "four" : "eight")
<< (myCart.romBankCount() == 4 ? "four"
: myCart.romBankCount() == 6 ? "six" : "eight")
<< " 2K banks ROM + 2K RAM, \n"
<< " mapped into three segments\n"
<< "Lower 2K accessible @ $F000 - $F7FF\n"
<< (myCart.romBankCount() == 4
? " ROM banks 0 - 2 (hotspots $FFE4 to $FFE6)\n"
: " ROM Banks 0 - 6 (hotspots $FFE0 to $FFE6)\n")
? " ROM banks 0 - 2 (hotspots $FFE4 - $FFE6)\n"
: myCart.romBankCount() == 6
? " ROM Banks 0 - 4 (hotspots $FFE0/$FFE1\n and $FFE4 - $FFE6)\n"
: " ROM Banks 0 - 6 (hotspots $FFE0 - $FFE6)\n")
<< " 1K RAM bank 3 (hotspot $FFE7)\n"
<< " $F400 - $F7FF (R), $F000 - $F3FF (W)\n"
<< "256B RAM accessible @ $F800 - $F9FF\n"
@ -205,6 +208,10 @@ const char* CartridgeE7Widget::getSpotLower(int idx)
static constexpr std::array<const char*, 4> spot_lower_8K = {
"#0 - ROM ($FFE4)", "#1 - ROM ($FFE5)", "#2 - ROM ($FFE6)", "#3 - RAM ($FFE7)"
};
static constexpr std::array<const char*, 6> spot_lower_12K = {
"#0 - ROM ($FFE0)", "#1 - ROM ($FFE1)",
"#2 - ROM ($FFE4)", "#3 - ROM ($FFE5)", "#4 - ROM ($FFE6)", "#5 - RAM ($FFE7)"
};
static constexpr std::array<const char*, 8> spot_lower_16K = {
"#0 - ROM ($FFE0)", "#1 - ROM ($FFE1)", "#2 - ROM ($FFE2)", "#3 - ROM ($FFE3)",
"#4 - ROM ($FFE4)", "#5 - ROM ($FFE5)", "#6 - ROM ($FFE6)", "#7 - RAM ($FFE7)"
@ -212,6 +219,8 @@ const char* CartridgeE7Widget::getSpotLower(int idx)
return myCart.romBankCount() == 4
? spot_lower_8K[idx]
: myCart.romBankCount() == 6
? spot_lower_12K[idx]
: spot_lower_16K[idx];
}

View File

@ -98,6 +98,9 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, size_t si
}
else if(size == 12_KB)
{
if(isProbablyE7(image, size))
type = Bankswitch::Type::_E7;
else
type = Bankswitch::Type::_FA;
}
else if(size == 16_KB)

View File

@ -115,6 +115,14 @@ void CartridgeE7::checkSwitchBank(uInt16 address)
{
bank(address & 0x0003);
}
else if(romBankCount() == 6 && (address >= 0x0FE0) && (address <= 0x0FE7))
{
static constexpr std::array<int, 8> banks = {
0, 1, 0, 1, 2, 3, 4 ,5
};
bank(banks[address & 0x0007]);
}
else if(romBankCount() == 8 && (address >= 0x0FE0) && (address <= 0x0FE7))
{
bank(address & 0x0007);