ASM view port in work.

This commit is contained in:
Matthew Budd 2020-09-03 22:39:01 -04:00
parent fc201b5ff7
commit e688ebe23b
3 changed files with 32 additions and 0 deletions

View File

@ -291,6 +291,8 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
periodicTimer = new QTimer( this );
connect( periodicTimer, &QTimer::timeout, this, &ConsoleDebugger::updatePeriodic );
//connect( hbar, SIGNAL(valueChanged(int)), this, SLOT(hbarChanged(int)) );
connect( vbar, SIGNAL(valueChanged(int)), this, SLOT(vbarChanged(int)) );
periodicTimer->start( 100 ); // 10hz
}
@ -602,6 +604,7 @@ void QAsmView::updateAssemblyView(void)
asmEntry.push_back(a);
}
vbar->setMaximum( asmEntry.size() );
}
//----------------------------------------------------------------------------
void ConsoleDebugger::updateWindowData(void)
@ -629,6 +632,12 @@ void ConsoleDebugger::breakPointNotify( int addr )
windowUpdateReq = true;
}
//----------------------------------------------------------------------------
void ConsoleDebugger::vbarChanged(int value)
{
//printf("VBar Changed: %i\n", value);
asmView->setLine( value );
}
//----------------------------------------------------------------------------
void FCEUD_DebugBreakpoint( int addr )
{
std::list <ConsoleDebugger*>::iterator it;
@ -690,6 +699,11 @@ void QAsmView::asmClear(void)
asmEntry.clear();
}
//----------------------------------------------------------------------------
void QAsmView::setLine(int lineNum)
{
lineOffset = lineNum;
}
//----------------------------------------------------------------------------
void QAsmView::calcFontData(void)
{
this->setFont(font);
@ -776,6 +790,17 @@ void QAsmView::paintEvent(QPaintEvent *event)
{
cursorPosY = viewLines-1;
}
maxLineOffset = asmEntry.size() - nrow + 1;
if ( maxLineOffset < 0 )
{
maxLineOffset = 0;
}
if ( lineOffset > maxLineOffset )
{
lineOffset = maxLineOffset;
}
painter.fillRect( 0, 0, viewWidth, viewHeight, this->palette().color(QPalette::Background) );

View File

@ -60,6 +60,7 @@ class QAsmView : public QWidget
void updateAssemblyView(void);
void asmClear(void);
int getAsmLineFromAddr(int addr);
void setLine(int lineNum);
protected:
void paintEvent(QPaintEvent *event);
void keyPressEvent(QKeyEvent *event);
@ -155,5 +156,6 @@ class ConsoleDebugger : public QDialog
void closeWindow(void);
private slots:
void updatePeriodic(void);
void vbarChanged(int value);
};

View File

@ -1764,6 +1764,11 @@ void QHexEdit::paintEvent(QPaintEvent *event)
//
maxLineOffset = mb.numLines() - nrow + 1;
if ( maxLineOffset < 0 )
{
maxLineOffset = 0;
}
if ( lineOffset > maxLineOffset )
{
lineOffset = maxLineOffset;