2001-12-27 19:54:36 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
2016-12-30 00:00:30 +00:00
|
|
|
// SSSS tt lll lll
|
|
|
|
// SS SS tt ll ll
|
|
|
|
// SS tttttt eeee ll ll aaaa
|
2001-12-27 19:54:36 +00:00
|
|
|
// SSSS tt ee ee ll ll aa
|
|
|
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
|
|
|
// SS SS tt ee ll ll aa aa
|
|
|
|
// SSSS ttt eeeee llll llll aaaaa
|
|
|
|
//
|
2019-12-31 17:18:56 +00:00
|
|
|
// Copyright (c) 1995-2020 by Bradford W. Mott, Stephen Anthony
|
2010-04-10 21:37:23 +00:00
|
|
|
// and the Stella Team
|
2001-12-27 19:54:36 +00:00
|
|
|
//
|
2010-01-10 03:23:32 +00:00
|
|
|
// See the file "License.txt" for information on usage and redistribution of
|
2001-12-27 19:54:36 +00:00
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#include "System.hxx"
|
2007-01-14 16:17:57 +00:00
|
|
|
#include "CartE0.hxx"
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2019-09-16 23:59:08 +00:00
|
|
|
CartridgeE0::CartridgeE0(const ByteBuffer& image, size_t size,
|
2018-12-18 13:54:40 +00:00
|
|
|
const string& md5, const Settings& settings)
|
2020-04-04 08:53:14 +00:00
|
|
|
: CartridgeEnhanced(image, size, md5, settings)
|
2001-12-27 19:54:36 +00:00
|
|
|
{
|
2020-04-04 08:53:14 +00:00
|
|
|
myBankShift = BANK_SHIFT;
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void CartridgeE0::reset()
|
|
|
|
{
|
|
|
|
// Setup segments to some default slices
|
2017-12-01 09:08:10 +00:00
|
|
|
if(randomStartBank())
|
|
|
|
{
|
2020-04-03 15:08:42 +00:00
|
|
|
bank(mySystem->randGenerator().next() % 8, 0);
|
|
|
|
bank(mySystem->randGenerator().next() % 8, 1);
|
|
|
|
bank(mySystem->randGenerator().next() % 8, 2);
|
2017-12-01 09:08:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-04-03 15:08:42 +00:00
|
|
|
bank(4, 0);
|
|
|
|
bank(5, 1);
|
|
|
|
bank(6, 2);
|
2017-12-01 09:08:10 +00:00
|
|
|
}
|
2010-03-28 03:13:10 +00:00
|
|
|
myBankChanged = true;
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
|
2019-09-07 12:29:33 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2020-04-04 08:53:14 +00:00
|
|
|
bool CartridgeE0::checkSwitchBank(uInt16 address, uInt8)
|
2001-12-27 19:54:36 +00:00
|
|
|
{
|
2020-04-19 10:19:44 +00:00
|
|
|
address &= ROM_MASK;
|
|
|
|
|
2008-03-28 23:29:14 +00:00
|
|
|
// Switch banks if necessary
|
|
|
|
if((address >= 0x0FE0) && (address <= 0x0FE7))
|
|
|
|
{
|
2020-04-03 15:08:42 +00:00
|
|
|
bank(address & 0x0007, 0);
|
2020-04-04 08:53:14 +00:00
|
|
|
return true;
|
2008-03-28 23:29:14 +00:00
|
|
|
}
|
|
|
|
else if((address >= 0x0FE8) && (address <= 0x0FEF))
|
|
|
|
{
|
2020-04-03 15:08:42 +00:00
|
|
|
bank(address & 0x0007, 1);
|
2020-04-04 08:53:14 +00:00
|
|
|
return true;
|
2008-03-28 23:29:14 +00:00
|
|
|
}
|
|
|
|
else if((address >= 0x0FF0) && (address <= 0x0FF7))
|
|
|
|
{
|
2020-04-03 15:08:42 +00:00
|
|
|
bank(address & 0x0007, 2);
|
2020-04-04 08:53:14 +00:00
|
|
|
return true;
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
2010-03-28 03:13:10 +00:00
|
|
|
return false;
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|