From b1bb6b4f08f2cc4d495362c3179dd6ecd04b2571 Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Sat, 17 Oct 2020 19:40:49 -0400 Subject: [PATCH 1/2] Removed fceux.pro qmake file. Qt/SDL port will always use cmake. --- fceux.pro | 369 --------------------------------------- pipelines/macOS_build.sh | 2 - 2 files changed, 371 deletions(-) delete mode 100644 fceux.pro diff --git a/fceux.pro b/fceux.pro deleted file mode 100644 index fec9f599..00000000 --- a/fceux.pro +++ /dev/null @@ -1,369 +0,0 @@ -###################################################################### -# Automatically generated by qmake (3.1) Sat Jun 20 21:20:47 2020 -###################################################################### - -TEMPLATE = app -TARGET = fceux -INCLUDEPATH += . - -# The following define makes your compiler warn you if you use any -# feature of Qt which has been marked as deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if you use deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -QT += widgets - -CONFIG += object_parallel_to_source - -INCLUDEPATH += src src/drivers - -ENABLE_LUA = 0 -USE_INTERNAL_LUA = 0 - -unix { - QT_CONFIG -= no-pkg-config - CONFIG += link_pkgconfig - - QMAKE_CXXFLAGS += -DPSS_STYLE=1 -DHAVE_ASPRINTF - - packagesExist(minizip){ - PKGCONFIG += minizip - QMAKE_CXXFLAGS += -D_SYSTEM_MINIZIP - } - - packagesExist(zlib){ - PKGCONFIG += zlib - } - - PKGCONFIG += sdl2 - - packagesExist(lua-5.1){ - PKGCONFIG += lua-5.1 - USE_INTERNAL_LUA = 0; - QMAKE_CXXFLAGS += -D_S9XLUA_H - } else { - USE_INTERNAL_LUA = 1; - QMAKE_CXXFLAGS += -D_S9XLUA_H - } - ENABLE_LUA = 1 - - QMAKE_CXXFLAGS -= -O2 - QMAKE_CXXFLAGS += -D__QT_DRIVER__ -O0 -g3 -Wall -Wno-write-strings -Wno-sign-compare -Wno-parentheses -Wno-unused-local-typedefs - QMAKE_CXXFLAGS_RELEASE -= -O2 - - LIBS += -lz -} - -# Input -SOURCES += src/asm.cpp -SOURCES += src/cart.cpp -SOURCES += src/cheat.cpp -SOURCES += src/conddebug.cpp -SOURCES += src/config.cpp -SOURCES += src/debug.cpp -SOURCES += src/drawing.cpp -SOURCES += src/fceu.cpp -SOURCES += src/fds.cpp -SOURCES += src/file.cpp -SOURCES += src/emufile.cpp -SOURCES += src/filter.cpp -SOURCES += src/ines.cpp -SOURCES += src/input.cpp -SOURCES += src/movie.cpp -SOURCES += src/netplay.cpp -SOURCES += src/nsf.cpp -SOURCES += src/oldmovie.cpp -SOURCES += src/palette.cpp -SOURCES += src/ppu.cpp -SOURCES += src/sound.cpp -SOURCES += src/state.cpp -SOURCES += src/unif.cpp -SOURCES += src/video.cpp -SOURCES += src/vsuni.cpp -SOURCES += src/wave.cpp -SOURCES += src/x6502.cpp - -isEqual( ENABLE_LUA, 1 ) { - isEqual( USE_INTERNAL_LUA, 1 ) { - message("Enabling Internal LUA") - INCLUDEPATH += src/lua/src - SOURCES += src/lua/src/lapi.c - SOURCES += src/lua/src/lauxlib.c - SOURCES += src/lua/src/lbaselib.c - SOURCES += src/lua/src/lcode.c - SOURCES += src/lua/src/ldblib.c - SOURCES += src/lua/src/ldebug.c - SOURCES += src/lua/src/ldo.c - SOURCES += src/lua/src/ldump.c - SOURCES += src/lua/src/lfunc.c - SOURCES += src/lua/src/lgc.c - SOURCES += src/lua/src/linit.c - SOURCES += src/lua/src/liolib.c - SOURCES += src/lua/src/llex.c - SOURCES += src/lua/src/lmathlib.c - SOURCES += src/lua/src/lmem.c - SOURCES += src/lua/src/loadlib.c - SOURCES += src/lua/src/lobject.c - SOURCES += src/lua/src/lopcodes.c - SOURCES += src/lua/src/loslib.c - SOURCES += src/lua/src/lparser.c - SOURCES += src/lua/src/lstate.c - SOURCES += src/lua/src/lstring.c - SOURCES += src/lua/src/lstrlib.c - SOURCES += src/lua/src/ltable.c - SOURCES += src/lua/src/ltablib.c - SOURCES += src/lua/src/ltm.c - SOURCES += src/lua/src/lundump.c - SOURCES += src/lua/src/lvm.c - SOURCES += src/lua/src/lzio.c - SOURCES += src/lua/src/print.c - SOURCES += src/lua-engine.cpp - } else { - message("Enabling System LUA") - SOURCES += src/lua-engine.cpp - } - message("Enabling LUA") -} else { - message("Disabling LUA") -} - -SOURCES += src/boards/01-222.cpp -SOURCES += src/boards/09-034a.cpp -SOURCES += src/boards/103.cpp -SOURCES += src/boards/106.cpp -SOURCES += src/boards/108.cpp -SOURCES += src/boards/112.cpp -SOURCES += src/boards/116.cpp -SOURCES += src/boards/117.cpp -SOURCES += src/boards/120.cpp -SOURCES += src/boards/121.cpp -SOURCES += src/boards/12in1.cpp -SOURCES += src/boards/151.cpp -SOURCES += src/boards/156.cpp -SOURCES += src/boards/158B.cpp -SOURCES += src/boards/15.cpp -SOURCES += src/boards/164.cpp -SOURCES += src/boards/168.cpp -SOURCES += src/boards/170.cpp -SOURCES += src/boards/175.cpp -SOURCES += src/boards/176.cpp -SOURCES += src/boards/177.cpp -SOURCES += src/boards/178.cpp -SOURCES += src/boards/183.cpp -SOURCES += src/boards/185.cpp -SOURCES += src/boards/186.cpp -SOURCES += src/boards/187.cpp -SOURCES += src/boards/189.cpp -SOURCES += src/boards/18.cpp -SOURCES += src/boards/190.cpp -SOURCES += src/boards/193.cpp -SOURCES += src/boards/199.cpp -SOURCES += src/boards/206.cpp -SOURCES += src/boards/208.cpp -SOURCES += src/boards/222.cpp -SOURCES += src/boards/225.cpp -SOURCES += src/boards/228.cpp -SOURCES += src/boards/230.cpp -SOURCES += src/boards/232.cpp -SOURCES += src/boards/234.cpp -SOURCES += src/boards/235.cpp -SOURCES += src/boards/244.cpp -SOURCES += src/boards/246.cpp -SOURCES += src/boards/252.cpp -SOURCES += src/boards/253.cpp -SOURCES += src/boards/28.cpp -SOURCES += src/boards/32.cpp -SOURCES += src/boards/33.cpp -SOURCES += src/boards/34.cpp -SOURCES += src/boards/36.cpp -SOURCES += src/boards/3d-block.cpp -SOURCES += src/boards/40.cpp -SOURCES += src/boards/411120-c.cpp -SOURCES += src/boards/41.cpp -SOURCES += src/boards/42.cpp -SOURCES += src/boards/43.cpp -SOURCES += src/boards/46.cpp -SOURCES += src/boards/50.cpp -SOURCES += src/boards/51.cpp -SOURCES += src/boards/57.cpp -SOURCES += src/boards/603-5052.cpp -SOURCES += src/boards/62.cpp -SOURCES += src/boards/65.cpp -SOURCES += src/boards/67.cpp -SOURCES += src/boards/68.cpp -SOURCES += src/boards/69.cpp -SOURCES += src/boards/71.cpp -SOURCES += src/boards/72.cpp -SOURCES += src/boards/77.cpp -SOURCES += src/boards/79.cpp -SOURCES += src/boards/80013-B.cpp -SOURCES += src/boards/80.cpp -SOURCES += src/boards/8157.cpp -SOURCES += src/boards/8237.cpp -SOURCES += src/boards/82.cpp -SOURCES += src/boards/830118C.cpp -SOURCES += src/boards/88.cpp -SOURCES += src/boards/8in1.cpp -SOURCES += src/boards/90.cpp -SOURCES += src/boards/91.cpp -SOURCES += src/boards/96.cpp -SOURCES += src/boards/99.cpp -SOURCES += src/boards/a9746.cpp -SOURCES += src/boards/ac-08.cpp -SOURCES += src/boards/addrlatch.cpp -SOURCES += src/boards/ax5705.cpp -SOURCES += src/boards/bandai.cpp -SOURCES += src/boards/bb.cpp -SOURCES += src/boards/bmc13in1jy110.cpp -SOURCES += src/boards/bmc42in1r.cpp -SOURCES += src/boards/bmc64in1nr.cpp -SOURCES += src/boards/bmc70in1.cpp -SOURCES += src/boards/BMW8544.cpp -SOURCES += src/boards/bonza.cpp -SOURCES += src/boards/bs-5.cpp -SOURCES += src/boards/cheapocabra.cpp -SOURCES += src/boards/cityfighter.cpp -SOURCES += src/boards/coolboy.cpp -SOURCES += src/boards/dance2000.cpp -SOURCES += src/boards/datalatch.cpp -SOURCES += src/boards/dream.cpp -SOURCES += src/boards/__dummy_mapper.cpp -SOURCES += src/boards/edu2000.cpp -SOURCES += src/boards/eh8813a.cpp -SOURCES += src/boards/emu2413.c -SOURCES += src/boards/et-100.cpp -SOURCES += src/boards/et-4320.cpp -SOURCES += src/boards/F-15.cpp -SOURCES += src/boards/famicombox.cpp -SOURCES += src/boards/ffe.cpp -SOURCES += src/boards/fk23c.cpp -SOURCES += src/boards/fns.cpp -SOURCES += src/boards/ghostbusters63in1.cpp -SOURCES += src/boards/gs-2004.cpp -SOURCES += src/boards/gs-2013.cpp -SOURCES += src/boards/h2288.cpp -SOURCES += src/boards/hp10xx_hp20xx.cpp -SOURCES += src/boards/hp898f.cpp -SOURCES += src/boards/inlnsf.cpp -SOURCES += src/boards/karaoke.cpp -SOURCES += src/boards/kof97.cpp -SOURCES += src/boards/ks7010.cpp -SOURCES += src/boards/ks7012.cpp -SOURCES += src/boards/ks7013.cpp -SOURCES += src/boards/ks7016.cpp -SOURCES += src/boards/ks7017.cpp -SOURCES += src/boards/ks7030.cpp -SOURCES += src/boards/ks7031.cpp -SOURCES += src/boards/ks7032.cpp -SOURCES += src/boards/ks7037.cpp -SOURCES += src/boards/ks7057.cpp -SOURCES += src/boards/le05.cpp -SOURCES += src/boards/lh32.cpp -SOURCES += src/boards/lh53.cpp -SOURCES += src/boards/malee.cpp -SOURCES += src/boards/mihunche.cpp -SOURCES += src/boards/mmc1.cpp -SOURCES += src/boards/mmc2and4.cpp -SOURCES += src/boards/mmc3.cpp -SOURCES += src/boards/mmc5.cpp -SOURCES += src/boards/n106.cpp -SOURCES += src/boards/n625092.cpp -SOURCES += src/boards/novel.cpp -SOURCES += src/boards/onebus.cpp -SOURCES += src/boards/pec-586.cpp -SOURCES += src/boards/rt-01.cpp -SOURCES += src/boards/sa-9602b.cpp -SOURCES += src/boards/sachen.cpp -SOURCES += src/boards/sb-2000.cpp -SOURCES += src/boards/sc-127.cpp -SOURCES += src/boards/sheroes.cpp -SOURCES += src/boards/sl1632.cpp -SOURCES += src/boards/subor.cpp -SOURCES += src/boards/super24.cpp -SOURCES += src/boards/supervision.cpp -SOURCES += src/boards/t-227-1.cpp -SOURCES += src/boards/t-262.cpp -SOURCES += src/boards/tengen.cpp -SOURCES += src/boards/tf-1201.cpp -SOURCES += src/boards/transformer.cpp -SOURCES += src/boards/unrom512.cpp -SOURCES += src/boards/vrc1.cpp -SOURCES += src/boards/vrc2and4.cpp -SOURCES += src/boards/vrc3.cpp -SOURCES += src/boards/vrc5.cpp -SOURCES += src/boards/vrc6.cpp -SOURCES += src/boards/vrc7.cpp -SOURCES += src/boards/vrc7p.cpp -SOURCES += src/boards/yoko.cpp -SOURCES += src/input/arkanoid.cpp -SOURCES += src/input/bworld.cpp -SOURCES += src/input/cursor.cpp -SOURCES += src/input/fkb.cpp -SOURCES += src/input/fns.cpp -SOURCES += src/input/ftrainer.cpp -SOURCES += src/input/hypershot.cpp -SOURCES += src/input/mahjong.cpp -SOURCES += src/input/mouse.cpp -SOURCES += src/input/oekakids.cpp -SOURCES += src/input/pec586kb.cpp -SOURCES += src/input/powerpad.cpp -SOURCES += src/input/quiz.cpp -SOURCES += src/input/shadow.cpp -SOURCES += src/input/snesmouse.cpp -SOURCES += src/input/suborkb.cpp -SOURCES += src/input/toprider.cpp -SOURCES += src/input/virtualboy.cpp -SOURCES += src/input/zapper.cpp -SOURCES += src/utils/backward.cpp -SOURCES += src/utils/ConvertUTF.c -SOURCES += src/utils/xstring.cpp -SOURCES += src/utils/crc32.cpp -SOURCES += src/utils/endian.cpp -SOURCES += src/utils/general.cpp -SOURCES += src/utils/guid.cpp -SOURCES += src/utils/md5.cpp -SOURCES += src/utils/memory.cpp -SOURCES += src/drivers/common/args.cpp -SOURCES += src/drivers/common/cheat.cpp -SOURCES += src/drivers/common/config.cpp -SOURCES += src/drivers/common/configSys.cpp -SOURCES += src/drivers/common/hq2x.cpp -SOURCES += src/drivers/common/hq3x.cpp -SOURCES += src/drivers/common/scale2x.cpp -SOURCES += src/drivers/common/scale3x.cpp -SOURCES += src/drivers/common/scalebit.cpp -SOURCES += src/drivers/common/vidblit.cpp -SOURCES += src/drivers/common/nes_ntsc.c - -HEADERS += src/drivers/Qt/ConsoleWindow.h -HEADERS += src/drivers/Qt/ConsoleViewerGL.h -HEADERS += src/drivers/Qt/ConsoleViewerSDL.h -HEADERS += src/drivers/Qt/GamePadConf.h -HEADERS += src/drivers/Qt/HotKeyConf.h -HEADERS += src/drivers/Qt/ConsoleVideoConf.h -HEADERS += src/drivers/Qt/ConsoleSoundConf.h -SOURCES += src/drivers/Qt/main.cpp -SOURCES += src/drivers/Qt/ConsoleWindow.cpp -SOURCES += src/drivers/Qt/ConsoleViewerGL.cpp -SOURCES += src/drivers/Qt/ConsoleViewerSDL.cpp -SOURCES += src/drivers/Qt/GamePadConf.cpp -SOURCES += src/drivers/Qt/HotKeyConf.cpp -SOURCES += src/drivers/Qt/ConsoleVideoConf.cpp -SOURCES += src/drivers/Qt/ConsoleSoundConf.cpp -SOURCES += src/drivers/Qt/fceuWrapper.cpp -SOURCES += src/drivers/Qt/config.cpp -SOURCES += src/drivers/Qt/input.cpp -SOURCES += src/drivers/Qt/nes_shm.cpp -SOURCES += src/drivers/Qt/keyscan.cpp -SOURCES += src/drivers/Qt/sdl-sound.cpp -SOURCES += src/drivers/Qt/sdl-video.cpp -SOURCES += src/drivers/Qt/sdl-joystick.cpp -SOURCES += src/drivers/Qt/sdl-throttle.cpp -SOURCES += src/drivers/Qt/unix-netplay.cpp - diff --git a/pipelines/macOS_build.sh b/pipelines/macOS_build.sh index b096dce2..9774b0d3 100755 --- a/pipelines/macOS_build.sh +++ b/pipelines/macOS_build.sh @@ -43,7 +43,6 @@ brew install minizip export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig: -#QMAKE=`find /usr/local -name qmake`; QT_CMAKE=`find /usr/local -name Qt5Config.cmake` echo $QT_CMAKE; export Qt5_DIR=`dirname $QT_CMAKE`; @@ -54,7 +53,6 @@ echo '*** Building Project ***' echo '**************************' mkdir build; cd build; -#$QMAKE .. cmake \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \ From fffa78b50758aad3def0c23de709d69c591393dc Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Sat, 17 Oct 2020 21:22:19 -0400 Subject: [PATCH 2/2] Bug fix for Qt debugger stack display clipping end of line. Added logic to allow for the stack display to auto show a horizontal scroll bar if needed. Also added a stack display bytes per line config option. This can be changed by either right clicking the stack display widget and selecting the desired value in the context menu or using the number keys 1-8 when the widget has focus. --- src/drivers/Qt/ConsoleDebugger.cpp | 167 +++++++++++++++++++++++------ src/drivers/Qt/ConsoleDebugger.h | 26 ++++- 2 files changed, 159 insertions(+), 34 deletions(-) diff --git a/src/drivers/Qt/ConsoleDebugger.cpp b/src/drivers/Qt/ConsoleDebugger.cpp index fecb09ce..408bb21c 100644 --- a/src/drivers/Qt/ConsoleDebugger.cpp +++ b/src/drivers/Qt/ConsoleDebugger.cpp @@ -203,15 +203,15 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent) vbox2->addLayout( hbox ); stackFrame = new QGroupBox(tr("Stack $0100")); - stackText = new QPlainTextEdit(this); + stackText = new DebuggerStackDisplay(this); hbox = new QHBoxLayout(); hbox->addWidget( stackText ); vbox2->addWidget( stackFrame ); stackFrame->setLayout( hbox ); stackText->setFont(font); stackText->setReadOnly(true); - stackText->setWordWrapMode( QTextOption::WordWrap ); - stackText->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); + stackText->setWordWrapMode( QTextOption::NoWrap ); + //stackText->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); //stackText->setMaximumWidth( 16 * fontCharWidth ); bpFrame = new QGroupBox(tr("Breakpoints")); @@ -2128,7 +2128,6 @@ void ConsoleDebugger::updateRegisterView(void) int stackPtr; char stmp[64]; char str[32], str2[32]; - std::string stackLine; sprintf( stmp, "%04X", X.PC ); @@ -2159,31 +2158,7 @@ void ConsoleDebugger::updateRegisterView(void) sprintf( stmp, "Stack: $%04X", stackPtr ); stackFrame->setTitle( tr(stmp) ); - - stackPtr++; - - if ( stackPtr <= 0x01FF ) - { - sprintf( stmp, "%02X", GetMem(stackPtr) ); - - stackLine.assign( stmp ); - - for (int i = 1; i < 128; i++) - { - //tmp = ((tmp+1)|0x0100)&0x01FF; //increment and fix pointer to $0100-$01FF range - stackPtr++; - if (stackPtr > 0x1FF) - break; - if ((i & 7) == 0) - sprintf( stmp, ",\r\n%02X", GetMem(stackPtr) ); - else - sprintf( stmp, ",%02X", GetMem(stackPtr) ); - - stackLine.append( stmp ); - } - } - - stackText->setPlainText( tr(stackLine.c_str()) ); + stackText->updateText(); // update counters int64 counter_value = timestampbase + (uint64)timestamp - total_cycles_base; @@ -2781,6 +2756,7 @@ QAsmView::QAsmView(QWidget *parent) ctxMenuAddr = -1; //setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding ); + setFocusPolicy(Qt::StrongFocus); } //---------------------------------------------------------------------------- QAsmView::~QAsmView(void) @@ -2899,14 +2875,12 @@ void QAsmView::resizeEvent(QResizeEvent *event) //---------------------------------------------------------------------------- void QAsmView::keyPressEvent(QKeyEvent *event) { - printf("Debug ASM Window Key Press: 0x%x \n", event->key() ); - + //printf("Debug ASM Window Key Press: 0x%x \n", event->key() ); } //---------------------------------------------------------------------------- void QAsmView::keyReleaseEvent(QKeyEvent *event) { - printf("Debug ASM Window Key Release: 0x%x \n", event->key() ); - //assignHotkey( event ); + //printf("Debug ASM Window Key Release: 0x%x \n", event->key() ); } //---------------------------------------------------------------------------- QPoint QAsmView::convPixToCursor( QPoint p ) @@ -3276,3 +3250,130 @@ debuggerBookmark_t *debuggerBookmarkManager_t::getAddr( int addr ) return NULL; } //---------------------------------------------------------------------------- +DebuggerStackDisplay::DebuggerStackDisplay(QWidget *parent) + : QPlainTextEdit(parent) +{ + stackBytesPerLine = 4; +} +//---------------------------------------------------------------------------- +DebuggerStackDisplay::~DebuggerStackDisplay(void) +{ + +} +//---------------------------------------------------------------------------- +void DebuggerStackDisplay::keyPressEvent(QKeyEvent *event) +{ + //printf("Debug Stack Window Key Press: 0x%x \n", event->key() ); + + if ( (event->key() >= Qt::Key_1) && ( (event->key() < Qt::Key_9) ) ) + { + stackBytesPerLine = event->key() - Qt::Key_0; + updateText(); + } +} +//---------------------------------------------------------------------------- +void DebuggerStackDisplay::contextMenuEvent(QContextMenuEvent *event) +{ + //QAction *act; + QMenu menu(this); + QMenu *subMenu; + QActionGroup *group; + QAction *bytesPerLineAct[4]; + + subMenu = menu.addMenu(tr("Display Bytes Per Line")); + group = new QActionGroup(this); + + group->setExclusive(true); + + for (int i=0; i<4; i++) + { + char stmp[8]; + + sprintf( stmp, "%i", i+1 ); + + bytesPerLineAct[i] = new QAction(tr(stmp), &menu); + bytesPerLineAct[i]->setCheckable(true); + + group->addAction(bytesPerLineAct[i]); + subMenu->addAction(bytesPerLineAct[i]); + + bytesPerLineAct[i]->setChecked( stackBytesPerLine == (i+1) ); + } + + connect( bytesPerLineAct[0], SIGNAL(triggered(void)), this, SLOT(sel1BytePerLine(void)) ); + connect( bytesPerLineAct[1], SIGNAL(triggered(void)), this, SLOT(sel2BytesPerLine(void)) ); + connect( bytesPerLineAct[2], SIGNAL(triggered(void)), this, SLOT(sel3BytesPerLine(void)) ); + connect( bytesPerLineAct[3], SIGNAL(triggered(void)), this, SLOT(sel4BytesPerLine(void)) ); + + menu.exec(event->globalPos()); +} +//---------------------------------------------------------------------------- +void DebuggerStackDisplay::sel1BytePerLine(void) +{ + stackBytesPerLine = 1; + updateText(); +} +//---------------------------------------------------------------------------- +void DebuggerStackDisplay::sel2BytesPerLine(void) +{ + stackBytesPerLine = 2; + updateText(); +} +//---------------------------------------------------------------------------- +void DebuggerStackDisplay::sel3BytesPerLine(void) +{ + stackBytesPerLine = 3; + updateText(); +} +//---------------------------------------------------------------------------- +void DebuggerStackDisplay::sel4BytesPerLine(void) +{ + stackBytesPerLine = 4; + updateText(); +} +//---------------------------------------------------------------------------- +void DebuggerStackDisplay::updateText(void) +{ + char stmp[128]; + int stackPtr = X.S | 0x0100; + std::string stackLine; + + stackPtr++; + + if ( stackPtr <= 0x01FF ) + { + sprintf( stmp, " $%04X : %02X", stackPtr, GetMem(stackPtr) ); + + stackLine.assign( stmp ); + + for (int i = 1; i < 128; i++) + { + //tmp = ((tmp+1)|0x0100)&0x01FF; //increment and fix pointer to $0100-$01FF range + stackPtr++; + if (stackPtr > 0x1FF) + break; + + if ( stackBytesPerLine > 1 ) + { + if ((i % stackBytesPerLine) == 0) + { + sprintf( stmp, "\n $%04X : %02X", stackPtr, GetMem(stackPtr) ); + } + else + { + sprintf( stmp, ",%02X", GetMem(stackPtr) ); + } + } + else + { + sprintf( stmp, "\n $%04X : %02X", stackPtr, GetMem(stackPtr) ); + } + stackLine.append( stmp ); + + //printf("Stack $%X: %s\n", stackPtr, stmp ); + } + } + + setPlainText( tr(stackLine.c_str()) ); +} +//---------------------------------------------------------------------------- diff --git a/src/drivers/Qt/ConsoleDebugger.h b/src/drivers/Qt/ConsoleDebugger.h index 51b6d40c..533f62fa 100644 --- a/src/drivers/Qt/ConsoleDebugger.h +++ b/src/drivers/Qt/ConsoleDebugger.h @@ -153,6 +153,30 @@ class QAsmView : public QWidget bool registerNameEnable; }; +class DebuggerStackDisplay : public QPlainTextEdit +{ + Q_OBJECT + + public: + DebuggerStackDisplay(QWidget *parent = 0); + ~DebuggerStackDisplay(void); + + void updateText(void); + + int stackBytesPerLine; + + protected: + void keyPressEvent(QKeyEvent *event); + void contextMenuEvent(QContextMenuEvent *event); + + + private slots: + void sel1BytePerLine(void); + void sel2BytesPerLine(void); + void sel3BytesPerLine(void); + void sel4BytesPerLine(void); +}; + class ConsoleDebugger : public QDialog { Q_OBJECT @@ -181,7 +205,7 @@ class ConsoleDebugger : public QDialog QScrollBar *vbar; QScrollBar *hbar; QAsmView *asmView; - QPlainTextEdit *stackText; + DebuggerStackDisplay *stackText; QLineEdit *seekEntry; QLineEdit *pcEntry; QLineEdit *regAEntry;