mirror of
https://github.com/markdavidlong/AppleSAWS.git
synced 2024-12-21 22:29:30 +00:00
Continued work on assembler metadata dialog
This commit is contained in:
parent
0badceb216
commit
cea53aadd5
@ -8,17 +8,17 @@ AssemblerSymbols::AssemblerSymbols(QObject *parent) : QObject(parent)
|
|||||||
bool AssemblerSymbols::hasAssemSymbolAtAddress(quint16 address)
|
bool AssemblerSymbols::hasAssemSymbolAtAddress(quint16 address)
|
||||||
{
|
{
|
||||||
// Assume list m_assemblerSymbols is sorted by address (it should be)
|
// Assume list m_assemblerSymbols is sorted by address (it should be)
|
||||||
QListIterator<AssemSymbol> it(m_assemblerSymbols);
|
QListIterator<AssemblerSymbol> it(m_assemblerSymbols);
|
||||||
while (it.hasNext())
|
while (it.hasNext())
|
||||||
{
|
{
|
||||||
AssemSymbol ep = it.next();
|
AssemblerSymbol ep = it.next();
|
||||||
if (ep.address == address) return true;
|
if (ep.address == address) return true;
|
||||||
if (ep.address > address) return false;
|
if (ep.address > address) return false;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssemblerSymbols::editSymbol(int location, AssemSymbol newSymbol)
|
void AssemblerSymbols::editSymbol(int location, AssemblerSymbol newSymbol)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (m_assemblerSymbols.at(location).address == newSymbol.address)
|
if (m_assemblerSymbols.at(location).address == newSymbol.address)
|
||||||
@ -33,7 +33,7 @@ void AssemblerSymbols::editSymbol(int location, AssemSymbol newSymbol)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssemblerSymbols::addSymbol(AssemSymbol ep)
|
void AssemblerSymbols::addSymbol(AssemblerSymbol ep)
|
||||||
{
|
{
|
||||||
if (hasAssemSymbolAtAddress(ep.address)) return;
|
if (hasAssemSymbolAtAddress(ep.address)) return;
|
||||||
|
|
||||||
@ -88,14 +88,14 @@ QDataStream &operator>>(QDataStream &in, AssemblerSymbols&model)
|
|||||||
return model.read(in);
|
return model.read(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const AssemSymbol &model)
|
QDataStream &operator<<(QDataStream &out, const AssemblerSymbol &model)
|
||||||
{
|
{
|
||||||
out << model.address;
|
out << model.address;
|
||||||
out << model.name;
|
out << model.name;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream &operator>>(QDataStream &in, AssemSymbol &model)
|
QDataStream &operator>>(QDataStream &in, AssemblerSymbol &model)
|
||||||
{
|
{
|
||||||
in >> model.address;
|
in >> model.address;
|
||||||
in >> model.name;
|
in >> model.name;
|
||||||
@ -108,15 +108,15 @@ QDataStream &operator>>(QDataStream &in, AssemSymbol &model)
|
|||||||
|
|
||||||
void AssemblerSymbols::doTestData()
|
void AssemblerSymbols::doTestData()
|
||||||
{
|
{
|
||||||
AssemSymbol ep;
|
AssemblerSymbol ep;
|
||||||
ep.address = 0x0010;
|
ep.address = 0x0100;
|
||||||
ep.name = "Test Entry Symbol 1";
|
ep.name = "Test Symbol 1";
|
||||||
addSymbol(ep);
|
addSymbol(ep);
|
||||||
ep.address = 0x0020;
|
ep.address = 0x0200;
|
||||||
ep.name = "Test Entry Symbol 2";
|
ep.name = "Test Symbol 2";
|
||||||
addSymbol(ep);
|
addSymbol(ep);
|
||||||
ep.address = 0x0030;
|
ep.address = 0x0300;
|
||||||
ep.name = "Test Entry Symbol 3";
|
ep.name = "Test Symbol 3";
|
||||||
addSymbol(ep);
|
addSymbol(ep);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
|
|
||||||
struct AssemSymbol {
|
struct AssemblerSymbol {
|
||||||
quint16 address;
|
quint16 address;
|
||||||
QString name;
|
QString name;
|
||||||
};
|
};
|
||||||
@ -17,11 +17,11 @@ public:
|
|||||||
|
|
||||||
bool hasAssemSymbolAtAddress(quint16 address);
|
bool hasAssemSymbolAtAddress(quint16 address);
|
||||||
|
|
||||||
const AssemSymbol &at(int location) const { return m_assemblerSymbols.at(location); }
|
const AssemblerSymbol &at(int location) const { return m_assemblerSymbols.at(location); }
|
||||||
AssemSymbol &symbolRefAt(int location) { return m_assemblerSymbols[location]; }
|
AssemblerSymbol &symbolRefAt(int location) { return m_assemblerSymbols[location]; }
|
||||||
AssemSymbol &operator[](int location) { return m_assemblerSymbols[location]; }
|
AssemblerSymbol &operator[](int location) { return m_assemblerSymbols[location]; }
|
||||||
|
|
||||||
void editSymbol(int at, AssemSymbol newSymbol);
|
void editSymbol(int at, AssemblerSymbol newSymbol);
|
||||||
|
|
||||||
QDataStream &read(QDataStream &dataStream);
|
QDataStream &read(QDataStream &dataStream);
|
||||||
QDataStream &write(QDataStream &dataStream) const;
|
QDataStream &write(QDataStream &dataStream) const;
|
||||||
@ -31,17 +31,17 @@ public:
|
|||||||
void doTestData();
|
void doTestData();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void symbolAdded(AssemSymbol &AssemSymbol, int location);
|
void symbolAdded(AssemblerSymbol &AssemblerSymbol, int location);
|
||||||
void symbolAddedAt(int location);
|
void symbolAddedAt(int location);
|
||||||
void symbolRemovedAt(int location);
|
void symbolRemovedAt(int location);
|
||||||
void symbolChangedAt(int location);
|
void symbolChangedAt(int location);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void addSymbol(AssemSymbol ep);
|
void addSymbol(AssemblerSymbol ep);
|
||||||
void removeSymbolAt(int location);
|
void removeSymbolAt(int location);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QList<AssemSymbol> m_assemblerSymbols;
|
QList<AssemblerSymbol> m_assemblerSymbols;
|
||||||
};
|
};
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const AssemblerSymbols &model);
|
QDataStream &operator<<(QDataStream &out, const AssemblerSymbols &model);
|
||||||
|
@ -42,6 +42,8 @@ DisassemblerMetadataDialog::~DisassemblerMetadataDialog()
|
|||||||
|
|
||||||
void DisassemblerMetadataDialog::showEvent(QShowEvent *){
|
void DisassemblerMetadataDialog::showEvent(QShowEvent *){
|
||||||
ui->entryTable->resizeRowsToContents();
|
ui->entryTable->resizeRowsToContents();
|
||||||
|
ui->symbolTable->resizeRowsToContents();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisassemblerMetadataDialog::setRelocatable(bool relocatable)
|
void DisassemblerMetadataDialog::setRelocatable(bool relocatable)
|
||||||
@ -97,7 +99,7 @@ void DisassemblerMetadataDialog::handleAddSymbolButton()
|
|||||||
lid.setWindowTitle("Add Symbol");
|
lid.setWindowTitle("Add Symbol");
|
||||||
if (lid.exec() == Accepted)
|
if (lid.exec() == Accepted)
|
||||||
{
|
{
|
||||||
AssemSymbol as;
|
AssemblerSymbol as;
|
||||||
as.address = lid.getAddress();
|
as.address = lid.getAddress();
|
||||||
as.name = lid.getInfo();
|
as.name = lid.getInfo();
|
||||||
m_as->addSymbol(as);
|
m_as->addSymbol(as);
|
||||||
@ -113,7 +115,7 @@ void DisassemblerMetadataDialog::handleRemoveSymbolButton()
|
|||||||
|
|
||||||
void DisassemblerMetadataDialog::processSymbols()
|
void DisassemblerMetadataDialog::processSymbols()
|
||||||
{
|
{
|
||||||
|
m_as->doTestData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisassemblerMetadataDialog::processEntryPoints()
|
void DisassemblerMetadataDialog::processEntryPoints()
|
||||||
|
Loading…
Reference in New Issue
Block a user