diff --git a/Changes.txt b/Changes.txt index 2d13b3ab8..c0f231b49 100644 --- a/Changes.txt +++ b/Changes.txt @@ -36,11 +36,11 @@ * Several improvements to the debugger: - user labels are now supported again + - 'runto' debugger command is now case-insensitive, and shows a + progressbar while searching through the disassembly - the debugger window can be resized between ROM loads (previously, the app had to be restarted) - a vertical line separates the disassembly from the raw bytes - - 'runto' debugger command is now case-insensitive, and shows a - progressbar while searching through the disassembly * Fixed behaviour of SWCHB and SWBCNT; pins set to output now remember the values previously written. Some ROMs use this functionality for @@ -74,7 +74,7 @@ * Updated DPC+ bankswitch scheme to latest specifications. * Snapshots taken in continuous snapshot mode are now timestamped, so - files are never overwritten. + older files are never overwritten. * Fixed a TIA segfault that could occur with certain ROMs. diff --git a/src/common/Array.hxx b/src/common/Array.hxx index d3aac6f4b..b77e1e286 100644 --- a/src/common/Array.hxx +++ b/src/common/Array.hxx @@ -71,6 +71,15 @@ class Array _data[_size++] = array._data[i]; } + void push_back_unique(const T& element) + { + if(!contains(element)) + { + ensureCapacity(_size + 1); + _data[_size++] = element; + } + } + void insert_at(int idx, const T& element) { assert(idx >= 0 && idx <= _size); diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index 928d5a6db..6830dc1f7 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -37,13 +37,15 @@ CartDebug::CartDebug(Debugger& dbg, Console& console, const RamAreaList& areas) for(RamAreaList::const_iterator i = areas.begin(); i != areas.end(); ++i) addRamArea(i->start, i->size, i->roffset, i->woffset); - // We need a start address for each potential bank - myStartAddresses = new uInt16[myConsole.cartridge().bankCount()]; + // Create an addresslist for each potential bank for(int i = 0; i < myConsole.cartridge().bankCount(); ++i) - myStartAddresses[i] = 0; + { + AddressList l; + myEntryAddresses.push_back(l); + } // We know the address for the startup bank right now - myStartAddresses[myConsole.cartridge().startBank()] = myDebugger.dpeek(0xfffc); + myEntryAddresses[myConsole.cartridge().startBank()].push_back(myDebugger.dpeek(0xfffc)); // Add system equates for(uInt16 addr = 0x00; addr <= 0x0F; ++addr) @@ -61,7 +63,9 @@ CartDebug::~CartDebug() myUserAddresses.clear(); mySystemAddresses.clear(); - delete[] myStartAddresses; + for(uInt32 i = 0; i < myEntryAddresses.size(); ++i) + myEntryAddresses[i].clear(); + myEntryAddresses.clear(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -199,11 +203,20 @@ bool CartDebug::disassemble(const string& resolvedata, bool force) if(changed) { - // Look at previous accesses to this bank to begin - // If no previous address exists, use the current program counter - uInt16 start = myStartAddresses[getBank()]; - if(start == 0 || (pcline == -1 && (PC & 0x1000))) - start = myStartAddresses[getBank()] = PC; + AddressList& addresses = myEntryAddresses[getBank()]; + + // If the bank has changed, all old addresses must be 'converted' + // For example, if the list contains any $fxxx and the address space is now + // $bxxx, it must be changed + uInt16 offset = (PC - (PC % 0x1000)); + for(uInt32 i = 0; i < addresses.size(); ++i) + addresses[i] = (addresses[i] & 0xFFF) + offset; + + addresses.push_back_unique(PC); + + uInt16 start = addresses[0]; + if(pcline == -1 && (PC & 0x1000)) + start = PC; // For now, DiStella can't handle address space below 0x1000 // However, we want to disassemble at least once, otherwise carts @@ -221,14 +234,14 @@ bool CartDebug::disassemble(const string& resolvedata, bool force) // Check whether to use the 'resolvedata' functionality from Distella if(resolvedata == "never") - fillDisassemblyList(start, false, search); + fillDisassemblyList(addresses, false, search); else if(resolvedata == "always") - fillDisassemblyList(start, true, search); + fillDisassemblyList(addresses, true, search); else // 'auto' { // First try with resolvedata on, then turn off if PC isn't found - if(!fillDisassemblyList(start, true, search)) - fillDisassemblyList(start, false, search); + if(!fillDisassemblyList(addresses, true, search)) + fillDisassemblyList(addresses, false, search); } } @@ -236,13 +249,15 @@ bool CartDebug::disassemble(const string& resolvedata, bool force) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartDebug::fillDisassemblyList(uInt16 start, bool resolvedata, uInt16 search) +bool CartDebug::fillDisassemblyList(const AddressList& addresses, + bool resolvedata, uInt16 search) { bool found = false; myDisassembly.list.clear(); myDisassembly.fieldwidth = 10 + myLabelLength; - DiStella distella(*this, myDisassembly.list, start, resolvedata); +cerr << "start (" << getBank() << "): "; + DiStella distella(*this, myDisassembly.list, addresses, resolvedata); // Parts of the disassembly will be accessed later in different ways // We place those parts in separate maps, to speed up access @@ -276,20 +291,23 @@ int CartDebug::addressToLine(uInt16 address) const string CartDebug::disassemble(uInt16 start, uInt16 lines) const { Disassembly disasm; - DiStella distella(*this, disasm.list, start, false); + AddressList addresses; + addresses.push_back(start); + DiStella distella(*this, disasm.list, addresses, false); // Fill the string with disassembled data start &= 0xFFF; ostringstream buffer; // First find the lines in the range, and determine the longest string - uInt32 begin = 0, end = 0, length = 0; - for(end = 0; end < disasm.list.size() && lines > 0; ++end) + uInt32 list_size = disasm.list.size(); + uInt32 begin = list_size, end = 0, length = 0; + for(end = 0; end < list_size && lines > 0; ++end) { const CartDebug::DisassemblyTag& tag = disasm.list[end]; if((tag.address & 0xfff) >= start) { - if(begin == 0) begin = end; + if(begin == list_size) begin = end; length = BSPF_max(length, (uInt32)tag.disasm.length()); --lines; @@ -303,7 +321,7 @@ string CartDebug::disassemble(uInt16 start, uInt16 lines) const buffer << uppercase << hex << setw(4) << setfill('0') << tag.address << ": " << tag.disasm << setw(length - tag.disasm.length() + 1) << setfill(' ') << " " - << tag.ccount << " " << tag.bytes << endl; + << tag.ccount << " " << tag.bytes << endl; } return buffer.str(); diff --git a/src/debugger/CartDebug.hxx b/src/debugger/CartDebug.hxx index 24dadf012..c20793722 100644 --- a/src/debugger/CartDebug.hxx +++ b/src/debugger/CartDebug.hxx @@ -30,6 +30,9 @@ class System; #include "StringList.hxx" #include "DebuggerSystem.hxx" +// Array of addresses +typedef Common::Array AddressList; + // pointer types for CartDebug instance methods typedef int (CartDebug::*CARTDEBUG_INT_METHOD)(); @@ -209,7 +212,8 @@ class CartDebug : public DebuggerSystem // Actually call DiStella to fill the DisassemblyList structure // Return whether the search address was actually in the list - bool fillDisassemblyList(uInt16 start, bool resolvedata, uInt16 search); + bool fillDisassemblyList(const AddressList& addresses, + bool resolvedata, uInt16 search); // Extract labels and values from the given character stream string extractLabel(char *c) const; @@ -219,10 +223,12 @@ class CartDebug : public DebuggerSystem CartState myState; CartState myOldState; - // A pointer to an array of start addresses for each bank in a cart + // A list of 'entry' addresses for each bank in a cart + // An entry address is the one at which time the debugger 'enters' the + // disassembler // The startup bank will normally be 0xfffc, while the others are // determined when the debugger is first opened - uInt16* myStartAddresses; + Common::Array myEntryAddresses; // Used for the disassembly display, and mapping from addresses // to corresponding lines of text in that display diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index 922c1f59f..6fccbe6be 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -80,10 +80,10 @@ static const char* builtin_functions[][3] = { { "_reset", "!(*SWCHB & $01)", "Game Reset pressed" }, { "_color", "*SWCHB & $08", "Color/BW set to Color" }, { "_bw", "!(*SWCHB & $08)", "Color/BW set to BW" }, - { "_diff0b", "!(*SWCHB & $40)", "Left difficulty set to B (easy)" }, - { "_diff0a", "*SWCHB & $40", "Left difficulty set to A (hard)" }, - { "_diff1b", "!(*SWCHB & $80)", "Right difficulty set to B (easy)" }, - { "_diff1a", "*SWCHB & $80", "Right difficulty set to A (hard)" }, + { "_diff0b", "!(*SWCHB & $40)", "Left diff. set to B (easy)" }, + { "_diff0a", "*SWCHB & $40", "Left diff. set to A (hard)" }, + { "_diff1b", "!(*SWCHB & $80)", "Right diff. set to B (easy)" }, + { "_diff1a", "*SWCHB & $80", "Right diff. set to A (hard)" }, // empty string marks end of list, do not remove { 0, 0, 0 } @@ -567,9 +567,9 @@ bool Debugger::setBank(int bank) if(myConsole->cartridge().bankCount() > 1) { myConsole->cartridge().unlockBank(); - myConsole->cartridge().bank(bank); + bool status = myConsole->cartridge().bank(bank); myConsole->cartridge().lockBank(); - return true; + return status; } return false; } diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index 3a41511ce..ba5008e56 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -626,6 +626,36 @@ void DebuggerParser::executeA() debugger->cpuDebug().setA((uInt8)args[0]); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// "bank" +void DebuggerParser::executeBank() +{ + int banks = debugger->cartDebug().bankCount(); + if(argCount == 0) + { + commandResult << debugger->cartDebug().getCartType() << ": "; + if(banks < 2) + commandResult << red("bankswitching not supported by this cartridge"); + else + { + commandResult << "current = " << debugger->valueToString(debugger->cartDebug().getBank()) + << " out of " << debugger->valueToString(banks) << " banks"; + } + } + else + { + if(banks == 1) + commandResult << red("bankswitching not supported by this cartridge"); + else if(args[0] >= banks) + commandResult << red("invalid bank number (must be 0 to ") + << debugger->valueToString(banks - 1) << ")"; + else if(debugger->setBank(args[0])) + commandResult << "switched bank OK"; + else + commandResult << red("error switching banks (bankswitching may not be supported)"); + } +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // "base" void DebuggerParser::executeBase() @@ -1362,6 +1392,15 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = { &DebuggerParser::executeA }, + { + "bank", + "Show # of banks, or switch to bank xx", + false, + true, + { kARG_WORD, kARG_END_ARGS }, + &DebuggerParser::executeBank + }, + { "base", "Set default base (hex, dec, or bin)", diff --git a/src/debugger/DebuggerParser.hxx b/src/debugger/DebuggerParser.hxx index 5e60d744a..9a8134d4f 100644 --- a/src/debugger/DebuggerParser.hxx +++ b/src/debugger/DebuggerParser.hxx @@ -83,7 +83,7 @@ class DebuggerParser private: enum { - kNumCommands = 56, + kNumCommands = 57, kMAX_ARG_TYPES = 10 }; @@ -135,6 +135,7 @@ class DebuggerParser // List of available command methods void executeA(); + void executeBank(); void executeBase(); void executeBreak(); void executeBreakif(); diff --git a/src/debugger/DiStella.cxx b/src/debugger/DiStella.cxx index ce8d168e6..8e0c80501 100644 --- a/src/debugger/DiStella.cxx +++ b/src/debugger/DiStella.cxx @@ -23,7 +23,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list, - uInt16 start, bool resolvedata) + const AddressList& addresses, bool resolvedata) : myDbg(dbg), myList(list) { @@ -53,9 +53,17 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list, Offset to code = $D000 Code range = $D000-$DFFF =============================================*/ + if(addresses.size() == 0) + return; + + uInt16 start = addresses[0]; myOffset = (start - (start % 0x1000)); - myAddressQueue.push(start); + // Fill queue with start addresses (entry points into the ROM space) + for(uInt32 i = 0; i < addresses.size(); ++i) +{ cerr << hex << addresses[i] << " "; + myAddressQueue.push(addresses[i]); +} cerr << endl; if(resolvedata) { diff --git a/src/debugger/DiStella.hxx b/src/debugger/DiStella.hxx index b4d9f68b8..2d1e7a4a8 100644 --- a/src/debugger/DiStella.hxx +++ b/src/debugger/DiStella.hxx @@ -48,11 +48,11 @@ class DiStella @param dbg The CartDebug instance containing all label information @param list The results of the disassembly are placed here - @param start The address at which to start disassembly + @param addresses The address(es) at which to start disassembly @param resolvedata If enabled, try to determine code vs. data sections */ DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list, - uInt16 start, bool resolvedata = true); + const AddressList& addresses, bool resolvedata = true); ~DiStella(); diff --git a/src/debugger/gui/RomWidget.cxx b/src/debugger/gui/RomWidget.cxx index 527668039..53aad6b7e 100644 --- a/src/debugger/gui/RomWidget.cxx +++ b/src/debugger/gui/RomWidget.cxx @@ -28,6 +28,7 @@ #include "CpuDebug.hxx" #include "GuiObject.hxx" #include "InputTextDialog.hxx" +#include "DataGridWidget.hxx" #include "EditTextWidget.hxx" #include "PopUpWidget.hxx" #include "StringList.hxx" @@ -50,26 +51,25 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y) // Show current bank xpos = x; ypos = y + 7; + ostringstream buf; + buf << "Current bank (" << dec + << instance().debugger().cartDebug().bankCount() << " total):"; t = new StaticTextWidget(boss, font, xpos, ypos, - font.getStringWidth("Bank (current/total):"), + font.getStringWidth(buf.str()), font.getFontHeight(), - "Bank (current/total):", kTextAlignLeft); + buf.str(), kTextAlignLeft); - xpos += t->getWidth() + 10; - myBank = new EditTextWidget(boss, font, xpos, ypos-2, - 4 * font.getMaxCharWidth(), - font.getLineHeight(), ""); - myBank->setEditable(false); - - // Show number of banks - xpos += myBank->getWidth() + 5; - myBankCount = - new EditTextWidget(boss, font, xpos, ypos-2, 4 * font.getMaxCharWidth(), - font.getLineHeight(), ""); - myBankCount->setEditable(false); + xpos += t->getWidth() + 5; + myBank = new DataGridWidget(boss, font, xpos, ypos-2, + 1, 1, 4, 8, kBASE_10); + myBank->setTarget(this); + myBank->setRange(0, instance().debugger().cartDebug().bankCount()); + if(instance().debugger().cartDebug().bankCount() <= 1) + myBank->setEditable(false); + addFocusWidget(myBank); // 'resolvedata' setting for Distella - xpos += myBankCount->getWidth() + 20; + xpos += myBank->getWidth() + 20; StringMap items; items.push_back("Never", "never"); items.push_back("Always", "always"); @@ -134,8 +134,7 @@ void RomWidget::loadConfig() myRomList->setHighlighted(pcline); // Set current bank and number of banks - myBank->setEditString(instance().debugger().valueToString(myCurrentBank, kBASE_10), bankChanged); - myBankCount->setEditString(instance().debugger().valueToString(cart.bankCount(), kBASE_10)); + myBank->setList(-1, myCurrentBank, bankChanged); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -177,6 +176,10 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) break; } + case kDGItemDataChangedCmd: + setBank(myBank->getSelectedValue()); + break; + case kResolveDataChanged: instance().settings().setString("resolvedata", myResolveData->getSelectedTag()); invalidate(); @@ -198,6 +201,14 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void RomWidget::setBank(uInt16 bank) +{ + ostringstream command; + command << "bank #" << bank; + instance().debugger().run(command.str()); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void RomWidget::setBreak(int disasm_line, bool state) { diff --git a/src/debugger/gui/RomWidget.hxx b/src/debugger/gui/RomWidget.hxx index 1cdfbb673..eedd8e029 100644 --- a/src/debugger/gui/RomWidget.hxx +++ b/src/debugger/gui/RomWidget.hxx @@ -24,6 +24,7 @@ #define ROM_WIDGET_HXX class GuiObject; +class DataGridWidget; class EditTextWidget; class InputTextDialog; class PopUpWidget; @@ -47,6 +48,7 @@ class RomWidget : public Widget, public CommandSender void loadConfig(); private: + void setBank(uInt16 bank); void setBreak(int disasm_line, bool state); void setPC(int disasm_line); void runtoPC(int disasm_line); @@ -60,8 +62,7 @@ class RomWidget : public Widget, public CommandSender }; RomListWidget* myRomList; - EditTextWidget* myBank; - EditTextWidget* myBankCount; + DataGridWidget* myBank; PopUpWidget* myResolveData; InputTextDialog* mySaveRom; diff --git a/src/emucore/Cart.hxx b/src/emucore/Cart.hxx index 65d0a7099..5bd51f122 100644 --- a/src/emucore/Cart.hxx +++ b/src/emucore/Cart.hxx @@ -130,7 +130,7 @@ class Cartridge : public Device /** Set the specified bank. */ - virtual void bank(uInt16 bank) = 0; + virtual bool bank(uInt16 bank) = 0; /** Get the current bank. diff --git a/src/emucore/Cart0840.cxx b/src/emucore/Cart0840.cxx index b95332537..74582cd07 100644 --- a/src/emucore/Cart0840.cxx +++ b/src/emucore/Cart0840.cxx @@ -146,9 +146,9 @@ bool Cartridge0840::poke(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Cartridge0840::bank(uInt16 bank) +bool Cartridge0840::bank(uInt16 bank) { - if(bankLocked()) return; + if(bankLocked()) return false; // Remember what bank we're in myCurrentBank = bank; @@ -167,7 +167,7 @@ void Cartridge0840::bank(uInt16 bank) access.directPeekBase = &myImage[offset + (address & 0x0FFF)]; mySystem->setPageAccess(address >> shift, access); } - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/Cart0840.hxx b/src/emucore/Cart0840.hxx index bbe02187a..76afceda9 100644 --- a/src/emucore/Cart0840.hxx +++ b/src/emucore/Cart0840.hxx @@ -64,7 +64,7 @@ class Cartridge0840 : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/Cart2K.cxx b/src/emucore/Cart2K.cxx index 994938fc1..ea9b4ac6e 100644 --- a/src/emucore/Cart2K.cxx +++ b/src/emucore/Cart2K.cxx @@ -101,9 +101,10 @@ bool Cartridge2K::poke(uInt16, uInt8) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Cartridge2K::bank(uInt16 bank) +bool Cartridge2K::bank(uInt16 bank) { // Doesn't support bankswitching + return false; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/Cart2K.hxx b/src/emucore/Cart2K.hxx index 742e6c6f2..094ad5b07 100644 --- a/src/emucore/Cart2K.hxx +++ b/src/emucore/Cart2K.hxx @@ -68,7 +68,7 @@ class Cartridge2K : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/Cart3E.cxx b/src/emucore/Cart3E.cxx index 463415bd9..53be3d83c 100644 --- a/src/emucore/Cart3E.cxx +++ b/src/emucore/Cart3E.cxx @@ -158,9 +158,9 @@ bool Cartridge3E::poke(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Cartridge3E::bank(uInt16 bank) +bool Cartridge3E::bank(uInt16 bank) { - if(bankLocked()) return; + if(bankLocked()) return false; if(bank < 256) { @@ -225,7 +225,7 @@ void Cartridge3E::bank(uInt16 bank) mySystem->setPageAccess(address >> shift, access); } } - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/Cart3E.hxx b/src/emucore/Cart3E.hxx index 2320316ff..f88718ade 100644 --- a/src/emucore/Cart3E.hxx +++ b/src/emucore/Cart3E.hxx @@ -96,7 +96,7 @@ class Cartridge3E : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/Cart3F.cxx b/src/emucore/Cart3F.cxx index f5e32b663..1a0138b4b 100644 --- a/src/emucore/Cart3F.cxx +++ b/src/emucore/Cart3F.cxx @@ -123,9 +123,9 @@ bool Cartridge3F::poke(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Cartridge3F::bank(uInt16 bank) +bool Cartridge3F::bank(uInt16 bank) { - if(bankLocked()) return; + if(bankLocked()) return false; // Make sure the bank they're asking for is reasonable if(((uInt32)bank << 11) < mySize) @@ -154,7 +154,7 @@ void Cartridge3F::bank(uInt16 bank) access.directPeekBase = &myImage[offset + (address & 0x07FF)]; mySystem->setPageAccess(address >> shift, access); } - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/Cart3F.hxx b/src/emucore/Cart3F.hxx index 10be4d6d9..a653acd31 100644 --- a/src/emucore/Cart3F.hxx +++ b/src/emucore/Cart3F.hxx @@ -73,7 +73,7 @@ class Cartridge3F : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/Cart4A50.cxx b/src/emucore/Cart4A50.cxx index 6119f18f5..9ae0fab01 100644 --- a/src/emucore/Cart4A50.cxx +++ b/src/emucore/Cart4A50.cxx @@ -311,9 +311,10 @@ void Cartridge4A50::checkBankSwitch(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Cartridge4A50::bank(uInt16) +bool Cartridge4A50::bank(uInt16) { // Doesn't support bankswitching in the normal sense + return false; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/Cart4A50.hxx b/src/emucore/Cart4A50.hxx index e894df2ab..02149e550 100644 --- a/src/emucore/Cart4A50.hxx +++ b/src/emucore/Cart4A50.hxx @@ -81,7 +81,7 @@ class Cartridge4A50 : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/Cart4K.cxx b/src/emucore/Cart4K.cxx index 5d9bf1fda..da8a0629d 100644 --- a/src/emucore/Cart4K.cxx +++ b/src/emucore/Cart4K.cxx @@ -78,9 +78,10 @@ bool Cartridge4K::poke(uInt16, uInt8) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Cartridge4K::bank(uInt16) +bool Cartridge4K::bank(uInt16) { // Doesn't support bankswitching + return false; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/Cart4K.hxx b/src/emucore/Cart4K.hxx index 1749881c3..f368894a5 100644 --- a/src/emucore/Cart4K.hxx +++ b/src/emucore/Cart4K.hxx @@ -66,7 +66,7 @@ class Cartridge4K : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartAR.cxx b/src/emucore/CartAR.cxx index 0335269b9..202b5bc57 100644 --- a/src/emucore/CartAR.cxx +++ b/src/emucore/CartAR.cxx @@ -216,7 +216,7 @@ bool CartridgeAR::poke(uInt16 addr, uInt8) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeAR::bankConfiguration(uInt8 configuration) +bool CartridgeAR::bankConfiguration(uInt8 configuration) { // D7-D5 of this byte: Write Pulse Delay (n/a for emulator) // @@ -306,7 +306,7 @@ void CartridgeAR::bankConfiguration(uInt8 configuration) break; } } - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -409,10 +409,12 @@ void CartridgeAR::loadIntoRAM(uInt8 load) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeAR::bank(uInt16 bank) +bool CartridgeAR::bank(uInt16 bank) { if(!bankLocked()) - bankConfiguration(bank); + return bankConfiguration(bank); + else + return false; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartAR.hxx b/src/emucore/CartAR.hxx index e2e5c2cba..a26b07df6 100644 --- a/src/emucore/CartAR.hxx +++ b/src/emucore/CartAR.hxx @@ -82,7 +82,7 @@ class CartridgeAR : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. @@ -153,7 +153,7 @@ class CartridgeAR : public Cartridge private: // Handle a change to the bank configuration - void bankConfiguration(uInt8 configuration); + bool bankConfiguration(uInt8 configuration); // Compute the sum of the array of bytes uInt8 checksum(uInt8* s, uInt16 length); diff --git a/src/emucore/CartCV.cxx b/src/emucore/CartCV.cxx index 1ca54b68b..7814b71a6 100644 --- a/src/emucore/CartCV.cxx +++ b/src/emucore/CartCV.cxx @@ -149,9 +149,10 @@ bool CartridgeCV::poke(uInt16, uInt8) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeCV::bank(uInt16 bank) +bool CartridgeCV::bank(uInt16 bank) { // Doesn't support bankswitching + return false; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartCV.hxx b/src/emucore/CartCV.hxx index d4209ec08..ac8b46ff4 100644 --- a/src/emucore/CartCV.hxx +++ b/src/emucore/CartCV.hxx @@ -69,7 +69,7 @@ class CartridgeCV : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartDPC.cxx b/src/emucore/CartDPC.cxx index 5c4dc77d5..7356391e7 100644 --- a/src/emucore/CartDPC.cxx +++ b/src/emucore/CartDPC.cxx @@ -416,9 +416,9 @@ bool CartridgeDPC::poke(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeDPC::bank(uInt16 bank) +bool CartridgeDPC::bank(uInt16 bank) { - if(bankLocked()) return; + if(bankLocked()) return false; // Remember what bank we're in myCurrentBank = bank; @@ -439,7 +439,7 @@ void CartridgeDPC::bank(uInt16 bank) access.directPeekBase = &myProgramImage[offset + (address & 0x0FFF)]; mySystem->setPageAccess(address >> shift, access); } - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartDPC.hxx b/src/emucore/CartDPC.hxx index 64309ad94..051f0d8c9 100644 --- a/src/emucore/CartDPC.hxx +++ b/src/emucore/CartDPC.hxx @@ -74,7 +74,7 @@ class CartridgeDPC : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartDPCPlus.cxx b/src/emucore/CartDPCPlus.cxx index 90a98a38b..473d0e7f8 100644 --- a/src/emucore/CartDPCPlus.cxx +++ b/src/emucore/CartDPCPlus.cxx @@ -545,14 +545,14 @@ bool CartridgeDPCPlus::poke(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeDPCPlus::bank(uInt16 bank) +bool CartridgeDPCPlus::bank(uInt16 bank) { - if(bankLocked()) return; + if(bankLocked()) return false; // Remember what bank we're in myCurrentBank = bank; - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartDPCPlus.hxx b/src/emucore/CartDPCPlus.hxx index c0cf2ef51..f6fb6f2b5 100644 --- a/src/emucore/CartDPCPlus.hxx +++ b/src/emucore/CartDPCPlus.hxx @@ -74,7 +74,7 @@ class CartridgeDPCPlus : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartE0.cxx b/src/emucore/CartE0.cxx index 2789ed4d0..5e245d067 100644 --- a/src/emucore/CartE0.cxx +++ b/src/emucore/CartE0.cxx @@ -200,9 +200,10 @@ void CartridgeE0::segmentTwo(uInt16 slice) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeE0::bank(uInt16) +bool CartridgeE0::bank(uInt16) { // Doesn't support bankswitching in the normal sense + return false; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartE0.hxx b/src/emucore/CartE0.hxx index 74a7aa5c6..1dd2537de 100644 --- a/src/emucore/CartE0.hxx +++ b/src/emucore/CartE0.hxx @@ -75,7 +75,7 @@ class CartridgeE0 : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartE7.cxx b/src/emucore/CartE7.cxx index f202e74d6..07d015db8 100644 --- a/src/emucore/CartE7.cxx +++ b/src/emucore/CartE7.cxx @@ -199,9 +199,9 @@ void CartridgeE7::bankRAM(uInt16 bank) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeE7::bank(uInt16 slice) +bool CartridgeE7::bank(uInt16 slice) { - if(bankLocked()) return; + if(bankLocked()) return false; // Remember what bank we're in myCurrentSlice[0] = slice; @@ -245,7 +245,7 @@ void CartridgeE7::bank(uInt16 slice) mySystem->setPageAccess(k >> shift, access); } } - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartE7.hxx b/src/emucore/CartE7.hxx index 34b254963..82227db11 100644 --- a/src/emucore/CartE7.hxx +++ b/src/emucore/CartE7.hxx @@ -92,7 +92,7 @@ class CartridgeE7 : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartEF.cxx b/src/emucore/CartEF.cxx index da3a6c734..8c333f5ea 100644 --- a/src/emucore/CartEF.cxx +++ b/src/emucore/CartEF.cxx @@ -94,9 +94,9 @@ bool CartridgeEF::poke(uInt16 address, uInt8) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeEF::bank(uInt16 bank) +bool CartridgeEF::bank(uInt16 bank) { - if(bankLocked()) return; + if(bankLocked()) return false; // Remember what bank we're in myCurrentBank = bank; @@ -118,7 +118,7 @@ void CartridgeEF::bank(uInt16 bank) access.directPeekBase = &myImage[offset + (address & 0x0FFF)]; mySystem->setPageAccess(address >> shift, access); } - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartEF.hxx b/src/emucore/CartEF.hxx index 4aef4c22a..437b874a1 100644 --- a/src/emucore/CartEF.hxx +++ b/src/emucore/CartEF.hxx @@ -70,7 +70,7 @@ class CartridgeEF : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartEFSC.cxx b/src/emucore/CartEFSC.cxx index 452dda7f1..2af4ae23f 100644 --- a/src/emucore/CartEFSC.cxx +++ b/src/emucore/CartEFSC.cxx @@ -139,9 +139,9 @@ bool CartridgeEFSC::poke(uInt16 address, uInt8) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeEFSC::bank(uInt16 bank) +bool CartridgeEFSC::bank(uInt16 bank) { - if(bankLocked()) return; + if(bankLocked()) return false; // Remember what bank we're in myCurrentBank = bank; @@ -162,7 +162,7 @@ void CartridgeEFSC::bank(uInt16 bank) access.directPeekBase = &myImage[offset + (address & 0x0FFF)]; mySystem->setPageAccess(address >> shift, access); } - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartEFSC.hxx b/src/emucore/CartEFSC.hxx index 3477aba86..a58345028 100644 --- a/src/emucore/CartEFSC.hxx +++ b/src/emucore/CartEFSC.hxx @@ -70,7 +70,7 @@ class CartridgeEFSC : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartF0.cxx b/src/emucore/CartF0.cxx index 12f03ea65..5b308e64e 100644 --- a/src/emucore/CartF0.cxx +++ b/src/emucore/CartF0.cxx @@ -124,12 +124,14 @@ void CartridgeF0::incbank() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeF0::bank(uInt16 bank) +bool CartridgeF0::bank(uInt16 bank) { - if(bankLocked()) return; + if(bankLocked()) return false; myCurrentBank = bank - 1; incbank(); + + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartF0.hxx b/src/emucore/CartF0.hxx index fff6b5cbd..9873df608 100644 --- a/src/emucore/CartF0.hxx +++ b/src/emucore/CartF0.hxx @@ -67,7 +67,7 @@ class CartridgeF0 : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartF4.cxx b/src/emucore/CartF4.cxx index 043c887a3..3f3e67496 100644 --- a/src/emucore/CartF4.cxx +++ b/src/emucore/CartF4.cxx @@ -99,9 +99,9 @@ bool CartridgeF4::poke(uInt16 address, uInt8) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeF4::bank(uInt16 bank) +bool CartridgeF4::bank(uInt16 bank) { - if(bankLocked()) return; + if(bankLocked()) return false; // Remember what bank we're in myCurrentBank = bank; @@ -122,7 +122,7 @@ void CartridgeF4::bank(uInt16 bank) access.directPeekBase = &myImage[offset + (address & 0x0FFF)]; mySystem->setPageAccess(address >> shift, access); } - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartF4.hxx b/src/emucore/CartF4.hxx index b796f0a07..6615a04a1 100644 --- a/src/emucore/CartF4.hxx +++ b/src/emucore/CartF4.hxx @@ -66,7 +66,7 @@ class CartridgeF4 : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartF4SC.cxx b/src/emucore/CartF4SC.cxx index e3934a3a6..d15e0a44a 100644 --- a/src/emucore/CartF4SC.cxx +++ b/src/emucore/CartF4SC.cxx @@ -142,9 +142,9 @@ bool CartridgeF4SC::poke(uInt16 address, uInt8) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeF4SC::bank(uInt16 bank) +bool CartridgeF4SC::bank(uInt16 bank) { - if(bankLocked()) return; + if(bankLocked()) return false; // Remember what bank we're in myCurrentBank = bank; @@ -165,7 +165,7 @@ void CartridgeF4SC::bank(uInt16 bank) access.directPeekBase = &myImage[offset + (address & 0x0FFF)]; mySystem->setPageAccess(address >> shift, access); } - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartF4SC.hxx b/src/emucore/CartF4SC.hxx index 274ac15f6..8db5ed3d8 100644 --- a/src/emucore/CartF4SC.hxx +++ b/src/emucore/CartF4SC.hxx @@ -66,7 +66,7 @@ class CartridgeF4SC : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartF6.cxx b/src/emucore/CartF6.cxx index 831537c67..24214bb36 100644 --- a/src/emucore/CartF6.cxx +++ b/src/emucore/CartF6.cxx @@ -139,9 +139,9 @@ bool CartridgeF6::poke(uInt16 address, uInt8) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeF6::bank(uInt16 bank) +bool CartridgeF6::bank(uInt16 bank) { - if(bankLocked()) return; + if(bankLocked()) return false; // Remember what bank we're in myCurrentBank = bank; @@ -162,7 +162,7 @@ void CartridgeF6::bank(uInt16 bank) access.directPeekBase = &myImage[offset + (address & 0x0FFF)]; mySystem->setPageAccess(address >> shift, access); } - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartF6.hxx b/src/emucore/CartF6.hxx index b080d835c..03ea30a66 100644 --- a/src/emucore/CartF6.hxx +++ b/src/emucore/CartF6.hxx @@ -66,7 +66,7 @@ class CartridgeF6 : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartF6SC.cxx b/src/emucore/CartF6SC.cxx index f10b0b5b9..dc763cf7a 100644 --- a/src/emucore/CartF6SC.cxx +++ b/src/emucore/CartF6SC.cxx @@ -185,9 +185,9 @@ bool CartridgeF6SC::poke(uInt16 address, uInt8) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeF6SC::bank(uInt16 bank) +bool CartridgeF6SC::bank(uInt16 bank) { - if(bankLocked()) return; + if(bankLocked()) return false; // Remember what bank we're in myCurrentBank = bank; @@ -208,7 +208,7 @@ void CartridgeF6SC::bank(uInt16 bank) access.directPeekBase = &myImage[offset + (address & 0x0FFF)]; mySystem->setPageAccess(address >> shift, access); } - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartF6SC.hxx b/src/emucore/CartF6SC.hxx index 9b894e1c2..0ca0e6f7a 100644 --- a/src/emucore/CartF6SC.hxx +++ b/src/emucore/CartF6SC.hxx @@ -66,7 +66,7 @@ class CartridgeF6SC : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartF8.cxx b/src/emucore/CartF8.cxx index c0f25aed5..730fc8007 100644 --- a/src/emucore/CartF8.cxx +++ b/src/emucore/CartF8.cxx @@ -125,9 +125,9 @@ bool CartridgeF8::poke(uInt16 address, uInt8) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeF8::bank(uInt16 bank) +bool CartridgeF8::bank(uInt16 bank) { - if(bankLocked()) return; + if(bankLocked()) return false; // Remember what bank we're in myCurrentBank = bank; @@ -148,7 +148,7 @@ void CartridgeF8::bank(uInt16 bank) access.directPeekBase = &myImage[offset + (address & 0x0FFF)]; mySystem->setPageAccess(address >> shift, access); } - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartF8.hxx b/src/emucore/CartF8.hxx index 31df7ca52..91aecfcbb 100644 --- a/src/emucore/CartF8.hxx +++ b/src/emucore/CartF8.hxx @@ -67,7 +67,7 @@ class CartridgeF8 : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartF8SC.cxx b/src/emucore/CartF8SC.cxx index d4f5eb388..a045cdc07 100644 --- a/src/emucore/CartF8SC.cxx +++ b/src/emucore/CartF8SC.cxx @@ -165,9 +165,9 @@ bool CartridgeF8SC::poke(uInt16 address, uInt8) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeF8SC::bank(uInt16 bank) +bool CartridgeF8SC::bank(uInt16 bank) { - if(bankLocked()) return; + if(bankLocked()) return false; // Remember what bank we're in myCurrentBank = bank; @@ -188,7 +188,7 @@ void CartridgeF8SC::bank(uInt16 bank) access.directPeekBase = &myImage[offset + (address & 0x0FFF)]; mySystem->setPageAccess(address >> shift, access); } - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartF8SC.hxx b/src/emucore/CartF8SC.hxx index 7debc4759..dcf5c38a5 100644 --- a/src/emucore/CartF8SC.hxx +++ b/src/emucore/CartF8SC.hxx @@ -66,7 +66,7 @@ class CartridgeF8SC : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartFA.cxx b/src/emucore/CartFA.cxx index d24c94fd2..2e4d39e97 100644 --- a/src/emucore/CartFA.cxx +++ b/src/emucore/CartFA.cxx @@ -175,9 +175,9 @@ bool CartridgeFA::poke(uInt16 address, uInt8) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeFA::bank(uInt16 bank) +bool CartridgeFA::bank(uInt16 bank) { - if(bankLocked()) return; + if(bankLocked()) return false; // Remember what bank we're in myCurrentBank = bank; @@ -198,7 +198,7 @@ void CartridgeFA::bank(uInt16 bank) access.directPeekBase = &myImage[offset + (address & 0x0FFF)]; mySystem->setPageAccess(address >> shift, access); } - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartFA.hxx b/src/emucore/CartFA.hxx index e31413040..045fb3a60 100644 --- a/src/emucore/CartFA.hxx +++ b/src/emucore/CartFA.hxx @@ -66,7 +66,7 @@ class CartridgeFA : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartFE.cxx b/src/emucore/CartFE.cxx index 8831678ef..cbc5a7ec2 100644 --- a/src/emucore/CartFE.cxx +++ b/src/emucore/CartFE.cxx @@ -83,9 +83,10 @@ bool CartridgeFE::poke(uInt16, uInt8) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeFE::bank(uInt16 b) +bool CartridgeFE::bank(uInt16) { // Doesn't support bankswitching in the normal sense + return false; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartFE.hxx b/src/emucore/CartFE.hxx index a0b197f17..695d88024 100644 --- a/src/emucore/CartFE.hxx +++ b/src/emucore/CartFE.hxx @@ -81,7 +81,7 @@ class CartridgeFE : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartMC.cxx b/src/emucore/CartMC.cxx index eeb8c4ab9..316c372a8 100644 --- a/src/emucore/CartMC.cxx +++ b/src/emucore/CartMC.cxx @@ -210,9 +210,10 @@ bool CartridgeMC::poke(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeMC::bank(uInt16 b) +bool CartridgeMC::bank(uInt16 b) { // Doesn't support bankswitching in the normal sense + return false; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartMC.hxx b/src/emucore/CartMC.hxx index 3447e7213..23ce9fd9b 100644 --- a/src/emucore/CartMC.hxx +++ b/src/emucore/CartMC.hxx @@ -173,7 +173,7 @@ class CartridgeMC : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartSB.cxx b/src/emucore/CartSB.cxx index b9d4fbbfd..6d7f9a8af 100644 --- a/src/emucore/CartSB.cxx +++ b/src/emucore/CartSB.cxx @@ -125,9 +125,9 @@ bool CartridgeSB::poke(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeSB::bank(uInt16 bank) +bool CartridgeSB::bank(uInt16 bank) { - if(bankLocked()) return; + if(bankLocked()) return false; // Remember what bank we're in myCurrentBank = bank; @@ -146,7 +146,7 @@ void CartridgeSB::bank(uInt16 bank) access.directPeekBase = &myImage[offset + (address & 0x0FFF)]; mySystem->setPageAccess(address >> shift, access); } - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartSB.hxx b/src/emucore/CartSB.hxx index 4bce1635c..1e4912213 100644 --- a/src/emucore/CartSB.hxx +++ b/src/emucore/CartSB.hxx @@ -64,7 +64,7 @@ class CartridgeSB : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartUA.cxx b/src/emucore/CartUA.cxx index 1be139672..6655f088d 100644 --- a/src/emucore/CartUA.cxx +++ b/src/emucore/CartUA.cxx @@ -134,9 +134,9 @@ bool CartridgeUA::poke(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeUA::bank(uInt16 bank) +bool CartridgeUA::bank(uInt16 bank) { - if(bankLocked()) return; + if(bankLocked()) return false; // Remember what bank we're in myCurrentBank = bank; @@ -155,7 +155,7 @@ void CartridgeUA::bank(uInt16 bank) access.directPeekBase = &myImage[offset + (address & 0x0FFF)]; mySystem->setPageAccess(address >> shift, access); } - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartUA.hxx b/src/emucore/CartUA.hxx index 4e03bb466..f1bc95f3f 100644 --- a/src/emucore/CartUA.hxx +++ b/src/emucore/CartUA.hxx @@ -67,7 +67,7 @@ class CartridgeUA : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank. diff --git a/src/emucore/CartX07.cxx b/src/emucore/CartX07.cxx index 0318022c9..7765e9237 100644 --- a/src/emucore/CartX07.cxx +++ b/src/emucore/CartX07.cxx @@ -118,9 +118,9 @@ bool CartridgeX07::poke(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CartridgeX07::bank(uInt16 bank) +bool CartridgeX07::bank(uInt16 bank) { - if(bankLocked()) return; + if(bankLocked()) return false; // Remember what bank we're in myCurrentBank = (bank & 0x0f); @@ -139,7 +139,7 @@ void CartridgeX07::bank(uInt16 bank) access.directPeekBase = &myImage[offset + (address & 0x0FFF)]; mySystem->setPageAccess(address >> shift, access); } - myBankChanged = true; + return myBankChanged = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartX07.hxx b/src/emucore/CartX07.hxx index a6fc8d2d7..eb917d9bf 100644 --- a/src/emucore/CartX07.hxx +++ b/src/emucore/CartX07.hxx @@ -76,7 +76,7 @@ class CartridgeX07 : public Cartridge @param bank The bank that should be installed in the system */ - void bank(uInt16 bank); + bool bank(uInt16 bank); /** Get the current bank.