diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index ed7842cb9..9932f48a1 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -328,6 +328,8 @@ bool CartDebug::disassemble(int bank, uInt16 PC, Disassembly& disassembly, // For example, if the list contains any $fxxx and the address space is now // $bxxx, it must be changed const uInt16 offset = (PC & 0x1000) ? myConsole.cartridge().bankOrigin(bank, PC) : 0; + if (offset && info.offset == 0) + info.offset = offset; AddressList& addresses = info.addressList; for(auto& i: addresses) i = (i & 0xFFF) + offset; diff --git a/src/emucore/CartE7.cxx b/src/emucore/CartE7.cxx index 093e8fc62..8bfd5ede0 100644 --- a/src/emucore/CartE7.cxx +++ b/src/emucore/CartE7.cxx @@ -285,6 +285,12 @@ uInt16 CartridgeE7::getBank(uInt16 address) const return myCurrentBank[(address & 0xFFF) >> 11]; // 2K segments } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +uInt16 CartridgeE7::getSegmentBank(uInt16 segment) const +{ + return getBank(0x800 * segment); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeE7::patch(uInt16 address, uInt8 value) { diff --git a/src/emucore/CartE7.hxx b/src/emucore/CartE7.hxx index 3509d9bb6..a0fd35639 100644 --- a/src/emucore/CartE7.hxx +++ b/src/emucore/CartE7.hxx @@ -111,6 +111,13 @@ class CartridgeE7 : public Cartridge */ uInt16 getBank(uInt16 address = 0) const override; + /** + Get the current bank for a bank segment. + + @param segment The segment to get the bank for + */ + uInt16 getSegmentBank(uInt16 segment = 0) const override; + /** Query the number of banks supported by the cartridge. */