enhanced CartCV to support small ROMs (Part 3)

This commit is contained in:
thrust26 2023-09-12 11:22:45 +02:00
parent 3043acba1e
commit d08d6668d1
2 changed files with 5 additions and 8 deletions

View File

@ -29,9 +29,10 @@ CartridgeCV::CartridgeCV(const ByteBuffer& image, size_t size,
if(size <= 2_KB) if(size <= 2_KB)
{ {
// Move the ROM of <=2K files to the 2nd half of the 4K ROM for(size_t i = 0; i < 2_KB; i += size)
// Copy the ROM of <=2K files to the 2nd half of the 4K ROM
// The 1st half is used for RAM // The 1st half is used for RAM
std::copy_n(image.get(), size, myImage.get() + 4_KB - size); std::copy_n(image.get(), size, myImage.get() + 2_KB + i);
} }
else if(size == 4_KB) else if(size == 4_KB)
{ {

View File

@ -34,10 +34,6 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, size_t si
else else
type = Bankswitch::Type::_AR; type = Bankswitch::Type::_AR;
} }
//else if(size < 2_KB) // Sub2K images
//{
// type = isProbablyCV(image, size) ? Bankswitch::Type::_CV : Bankswitch::Type::_2K;
//}
else if((size <= 2_KB) || else if((size <= 2_KB) ||
(size == 4_KB && std::memcmp(image.get(), image.get() + 2_KB, 2_KB) == 0)) (size == 4_KB && std::memcmp(image.get(), image.get() + 2_KB, 2_KB) == 0))
{ {