-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added 03E0 bankswitching for Brazilian Parker Bros ROMs (resolves #887)
- Loading branch information
Showing
22 changed files
with
444 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
//============================================================================ | ||
// | ||
// SSSS tt lll lll | ||
// SS SS tt ll ll | ||
// SS tttttt eeee ll ll aaaa | ||
// 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 | ||
// | ||
// Copyright (c) 1995-2023 by Bradford W. Mott, Stephen Anthony | ||
// and the Stella Team | ||
// | ||
// See the file "License.txt" for information on usage and redistribution of | ||
// this file, and for a DISCLAIMER OF ALL WARRANTIES. | ||
//============================================================================ | ||
|
||
#include "Cart03E0.hxx" | ||
#include "Cart03E0Widget.hxx" | ||
|
||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
Cartridge03E0Widget::Cartridge03E0Widget( | ||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont, | ||
int x, int y, int w, int h, Cartridge03E0& cart) | ||
: CartridgeEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart) | ||
{ | ||
initialize(); | ||
} | ||
|
||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
string Cartridge03E0Widget::description() | ||
{ | ||
ostringstream info; | ||
|
||
info << "03E0 cartridge,\n eight 1K banks mapped into four segments\n" | ||
<< CartridgeEnhancedWidget::description(); | ||
|
||
return info.str(); | ||
} | ||
|
||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
string Cartridge03E0Widget::romDescription() | ||
{ | ||
ostringstream info; | ||
|
||
for(int seg = 0; seg < 4; ++seg) | ||
{ | ||
const uInt16 segmentOffset = seg << 10; // myCart.myBankShift; | ||
|
||
info << "Segment #" << seg << " accessible @ $" | ||
<< Common::Base::HEX4 << (ADDR_BASE | segmentOffset) | ||
<< " - $" << (ADDR_BASE | (segmentOffset + /*myCart.myBankSize - 1*/ 0x3FF)) << ",\n"; | ||
if (seg < 3) | ||
info << " Hotspots " << hotspotStr(0, seg, true) << " - " << hotspotStr(7, seg, true) << "\n"; | ||
else | ||
info << " Always points to last 1K bank of ROM\n"; | ||
} | ||
info << "Startup banks = 4 / 5 / 6 or undetermined"; | ||
|
||
return info.str(); | ||
} | ||
|
||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
string Cartridge03E0Widget::hotspotStr(int bank, int segment, bool noBrackets) | ||
{ | ||
static constexpr uInt16 hotspots[3] = {0x03E0, 0x03D0, 0x03B0}; | ||
ostringstream info; | ||
|
||
info << (noBrackets ? "" : "(") | ||
<< "$" << Common::Base::HEX1 << ( hotspots[segment] + bank) | ||
<< (noBrackets ? "" : ")"); | ||
|
||
return info.str(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
//============================================================================ | ||
// | ||
// SSSS tt lll lll | ||
// SS SS tt ll ll | ||
// SS tttttt eeee ll ll aaaa | ||
// 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 | ||
// | ||
// Copyright (c) 1995-2023 by Bradford W. Mott, Stephen Anthony | ||
// and the Stella Team | ||
// | ||
// See the file "License.txt" for information on usage and redistribution of | ||
// this file, and for a DISCLAIMER OF ALL WARRANTIES. | ||
//============================================================================ | ||
|
||
#ifndef CARTRIDGE03E0_WIDGET_HXX | ||
#define CARTRIDGE03E0_WIDGET_HXX | ||
|
||
class Cartridge03E0; | ||
|
||
#include "CartEnhancedWidget.hxx" | ||
|
||
class Cartridge03E0Widget : public CartridgeEnhancedWidget | ||
{ | ||
public: | ||
Cartridge03E0Widget(GuiObject* boss, const GUI::Font& lfont, | ||
const GUI::Font& nfont, | ||
int x, int y, int w, int h, | ||
Cartridge03E0& cart); | ||
~Cartridge03E0Widget() override = default; | ||
|
||
private: | ||
string manufacturer() override { return "Parker Brothers (Brazil Pirate)"; } | ||
|
||
string description() override; | ||
|
||
string romDescription() override; | ||
|
||
string hotspotStr(int bank, int segment, bool noBrackets = false) override; | ||
|
||
uInt16 bankSegs() override { return 3; } | ||
|
||
private: | ||
// Following constructors and assignment operators not supported | ||
Cartridge03E0Widget() = delete; | ||
Cartridge03E0Widget(const Cartridge03E0Widget&) = delete; | ||
Cartridge03E0Widget(Cartridge03E0Widget&&) = delete; | ||
Cartridge03E0Widget& operator=(const Cartridge03E0Widget&) = delete; | ||
Cartridge03E0Widget& operator=(Cartridge03E0Widget&&) = delete; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
//============================================================================ | ||
// | ||
// SSSS tt lll lll | ||
// SS SS tt ll ll | ||
// SS tttttt eeee ll ll aaaa | ||
// 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 | ||
// | ||
// Copyright (c) 1995-2023 by Bradford W. Mott, Stephen Anthony | ||
// and the Stella Team | ||
// | ||
// See the file "License.txt" for information on usage and redistribution of | ||
// this file, and for a DISCLAIMER OF ALL WARRANTIES. | ||
//============================================================================ | ||
|
||
#include "System.hxx" | ||
#include "Cart03E0.hxx" | ||
|
||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
Cartridge03E0::Cartridge03E0(const ByteBuffer& image, size_t size, | ||
string_view md5, const Settings& settings, | ||
size_t bsSize) | ||
: CartridgeEnhanced(image, size, md5, settings, bsSize) | ||
{ | ||
myBankShift = BANK_SHIFT; | ||
} | ||
|
||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
void Cartridge03E0::install(System& system) | ||
{ | ||
CartridgeEnhanced::install(system); | ||
|
||
// Get the page accessing methods for the hot spots since they overlap | ||
// areas within the TIA we'll need to forward requests to the TIA | ||
myHotSpotPageAccess[0] = mySystem->getPageAccess(0x0380); | ||
myHotSpotPageAccess[1] = mySystem->getPageAccess(0x03c0); | ||
|
||
// Set the page accessing methods for the hot spots | ||
const System::PageAccess access(this, System::PageAccessType::READ); | ||
for(uInt16 addr = 0x0380; addr < 0x03FF; addr += System::PAGE_SIZE) | ||
mySystem->setPageAccess(addr, access); | ||
} | ||
|
||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
void Cartridge03E0::reset() | ||
{ | ||
// Setup segments to some default banks | ||
if(randomStartBank()) | ||
{ | ||
bank(mySystem->randGenerator().next() % 8, 0); | ||
bank(mySystem->randGenerator().next() % 8, 1); | ||
bank(mySystem->randGenerator().next() % 8, 2); | ||
} | ||
else | ||
{ | ||
bank(4, 0); | ||
bank(5, 1); | ||
bank(6, 2); | ||
} | ||
myBankChanged = true; | ||
} | ||
|
||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
bool Cartridge03E0::checkSwitchBank(uInt16 address, uInt8) | ||
{ | ||
bool switched = false; | ||
|
||
if((address & 0x10) == 0) | ||
{ | ||
bank(address & 0x0007, 0); | ||
switched = true; | ||
} | ||
if((address & 0x20) == 0) | ||
{ | ||
bank(address & 0x0007, 1); | ||
switched = true; | ||
} | ||
if((address & 0x40) == 0) | ||
{ | ||
bank(address & 0x0007, 2); | ||
switched = true; | ||
} | ||
return switched; | ||
} | ||
|
||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
uInt8 Cartridge03E0::peek(uInt16 address) | ||
{ | ||
checkSwitchBank(address, 0); | ||
|
||
// Because of the way we've set up accessing above, we can only | ||
// get here when the addresses are from 0x380 - 0x3FF | ||
const int hotspot = ((address & 0x40) >> 6); | ||
return myHotSpotPageAccess[hotspot].device->peek(address); | ||
} | ||
|
||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
bool Cartridge03E0::poke(uInt16 address, uInt8 value) | ||
{ | ||
// Because of the way accessing is set up, we will may get here by | ||
// doing a write to 0x380 - 0x3FF or cart; we ignore the cart write | ||
if(!(address & 0x1000)) | ||
{ | ||
checkSwitchBank(address, 0); | ||
|
||
const int hotspot = ((address & 0x40) >> 6); | ||
myHotSpotPageAccess[hotspot].device->poke(address, value); | ||
} | ||
|
||
return false; | ||
} |
Oops, something went wrong.