1
//============================================================================
5
// SS tttttt eeee ll ll aaaa
6
// SSSS tt ee ee ll ll aa
7
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8
// SS SS tt ee ll ll aa aa
9
// SSSS ttt eeeee llll llll aaaaa
11
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony
12
// and the Stella Team
14
// See the file "License.txt" for information on usage and redistribution of
15
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
17
// $Id: CartEFWidget.cxx 2743 2013-05-29 16:27:12Z stephena $
18
//============================================================================
21
#include "PopUpWidget.hxx"
22
#include "CartEFWidget.hxx"
24
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
25
CartridgeEFWidget::CartridgeEFWidget(
26
GuiObject* boss, const GUI::Font& font,
27
int x, int y, int w, int h, CartridgeEF& cart)
28
: CartDebugWidget(boss, font, x, y, w, h),
31
uInt32 size = 16 * 4096;
34
info << "64K H. Runner EF cartridge, 16 4K banks\n"
35
<< "Startup bank = " << cart.myStartBank << "\n";
37
// Eventually, we should query this from the debugger/disassembler
38
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFE0; i < 16; ++i, offset += 0x1000)
40
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
41
start -= start % 0x1000;
42
info << "Bank " << dec << i << " @ $" << HEX4 << start << " - "
43
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
47
ypos = addBaseInformation(size, "Paul Slocum / Homestar Runner",
48
info.str()) + myLineHeight;
51
items.push_back(" 0 ($FE0)");
52
items.push_back(" 1 ($FE1)");
53
items.push_back(" 2 ($FE2)");
54
items.push_back(" 3 ($FE3)");
55
items.push_back(" 4 ($FE4)");
56
items.push_back(" 5 ($FE5)");
57
items.push_back(" 6 ($FE6)");
58
items.push_back(" 7 ($FE7)");
59
items.push_back(" 8 ($FE8)");
60
items.push_back(" 9 ($FE9)");
61
items.push_back("10 ($FEA)");
62
items.push_back("11 ($FEB)");
63
items.push_back("12 ($FEC)");
64
items.push_back("13 ($FED)");
65
items.push_back("14 ($FEE)");
66
items.push_back("15 ($FEF)");
68
new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("15 ($FE0) "),
69
myLineHeight, items, "Set bank: ",
70
font.getStringWidth("Set bank: "), kBankChanged);
71
myBank->setTarget(this);
72
addFocusWidget(myBank);
75
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
76
void CartridgeEFWidget::loadConfig()
78
myBank->setSelected(myCart.myCurrentBank);
80
CartDebugWidget::loadConfig();
83
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
84
void CartridgeEFWidget::handleCommand(CommandSender* sender,
85
int cmd, int data, int id)
87
if(cmd == kBankChanged)
90
myCart.bank(myBank->getSelected());
96
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
97
string CartridgeEFWidget::bankState()
99
ostringstream& buf = buffer();
101
static const char* spot[] = {
102
"$FE0", "$FE1", "$FE2", "$FE3", "$FE4", "$FE5", "$FE6", "$FE7",
103
"$FE8", "$FE9", "$FEA", "$FEB", "$FEC", "$FED", "$FEE", "$FEF"
105
buf << "Bank = " << myCart.myCurrentBank
106
<< ", hotspot = " << spot[myCart.myCurrentBank];