Updated FA2 scheme to include 28KB ROMs.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2432 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2012-03-29 19:03:58 +00:00
parent bccac33a55
commit 56f22a2220
3 changed files with 30 additions and 10 deletions

View File

@ -380,7 +380,7 @@ string Cartridge::autodetectType(const uInt8* image, uInt32 size)
else
type = "F6";
}
else if(size == 24*1024) // 24K
else if(size == 24*1024 || size == 28*1024) // 24K & 28K
{
type = "FA2";
}

View File

@ -25,22 +25,27 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeFA2::CartridgeFA2(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
mySize(size)
{
// Allocate array for the ROM image
myImage = new uInt8[mySize];
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(24576u, size));
createCodeAccessBase(24576);
memcpy(myImage, image, mySize);
createCodeAccessBase(mySize);
// This cart contains 256 bytes extended RAM @ 0x1000
registerRamArea(0x1000, 256, 0x100, 0x00);
// Remember startup bank
myStartBank = 5;
myStartBank = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeFA2::~CartridgeFA2()
{
delete[] myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -131,6 +136,12 @@ uInt8 CartridgeFA2::peek(uInt16 address)
bank(5);
break;
case 0x0FFB:
// Set the current bank to the seventh 4k bank
// This is only available on 28K ROMs
if(mySize == 28*1024) bank(6);
break;
default:
break;
}
@ -190,6 +201,12 @@ bool CartridgeFA2::poke(uInt16 address, uInt8)
bank(5);
break;
case 0x0FFB:
// Set the current bank to the seventh 4k bank
// This is only available on 28K ROMs
if(mySize == 28*1024) bank(6);
break;
default:
break;
}
@ -240,7 +257,7 @@ uInt16 CartridgeFA2::bank() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt16 CartridgeFA2::bankCount() const
{
return 6;
return (mySize / 4096);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -264,7 +281,7 @@ bool CartridgeFA2::patch(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const uInt8* CartridgeFA2::getImage(int& size) const
{
size = 24576;
size = mySize;
return myImage;
}

View File

@ -29,7 +29,7 @@ class System;
This is an extended version of the CBS RAM Plus bankswitching scheme
supported by the Harmony cartridge.
There are six 4K banks and 256 bytes of RAM.
There are six (or seven) 4K banks and 256 bytes of RAM.
@author Chris D. Walton
@version $Id$
@ -143,11 +143,14 @@ class CartridgeFA2 : public Cartridge
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 24K ROM image of the cartridge
uInt8 myImage[24576];
// The 24K/28K ROM image of the cartridge
uInt8* myImage;
// The 256 bytes of RAM on the cartridge
uInt8 myRAM[256];
// Size of the ROM image
uInt32 mySize;
};
#endif