Skip to content

Commit

Permalink
Many changes and improvements - not stable
Browse files Browse the repository at this point in the history
CodeEditor - perfomance and debug line highlighting improved.
Debugger - pause action, determine of entry point, debugging programs
without debug information, improved locks mechanism.
FASM - debug ability added,  lst parsing improved.
Ability to choose assembler and linker added.
Many bugs fixed.
  • Loading branch information
Dman95 committed May 7, 2014
1 parent 206b615 commit 4cf45b8
Show file tree
Hide file tree
Showing 23 changed files with 811 additions and 447 deletions.
1 change: 1 addition & 0 deletions Images.qrc
Expand Up @@ -19,5 +19,6 @@
<file>images/stepinto.png</file>
<file>images/stepover.png</file>
<file>images/undo.png</file>
<file>images/debugPause.png</file>
</qresource>
</RCC>
6 changes: 4 additions & 2 deletions SASM.pro
Expand Up @@ -49,7 +49,8 @@ SOURCES += main.cpp\
nasm.cpp \
gas.cpp \
common.cpp \
fasm.cpp
fasm.cpp \
signallocker.cpp

HEADERS += mainwindow.h \
tab.h \
Expand All @@ -67,7 +68,8 @@ HEADERS += mainwindow.h \
nasm.h \
gas.h \
common.h \
fasm.h
fasm.h \
signallocker.h

FORMS += settings.ui

Expand Down
Binary file added Windows/MinGW/bin/objdump.exe
Binary file not shown.
Binary file added Windows/MinGW64/bin/objdump.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion assembler.h
Expand Up @@ -74,7 +74,7 @@ class Assembler : public QObject //Abstract class
bool x86;
explicit Assembler(bool x86, QObject *parent = 0);
virtual QString getAssemblerPath() = 0;
virtual quint64 getMainOffset(QFile &lst) = 0;
virtual quint64 getMainOffset(QFile &lst, QString entryLabel) = 0;
virtual void parseLstFile(QFile &lst, QVector<Assembler::LineNum> &lines, bool ioIncIncluded, quint64 ioIncSize, quint64 offset) = 0;
virtual void fillHighligherRules(QVector<Assembler::HighlightingRule> &highlightingRules,
QList<QTextCharFormat *> &formats,
Expand Down
19 changes: 9 additions & 10 deletions codeeditor.cpp
Expand Up @@ -42,7 +42,8 @@

CodeEditor::CodeEditor(QWidget *parent, bool withBeakpoints) :
RuQPlainTextEdit(parent), debugImage(":/images/debugLine.png"),
breakpointImage(":/images/breakpoint.png")
breakpointImage(":/images/breakpoint.png"),
settings("SASM Project", "SASM")
{
hasBreakpoints = withBeakpoints;
prevBlockCount = -1;
Expand Down Expand Up @@ -105,18 +106,13 @@ void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event)
{
//paint on line number area
QPainter painter(lineNumberArea);
QSettings settings("SASM Project", "SASM");
painter.fillRect(event->rect(), settings.value("linenumberpanelcolor", palette().color(QPalette::Window)).value<QColor>());

QTextBlock block = firstVisibleBlock();
int blockNumber = block.blockNumber();
int top = (int) blockBoundingGeometry(block).translated(contentOffset()).top();
int bottom = top + (int) blockBoundingRect(block).height();

//set debugAreaWidth before drawing
debugAreaWidth = 3 + debugImage.width() + 1; //left margin + arrow width + right margin
updateLineNumberAreaWidth(0);

while (block.isValid() && top <= event->rect().bottom()) {
if (block.isVisible() && bottom >= event->rect().top()) {
QString number = QString::number(blockNumber + 1);
Expand Down Expand Up @@ -213,7 +209,6 @@ QList<int> *CodeEditor::getBreakpoints()

void CodeEditor::highlightCurrentLine()
{
QSettings settings("SASM Project", "SASM");
if (!debugMode) {
if (settings.value("currentlinemode", true).toBool()) {
QList<QTextEdit::ExtraSelection> extraSelections;
Expand Down Expand Up @@ -243,10 +238,9 @@ void CodeEditor::highlightDebugLine(int lineNumber)
if (debugMode) {
QList<QTextEdit::ExtraSelection> extraSelections;

if (!isReadOnly()) {
if (!isReadOnly() && lineNumber > 0) {
QTextEdit::ExtraSelection selection;

QSettings settings("SASM Project", "SASM");
QColor lineColor = settings.value("debuglinecolor", QColor(235, 200, 40)).value<QColor>();

selection.format.setBackground(lineColor);
Expand All @@ -264,11 +258,16 @@ void CodeEditor::highlightDebugLine(int lineNumber)

void CodeEditor::updateDebugLine(int number)
{
//number > 0 => highlight line
//number == -1 => exit from debug mode
//number == -2 => does not highlight any line, but does not exit from debug mode
//last case for waiting program stops on next instruction or breakpoint
if (number == -1)
setDebugMode(false);
else
setDebugMode(true);
currentDebugLine = number;
if (number != -2)
currentDebugLine = number;

//create rectangle of line number area and highlight debug line throw updateRequest()
QRect lineNumberAreaRect(lineNumberArea->x(), lineNumberArea->y(),
Expand Down
1 change: 1 addition & 0 deletions codeeditor.h
Expand Up @@ -99,6 +99,7 @@ private slots:
int firstTopMargin;
bool hasBreakpoints;
int prevBlockCount;
QSettings settings;

signals:
void breakpointsChanged(quint64 lineNumber, bool isAdded);
Expand Down

0 comments on commit 4cf45b8

Please sign in to comment.