mirror of https://github.com/stella-emu/stella.git
improved bank origin detection (fixes #428)
This commit is contained in:
parent
47710cdbcd
commit
cdecb9165e
|
@ -290,7 +290,7 @@ bool CartDebug::disassemble(int bank, uInt16 PC, bool force)
|
|||
// If the offset 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));
|
||||
uInt16 offset = myConsole.cartridge().bankOrigin(bank, PC);
|
||||
AddressList& addresses = info.addressList;
|
||||
for(auto& i: addresses)
|
||||
i = (i & 0xFFF) + offset;
|
||||
|
|
|
@ -180,10 +180,10 @@ string Cartridge::getAccessCounters() const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt16 Cartridge::bankOrigin(uInt16 bank) const
|
||||
uInt16 Cartridge::bankOrigin(uInt16 bank, uInt16 PC) const
|
||||
{
|
||||
// isolate the high 3 address bits, count them and
|
||||
// select the most frequent to define the bank origin
|
||||
// Isolate the high 3 address bits, count them, include the PC if provided
|
||||
// and select the most frequent to define the bank origin
|
||||
// TODO: origin for banks smaller than 4K
|
||||
constexpr int intervals = 0x8000 / 0x100;
|
||||
const uInt32 offset = bank * bankSize();
|
||||
|
@ -196,6 +196,8 @@ uInt16 Cartridge::bankOrigin(uInt16 bank) const
|
|||
//addrMask;
|
||||
|
||||
count.fill(0);
|
||||
if(PC)
|
||||
count[PC >> 13]++;
|
||||
for(uInt16 addr = 0x0000; addr < bankSize(bank); ++addr)
|
||||
{
|
||||
const Device::AccessFlags flags = myRomAccessBase[offset + addr];
|
||||
|
|
|
@ -189,9 +189,10 @@ class Cartridge : public Device
|
|||
Determine the bank's origin
|
||||
|
||||
@param bank The bank to query
|
||||
@param PC The current PC
|
||||
@return The origin of the bank
|
||||
*/
|
||||
uInt16 bankOrigin(uInt16 bank) const;
|
||||
uInt16 bankOrigin(uInt16 bank, uInt16 PC = 0) const;
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue