mirror of https://github.com/stella-emu/stella.git
1st part of Distella improvements
This commit is contained in:
parent
648ed74527
commit
95b04b2baa
|
@ -986,7 +986,7 @@ string CartDebug::saveDisassembly()
|
||||||
settings.aflag = false; // Otherwise DASM gets confused
|
settings.aflag = false; // Otherwise DASM gets confused
|
||||||
settings.fflag = DiStella::settings.fflag;
|
settings.fflag = DiStella::settings.fflag;
|
||||||
settings.rflag = DiStella::settings.rflag;
|
settings.rflag = DiStella::settings.rflag;
|
||||||
settings.bwidth = 17; // default from Distella
|
settings.bwidth = 8+1; // same as Stella debugger
|
||||||
|
|
||||||
Disassembly disasm;
|
Disassembly disasm;
|
||||||
disasm.list.reserve(2048);
|
disasm.list.reserve(2048);
|
||||||
|
@ -1002,8 +1002,8 @@ string CartDebug::saveDisassembly()
|
||||||
DiStella distella(*this, disasm.list, info, settings,
|
DiStella distella(*this, disasm.list, info, settings,
|
||||||
myDisLabels, myDisDirectives, myReserved);
|
myDisLabels, myDisDirectives, myReserved);
|
||||||
|
|
||||||
buf << " SEG CODE\n"
|
buf << " SEG CODE\n"
|
||||||
<< " ORG $" << Base::HEX4 << info.offset << "\n\n";
|
<< " ORG $" << Base::HEX4 << info.offset << "\n\n";
|
||||||
|
|
||||||
// Format in 'distella' style
|
// Format in 'distella' style
|
||||||
for(uInt32 i = 0; i < disasm.list.size(); ++i)
|
for(uInt32 i = 0; i < disasm.list.size(); ++i)
|
||||||
|
@ -1012,55 +1012,53 @@ string CartDebug::saveDisassembly()
|
||||||
|
|
||||||
// Add label (if any)
|
// Add label (if any)
|
||||||
if(tag.label != "")
|
if(tag.label != "")
|
||||||
buf << ALIGN(7) << (tag.label+":") << endl;
|
buf << ALIGN(4) << (tag.label) << "\n";
|
||||||
buf << " ";
|
buf << " ";
|
||||||
|
|
||||||
switch(tag.type)
|
switch(tag.type)
|
||||||
{
|
{
|
||||||
case CartDebug::CODE:
|
case CartDebug::CODE:
|
||||||
{
|
{
|
||||||
buf << ALIGN(25) << tag.disasm << tag.ccount << "\n";
|
buf << ALIGN(32) << tag.disasm << tag.ccount.substr(0, 5) << tag.ctotal << tag.ccount.substr(5, 2);
|
||||||
break;
|
if (tag.disasm.find("WSYNC") != std::string::npos)
|
||||||
}
|
buf << "\n;---------------------------------------";
|
||||||
case CartDebug::NONE:
|
|
||||||
{
|
|
||||||
buf << "\n";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CartDebug::ROW:
|
case CartDebug::ROW:
|
||||||
{
|
{
|
||||||
buf << tag.disasm << "\n";
|
buf << ".byte " << ALIGN(32) << tag.disasm.substr(6, 8*4-1) << "; $" << Base::HEX4 << tag.address << " (*)";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CartDebug::GFX:
|
case CartDebug::GFX:
|
||||||
{
|
{
|
||||||
buf << ".byte " << (settings.gfx_format == Base::F_2 ? "%" : "$")
|
buf << ".byte " << (settings.gfx_format == Base::F_2 ? "%" : "$")
|
||||||
<< tag.bytes << " ; |";
|
<< tag.bytes << " ; |";
|
||||||
for(int c = 12; c < 20; ++c)
|
for(int c = 12; c < 20; ++c)
|
||||||
buf << ((tag.disasm[c] == '\x1e') ? "#" : " ");
|
buf << ((tag.disasm[c] == '\x1e') ? "#" : " ");
|
||||||
buf << "| $" << Base::HEX4 << tag.address << " (G)\n";
|
buf << ALIGN(13) << "|" << "$" << Base::HEX4 << tag.address << " (G)";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CartDebug::PGFX:
|
case CartDebug::PGFX:
|
||||||
{
|
{
|
||||||
buf << ".byte " << (settings.gfx_format == Base::F_2 ? "%" : "$")
|
buf << ".byte " << (settings.gfx_format == Base::F_2 ? "%" : "$")
|
||||||
<< tag.bytes << " ; |";
|
<< tag.bytes << " ; |";
|
||||||
for(int c = 12; c < 20; ++c)
|
for(int c = 12; c < 20; ++c)
|
||||||
buf << ((tag.disasm[c] == '\x1f') ? "*" : " ");
|
buf << ((tag.disasm[c] == '\x1f') ? "*" : " ");
|
||||||
buf << "| $" << Base::HEX4 << tag.address << " (P)\n";
|
buf << ALIGN(13) << "|" << "$" << Base::HEX4 << tag.address << " (P)";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CartDebug::DATA:
|
case CartDebug::DATA:
|
||||||
{
|
{
|
||||||
buf << tag.disasm.substr(0, 9) << " ; $" << Base::HEX4 << tag.address << " (D)\n";
|
buf << ".byte " << ALIGN(32) << tag.disasm.substr(6, 8 * 4 - 1) << "; $" << Base::HEX4 << tag.address << " (D)";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case CartDebug::NONE:
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
buf << "\n";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} // switch
|
||||||
|
buf << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1074,10 +1072,11 @@ string CartDebug::saveDisassembly()
|
||||||
<< "; ROM properties MD5 : " << myConsole.properties().get(Cartridge_MD5) << "\n"
|
<< "; ROM properties MD5 : " << myConsole.properties().get(Cartridge_MD5) << "\n"
|
||||||
<< "; Bankswitch type : " << myConsole.cartridge().about() << "\n;\n"
|
<< "; Bankswitch type : " << myConsole.cartridge().about() << "\n;\n"
|
||||||
<< "; Legend: * = CODE not yet run (tentative code)\n"
|
<< "; Legend: * = CODE not yet run (tentative code)\n"
|
||||||
|
<< "; ! = taken branch crosses page\n"
|
||||||
<< "; D = DATA directive (referenced in some way)\n"
|
<< "; D = DATA directive (referenced in some way)\n"
|
||||||
<< "; G = GFX directive, shown as '#' (stored in player, missile, ball)\n"
|
<< "; G = GFX directive, shown as '#' (stored in player, missile, ball)\n"
|
||||||
<< "; P = PGFX directive, shown as '*' (stored in playfield)\n\n"
|
<< "; P = PGFX directive, shown as '*' (stored in playfield)\n\n"
|
||||||
<< " processor 6502\n\n";
|
<< " processor 6502\n\n";
|
||||||
|
|
||||||
bool addrUsed = false;
|
bool addrUsed = false;
|
||||||
for(uInt16 addr = 0x00; addr <= 0x0F; ++addr)
|
for(uInt16 addr = 0x00; addr <= 0x0F; ++addr)
|
||||||
|
@ -1093,15 +1092,15 @@ string CartDebug::saveDisassembly()
|
||||||
<< ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n";
|
<< ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n";
|
||||||
for(uInt16 addr = 0x00; addr <= 0x0F; ++addr)
|
for(uInt16 addr = 0x00; addr <= 0x0F; ++addr)
|
||||||
if(myReserved.TIARead[addr] && ourTIAMnemonicR[addr])
|
if(myReserved.TIARead[addr] && ourTIAMnemonicR[addr])
|
||||||
out << ALIGN(6) << ourTIAMnemonicR[addr] << " = $"
|
out << ALIGN(16) << ourTIAMnemonicR[addr] << "= $"
|
||||||
<< Base::HEX2 << right << addr << " ; (R)\n";
|
<< Base::HEX2 << right << addr << " ; (R)\n";
|
||||||
for(uInt16 addr = 0x00; addr <= 0x3F; ++addr)
|
for(uInt16 addr = 0x00; addr <= 0x3F; ++addr)
|
||||||
if(myReserved.TIAWrite[addr] && ourTIAMnemonicW[addr])
|
if(myReserved.TIAWrite[addr] && ourTIAMnemonicW[addr])
|
||||||
out << ALIGN(6) << ourTIAMnemonicW[addr] << " = $"
|
out << ALIGN(16) << ourTIAMnemonicW[addr] << "= $"
|
||||||
<< Base::HEX2 << right << addr << " ; (W)\n";
|
<< Base::HEX2 << right << addr << " ; (W)\n";
|
||||||
for(uInt16 addr = 0x00; addr <= 0x17; ++addr)
|
for(uInt16 addr = 0x00; addr <= 0x17; ++addr)
|
||||||
if(myReserved.IOReadWrite[addr] && ourIOMnemonic[addr])
|
if(myReserved.IOReadWrite[addr] && ourIOMnemonic[addr])
|
||||||
out << ALIGN(6) << ourIOMnemonic[addr] << " = $"
|
out << ALIGN(16) << ourIOMnemonic[addr] << "= $"
|
||||||
<< Base::HEX4 << right << (addr+0x280) << "\n";
|
<< Base::HEX4 << right << (addr+0x280) << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1118,7 +1117,7 @@ string CartDebug::saveDisassembly()
|
||||||
if(myReserved.ZPRAM[addr-0x80] &&
|
if(myReserved.ZPRAM[addr-0x80] &&
|
||||||
myUserLabels.find(addr) == myUserLabels.end())
|
myUserLabels.find(addr) == myUserLabels.end())
|
||||||
{
|
{
|
||||||
out << ALIGN(6) << ourZPMnemonic[addr-0x80] << " = $"
|
out << ALIGN(16) << ourZPMnemonic[addr-0x80] << "= $"
|
||||||
<< Base::HEX2 << right << (addr) << "\n";
|
<< Base::HEX2 << right << (addr) << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1130,7 +1129,7 @@ string CartDebug::saveDisassembly()
|
||||||
<< "; NON LOCATABLE\n"
|
<< "; NON LOCATABLE\n"
|
||||||
<< ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n";
|
<< ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n";
|
||||||
for(const auto& iter: myReserved.Label)
|
for(const auto& iter: myReserved.Label)
|
||||||
out << ALIGN(10) << iter.second << " = $" << iter.first << "\n";
|
out << ALIGN(16) << iter.second << "= $" << iter.first << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(myUserLabels.size() > 0)
|
if(myUserLabels.size() > 0)
|
||||||
|
@ -1138,11 +1137,11 @@ string CartDebug::saveDisassembly()
|
||||||
out << "\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"
|
out << "\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"
|
||||||
<< "; USER DEFINED\n"
|
<< "; USER DEFINED\n"
|
||||||
<< ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n";
|
<< ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n";
|
||||||
int max_len = 0;
|
int max_len = 16;
|
||||||
for(const auto& iter: myUserLabels)
|
for(const auto& iter: myUserLabels)
|
||||||
max_len = std::max(max_len, int(iter.second.size()));
|
max_len = std::max(max_len, int(iter.second.size()));
|
||||||
for(const auto& iter: myUserLabels)
|
for(const auto& iter: myUserLabels)
|
||||||
out << ALIGN(max_len) << iter.second << " = $" << iter.first << "\n";
|
out << ALIGN(max_len) << iter.second << "= $" << iter.first << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// And finally, output the disassembly
|
// And finally, output the disassembly
|
||||||
|
@ -1156,7 +1155,7 @@ string CartDebug::saveRom()
|
||||||
{
|
{
|
||||||
const string& rom = myConsole.properties().get(Cartridge_Name) + ".a26";
|
const string& rom = myConsole.properties().get(Cartridge_Name) + ".a26";
|
||||||
|
|
||||||
FilesystemNode node(myOSystem.defaultSaveDir() + rom);
|
FilesystemNode node(myOSystem.defaultSaveDir() + "ROMs\\" + rom);
|
||||||
ofstream out(node.getPath(), std::ios::binary);
|
ofstream out(node.getPath(), std::ios::binary);
|
||||||
if(out && myConsole.cartridge().saveROM(out))
|
if(out && myConsole.cartridge().saveROM(out))
|
||||||
return "saved ROM as " + node.getShortPath();
|
return "saved ROM as " + node.getShortPath();
|
||||||
|
|
|
@ -76,6 +76,7 @@ class CartDebug : public DebuggerSystem
|
||||||
string label;
|
string label;
|
||||||
string disasm;
|
string disasm;
|
||||||
string ccount;
|
string ccount;
|
||||||
|
string ctotal;
|
||||||
string bytes;
|
string bytes;
|
||||||
bool hllabel;
|
bool hllabel;
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -83,7 +83,11 @@ class DiStella
|
||||||
void disasm(uInt32 distart, int pass);
|
void disasm(uInt32 distart, int pass);
|
||||||
bool check_range(uInt16 start, uInt16 end) const;
|
bool check_range(uInt16 start, uInt16 end) const;
|
||||||
int mark(uInt32 address, uInt8 mask, bool directive = false);
|
int mark(uInt32 address, uInt8 mask, bool directive = false);
|
||||||
bool check_bit(uInt16 address, uInt8 mask) const;
|
bool checkBit(uInt16 address, uInt8 mask) const;
|
||||||
|
|
||||||
|
bool DiStella::checkBits(uInt16 address, uInt8 mask, uInt8 notMask) const;
|
||||||
|
void outputGraphics();
|
||||||
|
void outputBytes(CartDebug::DisasmType type);
|
||||||
|
|
||||||
// Convenience methods to generate appropriate labels
|
// Convenience methods to generate appropriate labels
|
||||||
inline void labelA12High(stringstream& buf, uInt8 op, uInt16 addr, int labfound)
|
inline void labelA12High(stringstream& buf, uInt8 op, uInt16 addr, int labfound)
|
||||||
|
@ -114,7 +118,8 @@ class DiStella
|
||||||
CartDebug::ReservedEquates& myReserved;
|
CartDebug::ReservedEquates& myReserved;
|
||||||
stringstream myDisasmBuf;
|
stringstream myDisasmBuf;
|
||||||
std::queue<uInt16> myAddressQueue;
|
std::queue<uInt16> myAddressQueue;
|
||||||
uInt16 myOffset, myPC, myPCEnd;
|
uInt16 myOffset, myPC, myPCEnd, myPass;
|
||||||
|
uInt16 mySegType;
|
||||||
|
|
||||||
struct resource {
|
struct resource {
|
||||||
uInt16 start;
|
uInt16 start;
|
||||||
|
|
|
@ -461,7 +461,7 @@ void RomListWidget::drawWidget(bool hilite)
|
||||||
s.vLine(_x + CheckboxWidget::boxSize() + 5, _y, _y + _h - 1, kColor);
|
s.vLine(_x + CheckboxWidget::boxSize() + 5, _y, _y + _h - 1, kColor);
|
||||||
|
|
||||||
// Draw the list items
|
// Draw the list items
|
||||||
int ccountw = _fontWidth << 2,
|
int ccountw = _fontWidth << 3,
|
||||||
large_disasmw = _w - l.x() - _labelWidth,
|
large_disasmw = _w - l.x() - _labelWidth,
|
||||||
medium_disasmw = large_disasmw - r.width(),
|
medium_disasmw = large_disasmw - r.width(),
|
||||||
small_disasmw = medium_disasmw - (ccountw << 1),
|
small_disasmw = medium_disasmw - (ccountw << 1),
|
||||||
|
|
|
@ -3640,7 +3640,7 @@ case 0x60:
|
||||||
peek(0x0100 + SP++, DISASM_NONE);
|
peek(0x0100 + SP++, DISASM_NONE);
|
||||||
PC = peek(0x0100 + SP++, DISASM_NONE);
|
PC = peek(0x0100 + SP++, DISASM_NONE);
|
||||||
PC |= (uInt16(peek(0x0100 + SP, DISASM_NONE)) << 8);
|
PC |= (uInt16(peek(0x0100 + SP, DISASM_NONE)) << 8);
|
||||||
peek(PC++, DISASM_CODE);
|
peek(PC++, DISASM_NONE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -845,7 +845,7 @@ define(M6502_RTS, `{
|
||||||
peek(0x0100 + SP++, DISASM_NONE);
|
peek(0x0100 + SP++, DISASM_NONE);
|
||||||
PC = peek(0x0100 + SP++, DISASM_NONE);
|
PC = peek(0x0100 + SP++, DISASM_NONE);
|
||||||
PC |= (uInt16(peek(0x0100 + SP, DISASM_NONE)) << 8);
|
PC |= (uInt16(peek(0x0100 + SP, DISASM_NONE)) << 8);
|
||||||
peek(PC++, DISASM_CODE);
|
peek(PC++, DISASM_NONE);
|
||||||
}')
|
}')
|
||||||
|
|
||||||
define(M6502_SAX, `{
|
define(M6502_SAX, `{
|
||||||
|
|
Loading…
Reference in New Issue