Added tool tips for CPU status display on Qt debugger.

This commit is contained in:
mjbudd77 2021-07-06 19:58:12 -04:00
parent a993487d13
commit 47da5cbc17
2 changed files with 97 additions and 56 deletions

View File

@ -551,11 +551,13 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
mainLayouth->addLayout( vbox4, 5 );
mainLayouth->addLayout( vbox1, 4 );
grid = new QGridLayout();
cpuFrame = new QGroupBox( tr("CPU Status") );
grid = new QGridLayout();
vbox1->addLayout( hbox1 );
vbox1->addWidget( cpuFrame );
hbox1->addLayout( vbox2, 1 );
vbox2->addLayout( grid );
cpuFrame->setLayout( hbox1 );
//button = new QPushButton( tr("Run") );
//grid->addWidget( button, 0, 0, Qt::AlignLeft );
@ -596,6 +598,7 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
hbox = new QHBoxLayout();
lbl = new QLabel( tr("PC:") );
lbl->setToolTip( tr("Program Counter Register") );
pcEntry = new QLineEdit();
pcEntry->setFont( font );
pcEntry->setMaxLength( 4 );
@ -603,6 +606,7 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
pcEntry->setAlignment(Qt::AlignCenter);
pcEntry->setMinimumWidth( 6 * fontCharWidth );
pcEntry->setMaximumWidth( 6 * fontCharWidth );
pcEntry->setToolTip( tr("Program Counter Register Hex Value") );
hbox->addWidget( lbl );
hbox->addWidget( pcEntry, 1, Qt::AlignLeft );
grid->addLayout( hbox, 0, 0, Qt::AlignLeft );
@ -613,6 +617,7 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
hbox = new QHBoxLayout();
lbl = new QLabel( tr("A:") );
lbl->setToolTip( tr("Accumulator Register") );
regAEntry = new QLineEdit();
regAEntry->setFont( font );
regAEntry->setMaxLength( 2 );
@ -620,12 +625,14 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
regAEntry->setAlignment(Qt::AlignCenter);
regAEntry->setMinimumWidth( 4 * fontCharWidth );
regAEntry->setMaximumWidth( 4 * fontCharWidth );
regAEntry->setToolTip( tr("Accumulator Register Hex Value") );
hbox->addWidget( lbl );
hbox->addWidget( regAEntry, 1, Qt::AlignLeft );
grid->addLayout( hbox, 0, 1 );
hbox = new QHBoxLayout();
lbl = new QLabel( tr("X:") );
lbl->setToolTip( tr("X Index Register") );
regXEntry = new QLineEdit();
regXEntry->setFont( font );
regXEntry->setMaxLength( 2 );
@ -633,12 +640,14 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
regXEntry->setAlignment(Qt::AlignCenter);
regXEntry->setMinimumWidth( 4 * fontCharWidth );
regXEntry->setMaximumWidth( 4 * fontCharWidth );
regXEntry->setToolTip( tr("X Index Register Hex Value") );
hbox->addWidget( lbl );
hbox->addWidget( regXEntry, 1, Qt::AlignLeft );
grid->addLayout( hbox, 0, 2 );
hbox = new QHBoxLayout();
lbl = new QLabel( tr("Y:") );
lbl->setToolTip( tr("Y Index Register") );
regYEntry = new QLineEdit();
regYEntry->setFont( font );
regYEntry->setMaxLength( 2 );
@ -646,10 +655,26 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
regYEntry->setAlignment(Qt::AlignCenter);
regYEntry->setMinimumWidth( 4 * fontCharWidth );
regYEntry->setMaximumWidth( 4 * fontCharWidth );
regYEntry->setToolTip( tr("Y Index Register Hex Value") );
hbox->addWidget( lbl );
hbox->addWidget( regYEntry, 1, Qt::AlignLeft );
grid->addLayout( hbox, 0, 3 );
QHBoxLayout *regPHbox = new QHBoxLayout();
lbl = new QLabel( tr("P:") );
lbl->setToolTip( tr("Status Register") );
regPEntry = new QLineEdit();
regPEntry->setFont( font );
regPEntry->setMaxLength( 2 );
regPEntry->setInputMask( ">HH;0" );
regPEntry->setAlignment(Qt::AlignCenter);
regPEntry->setMinimumWidth( 4 * fontCharWidth );
regPEntry->setMaximumWidth( 4 * fontCharWidth );
regPEntry->setToolTip( tr("Status Register Hex Value") );
regPHbox->addWidget( lbl );
regPHbox->addWidget( regPEntry, 1, Qt::AlignLeft );
//grid->addLayout( regPHbox, 0, 4 );
cpuCyclesLbl1 = new QLabel( tr("CPU Cycles:") );
//cpuCyclesLbl2 = new QLabel( tr("(+0):") );
cpuCyclesVal = new QLineEdit( tr("(+0):") );
@ -754,14 +779,24 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
Z_chkbox = new QCheckBox( tr("Z") );
C_chkbox = new QCheckBox( tr("C") );
grid->addWidget( N_chkbox, 0, 0, Qt::AlignCenter );
grid->addWidget( V_chkbox, 0, 1, Qt::AlignCenter );
grid->addWidget( U_chkbox, 0, 2, Qt::AlignCenter );
grid->addWidget( B_chkbox, 0, 3, Qt::AlignCenter );
grid->addWidget( D_chkbox, 1, 0, Qt::AlignCenter );
grid->addWidget( I_chkbox, 1, 1, Qt::AlignCenter );
grid->addWidget( Z_chkbox, 1, 2, Qt::AlignCenter );
grid->addWidget( C_chkbox, 1, 3, Qt::AlignCenter );
N_chkbox->setToolTip( tr("Negative" ) );
V_chkbox->setToolTip( tr("Overflow" ) );
U_chkbox->setToolTip( tr("Unused" ) );
B_chkbox->setToolTip( tr("Break" ) );
D_chkbox->setToolTip( tr("Decimal" ) );
I_chkbox->setToolTip( tr("Interrupt") );
Z_chkbox->setToolTip( tr("Zero" ) );
C_chkbox->setToolTip( tr("Carry" ) );
grid->addLayout( regPHbox, 0, 0, 2, 1);
grid->addWidget( N_chkbox, 0, 1, Qt::AlignLeft );
grid->addWidget( V_chkbox, 0, 2, Qt::AlignLeft );
grid->addWidget( U_chkbox, 0, 3, Qt::AlignLeft );
grid->addWidget( B_chkbox, 0, 4, Qt::AlignLeft );
grid->addWidget( D_chkbox, 1, 1, Qt::AlignLeft );
grid->addWidget( I_chkbox, 1, 2, Qt::AlignLeft );
grid->addWidget( Z_chkbox, 1, 3, Qt::AlignLeft );
grid->addWidget( C_chkbox, 1, 4, Qt::AlignLeft );
vbox1->addWidget( bpFrame);
vbox2->addWidget( sfFrame);
@ -2764,6 +2799,10 @@ void ConsoleDebugger::updateRegisterView(void)
regYEntry->setText( tr(stmp) );
sprintf( stmp, "%02X", X.P );
regPEntry->setText( tr(stmp) );
N_chkbox->setChecked( (X.P & N_FLAG) ? true : false );
V_chkbox->setChecked( (X.P & V_FLAG) ? true : false );
U_chkbox->setChecked( (X.P & U_FLAG) ? true : false );
@ -3294,7 +3333,7 @@ void loadGameDebugBreakpoints(void)
while ( stmp[i] != 0 )
{
i = getKeyValuePair( i, stmp, id, data );
i = getKeyValuePair( i, stmp, id, data );
//printf("ID:'%s' DATA:'%s' \n", id, data );
@ -3353,7 +3392,7 @@ void loadGameDebugBreakpoints(void)
}
}
}
else if ( strcmp( id, "Bookmark" ) == 0 )
else if ( strcmp( id, "Bookmark" ) == 0 )
{
int addr = -1;
char desc[256];
@ -3362,7 +3401,7 @@ void loadGameDebugBreakpoints(void)
while ( stmp[i] != 0 )
{
i = getKeyValuePair( i, stmp, id, data );
i = getKeyValuePair( i, stmp, id, data );
//printf("ID:'%s' DATA:'%s' \n", id, data );
@ -3374,16 +3413,16 @@ void loadGameDebugBreakpoints(void)
{
strcpy( desc, data );
}
}
}
if ( addr >= 0 )
{
if ( dbgBmMgr.addBookmark( addr, desc ) )
{
printf("Error:Failed to add debug bookmark: $%04X '%s' \n", addr, desc );
}
}
}
if ( addr >= 0 )
{
if ( dbgBmMgr.addBookmark( addr, desc ) )
{
printf("Error:Failed to add debug bookmark: $%04X '%s' \n", addr, desc );
}
}
}
}
fclose(fp);
@ -4376,7 +4415,7 @@ void QAsmView::paintEvent(QPaintEvent *event)
x = -pxLineXScroll;
l = lineOffset + row;
if ( (l >= txtHlgtStartLine) && (l <= txtHlgtEndLine) )
if ( (l >= txtHlgtStartLine) && (l <= txtHlgtEndLine) )
{
int ax, hlgtXs, hlgtXe, hlgtXd;
std::string s;
@ -4587,7 +4626,7 @@ void DebuggerStackDisplay::contextMenuEvent(QContextMenuEvent *event)
{
QAction *act;
QMenu menu(this);
QMenu *subMenu;
QMenu *subMenu;
QActionGroup *group;
QAction *bytesPerLineAct[4];
@ -4596,7 +4635,7 @@ void DebuggerStackDisplay::contextMenuEvent(QContextMenuEvent *event)
act->setChecked(showAddrs);
connect( act, SIGNAL(triggered(void)), this, SLOT(toggleShowAddr(void)) );
menu.addAction( act );
menu.addAction( act );
subMenu = menu.addMenu(tr("Display Bytes Per Line"));
group = new QActionGroup(&menu);
@ -4667,14 +4706,14 @@ void DebuggerStackDisplay::updateText(void)
if ( stackPtr <= 0x01FF )
{
if ( showAddrs || (stackBytesPerLine <= 1) )
{
sprintf( stmp, "%03X: %02X", stackPtr, GetMem(stackPtr) );
}
else
{
sprintf( stmp, " %02X", GetMem(stackPtr) );
}
if ( showAddrs || (stackBytesPerLine <= 1) )
{
sprintf( stmp, "%03X: %02X", stackPtr, GetMem(stackPtr) );
}
else
{
sprintf( stmp, " %02X", GetMem(stackPtr) );
}
stackLine.assign( stmp );
@ -4685,31 +4724,31 @@ void DebuggerStackDisplay::updateText(void)
if (stackPtr > 0x1FF)
break;
if ( stackBytesPerLine > 1 )
{
if ((i % stackBytesPerLine) == 0)
{
if ( showAddrs )
{
sprintf( stmp, "\n%03X: %02X", stackPtr, GetMem(stackPtr) );
}
else
{
sprintf( stmp, "\n %02X", GetMem(stackPtr) );
}
}
else
{
sprintf( stmp, ",%02X", GetMem(stackPtr) );
}
}
else
{
sprintf( stmp, "\n%03X: %02X", stackPtr, GetMem(stackPtr) );
}
if ( stackBytesPerLine > 1 )
{
if ((i % stackBytesPerLine) == 0)
{
if ( showAddrs )
{
sprintf( stmp, "\n%03X: %02X", stackPtr, GetMem(stackPtr) );
}
else
{
sprintf( stmp, "\n %02X", GetMem(stackPtr) );
}
}
else
{
sprintf( stmp, ",%02X", GetMem(stackPtr) );
}
}
else
{
sprintf( stmp, "\n%03X: %02X", stackPtr, GetMem(stackPtr) );
}
stackLine.append( stmp );
//printf("Stack $%X: %s\n", stackPtr, stmp );
//printf("Stack $%X: %s\n", stackPtr, stmp );
}
}

View File

@ -248,11 +248,13 @@ class ConsoleDebugger : public QDialog
QLineEdit *regAEntry;
QLineEdit *regXEntry;
QLineEdit *regYEntry;
QLineEdit *regPEntry;
//QLineEdit *cpuCycExdVal;
//QLineEdit *instrExdVal;
QLineEdit *selBmAddr;
QLineEdit *cpuCyclesVal;
QLineEdit *cpuInstrsVal;
QGroupBox *cpuFrame;
QGroupBox *stackFrame;
QGroupBox *bpFrame;
QGroupBox *sfFrame;