2013-04-06 14:09:16 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
//
|
2014-01-12 17:23:42 +00:00
|
|
|
// Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
|
2013-04-06 14:09:16 +00:00
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#include "CartF8SC.hxx"
|
|
|
|
#include "PopUpWidget.hxx"
|
|
|
|
#include "CartF8SCWidget.hxx"
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
CartridgeF8SCWidget::CartridgeF8SCWidget(
|
2013-08-26 13:01:29 +00:00
|
|
|
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
2013-04-06 14:09:16 +00:00
|
|
|
int x, int y, int w, int h, CartridgeF8SC& cart)
|
2013-08-26 13:01:29 +00:00
|
|
|
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
2013-04-06 14:09:16 +00:00
|
|
|
myCart(cart)
|
|
|
|
{
|
|
|
|
uInt16 size = 8192;
|
|
|
|
|
|
|
|
ostringstream info;
|
|
|
|
info << "Standard F8SC cartridge, two 4K banks\n"
|
|
|
|
<< "128 bytes RAM @ $F000 - $F0FF\n"
|
|
|
|
<< " $F080 - $F0FF (R), $F000 - $F07F (W)\n"
|
|
|
|
<< "Startup bank = " << cart.myStartBank << "\n";
|
|
|
|
|
|
|
|
// Eventually, we should query this from the debugger/disassembler
|
|
|
|
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF8; i < 2; ++i, offset += 0x1000)
|
|
|
|
{
|
|
|
|
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
|
|
|
start -= start % 0x1000;
|
2013-07-27 22:28:41 +00:00
|
|
|
info << "Bank " << i << " @ $" << Common::Base::HEX4 << (start + 0x100) << " - "
|
2013-04-06 14:09:16 +00:00
|
|
|
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
int xpos = 10,
|
|
|
|
ypos = addBaseInformation(size, "Atari", info.str()) + myLineHeight;
|
|
|
|
|
2013-05-09 14:22:34 +00:00
|
|
|
VariantList items;
|
|
|
|
items.push_back("0 ($FF8)");
|
|
|
|
items.push_back("1 ($FF9)");
|
2013-04-06 14:09:16 +00:00
|
|
|
myBank =
|
2013-08-26 13:01:29 +00:00
|
|
|
new PopUpWidget(boss, _font, xpos, ypos-2, _font.getStringWidth("0 ($FFx) "),
|
2013-04-06 14:09:16 +00:00
|
|
|
myLineHeight, items, "Set bank: ",
|
2013-08-26 13:01:29 +00:00
|
|
|
_font.getStringWidth("Set bank: "), kBankChanged);
|
2013-04-06 14:09:16 +00:00
|
|
|
myBank->setTarget(this);
|
|
|
|
addFocusWidget(myBank);
|
|
|
|
}
|
|
|
|
|
2014-06-13 16:28:28 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void CartridgeF8SCWidget::saveOldState()
|
|
|
|
{
|
|
|
|
myOldState.internalram.clear();
|
|
|
|
|
|
|
|
for(uInt32 i = 0; i < this->internalRamSize();i++)
|
|
|
|
{
|
|
|
|
myOldState.internalram.push_back(myCart.myRAM[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-06 14:09:16 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void CartridgeF8SCWidget::loadConfig()
|
|
|
|
{
|
2013-07-30 20:31:14 +00:00
|
|
|
myBank->setSelectedIndex(myCart.myCurrentBank);
|
2013-04-06 21:04:11 +00:00
|
|
|
|
|
|
|
CartDebugWidget::loadConfig();
|
2013-04-06 14:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void CartridgeF8SCWidget::handleCommand(CommandSender* sender,
|
|
|
|
int cmd, int data, int id)
|
|
|
|
{
|
|
|
|
if(cmd == kBankChanged)
|
|
|
|
{
|
|
|
|
myCart.unlockBank();
|
|
|
|
myCart.bank(myBank->getSelected());
|
|
|
|
myCart.lockBank();
|
|
|
|
invalidate();
|
|
|
|
}
|
|
|
|
}
|
2013-05-29 16:27:12 +00:00
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
string CartridgeF8SCWidget::bankState()
|
|
|
|
{
|
|
|
|
ostringstream& buf = buffer();
|
|
|
|
|
|
|
|
static const char* spot[] = { "$FF8", "$FF9" };
|
2013-07-30 20:31:14 +00:00
|
|
|
buf << "Bank = " << dec << myCart.myCurrentBank
|
2013-05-29 16:27:12 +00:00
|
|
|
<< ", hotspot = " << spot[myCart.myCurrentBank];
|
|
|
|
|
|
|
|
return buf.str();
|
|
|
|
}
|
2014-06-13 16:28:28 +00:00
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
bool CartridgeF8SCWidget::internalRam()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
uInt32 CartridgeF8SCWidget::internalRamSize()
|
|
|
|
{
|
|
|
|
return 128;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
string CartridgeF8SCWidget::internalRamDescription()
|
|
|
|
{
|
|
|
|
ostringstream desc;
|
|
|
|
desc << "F000-F07F used for Write Access\n"
|
|
|
|
<< "F080-F0FF used for Read Access";
|
|
|
|
|
|
|
|
return desc.str();
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
ByteArray CartridgeF8SCWidget::internalRamOld(int start, int count)
|
|
|
|
{
|
|
|
|
ByteArray ram;
|
|
|
|
ram.clear();
|
|
|
|
for (int i = 0;i<count;i++)
|
|
|
|
ram.push_back(myOldState.internalram[start + i]);
|
|
|
|
return ram;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
ByteArray CartridgeF8SCWidget::internalRamCurrent(int start, int count)
|
|
|
|
{
|
|
|
|
ByteArray ram;
|
|
|
|
ram.clear();
|
|
|
|
for (int i = 0;i<count;i++)
|
|
|
|
ram.push_back(myCart.myRAM[start + i]);
|
|
|
|
return ram;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void CartridgeF8SCWidget::internalRamSetValue(int addr, uInt8 value)
|
|
|
|
{
|
|
|
|
myCart.myRAM[addr] = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
uInt8 CartridgeF8SCWidget::internalRamGetValue(int addr)
|
|
|
|
{
|
|
|
|
return myCart.myRAM[addr];
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
string CartridgeF8SCWidget::internalRamLabel(int addr)
|
|
|
|
{
|
|
|
|
CartDebug& dbg = instance().debugger().cartDebug();
|
|
|
|
return dbg.getLabel(addr + 0x1080, false);
|
|
|
|
}
|