mirror of
https://github.com/markdavidlong/AppleSAWS.git
synced 2024-12-26 09:29:39 +00:00
Cleaned up disassembler code a bit. Added a few new labels for disassembler viewer zero page addresses.
This commit is contained in:
parent
e301ca49d0
commit
46f9ceb386
@ -20,30 +20,14 @@ QList<DisassembledItem> Disassembler::disassemble(quint16 from, quint16 to,
|
||||
m_to = to;
|
||||
QList<DisassembledItem> retval;
|
||||
qDebug() << "\n\n*****************\n\nDisassemble: From"<<uint16ToHex(from)<<"to"<<uint16ToHex(to);
|
||||
//#define OLDDISSEM
|
||||
|
||||
#ifdef OLDDISSEM
|
||||
for (int idx = from; idx <= to; )
|
||||
{
|
||||
|
||||
DisassembledItem item;
|
||||
disassembleOp(quint16(idx),item);
|
||||
retval.append(item);
|
||||
idx = item.nextContiguousAddress();
|
||||
if (idx > 0xffff || (idx < from)) {
|
||||
qDebug() << "Breaking.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
MemoryUsageMap memuse;
|
||||
MemoryUsageMap memUse;
|
||||
|
||||
bool stopping = false;
|
||||
quint16 next = from;
|
||||
while (entryPoints.count())
|
||||
{
|
||||
next = entryPoints.takeFirst();
|
||||
//m_jumps.append(entryPoints);
|
||||
m_stack.push(next);
|
||||
}
|
||||
|
||||
@ -55,7 +39,7 @@ QList<DisassembledItem> Disassembler::disassemble(quint16 from, quint16 to,
|
||||
bool ok = false;
|
||||
|
||||
if (next >= from && next <= to) //TODO: Remove this to not limit disassembly to program range
|
||||
ok = disassembleOp(next,item,&memuse);
|
||||
ok = disassembleOp(next,item,&memUse);
|
||||
|
||||
if (ok)
|
||||
{
|
||||
@ -67,24 +51,15 @@ QList<DisassembledItem> Disassembler::disassemble(quint16 from, quint16 to,
|
||||
{
|
||||
qDebug() << "Is Branch";
|
||||
m_stack.push(item.targetAddress());
|
||||
// if (!m_jumps.contains(item.targetAddress()))
|
||||
// {
|
||||
// m_jumps.append(item.targetAddress());
|
||||
// qDebug() << "Appending branch" << uint16ToHex(item.targetAddress()) << "to jump table";
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
if (item.isJsr() && !item.canNotFollow())
|
||||
{
|
||||
if (item.targetAddress() <= to) //TODO: Remove this to not limit disassembly to program range
|
||||
if (item.targetAddress() <= to && item.targetAddress() >= from) //TODO: Remove this to not limit disassembly to program range
|
||||
{
|
||||
if (m_stack.push(item.targetAddress()))
|
||||
//if (!m_jumps.contains(item.targetAddress()))
|
||||
{
|
||||
qDebug() << "Appending" << uint16ToHex(item.targetAddress()) << "to jump table";
|
||||
|
||||
//m_jumps.append(item.targetAddress());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -105,23 +80,14 @@ QList<DisassembledItem> Disassembler::disassemble(quint16 from, quint16 to,
|
||||
stopping = true; // already processed this address
|
||||
}
|
||||
|
||||
// if (found.contains(next)) stopping = true;
|
||||
if (next >= to) stopping = true;
|
||||
// if (stopping) {
|
||||
// qDebug() << "Stopping. Stops processing: "
|
||||
// << item.stopsProcessing()
|
||||
// << ", next>=to: " << (next >= to)
|
||||
// << ", alreadyFound: " << ((!ok)?"true":"false");
|
||||
// }
|
||||
}
|
||||
|
||||
m_memusagemap.merge(memuse);
|
||||
m_memusagemap.merge(memUse);
|
||||
|
||||
if (processRecursively)
|
||||
//while (m_jumps.size())
|
||||
while (!m_stack.isEmpty())
|
||||
{
|
||||
// quint16 num = m_jumps.takeFirst();
|
||||
quint16 num = m_stack.pop();
|
||||
if (!m_memusagemap[num].testFlag(Operation))
|
||||
{
|
||||
@ -134,27 +100,10 @@ QList<DisassembledItem> Disassembler::disassemble(quint16 from, quint16 to,
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
// qSort(retval);
|
||||
std::sort(retval.begin(),retval.end());
|
||||
|
||||
// QStringList hexdump;
|
||||
// foreach (quint16 adr,m_memusagemap.addressesWhichContain(Operation))
|
||||
// {
|
||||
// hexdump.append(uint16ToHex(adr));
|
||||
// }
|
||||
// qDebug() << "Operations:" << hexdump;
|
||||
|
||||
// hexdump.clear();
|
||||
// foreach (quint16 adr,m_memusagemap.addressesWhichContain(OperationArg))
|
||||
// {
|
||||
// hexdump.append(uint16ToHex(adr));
|
||||
// }
|
||||
// qDebug() << "Operations Args:" << hexdump;
|
||||
|
||||
if (processRecursively)
|
||||
{
|
||||
// m_jlm.dumpJumps();
|
||||
m_jumplines = m_jlm.buildJumpLines();
|
||||
qDebug() << "Num Channels: " << m_jlm.getNumJumpLineChannels();
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ ApplesoftFileViewer::ApplesoftFileViewer(QWidget *parent) :
|
||||
setSyntaxHighlighting(settings.value("ASViewer.syntaxHighlighting",true).toBool(), NoReformat);
|
||||
setShowCtrlChars(settings.value("ASViewer.showCtrlChars",true).toBool(), NoReformat);
|
||||
|
||||
// setTextFont(fontFromSettings("ASViewer.textFont", textAreaFont), NoReformat);
|
||||
setTextFont(fontFromSettings("ASViewer.textFont", textAreaFont), NoReformat);
|
||||
setTextFont(textAreaFont, NoReformat);
|
||||
}
|
||||
|
||||
|
@ -265,10 +265,28 @@ QString DisassemblerViewer::getPotentialLabel(quint16 address)
|
||||
return m_bfm->assemblerSymbols()->getSymbolAtAddress(address);
|
||||
}
|
||||
}
|
||||
if (address == 0x20) { return "MON.WINDOW_LEFT"; }
|
||||
if (address == 0x21) { return "MON.WINDOW_WIDTH"; }
|
||||
if (address == 0x22) { return "MON.WINDOW_TOP"; }
|
||||
if (address == 0x23) { return "MON.WINDOW_BOTTOM"; }
|
||||
|
||||
if (address == 0x24) { return "MON.CURSORHORIZ"; }
|
||||
if (address == 0x25) { return "MON.CURSORVERT"; }
|
||||
|
||||
if (address == 0x28) { return "MON.BASL"; }
|
||||
if (address == 0x29) { return "MON.BASH"; }
|
||||
|
||||
if (address == 0x2A) { return "DOS.SCRATCH"; }
|
||||
if (address == 0x2B) { return "DOS.BOOT_SLOT"; }
|
||||
|
||||
if (address == 0x2C) { return "DOS.RWTS_CKSUM"; }
|
||||
if (address == 0x2D) { return "DOS.RWTS_SECTOR"; }
|
||||
if (address == 0x2E) { return "DOS.RWTS_TRACK"; }
|
||||
if (address == 0x2F) { return "DOS.RWTS_VOLUME"; }
|
||||
|
||||
if (address == 0x30) { return "MON.HIRES_TMPBM"; }
|
||||
|
||||
if (address == 0x32) { return "MON.VIDEO_MODE"; }
|
||||
if (address == 0x33) { return "MON.PROMPTCHAR"; }
|
||||
if (address == 0x36) { return "DOS.CSWL"; }
|
||||
if (address == 0x37) { return "DOS.CSWH"; }
|
||||
@ -281,6 +299,10 @@ QString DisassemblerViewer::getPotentialLabel(quint16 address)
|
||||
if (address == 0x44) { return "DOS.NUMERIC_OPERAND_L"; }
|
||||
if (address == 0x45) { return "DOS.NUMERIC_OPERAND_H"; }
|
||||
|
||||
if (address == 0x48) { return "DOS.RWTS_IOB_PTR_L"; }
|
||||
if (address == 0x49) { return "DOS.RWRS_IOB_PTR_H"; }
|
||||
|
||||
|
||||
if (address == 0x67) { return "AS.PROG_STARTL"; }
|
||||
if (address == 0x68) { return "AS.PROG_STARTH"; }
|
||||
|
||||
@ -330,18 +352,37 @@ QString DisassemblerViewer::getPotentialLabel(quint16 address)
|
||||
if (address == 0xB0) { return "AS.PROGEND_H"; }
|
||||
|
||||
if (address == 0xD6) { return "DOS.AS.LOCK"; }
|
||||
if (address == 0xD8) { return "DOS.AS.ONERR"; }
|
||||
|
||||
if (address == 0xDA) { return "DOS.AS.ONERR_LINE_L"; }
|
||||
if (address == 0xDB) { return "DOS.AS.ONERR_LINE_H"; }
|
||||
|
||||
if (address == 0xE0) { return "AS.HGR_X_L"; }
|
||||
if (address == 0xE1) { return "AS.HGR_X_H"; }
|
||||
if (address == 0xE2) { return "AS.HGR_Y"; }
|
||||
|
||||
if (address == 0xE4) { return "AS.HGR_COLOR"; }
|
||||
if (address == 0xE5) { return "AS.HGR_MAP_BYTE"; }
|
||||
if (address == 0xE6) { return "AS.HGR_PLOT_PAGE"; }
|
||||
if (address == 0xE7) { return "AS.HGR_SCALE"; }
|
||||
|
||||
if (address == 0xE8) { return "AS.SHAPETBL_L"; }
|
||||
if (address == 0xE9) { return "AS.SHAPETBL_H"; }
|
||||
|
||||
if (address == 0xEA) { return "AS.HGR_COLLISION_CTR"; }
|
||||
|
||||
if (address == 0xF0) { return "AS.LORES_SCRATCH"; }
|
||||
if (address == 0xF1) { return "AS.255_MINUS_SPEED"; }
|
||||
if (address == 0xF2) { return "AS.TRACE_FLAG"; }
|
||||
if (address == 0xF3) { return "MON.FLASH_MASK"; }
|
||||
if (address == 0xF4) { return "AS.ONERR_PTR_AREA_0"; }
|
||||
if (address == 0xF5) { return "AS.ONERR_PTR_AREA_1"; }
|
||||
if (address == 0xF6) { return "AS.ONERR_PTR_AREA_2"; }
|
||||
if (address == 0xF7) { return "AS.ONERR_PTR_AREA_3"; }
|
||||
if (address == 0xF8) { return "AS.ONERR_PTR_AREA_4"; }
|
||||
|
||||
if (address == 0xF9) { return "AS.HGR_ROT"; }
|
||||
|
||||
if (address == 0x03d0) { return "DOS.WARMSTART"; }
|
||||
if (address == 0x03d3) { return "DOS.COLDSTART"; }
|
||||
if (address == 0x03d6) { return "DOS.FILE_MANAGER"; }
|
||||
|
Loading…
Reference in New Issue
Block a user