The debugger disassembly (both in the ROM view and the prompt) and the

listconfig command are now synchronized, and produce the same output.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2736 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2013-05-17 01:05:50 +00:00
parent a5bdbaf997
commit 640927b1c6
2 changed files with 19 additions and 24 deletions

View File

@ -339,33 +339,16 @@ int CartDebug::addressToLine(uInt16 address) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartDebug::disassemble(uInt16 start, uInt16 lines) const string CartDebug::disassemble(uInt16 start, uInt16 lines) const
{ {
Disassembly disasm;
BankInfo info;
info.addressList.push_back(start);
if(start & 0x1000)
{
int banksize = 0;
myConsole.cartridge().getImage(banksize);
info.size = BSPF_min(banksize, 4096);
}
else
info.size = 128;
DiStella distella(*this, disasm.list, info, DiStella::settings,
(uInt8*)myDisLabels, (uInt8*)myDisDirectives,
(ReservedEquates&)myReserved, false);
// Fill the string with disassembled data // Fill the string with disassembled data
start &= 0xFFF; start &= 0xFFF;
ostringstream buffer; ostringstream buffer;
// First find the lines in the range, and determine the longest string // First find the lines in the range, and determine the longest string
uInt32 list_size = disasm.list.size(); uInt32 list_size = myDisassembly.list.size();
uInt32 begin = list_size, end = 0, length = 0; uInt32 begin = list_size, end = 0, length = 0;
for(end = 0; end < list_size && lines > 0; ++end) for(end = 0; end < list_size && lines > 0; ++end)
{ {
const CartDebug::DisassemblyTag& tag = disasm.list[end]; const CartDebug::DisassemblyTag& tag = myDisassembly.list[end];
if((tag.address & 0xfff) >= start) if((tag.address & 0xfff) >= start)
{ {
if(begin == list_size) begin = end; if(begin == list_size) begin = end;
@ -379,7 +362,7 @@ string CartDebug::disassemble(uInt16 start, uInt16 lines) const
// Now output the disassembly, using as little space as possible // Now output the disassembly, using as little space as possible
for(uInt32 i = begin; i < end; ++i) for(uInt32 i = begin; i < end; ++i)
{ {
const CartDebug::DisassemblyTag& tag = disasm.list[i]; const CartDebug::DisassemblyTag& tag = myDisassembly.list[i];
if(tag.type == CartDebug::NONE) if(tag.type == CartDebug::NONE)
continue; continue;
else if(tag.address) else if(tag.address)
@ -388,9 +371,9 @@ string CartDebug::disassemble(uInt16 start, uInt16 lines) const
else else
buffer << " "; buffer << " ";
buffer << tag.disasm << setw(length - tag.disasm.length() + 1) buffer << tag.disasm << setw(length - tag.disasm.length() + 2)
<< setfill(' ') << " " << setfill(' ') << " "
<< tag.ccount << " " << tag.bytes << endl; << setw(4) << left << tag.ccount << " " << tag.bytes << endl;
} }
return buffer.str(); return buffer.str();
@ -1181,7 +1164,7 @@ CartDebug::DisasmType CartDebug::disasmTypeAbsolute(uInt8 flags) const
if(flags & CartDebug::CODE) if(flags & CartDebug::CODE)
return CartDebug::CODE; return CartDebug::CODE;
else if(flags & CartDebug::PCODE) else if(flags & CartDebug::PCODE)
return CartDebug::PCODE; return CartDebug::CODE; // TODO - should this be separate??
else if(flags & CartDebug::GFX) else if(flags & CartDebug::GFX)
return CartDebug::GFX; return CartDebug::GFX;
else if(flags & CartDebug::PGFX) else if(flags & CartDebug::PGFX)

View File

@ -175,6 +175,15 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
} }
for (int k = 0; k <= myAppData.end; k++) for (int k = 0; k <= myAppData.end; k++)
{ {
// Let the emulation core know about preliminary code
if(check_bit(k, CartDebug::CODE) &&
!(Debugger::debugger().getAccessFlags(k+myOffset) & CartDebug::CODE)
&& myOffset != 0)
{
Debugger::debugger().setAccessFlags(k+myOffset, CartDebug::PCODE);
}
// Must be ROW / unused bytes
if (!check_bit(k, CartDebug::CODE | CartDebug::GFX | if (!check_bit(k, CartDebug::CODE | CartDebug::GFX |
CartDebug::PGFX | CartDebug::DATA)) CartDebug::PGFX | CartDebug::DATA))
mark(k+myOffset, CartDebug::ROW); mark(k+myOffset, CartDebug::ROW);
@ -1020,8 +1029,11 @@ void DiStella::addEntry(CartDebug::DisasmType type)
// Since it is impossible to tell the difference, marking the address // Since it is impossible to tell the difference, marking the address
// in the disassembly at least tells the user about it // in the disassembly at least tells the user about it
if(!(Debugger::debugger().getAccessFlags(tag.address) & CartDebug::CODE) if(!(Debugger::debugger().getAccessFlags(tag.address) & CartDebug::CODE)
&& myAppData.length >= 4096) && myOffset != 0)
{
tag.ccount += " *"; tag.ccount += " *";
Debugger::debugger().setAccessFlags(tag.address, CartDebug::PCODE);
}
break; break;
case CartDebug::GFX: case CartDebug::GFX:
case CartDebug::PGFX: case CartDebug::PGFX: