mirror of https://github.com/stella-emu/stella.git
fixed bank crossing branches
This commit is contained in:
parent
bcc8fe6e6e
commit
06a70ec90b
|
@ -86,7 +86,8 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
|
|||
if (myDbg.addressType(k + myOffset) == CartDebug::AddrType::ROM) {
|
||||
reservedLabel.str("");
|
||||
labelHigh(reservedLabel, k + myOffset);
|
||||
myReserved.Label.emplace(k + myOffset, reservedLabel.str());
|
||||
myReserved.Label.emplace(CartDebug::BankAddress(myBank, k + myOffset),
|
||||
reservedLabel.str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -538,15 +539,28 @@ void DiStella::disasm(uInt32 distart, int pass)
|
|||
d1 = Debugger::debugger().peek(myPC + myOffset); ++myPC;
|
||||
ad = ((myPC + Int8(d1)) & 0xfff) + myOffset;
|
||||
|
||||
labelFound = mark(ad, Device::REFERENCED);
|
||||
// Detect cross-bank branches
|
||||
bool crossBank = Int32(myPC) + Int8(d1) < myAppData.start
|
||||
|| Int32(myPC) + Int8(d1) > myAppData.end;
|
||||
|
||||
if(!crossBank)
|
||||
labelFound = mark(ad, Device::REFERENCED);
|
||||
else
|
||||
{
|
||||
labelFound = AddressType::INVALID;
|
||||
cerr << myBank << "_" << myPC << ": " << Base::HEX2 << std::to_string(Int8(d1)) << endl;
|
||||
}
|
||||
|
||||
if(pass == 3) {
|
||||
if(labelFound == AddressType::ROM) {
|
||||
nextLine << " ";
|
||||
LABEL_HIGH(ad);
|
||||
}
|
||||
else
|
||||
else if(!crossBank)
|
||||
nextLine << " $" << Base::HEX4 << ad;
|
||||
|
||||
else
|
||||
nextLine << " . " << (Int8(d1) > 0 ? "+" : "-")
|
||||
<< " $" << Base::HEX2 << std::to_string(abs(Int8(d1)));
|
||||
nextLineBytes << Base::HEX2 << int(d1);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -117,13 +117,13 @@ class DiStella
|
|||
// Convenience methods to generate appropriate labels
|
||||
inline void lineLabelHigh(stringstream& buf, uInt16 addr)
|
||||
{
|
||||
stringstream buf8;
|
||||
stringstream buf10; // must be formatted as '8x'
|
||||
|
||||
buf8 << "'L";
|
||||
buf10 << "'L";
|
||||
if(myNumBanks > 1)
|
||||
buf8 << Common::Base::HEX1 << myBank << "_";
|
||||
buf8 << Common::Base::HEX4 << addr;
|
||||
buf << std::left << std::setw(9) << std::setfill(' ') << buf8.str() << "'";
|
||||
buf10 << Common::Base::HEX1 << myBank << "_";
|
||||
buf10 << Common::Base::HEX4 << addr;
|
||||
buf << std::left << std::setw(9) << std::setfill(' ') << buf10.str() << "'";
|
||||
}
|
||||
|
||||
inline void labelHigh(stringstream& buf, uInt16 addr)
|
||||
|
|
Loading…
Reference in New Issue