mirror of https://github.com/stella-emu/stella.git
80 lines
2.7 KiB
C++
80 lines
2.7 KiB
C++
|
//============================================================================
|
||
|
//
|
||
|
// 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-2013 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.
|
||
|
//
|
||
|
// $Id$
|
||
|
//============================================================================
|
||
|
|
||
|
#include "CartF8SC.hxx"
|
||
|
#include "PopUpWidget.hxx"
|
||
|
#include "CartF8SCWidget.hxx"
|
||
|
|
||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||
|
CartridgeF8SCWidget::CartridgeF8SCWidget(
|
||
|
GuiObject* boss, const GUI::Font& font,
|
||
|
int x, int y, int w, int h, CartridgeF8SC& cart)
|
||
|
: CartDebugWidget(boss, font, x, y, w, h),
|
||
|
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;
|
||
|
info << "Bank " << i << " @ $" << HEX4 << start << " - "
|
||
|
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
||
|
}
|
||
|
|
||
|
int xpos = 10,
|
||
|
ypos = addBaseInformation(size, "Atari", info.str()) + myLineHeight;
|
||
|
|
||
|
StringMap items;
|
||
|
items.push_back("0 ($FF8)", "0");
|
||
|
items.push_back("1 ($FF9)", "1");
|
||
|
myBank =
|
||
|
new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($FFx) "),
|
||
|
myLineHeight, items, "Set bank: ",
|
||
|
font.getStringWidth("Set bank: "), kBankChanged);
|
||
|
myBank->setTarget(this);
|
||
|
addFocusWidget(myBank);
|
||
|
}
|
||
|
|
||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||
|
void CartridgeF8SCWidget::loadConfig()
|
||
|
{
|
||
|
myBank->setSelected(myCart.myCurrentBank);
|
||
|
}
|
||
|
|
||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||
|
void CartridgeF8SCWidget::handleCommand(CommandSender* sender,
|
||
|
int cmd, int data, int id)
|
||
|
{
|
||
|
if(cmd == kBankChanged)
|
||
|
{
|
||
|
myCart.unlockBank();
|
||
|
myCart.bank(myBank->getSelected());
|
||
|
myCart.lockBank();
|
||
|
invalidate();
|
||
|
}
|
||
|
}
|