replaced "slice" with "bank" in many Cart(Widget) classes

minor UI fixed for CartDPCWidget
This commit is contained in:
thrust26 2020-04-24 12:42:52 +02:00
parent fa09f3e583
commit 6ae8d92ebf
19 changed files with 120 additions and 123 deletions

View File

@ -27,12 +27,13 @@ CartridgeDPCWidget::CartridgeDPCWidget(
: CartDebugWidget(boss, lfont, nfont, x, y, w, h), : CartDebugWidget(boss, lfont, nfont, x, y, w, h),
myCart(cart) myCart(cart)
{ {
const int V_GAP = 4;
size_t size = cart.mySize; size_t size = cart.mySize;
ostringstream info; ostringstream info;
info << "DPC cartridge, two 4K banks + 2K display bank\n" info << "DPC cartridge, two 4K banks + 2K display bank\n"
<< "DPC registers accessible @ $F000 - $F07F\n" << "DPC registers accessible @ $" << Common::Base::HEX4 << 0xF000 << " - $" << 0xF07F << "\n"
<< " $F000 - $F03F (R), $F040 - $F07F (W)\n" << " $" << 0xF000 << " - " << 0xF03F << " (R), $" << 0xF040 << " - $" << 0xF07F << " (W)\n"
<< "Startup bank = " << cart.startBank() << " or undetermined\n"; << "Startup bank = " << cart.startBank() << " or undetermined\n";
@ -42,7 +43,7 @@ CartridgeDPCWidget::CartridgeDPCWidget(
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset]; uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
start -= start % 0x1000; start -= start % 0x1000;
info << "Bank " << i << " @ $" << Common::Base::HEX4 << (start + 0x80) << " - " info << "Bank " << i << " @ $" << Common::Base::HEX4 << (start + 0x80) << " - "
<< "$" << (start + 0xFFF) << " (hotspot = $F" << (spot+i) << ")\n"; << "$" << (start + 0xFFF) << " (hotspot = $" << (0xF000 + spot + i) << ")\n";
} }
int xpos = 2, int xpos = 2,
@ -50,26 +51,30 @@ CartridgeDPCWidget::CartridgeDPCWidget(
myLineHeight; myLineHeight;
VariantList items; VariantList items;
VarList::push_back(items, "0 ($FFF8)"); for(int bank = 0; bank < 2; ++bank)
VarList::push_back(items, "1 ($FFF9)"); {
ostringstream buf;
buf << "#" << std::dec << bank << " ($" << Common::Base::HEX4 << (0xFFF8 + bank) << ")";
VarList::push_back(items, buf.str());
}
myBank = myBank =
new PopUpWidget(boss, _font, xpos, ypos-2, _font.getStringWidth("0 ($FFFx)"), new PopUpWidget(boss, _font, xpos, ypos-2, _font.getStringWidth("#0 ($FFFx)"),
myLineHeight, items, "Set bank ", myLineHeight, items, "Set bank ",
0, kBankChanged); 0, kBankChanged);
myBank->setTarget(this); myBank->setTarget(this);
addFocusWidget(myBank); addFocusWidget(myBank);
ypos += myLineHeight + 8; ypos += myLineHeight + V_GAP * 3;
// Data fetchers // Data fetchers
int lwidth = _font.getStringWidth("Data Fetchers "); int lwidth = _font.getStringWidth("Data fetchers ");
new StaticTextWidget(boss, _font, xpos, ypos, lwidth, new StaticTextWidget(boss, _font, xpos, ypos, "Data fetchers ");
myFontHeight, "Data Fetchers ", TextAlign::Left);
// Top registers // Top registers
lwidth = _font.getStringWidth("Counter Registers "); lwidth = _font.getStringWidth("Counter registers ");
xpos = 18; ypos += myLineHeight + 4; xpos = 2 + _font.getMaxCharWidth() * 2; ypos += myLineHeight + 4;
new StaticTextWidget(boss, _font, xpos, ypos, lwidth, new StaticTextWidget(boss, _font, xpos, ypos, "Top registers ");
myFontHeight, "Top Registers ", TextAlign::Left);
xpos += lwidth; xpos += lwidth;
myTops = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::Fmt::_16); myTops = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::Fmt::_16);
@ -77,9 +82,8 @@ CartridgeDPCWidget::CartridgeDPCWidget(
myTops->setEditable(false); myTops->setEditable(false);
// Bottom registers // Bottom registers
xpos = 10; ypos += myLineHeight + 4; xpos = 2 + _font.getMaxCharWidth() * 2; ypos += myLineHeight + 4;
new StaticTextWidget(boss, _font, xpos, ypos, lwidth, new StaticTextWidget(boss, _font, xpos, ypos, "Bottom registers ");
myFontHeight, "Bottom Registers ", TextAlign::Left);
xpos += lwidth; xpos += lwidth;
myBottoms = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::Fmt::_16); myBottoms = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::Fmt::_16);
@ -87,9 +91,8 @@ CartridgeDPCWidget::CartridgeDPCWidget(
myBottoms->setEditable(false); myBottoms->setEditable(false);
// Counter registers // Counter registers
xpos = 10; ypos += myLineHeight + 4; xpos = 2 + _font.getMaxCharWidth() * 2; ypos += myLineHeight + 4;
new StaticTextWidget(boss, _font, xpos, ypos, lwidth, new StaticTextWidget(boss, _font, xpos, ypos, "Counter registers ");
myFontHeight, "Counter Registers ", TextAlign::Left);
xpos += lwidth; xpos += lwidth;
myCounters = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 4, 16, Common::Base::Fmt::_16_4); myCounters = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 4, 16, Common::Base::Fmt::_16_4);
@ -97,9 +100,8 @@ CartridgeDPCWidget::CartridgeDPCWidget(
myCounters->setEditable(false); myCounters->setEditable(false);
// Flag registers // Flag registers
xpos = 10; ypos += myLineHeight + 4; xpos = 2 + _font.getMaxCharWidth() * 2; ypos += myLineHeight + 4;
new StaticTextWidget(boss, _font, xpos, ypos, lwidth, new StaticTextWidget(boss, _font, xpos, ypos, "Flag registers ");
myFontHeight, "Flag Registers ", TextAlign::Left);
xpos += lwidth; xpos += lwidth;
myFlags = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::Fmt::_16); myFlags = new DataGridWidget(boss, _nfont, xpos, ypos-2, 8, 1, 2, 8, Common::Base::Fmt::_16);
@ -107,10 +109,9 @@ CartridgeDPCWidget::CartridgeDPCWidget(
myFlags->setEditable(false); myFlags->setEditable(false);
// Music mode // Music mode
xpos = 2; ypos += myLineHeight + 12; xpos = 2; ypos += myLineHeight + V_GAP * 3;
lwidth = _font.getStringWidth("Music mode (DF5/DF6/DF7) "); lwidth = _font.getStringWidth("Music mode (DF5/DF6/DF7) ");
new StaticTextWidget(boss, _font, xpos, ypos, lwidth, new StaticTextWidget(boss, _font, xpos, ypos, "Music mode (DF5/DF6/DF7) ");
myFontHeight, "Music mode (DF5/DF6/DF7) ", TextAlign::Left);
xpos += lwidth; xpos += lwidth;
myMusicMode = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 2, 8, Common::Base::Fmt::_16); myMusicMode = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 2, 8, Common::Base::Fmt::_16);
@ -118,9 +119,8 @@ CartridgeDPCWidget::CartridgeDPCWidget(
myMusicMode->setEditable(false); myMusicMode->setEditable(false);
// Current random number // Current random number
xpos = 10; ypos += myLineHeight + 4; xpos = 2; ypos += myLineHeight + V_GAP * 3;
new StaticTextWidget(boss, _font, xpos, ypos, lwidth, new StaticTextWidget(boss, _font, xpos, ypos, "Current random number ");
myFontHeight, "Current random number ", TextAlign::Left);
xpos += lwidth; xpos += lwidth;
myRandom = new DataGridWidget(boss, _nfont, xpos, ypos-2, 1, 1, 2, 8, Common::Base::Fmt::_16); myRandom = new DataGridWidget(boss, _nfont, xpos, ypos-2, 1, 1, 2, 8, Common::Base::Fmt::_16);
@ -229,9 +229,8 @@ string CartridgeDPCWidget::bankState()
{ {
ostringstream& buf = buffer(); ostringstream& buf = buffer();
static constexpr std::array<const char*, 2> spot = { "$FFF8", "$FFF9" }; buf << "Bank #" << std::dec << myCart.getBank()
buf << "Bank = " << std::dec << myCart.getBank() << " (hotspot $" << Common::Base::HEX4 << (0xFFF8 + myCart.getBank()) << ")";
<< ", hotspot = " << spot[myCart.getBank()];
return buf.str(); return buf.str();
} }
@ -252,10 +251,9 @@ uInt32 CartridgeDPCWidget::internalRamRPort(int start)
string CartridgeDPCWidget::internalRamDescription() string CartridgeDPCWidget::internalRamDescription()
{ {
ostringstream desc; ostringstream desc;
desc << "$0000 - $07FF - 2K display data\n" desc << "2K display data @ $0000 - $" << Common::Base::HEX4 << 0x07FF << "\n"
<< " indirectly accessible to 6507\n" << " indirectly accessible to 6507 via DPC's\n"
<< " via DPC+'s Data Fetcher\n" << " data fetcher registers\n";
<< " registers\n";
return desc.str(); return desc.str();
} }

View File

@ -75,6 +75,7 @@ class CartridgeDPCWidget : public CartDebugWidget
const ByteArray& internalRamCurrent(int start, int count) override; const ByteArray& internalRamCurrent(int start, int count) override;
void internalRamSetValue(int addr, uInt8 value) override; void internalRamSetValue(int addr, uInt8 value) override;
uInt8 internalRamGetValue(int addr) override; uInt8 internalRamGetValue(int addr) override;
string tabLabel() override { return " DPC Display Data "; }
// end of functions for Cartridge RAM tab // end of functions for Cartridge RAM tab
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported

View File

@ -49,7 +49,7 @@ int CartDebugWidget::addBaseInformation(size_t bytes, const string& manufacturer
int x = 2, y = 8; int x = 2, y = 8;
// Add ROM size, manufacturer and bankswitch info // Add ROM size, manufacturer and bankswitch info
new StaticTextWidget(_boss, _font, x, y + 1, "ROM Size "); new StaticTextWidget(_boss, _font, x, y + 1, "ROM size ");
buf << bytes << " bytes"; buf << bytes << " bytes";
if(bytes >= 1024) if(bytes >= 1024)
buf << " / " << (bytes/1024) << "KB"; buf << " / " << (bytes/1024) << "KB";

View File

@ -58,7 +58,7 @@ class CartDebugWidget : public Widget, public CommandSender
virtual string bankState() { return "0 (non-bankswitched)"; } virtual string bankState() { return "0 (non-bankswitched)"; }
// To make the Cartridge RAM show up in the debugger, implement // To make the Cartridge RAM show up in the debugger, implement
// the following 8 functions for cartridges with internal RAM // the following 9 functions for cartridges with internal RAM
virtual uInt32 internalRamSize() { return 0; } virtual uInt32 internalRamSize() { return 0; }
virtual uInt32 internalRamRPort(int start) { return 0; } virtual uInt32 internalRamRPort(int start) { return 0; }
virtual string internalRamDescription() { return EmptyString; } virtual string internalRamDescription() { return EmptyString; }
@ -67,6 +67,7 @@ class CartDebugWidget : public Widget, public CommandSender
virtual void internalRamSetValue(int addr, uInt8 value) { } virtual void internalRamSetValue(int addr, uInt8 value) { }
virtual uInt8 internalRamGetValue(int addr) { return 0; } virtual uInt8 internalRamGetValue(int addr) { return 0; }
virtual string internalRamLabel(int addr) { return "Not available/applicable"; } virtual string internalRamLabel(int addr) { return "Not available/applicable"; }
virtual string tabLabel() { return " Cartridge RAM "; }
protected: protected:
// Arrays used to hold current and previous internal RAM values // Arrays used to hold current and previous internal RAM values

View File

@ -27,17 +27,18 @@ CartridgeE78KWidget::CartridgeE78KWidget(
: CartridgeMNetworkWidget(boss, lfont, nfont, x, y, w, h, cart) : CartridgeMNetworkWidget(boss, lfont, nfont, x, y, w, h, cart)
{ {
ostringstream info; ostringstream info;
info << "E78K cartridge, 4 2K slices ROM + 2 1K RAM\n" info << "E78K cartridge, four 2K banks ROM + 2K RAM,\n"
<< " mapped into three segments\n"
<< "Lower 2K accessible @ $F000 - $F7FF\n" << "Lower 2K accessible @ $F000 - $F7FF\n"
<< " Slice 0 - 2 of ROM (hotspots $FE4 to $FE6)\n" << " ROM banks 0 - 2 (hotspots $FFE4 to $FFE6)\n"
<< " Slice 7 (1K) of RAM (hotspot $FE7)\n" << " 1K RAM bank 3 (hotspot $FFE7)\n"
<< " $F400 - $F7FF (R), $F000 - $F3FF (W)\n" << " $F400 - $F7FF (R), $F000 - $F3FF (W)\n"
<< "256B RAM accessible @ $F800 - $F9FF\n" << "256B RAM accessible @ $F800 - $F9FF\n"
<< " Hotspots $FE8 - $FEB (256B of RAM slice 1)\n" << " RAM banks 0 - 3 (hotspots $FFE8 - $FFEB)\n"
<< " $F900 - $F9FF (R), $F800 - $F8FF (W)\n" << " $F900 - $F9FF (R), $F800 - $F8FF (W)\n"
<< "Upper 1.5K ROM accessible @ $FA00 - $FFFF\n" << "Upper 1.5K ROM accessible @ $FA00 - $FFFF\n"
<< " Always points to last 1.5K of ROM\n" << " Always points to last 1.5K of ROM\n"
<< "Startup slices = 0 / 0 or undetermined\n"; << "Startup segments = 0 / 0 or undetermined\n";
#if 0 #if 0
// Eventually, we should query this from the debugger/disassembler // Eventually, we should query this from the debugger/disassembler
@ -53,7 +54,7 @@ CartridgeE78KWidget::CartridgeE78KWidget(
const char* CartridgeE78KWidget::getSpotLower(int idx) const char* CartridgeE78KWidget::getSpotLower(int idx)
{ {
static constexpr std::array<const char*, 4> spot_lower = { static constexpr std::array<const char*, 4> spot_lower = {
"0 - ROM ($FFE4)", "1 - ROM ($FFE5)", "2 - ROM ($FFE6)", "3 - RAM ($FFE7)" "#0 - ROM ($FFE4)", "#1 - ROM ($FFE5)", "#2 - ROM ($FFE6)", "#3 - RAM ($FFE7)"
}; };
return spot_lower[idx]; return spot_lower[idx];
@ -63,7 +64,7 @@ const char* CartridgeE78KWidget::getSpotLower(int idx)
const char* CartridgeE78KWidget::getSpotUpper(int idx) const char* CartridgeE78KWidget::getSpotUpper(int idx)
{ {
static constexpr std::array<const char*, 4> spot_upper = { static constexpr std::array<const char*, 4> spot_upper = {
"0 - RAM ($FFE8)", "1 - RAM ($FFE9)", "2 - RAM ($FFEA)", "3 - RAM ($FFEB)" "#0 - RAM ($FFE8)", "#1 - RAM ($FFE9)", "#2 - RAM ($FFEA)", "#3 - RAM ($FFEB)"
}; };
return spot_upper[idx]; return spot_upper[idx];

View File

@ -26,17 +26,18 @@ CartridgeE7Widget::CartridgeE7Widget(
: CartridgeMNetworkWidget(boss, lfont, nfont, x, y, w, h, cart) : CartridgeMNetworkWidget(boss, lfont, nfont, x, y, w, h, cart)
{ {
ostringstream info; ostringstream info;
info << "E7 cartridge, 8 2K slices ROM + 2 1K RAM\n" info << "E7 cartridge, eight 2K banks ROM + 2K RAM,\n"
<< " mapped into three segments\n"
<< "Lower 2K accessible @ $F000 - $F7FF\n" << "Lower 2K accessible @ $F000 - $F7FF\n"
<< " Slice 0 - 6 of ROM (hotspots $FE0 to $FE6)\n" << " ROM Banks 0 - 6 (hotspots $FFE0 to $FFE6)\n"
<< " Slice 7 (1K) of RAM (hotspot $FE7)\n" << " 1K RAM Bank 7 (hotspot $FFE7)\n"
<< " $F400 - $F7FF (R), $F000 - $F3FF (W)\n" << " $F400 - $F7FF (R), $F000 - $F3FF (W)\n"
<< "256B RAM accessible @ $F800 - $F9FF\n" << "256B RAM accessible @ $F800 - $F9FF\n"
<< " Hotspots $FE8 - $FEB (256B of RAM slice 1)\n" << " RAM banks 0 - 3 (hotspots $FFE8 - $FFEB)\n"
<< " $F900 - $F9FF (R), $F800 - $F8FF (W)\n" << " $F900 - $F9FF (R), $F800 - $F8FF (W)\n"
<< "Upper 1.5K ROM accessible @ $FA00 - $FFFF\n" << "Upper 1.5K ROM accessible @ $FA00 - $FFFF\n"
<< " Always points to last 1.5K of ROM\n" << " Always points to last 1.5K of ROM\n"
<< "Startup slices = 0 / 0 or undetermined\n"; << "Startup segments = 0 / 0 or undetermined\n";
#if 0 #if 0
// Eventually, we should query this from the debugger/disassembler // Eventually, we should query this from the debugger/disassembler
@ -52,8 +53,8 @@ CartridgeE7Widget::CartridgeE7Widget(
const char* CartridgeE7Widget::getSpotLower(int idx) const char* CartridgeE7Widget::getSpotLower(int idx)
{ {
static constexpr std::array<const char*, 8> spot_lower = { static constexpr std::array<const char*, 8> spot_lower = {
"0 - ROM ($FFE0)", "1 - ROM ($FFE1)", "2 - ROM ($FFE2)", "3 - ROM ($FFE3)", "#0 - ROM ($FFE0)", "#1 - ROM ($FFE1)", "#2 - ROM ($FFE2)", "#3 - ROM ($FFE3)",
"4 - ROM ($FFE4)", "5 - ROM ($FFE5)", "6 - ROM ($FFE6)", "7 - RAM ($FFE7)" "#4 - ROM ($FFE4)", "#5 - ROM ($FFE5)", "#6 - ROM ($FFE6)", "#7 - RAM ($FFE7)"
}; };
return spot_lower[idx]; return spot_lower[idx];
@ -63,7 +64,7 @@ const char* CartridgeE7Widget::getSpotLower(int idx)
const char* CartridgeE7Widget::getSpotUpper(int idx) const char* CartridgeE7Widget::getSpotUpper(int idx)
{ {
static constexpr std::array<const char*, 4> spot_upper = { static constexpr std::array<const char*, 4> spot_upper = {
"0 - RAM ($FFE8)", "1 - RAM ($FFE9)", "2 - RAM ($FFEA)", "3 - RAM ($FFEB)" "#0 - RAM ($FFE8)", "#1 - RAM ($FFE9)", "#2 - RAM ($FFEA)", "#3 - RAM ($FFEB)"
}; };
return spot_upper[idx]; return spot_upper[idx];

View File

@ -233,7 +233,7 @@ string CartridgeEnhancedWidget::bankState()
} }
return buf.str(); return buf.str();
} }
return "0 (non-bankswitched)"; return "non-bankswitched";
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -339,18 +339,18 @@ string CartridgeEnhancedWidget::internalRamDescription()
{ {
desc << indent << "$" << Common::Base::HEX4 << (ADDR_BASE | myCart.myReadOffset) desc << indent << "$" << Common::Base::HEX4 << (ADDR_BASE | myCart.myReadOffset)
<< " - $" << (ADDR_BASE | (myCart.myReadOffset + myCart.myRamMask)) << " - $" << (ADDR_BASE | (myCart.myReadOffset + myCart.myRamMask))
<< " used for read Access\n"; << " used for read access\n";
} }
desc << indent << "$" << Common::Base::HEX4 << (ADDR_BASE | myCart.myWriteOffset) desc << indent << "$" << Common::Base::HEX4 << (ADDR_BASE | myCart.myWriteOffset)
<< " - $" << (ADDR_BASE | (myCart.myWriteOffset + myCart.myRamMask)) << " - $" << (ADDR_BASE | (myCart.myWriteOffset + myCart.myRamMask))
<< " used for write Access"; << " used for write access";
if(myCart.myReadOffset > myCart.myWriteOffset) if(myCart.myReadOffset > myCart.myWriteOffset)
{ {
desc << indent << "\n$" << Common::Base::HEX4 << (ADDR_BASE | myCart.myReadOffset) desc << indent << "\n$" << Common::Base::HEX4 << (ADDR_BASE | myCart.myReadOffset)
<< " - $" << (ADDR_BASE | (myCart.myReadOffset + myCart.myRamMask)) << " - $" << (ADDR_BASE | (myCart.myReadOffset + myCart.myRamMask))
<< " used for read Access"; << " used for read access";
} }
return desc.str(); return desc.str();

View File

@ -47,18 +47,18 @@ void CartridgeMNetworkWidget::initialize(GuiObject* boss, CartridgeMNetwork& car
for(int i = 0; i < 4; ++i) for(int i = 0; i < 4; ++i)
VarList::push_back(items1, getSpotUpper(i)); VarList::push_back(items1, getSpotUpper(i));
const int lwidth = _font.getStringWidth("Set slice for upper 256B "), const int lwidth = _font.getStringWidth("Set bank for upper 256B segment "),
fwidth = _font.getStringWidth("3 - RAM ($FFEB)"); fwidth = _font.getStringWidth("#3 - RAM ($FFEB)");
myLower2K = myLower2K =
new PopUpWidget(boss, _font, xpos, ypos - 2, fwidth, myLineHeight, items0, new PopUpWidget(boss, _font, xpos, ypos - 2, fwidth, myLineHeight, items0,
"Set slice for lower 2K ", lwidth, kLowerChanged); "Set bank for lower 2K segment", lwidth, kLowerChanged);
myLower2K->setTarget(this); myLower2K->setTarget(this);
addFocusWidget(myLower2K); addFocusWidget(myLower2K);
ypos += myLower2K->getHeight() + 4; ypos += myLower2K->getHeight() + 4;
myUpper256B = myUpper256B =
new PopUpWidget(boss, _font, xpos, ypos - 2, fwidth, myLineHeight, items1, new PopUpWidget(boss, _font, xpos, ypos - 2, fwidth, myLineHeight, items1,
"Set slice for upper 256B ", lwidth, kUpperChanged); "Set bank for upper 256B segment ", lwidth, kUpperChanged);
myUpper256B->setTarget(this); myUpper256B->setTarget(this);
addFocusWidget(myUpper256B); addFocusWidget(myUpper256B);
} }
@ -71,14 +71,14 @@ void CartridgeMNetworkWidget::saveOldState()
for(uInt32 i = 0; i < internalRamSize(); ++i) for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myRAM[i]); myOldState.internalram.push_back(myCart.myRAM[i]);
myOldState.lowerBank = myCart.myCurrentSlice[0]; myOldState.lowerBank = myCart.myCurrentBank[0];
myOldState.upperBank = myCart.myCurrentRAM; myOldState.upperBank = myCart.myCurrentRAM;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeMNetworkWidget::loadConfig() void CartridgeMNetworkWidget::loadConfig()
{ {
myLower2K->setSelectedIndex(myCart.myCurrentSlice[0], myCart.myCurrentSlice[0] != myOldState.lowerBank); myLower2K->setSelectedIndex(myCart.myCurrentBank[0], myCart.myCurrentBank[0] != myOldState.lowerBank);
myUpper256B->setSelectedIndex(myCart.myCurrentRAM, myCart.myCurrentRAM != myOldState.upperBank); myUpper256B->setSelectedIndex(myCart.myCurrentRAM, myCart.myCurrentRAM != myOldState.upperBank);
CartDebugWidget::loadConfig(); CartDebugWidget::loadConfig();
@ -111,8 +111,8 @@ string CartridgeMNetworkWidget::bankState()
{ {
ostringstream& buf = buffer(); ostringstream& buf = buffer();
buf << "Slices: " << std::dec buf << "Segments: " << std::dec
<< getSpotLower(myCart.myCurrentSlice[0]) << " / " << getSpotLower(myCart.myCurrentBank[0]) << " / "
<< getSpotUpper(myCart.myCurrentRAM); << getSpotUpper(myCart.myCurrentRAM);
return buf.str(); return buf.str();
@ -135,11 +135,11 @@ string CartridgeMNetworkWidget::internalRamDescription()
{ {
ostringstream desc; ostringstream desc;
desc << "First 1K accessible via:\n" desc << "First 1K accessible via:\n"
<< " $F000 - $F3FF used for Write Access\n" << " $F000 - $F3FF used for write access\n"
<< " $F400 - $F7FF used for Read Access\n" << " $F400 - $F7FF used for read access\n"
<< "256K of second 1K accessible via:\n" << "256 bytes of second 1K accessible via:\n"
<< " $F800 - $F8FF used for Write Access\n" << " $F800 - $F8FF used for write access\n"
<< " $F900 - $F9FF used for Read Access"; << " $F900 - $F9FF used for read access";
return desc.str(); return desc.str();
} }

View File

@ -47,7 +47,7 @@ CartRamWidget::CartRamWidget(
int xpos = 2, ypos = 8; int xpos = 2, ypos = 8;
// Add RAM size // Add RAM size
new StaticTextWidget(_boss, _font, xpos, ypos + 1, "RAM Size "); new StaticTextWidget(_boss, _font, xpos, ypos + 1, "RAM size ");
uInt32 ramsize = cartDebug.internalRamSize(); uInt32 ramsize = cartDebug.internalRamSize();
buf << ramsize << " bytes"; buf << ramsize << " bytes";

View File

@ -640,7 +640,7 @@ void DebuggerDialog::addRomArea()
// The cartridge RAM tab // The cartridge RAM tab
if (myCartDebug->internalRamSize() > 0) if (myCartDebug->internalRamSize() > 0)
{ {
tabID = myRomTab->addTab(" Cartridge RAM ", TabWidget::AUTO_WIDTH); tabID = myRomTab->addTab(myCartDebug->tabLabel(), TabWidget::AUTO_WIDTH);
myCartRam = myCartRam =
new CartRamWidget(myRomTab, *myLFont, *myNFont, 2, 2, tabWidth - 1, new CartRamWidget(myRomTab, *myLFont, *myNFont, 2, 2, tabWidth - 1,
tabHeight - myRomTab->getTabHeight() - 2, *myCartDebug); tabHeight - myRomTab->getTabHeight() - 2, *myCartDebug);

View File

@ -41,12 +41,9 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
// Show current bank state // Show current bank state
xpos = x; ypos = y + 7; xpos = x; ypos = y + 7;
t = new StaticTextWidget(boss, lfont, xpos, ypos, t = new StaticTextWidget(boss, lfont, xpos, ypos, "Info ");
lfont.getStringWidth("Bank"),
lfont.getFontHeight(),
"Bank", TextAlign::Left);
xpos += t->getWidth() + 5; xpos += t->getRight();
myBank = new EditTextWidget(boss, nfont, xpos, ypos-2, myBank = new EditTextWidget(boss, nfont, xpos, ypos-2,
_w - 2 - xpos, nfont.getLineHeight()); _w - 2 - xpos, nfont.getLineHeight());
myBank->setEditable(false); myBank->setEditable(false);

View File

@ -189,7 +189,7 @@ class Cartridge : public Device
cases where ROMs have 2K blocks in some preset area, the bankCount cases where ROMs have 2K blocks in some preset area, the bankCount
is the number of such blocks. Finally, in some esoteric schemes, is the number of such blocks. Finally, in some esoteric schemes,
the number of ways that the addressing can change (multiple ROM and the number of ways that the addressing can change (multiple ROM and
RAM slices at multiple access points) is so complicated that the RAM segments at multiple access points) is so complicated that the
cart will report having only one 'virtual' bank. cart will report having only one 'virtual' bank.
*/ */
virtual uInt16 romBankCount() const { return 1; } virtual uInt16 romBankCount() const { return 1; }

View File

@ -29,7 +29,7 @@ CartridgeE0::CartridgeE0(const ByteBuffer& image, size_t size,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE0::reset() void CartridgeE0::reset()
{ {
// Setup segments to some default slices // Setup segments to some default banks
if(randomStartBank()) if(randomStartBank())
{ {
bank(mySystem->randGenerator().next() % 8, 0); bank(mySystem->randGenerator().next() % 8, 0);

View File

@ -29,10 +29,10 @@ class System;
/** /**
This is the cartridge class for Parker Brothers' 8K games. In This is the cartridge class for Parker Brothers' 8K games. In
this bankswitching scheme the 2600's 4K cartridge address space this bankswitching scheme the 2600's 4K cartridge address space
is broken into four 1K segments. The desired 1K slice of the is broken into four 1K segments. The desired 1K bank of the
ROM is selected by accessing $1FE0 to $1FE7 for the first 1K. ROM is selected by accessing $1FE0 to $1FE7 for the first 1K.
$1FE8 to $1FEF selects the slice for the second 1K, and $1FF0 to $1FE8 to $1FEF selects the bank for the second 1K, and $1FF0 to
$1FF7 selects the slice for the third 1K. The last 1K segment $1FF7 selects the bank for the third 1K. The last 1K segment
always points to the last 1K of the ROM image. always points to the last 1K of the ROM image.
Because of the complexity of this scheme, the cart reports having Because of the complexity of this scheme, the cart reports having

View File

@ -48,7 +48,7 @@ void CartridgeEnhanced::install(System& system)
createRomAccessArrays(mySize + (myRomOffset > 0 ? 0 : myRamSize)); createRomAccessArrays(mySize + (myRomOffset > 0 ? 0 : myRamSize));
// Allocate array for the current bank segments slices // Allocate array for the segment's current bank offset
myCurrentSegOffset = make_unique<uInt32[]>(myBankSegs); myCurrentSegOffset = make_unique<uInt32[]>(myBankSegs);
// Allocate array for the RAM area // Allocate array for the RAM area

View File

@ -36,7 +36,7 @@ void CartridgeMNetwork::initialize(const ByteBuffer& image, size_t size)
std::copy_n(image.get(), std::min<size_t>(romSize(), size), myImage.get()); std::copy_n(image.get(), std::min<size_t>(romSize(), size), myImage.get());
createRomAccessArrays(romSize() + myRAM.size()); createRomAccessArrays(romSize() + myRAM.size());
myRAMSlice = romBankCount() - 1; myRAMBank = romBankCount() - 1;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -96,10 +96,10 @@ void CartridgeMNetwork::install(System& system)
/*setAccess(0x1FE0 & ~System::PAGE_MASK, System::PAGE_SIZE, /*setAccess(0x1FE0 & ~System::PAGE_MASK, System::PAGE_SIZE,
0, nullptr, 0x1fc0, System::PA_NONE, 0x1fc0);*/ 0, nullptr, 0x1fc0, System::PA_NONE, 0x1fc0);*/
// Setup the second segment to always point to the last ROM slice // Setup the second segment to always point to the last ROM bank
setAccess(0x1A00, 0x1FE0U & (~System::PAGE_MASK - 0x1A00), setAccess(0x1A00, 0x1FE0U & (~System::PAGE_MASK - 0x1A00),
myRAMSlice * BANK_SIZE, myImage.get(), myRAMSlice * BANK_SIZE, System::PageAccessType::READ, BANK_SIZE - 1); myRAMBank * BANK_SIZE, myImage.get(), myRAMBank * BANK_SIZE, System::PageAccessType::READ, BANK_SIZE - 1);
myCurrentSlice[1] = myRAMSlice; myCurrentBank[1] = myRAMBank;
// Install some default banks for the RAM and first segment // Install some default banks for the RAM and first segment
bankRAM(0); bankRAM(0);
@ -115,7 +115,7 @@ uInt8 CartridgeMNetwork::peek(uInt16 address)
// Switch banks if necessary // Switch banks if necessary
checkSwitchBank(address); checkSwitchBank(address);
if((myCurrentSlice[0] == myRAMSlice) && (address < BANK_SIZE / 2)) if((myCurrentBank[0] == myRAMBank) && (address < BANK_SIZE / 2))
{ {
// Reading from the 1K write port @ $1000 triggers an unwanted write // Reading from the 1K write port @ $1000 triggers an unwanted write
return peekRAM(myRAM[address & (BANK_SIZE / 2 - 1)], peekAddress); return peekRAM(myRAM[address & (BANK_SIZE / 2 - 1)], peekAddress);
@ -126,7 +126,7 @@ uInt8 CartridgeMNetwork::peek(uInt16 address)
return peekRAM(myRAM[0x0400 + (myCurrentRAM << 8) + (address & 0x00FF)], peekAddress); return peekRAM(myRAM[0x0400 + (myCurrentRAM << 8) + (address & 0x00FF)], peekAddress);
} }
else else
return myImage[(myCurrentSlice[address >> 11] << 11) + (address & (BANK_SIZE - 1))]; return myImage[(myCurrentBank[address >> 11] << 11) + (address & (BANK_SIZE - 1))];
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -139,9 +139,9 @@ bool CartridgeMNetwork::poke(uInt16 address, uInt8 value)
checkSwitchBank(address); checkSwitchBank(address);
// All RAM writes are mapped here // All RAM writes are mapped here
if((myCurrentSlice[0] == myRAMSlice) && (address < BANK_SIZE / 2)) if((myCurrentBank[0] == myRAMBank) && (address < BANK_SIZE / 2))
{ {
// RAM slices // RAM banks
if(!(address & 0x0400)) if(!(address & 0x0400))
{ {
pokeRAM(myRAM[address & (BANK_SIZE / 2 - 1)], pokeAddress, value); pokeRAM(myRAM[address & (BANK_SIZE / 2 - 1)], pokeAddress, value);
@ -189,7 +189,7 @@ void CartridgeMNetwork::bankRAM(uInt16 bank)
// Remember what bank we're in // Remember what bank we're in
myCurrentRAM = bank; myCurrentRAM = bank;
uInt16 offset = bank << 8; // * RAM_SLICE_SIZE (256) uInt16 offset = bank << 8; // * RAM_BANK_SIZE (256)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
// Set the page accessing method for the 256 bytes of RAM reading pages // Set the page accessing method for the 256 bytes of RAM reading pages
@ -201,26 +201,26 @@ void CartridgeMNetwork::bankRAM(uInt16 bank)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeMNetwork::bank(uInt16 slice) bool CartridgeMNetwork::bank(uInt16 bank)
{ {
if(bankLocked()) return false; if(bankLocked()) return false;
// Remember what bank we're in // Remember what bank we're in
myCurrentSlice[0] = slice; myCurrentBank[0] = bank;
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
if(slice != myRAMSlice) if(bank != myRAMBank)
{ {
uInt16 offset = slice << 11; // * BANK_SIZE (2048) uInt16 offset = bank << 11; // * BANK_SIZE (2048)
// Map ROM image into first segment // Map ROM image into first segment
setAccess(0x1000, BANK_SIZE, offset, myImage.get(), offset, System::PageAccessType::READ); setAccess(0x1000, BANK_SIZE, offset, myImage.get(), offset, System::PageAccessType::READ);
} }
else else
{ {
// Set the page accessing method for the 1K slice of RAM writing pages // Set the page accessing method for the 1K bank of RAM writing pages
setAccess(0x1000, BANK_SIZE / 2, 0, myRAM.data(), romSize(), System::PageAccessType::WRITE); setAccess(0x1000, BANK_SIZE / 2, 0, myRAM.data(), romSize(), System::PageAccessType::WRITE);
// Set the page accessing method for the 1K slice of RAM reading pages // Set the page accessing method for the 1K bank of RAM reading pages
setAccess(0x1000 + BANK_SIZE / 2, BANK_SIZE / 2, 0, myRAM.data(), romSize(), System::PageAccessType::READ); setAccess(0x1000 + BANK_SIZE / 2, BANK_SIZE / 2, 0, myRAM.data(), romSize(), System::PageAccessType::READ);
} }
return myBankChanged = true; return myBankChanged = true;
@ -229,7 +229,7 @@ bool CartridgeMNetwork::bank(uInt16 slice)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt16 CartridgeMNetwork::getBank(uInt16 address) const uInt16 CartridgeMNetwork::getBank(uInt16 address) const
{ {
return myCurrentSlice[(address & 0xFFF) >> 11]; // 2K slices return myCurrentBank[(address & 0xFFF) >> 11]; // 2K segments
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -239,7 +239,7 @@ bool CartridgeMNetwork::patch(uInt16 address, uInt8 value)
if(address < 0x0800) if(address < 0x0800)
{ {
if(myCurrentSlice[0] == myRAMSlice) if(myCurrentBank[0] == myRAMBank)
{ {
// Normally, a write to the read port won't do anything // Normally, a write to the read port won't do anything
// However, the patch command is special in that ignores such // However, the patch command is special in that ignores such
@ -247,7 +247,7 @@ bool CartridgeMNetwork::patch(uInt16 address, uInt8 value)
myRAM[address & 0x03FF] = value; myRAM[address & 0x03FF] = value;
} }
else else
myImage[(myCurrentSlice[0] << 11) + (address & (BANK_SIZE-1))] = value; myImage[(myCurrentBank[0] << 11) + (address & (BANK_SIZE-1))] = value;
} }
else if(address < 0x0900) else if(address < 0x0900)
{ {
@ -257,7 +257,7 @@ bool CartridgeMNetwork::patch(uInt16 address, uInt8 value)
myRAM[0x0400 + (myCurrentRAM << 8) + (address & 0x00FF)] = value; myRAM[0x0400 + (myCurrentRAM << 8) + (address & 0x00FF)] = value;
} }
else else
myImage[(myCurrentSlice[address >> 11] << 11) + (address & (BANK_SIZE-1))] = value; myImage[(myCurrentBank[address >> 11] << 11) + (address & (BANK_SIZE-1))] = value;
return myBankChanged = true; return myBankChanged = true;
} }
@ -274,7 +274,7 @@ bool CartridgeMNetwork::save(Serializer& out) const
{ {
try try
{ {
out.putShortArray(myCurrentSlice.data(), myCurrentSlice.size()); out.putShortArray(myCurrentBank.data(), myCurrentBank.size());
out.putShort(myCurrentRAM); out.putShort(myCurrentRAM);
out.putByteArray(myRAM.data(), myRAM.size()); out.putByteArray(myRAM.data(), myRAM.size());
} }
@ -292,7 +292,7 @@ bool CartridgeMNetwork::load(Serializer& in)
{ {
try try
{ {
in.getShortArray(myCurrentSlice.data(), myCurrentSlice.size()); in.getShortArray(myCurrentBank.data(), myCurrentBank.size());
myCurrentRAM = in.getShort(); myCurrentRAM = in.getShort();
in.getByteArray(myRAM.data(), myRAM.size()); in.getByteArray(myRAM.data(), myRAM.size());
} }
@ -304,7 +304,7 @@ bool CartridgeMNetwork::load(Serializer& in)
// Set up the previously used banks for the RAM and segment // Set up the previously used banks for the RAM and segment
bankRAM(myCurrentRAM); bankRAM(myCurrentRAM);
bank(myCurrentSlice[0]); bank(myCurrentBank[0]);
return true; return true;
} }

View File

@ -51,7 +51,7 @@
here by accessing 1FE8 to 1FEB. here by accessing 1FE8 to 1FEB.
This cart reports having 8 banks; 1 for each of the possible 7 This cart reports having 8 banks; 1 for each of the possible 7
slices in the lower 2K area, and the last for RAM in the lower bank in the lower 2K area, and the last for RAM in the lower
2K area." 2K area."
There are 8K, 12K and 16K variations, with or without RAM. There are 8K, 12K and 16K variations, with or without RAM.
@ -179,7 +179,7 @@ class CartridgeMNetwork : public Cartridge
private: private:
// Size of RAM in the cart // Size of RAM in the cart
static constexpr uInt32 RAM_SIZE = 0x800; // 1K + 4 * 256B = 2K static constexpr uInt32 RAM_SIZE = 0x800; // 1K + 4 * 256B = 2K
// Number of slices with 4K address space // Number of segment within the 4K address space
static constexpr uInt32 NUM_SEGMENTS = 2; static constexpr uInt32 NUM_SEGMENTS = 2;
/** /**
@ -198,8 +198,6 @@ class CartridgeMNetwork : public Cartridge
private: private:
// Pointer to a dynamically allocated ROM image of the cartridge // Pointer to a dynamically allocated ROM image of the cartridge
ByteBuffer myImage; ByteBuffer myImage;
// The 16K ROM image of the cartridge (works for E78K too)
//uInt8 myImage[BANK_SIZE * 8];
// Size of the ROM image // Size of the ROM image
size_t mySize{0}; size_t mySize{0};
@ -207,14 +205,14 @@ class CartridgeMNetwork : public Cartridge
// The 2K of RAM // The 2K of RAM
std::array<uInt8, RAM_SIZE> myRAM; std::array<uInt8, RAM_SIZE> myRAM;
// Indicates which slice is in the segment // Indicates which bank is in the segment
std::array<uInt16, NUM_SEGMENTS> myCurrentSlice; std::array<uInt16, NUM_SEGMENTS> myCurrentBank;
// Indicates which 256 byte bank of RAM is being used // Indicates which 256 byte bank of RAM is being used
uInt16 myCurrentRAM{0}; uInt16 myCurrentRAM{0};
// The number of the RAM slice (== bankCount() - 1) // The number of the RAM bank (== bankCount() - 1)
uInt32 myRAMSlice{0}; uInt32 myRAMBank{0};
private: private:
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported

View File

@ -28,7 +28,7 @@ CartridgeWD::CartridgeWD(const ByteBuffer& image, size_t size,
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
if (mySize == 8_KB + 3) if (mySize == 8_KB + 3)
{ {
// swap slices 2 & 3 of bad dump and correct size // swap banks 2 & 3 of bad dump and correct size
std::copy_n(image.get() + 1_KB * 3, 1_KB * 1, myImage.get() + 1_KB * 2); std::copy_n(image.get() + 1_KB * 3, 1_KB * 1, myImage.get() + 1_KB * 2);
std::copy_n(image.get() + 1_KB * 2, 1_KB * 1, myImage.get() + 1_KB * 3); std::copy_n(image.get() + 1_KB * 2, 1_KB * 1, myImage.get() + 1_KB * 3);
mySize = 8_KB; mySize = 8_KB;

View File

@ -30,8 +30,8 @@ class System;
This is the cartridge class for a "Wickstead Design" prototype cart. This is the cartridge class for a "Wickstead Design" prototype cart.
The ROM has 64 bytes of RAM. The ROM has 64 bytes of RAM.
In this bankswitching scheme the 2600's 4K cartridge address space In this bankswitching scheme the 2600's 4K cartridge address space
is broken into four 1K segments. The desired arrangement of 1K slices is broken into four 1K segments. The desired arrangement of 1K banks
is selected by accessing $30 - $3F of TIA address space. The slices is selected by accessing $30 - $3F of TIA address space. The banks
are mapped into all 4 segments at once as follows: are mapped into all 4 segments at once as follows:
$0030, $0038: 0,0,1,3 $0030, $0038: 0,0,1,3