]> Shamusworld >> Repos - virtualjaguar/commitdiff
Minor update to debugger; added autoupdating to CPU/MEM windows.
authorShamus Hammons <jlhamm@acm.org>
Fri, 1 Apr 2016 22:49:08 +0000 (17:49 -0500)
committerShamus Hammons <jlhamm@acm.org>
Fri, 1 Apr 2016 22:49:08 +0000 (17:49 -0500)
12 files changed:
res/blur-off.png [new file with mode: 0644]
res/blur-on.png [new file with mode: 0644]
res/blur.png [deleted file]
src/gui/debug/cpubrowser.cpp
src/gui/debug/cpubrowser.h
src/gui/debug/memorybrowser.cpp
src/gui/mainwin.cpp
src/gui/mainwin.h
src/gui/virtualjaguar.qrc
src/jaguar.cpp
src/m68000/cpuextra.c
src/m68000/m68kinterface.c

diff --git a/res/blur-off.png b/res/blur-off.png
new file mode 100644 (file)
index 0000000..e84a1ca
Binary files /dev/null and b/res/blur-off.png differ
diff --git a/res/blur-on.png b/res/blur-on.png
new file mode 100644 (file)
index 0000000..f4877b2
Binary files /dev/null and b/res/blur-on.png differ
diff --git a/res/blur.png b/res/blur.png
deleted file mode 100644 (file)
index efc1ad5..0000000
Binary files a/res/blur.png and /dev/null differ
index 331ac9059ac390f30f2536017876fa39d6a75603..6a0d242790f527ce36c7b0bf0da73611e6ddea8d 100644 (file)
@@ -25,7 +25,8 @@
 CPUBrowserWindow::CPUBrowserWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog),
        layout(new QVBoxLayout), text(new QLabel),
        refresh(new QPushButton(tr("Refresh"))),
-       bpm(new QCheckBox(tr("BPM"))), bpmAddress(new QLineEdit)
+       bpm(new QCheckBox(tr("BPM"))), bpmAddress(new QLineEdit),
+       bpmContinue(new QPushButton(tr("Resume")))
 {
        setWindowTitle(tr("CPU Browser"));
 
@@ -37,6 +38,7 @@ CPUBrowserWindow::CPUBrowserWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt:
        QHBoxLayout * hbox1 = new QHBoxLayout;
        hbox1->addWidget(bpm);
        hbox1->addWidget(bpmAddress);
+       hbox1->addWidget(bpmContinue);
 
        QFont fixedFont("Lucida Console", 8, QFont::Normal);
 //     QFont fixedFont("", 8, QFont::Normal);
@@ -52,6 +54,7 @@ CPUBrowserWindow::CPUBrowserWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt:
        connect(refresh, SIGNAL(clicked()), this, SLOT(RefreshContents()));
        connect(bpm, SIGNAL(clicked(bool)), this, SLOT(HandleBPM(bool)));
        connect(bpmAddress, SIGNAL(textChanged(const QString &)), this, SLOT(HandleBPMAddress(const QString &)));
+       connect(bpmContinue, SIGNAL(clicked()), this, SLOT(HandleBPMContinue()));
 }
 
 
@@ -260,6 +263,12 @@ void CPUBrowserWindow::HandleBPMAddress(const QString & newText)
 }
 
 
+void CPUBrowserWindow::HandleBPMContinue(void)
+{
+       M68KDebugResume();
+}
+
+
 void CPUBrowserWindow::keyPressEvent(QKeyEvent * e)
 {
        if (e->key() == Qt::Key_Escape)
index 04fa775773bc6de175bd8dc28d5ad69a10c0a081..1bf34426a27600a90972430caafd6f0a0c594a09 100644 (file)
@@ -24,6 +24,7 @@ class CPUBrowserWindow: public QWidget
                void RefreshContents(void);
                void HandleBPM(bool);
                void HandleBPMAddress(const QString &);
+               void HandleBPMContinue(void);
 
        protected:
                void keyPressEvent(QKeyEvent *);
@@ -35,6 +36,7 @@ class CPUBrowserWindow: public QWidget
                QPushButton * refresh;
                QCheckBox * bpm;
                QLineEdit * bpmAddress;
+               QPushButton * bpmContinue;
 
 //             int32_t memBase;
 };
index 45bae7f7883f87d2a1b2259db8754bd7a69fb627..42bdddf95dad196c0b1f54deb5b45026e8dad555 100644 (file)
@@ -79,7 +79,7 @@ void MemoryBrowserWindow::RefreshContents(void)
                        if (c == 0x20)
                                sprintf(buf, "&nbsp;");
 
-                       if ((c < 0x20) || ((c > 0x7F) && (c < 0xA0)))
+                       if ((c < 0x20) || (c > 0x7E))
                                sprintf(buf, ".");
 
                        strcat(string, buf);
index c9733d5d0a86aef320101787e97b035a89e8548c..9f64c625a64ba3368494bb1186bbb735c3094f5f 100644 (file)
@@ -139,18 +139,15 @@ MainWin::MainWin(bool autoRun): running(true), powerButtonOn(false),
        powerRed.addFile(":/res/power-off.png", QSize(), QIcon::Normal, QIcon::Off);
        powerRed.addFile(":/res/power-on-red.png", QSize(), QIcon::Normal, QIcon::On);
 
-//     powerAct = new QAction(QIcon(":/res/power.png"), tr("&Power"), this);
        powerAct = new QAction(powerGreen, tr("&Power"), this);
        powerAct->setStatusTip(tr("Powers Jaguar on/off"));
        powerAct->setCheckable(true);
        powerAct->setChecked(false);
-//     powerAct->setDisabled(true);
        connect(powerAct, SIGNAL(triggered()), this, SLOT(TogglePowerState()));
 
        QIcon pauseIcon;
        pauseIcon.addFile(":/res/pause-off", QSize(), QIcon::Normal, QIcon::Off);
        pauseIcon.addFile(":/res/pause-on", QSize(), QIcon::Normal, QIcon::On);
-//     pauseAct = new QAction(QIcon(":/res/pause.png"), tr("Pause"), this);
        pauseAct = new QAction(pauseIcon, tr("Pause"), this);
        pauseAct->setStatusTip(tr("Toggles the running state"));
        pauseAct->setCheckable(true);
@@ -188,7 +185,10 @@ MainWin::MainWin(bool autoRun): running(true), powerButtonOn(false),
        palAct->setCheckable(true);
        connect(palAct, SIGNAL(triggered()), this, SLOT(SetPAL()));
 
-       blurAct = new QAction(QIcon(":/res/blur.png"), tr("Blur"), this);
+       blur.addFile(":/res/blur-off.png", QSize(), QIcon::Normal, QIcon::Off);
+       blur.addFile(":/res/blur-on.png", QSize(), QIcon::Normal, QIcon::On);
+
+       blurAct = new QAction(blur, tr("Blur"), this);
        blurAct->setStatusTip(tr("Sets OpenGL rendering to GL_NEAREST"));
        blurAct->setCheckable(true);
        connect(blurAct, SIGNAL(triggered()), this, SLOT(ToggleBlur()));
@@ -725,6 +725,21 @@ static uint32_t ntscTickCount;
                HandleGamepads();
                JaguarExecuteNew();
                videoWidget->HandleMouseHiding();
+
+static uint32_t refresh = 0;
+               // Do autorefresh on debug windows
+               // Have to be careful, too much causes the emulator to slow way down!
+               if (vjs.hardwareTypeAlpine)
+               {
+                       if (refresh == 60)
+                       {
+                               memBrowseWin->RefreshContents();
+                               cpuBrowseWin->RefreshContents();
+                               refresh = 0;
+                       }
+                       else
+                               refresh++;
+               }
        }
 
        videoWidget->updateGL();
index a29dbc6119343f2edd1f1a8fdf81e45a36bc84b4..e9ff6c05d4327b5546dc2b9cb407c0af488f652f 100644 (file)
@@ -146,6 +146,7 @@ class MainWin: public QMainWindow
 
                QIcon powerGreen;
                QIcon powerRed;
+               QIcon blur;
                uint32_t testPattern[VIRTUAL_SCREEN_WIDTH * VIRTUAL_SCREEN_HEIGHT_PAL];
                uint32_t testPattern2[VIRTUAL_SCREEN_WIDTH * VIRTUAL_SCREEN_HEIGHT_PAL];
 };
index 329450ccb346e609aa243cba432ca06966402e5d..3cd226bd0cf3fcd4b2a91e4f1863e850c91bd76b 100644 (file)
@@ -10,7 +10,8 @@
        <file>../../res/zoom100.png</file>
        <file>../../res/zoom200.png</file>
        <file>../../res/zoom300.png</file>
-       <file>../../res/blur.png</file>
+       <file>../../res/blur-off.png</file>
+       <file>../../res/blur-on.png</file>
        <file>../../res/fullscreen.png</file>
        <file>../../res/tool-memory.png</file>
        <file>../../res/tool-cpu.png</file>
index 7cf0bca8f6338238f7103236e93a534da9d30cf7..4d96dca88df6c9ef64d296b6e741f974e0a87379 100644 (file)
@@ -97,6 +97,7 @@ uint32_t d4Queue[0x400];
 uint32_t d5Queue[0x400];
 uint32_t d6Queue[0x400];
 uint32_t d7Queue[0x400];
+uint32_t srQueue[0x400];
 uint32_t pcQPtr = 0;
 bool startM68KTracing = false;
 
@@ -177,6 +178,7 @@ if (inRoutine)
        d5Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_D5);
        d6Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_D6);
        d7Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_D7);
+       srQueue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_SR);
        pcQPtr++;
        pcQPtr &= 0x3FF;
 
@@ -188,7 +190,7 @@ if (inRoutine)
                for(int i=0; i<0x400; i++)
                {
 //                     WriteLog("[A2=%08X, D0=%08X]\n", a2Queue[(pcQPtr + i) & 0x3FF], d0Queue[(pcQPtr + i) & 0x3FF]);
-                       WriteLog("[A0=%08X, A1=%08X, A2=%08X, A3=%08X, A4=%08X, A5=%08X, A6=%08X, A7=%08X, D0=%08X, D1=%08X, D2=%08X, D3=%08X, D4=%08X, D5=%08X, D6=%08X, D7=%08X]\n", a0Queue[(pcQPtr + i) & 0x3FF], a1Queue[(pcQPtr + i) & 0x3FF], a2Queue[(pcQPtr + i) & 0x3FF], a3Queue[(pcQPtr + i) & 0x3FF], a4Queue[(pcQPtr + i) & 0x3FF], a5Queue[(pcQPtr + i) & 0x3FF], a6Queue[(pcQPtr + i) & 0x3FF], a7Queue[(pcQPtr + i) & 0x3FF], d0Queue[(pcQPtr + i) & 0x3FF], d1Queue[(pcQPtr + i) & 0x3FF], d2Queue[(pcQPtr + i) & 0x3FF], d3Queue[(pcQPtr + i) & 0x3FF], d4Queue[(pcQPtr + i) & 0x3FF], d5Queue[(pcQPtr + i) & 0x3FF], d6Queue[(pcQPtr + i) & 0x3FF], d7Queue[(pcQPtr + i) & 0x3FF]);
+                       WriteLog("[A0=%08X, A1=%08X, A2=%08X, A3=%08X, A4=%08X, A5=%08X, A6=%08X, A7=%08X, D0=%08X, D1=%08X, D2=%08X, D3=%08X, D4=%08X, D5=%08X, D6=%08X, D7=%08X, SR=%04X]\n", a0Queue[(pcQPtr + i) & 0x3FF], a1Queue[(pcQPtr + i) & 0x3FF], a2Queue[(pcQPtr + i) & 0x3FF], a3Queue[(pcQPtr + i) & 0x3FF], a4Queue[(pcQPtr + i) & 0x3FF], a5Queue[(pcQPtr + i) & 0x3FF], a6Queue[(pcQPtr + i) & 0x3FF], a7Queue[(pcQPtr + i) & 0x3FF], d0Queue[(pcQPtr + i) & 0x3FF], d1Queue[(pcQPtr + i) & 0x3FF], d2Queue[(pcQPtr + i) & 0x3FF], d3Queue[(pcQPtr + i) & 0x3FF], d4Queue[(pcQPtr + i) & 0x3FF], d5Queue[(pcQPtr + i) & 0x3FF], d6Queue[(pcQPtr + i) & 0x3FF], d7Queue[(pcQPtr + i) & 0x3FF], srQueue[(pcQPtr + i) & 0x3FF]);
                        m68k_disassemble(buffer, pcQueue[(pcQPtr + i) & 0x3FF], 0);//M68K_CPU_TYPE_68000);
                        WriteLog("\t%08X: %s\n", pcQueue[(pcQPtr + i) & 0x3FF], buffer);
                }
@@ -1003,10 +1005,12 @@ int irq_ack_handler(int level)
        // IPL1 is connected to INTL on TOM (OUT to 68K)
        // IPL0-2 are also tied to Vcc via 4.7K resistors!
        // (DINT on TOM goes into DINT on JERRY (IN Tom from Jerry))
-       // There doesn't seem to be any other path to IPL0 or 2 on the schematic, which means
-       // that *all* IRQs to the 68K are routed thru TOM at level 2. Which means they're all maskable.
+       // There doesn't seem to be any other path to IPL0 or 2 on the schematic,
+       // which means that *all* IRQs to the 68K are routed thru TOM at level 2.
+       // Which means they're all maskable.
 
-       // The GPU/DSP/etc are probably *not* issuing an NMI, but it seems to work OK...
+       // The GPU/DSP/etc are probably *not* issuing an NMI, but it seems to work
+       // OK...
        // They aren't, and this causes problems with a, err, specific ROM. :-D
 
        if (level == 2)
@@ -1474,8 +1478,9 @@ void M68K_show_context(void)
 // Unknown read/write byte/word routines
 //
 
-// It's hard to believe that developers would be sloppy with their memory writes, yet in
-// some cases the developers screwed up royal. E.g., Club Drive has the following code:
+// It's hard to believe that developers would be sloppy with their memory
+// writes, yet in some cases the developers screwed up royal. E.g., Club Drive
+// has the following code:
 //
 // 807EC4: movea.l #$f1b000, A1
 // 807ECA: movea.l #$8129e0, A0
@@ -1486,9 +1491,10 @@ void M68K_show_context(void)
 // 807EDC: move.l  (A0)+, (A1)+
 // 807EDE: dbra    D1, 807edc
 //
-// The problem is at $807ED0--instead of putting A0 into D0, they really meant to put A1
-// in. This mistake causes it to try and overwrite approximately $700000 worth of address
-// space! (That is, unless the 68K causes a bus error...)
+// The problem is at $807ED0--instead of putting A0 into D0, they really meant
+// to put A1 in. This mistake causes it to try and overwrite approximately
+// $700000 worth of address space! (That is, unless the 68K causes a bus
+// error...)
 
 void jaguar_unknown_writebyte(unsigned address, unsigned data, uint32_t who/*=UNKNOWN*/)
 {
@@ -1655,6 +1661,10 @@ uint16_t JaguarReadWord(uint32_t offset, uint32_t who/*=UNKNOWN*/)
 
 void JaguarWriteByte(uint32_t offset, uint8_t data, uint32_t who/*=UNKNOWN*/)
 {
+/*     if ((offset & 0x1FFFFF) >= 0xE00 && (offset & 0x1FFFFF) < 0xE18)
+       {
+               WriteLog("JWB: Byte %02X written at %08X by %s\n", data, offset, whoName[who]);
+       }//*/
 /*     if (offset >= 0x4E00 && offset < 0x4E04)
                WriteLog("JWB: Byte %02X written at %08X by %s\n", data, offset, whoName[who]);//*/
 //Need to check for writes in the range of $18FA70 + 8000...
@@ -1693,6 +1703,11 @@ void JaguarWriteByte(uint32_t offset, uint8_t data, uint32_t who/*=UNKNOWN*/)
 uint32_t starCount;
 void JaguarWriteWord(uint32_t offset, uint16_t data, uint32_t who/*=UNKNOWN*/)
 {
+/*     if ((offset & 0x1FFFFF) >= 0xE00 && (offset & 0x1FFFFF) < 0xE18)
+       {
+               WriteLog("JWW: Word %04X written at %08X by %s\n", data, offset, whoName[who]);
+               WriteLog("     GPU PC = $%06X\n", GPUReadLong(0xF02110, DEBUG));
+       }//*/
 /*     if (offset >= 0x4E00 && offset < 0x4E04)
                WriteLog("JWW: Word %04X written at %08X by %s\n", data, offset, whoName[who]);//*/
 /*if (offset == 0x0100)//64*4)
index e165dd202610e196425fde74cc07a8662e51ab6e..e98f1da8120f957a220e2d69898064165add532e 100644 (file)
@@ -110,6 +110,43 @@ NB: Seems that when an address exception occurs, it doesn't get handled properly
 // on Atari ST, because it's possible to change the MFP's vector base
 // and get a conflict with 'normal' cpu exceptions.
 //
+#if 0
+/*
+This is the STOP # function. Dunno if exception handling occurs when it hits here or not, because don't know if the regs.s bit is set or not!
+Seems to be...
+
+SR-----------------
+1111 11
+5432 1098 7654 3210
+---- ---- ---- ----
+  1    1
+
+
+*/
+unsigned long CPUFUNC(op_4e72_5)(uint32_t opcode) /* STOP */
+{
+       OpcodeFamily = 44;
+       CurrentInstrCycles = 4;
+
+       if (!regs.s)
+       {
+               Exception(8, 0, M68000_EXC_SRC_CPU);
+       }
+       else
+       {
+               int16_t src = get_iword_prefetch(2);
+               regs.sr = src;
+               MakeFromSR();
+               m68k_setstopped(1);
+               m68k_incpc(4);
+               fill_prefetch_0();
+       }
+
+       return 4;
+}
+#endif
+//tmp...
+void WriteLog(const char * text, ...);
 void Exception(int nr, uint32_t oldpc, int ExceptionSource)
 {
        uint32_t currpc = m68k_getpc(), newpc;
@@ -128,15 +165,15 @@ char excNames[33][64] = {
        "Trap #"
 };
 
-printf("Exception #%i occurred! (%s)\n", nr, (nr < 32 ? excNames[nr] : (nr < 48 ? "Trap #" : "????")));
-printf("Vector @ #%i = %08X\n", nr, m68k_read_memory_32(nr * 4));
+WriteLog("Exception #%i occurred! (%s)\n", nr, (nr < 32 ? excNames[nr] : (nr < 48 ? "Trap #" : "????")));
+WriteLog("Vector @ #%i = %08X\n", nr, m68k_read_memory_32(nr * 4));
 //abort();
-printf("PC = $%08X\n", currpc);
-printf("A0 = $%08X A1 = $%08X A2 = $%08X A3 = $%08X\n", m68k_areg(regs, 0), m68k_areg(regs, 1), m68k_areg(regs, 2), m68k_areg(regs, 3));
-printf("A4 = $%08X A5 = $%08X A6 = $%08X A7 = $%08X\n", m68k_areg(regs, 4), m68k_areg(regs, 5), m68k_areg(regs, 6), m68k_areg(regs, 7));
-printf("D0 = $%08X D1 = $%08X D2 = $%08X D3 = $%08X\n", m68k_dreg(regs, 0), m68k_dreg(regs, 1), m68k_dreg(regs, 2), m68k_dreg(regs, 3));
-printf("D4 = $%08X D5 = $%08X D6 = $%08X D7 = $%08X\n", m68k_dreg(regs, 4), m68k_dreg(regs, 5), m68k_dreg(regs, 6), m68k_dreg(regs, 7));
-printf("\n");
+WriteLog("PC = $%08X\n", currpc);
+WriteLog("A0 = $%08X A1 = $%08X A2 = $%08X A3 = $%08X\n", m68k_areg(regs, 0), m68k_areg(regs, 1), m68k_areg(regs, 2), m68k_areg(regs, 3));
+WriteLog("A4 = $%08X A5 = $%08X A6 = $%08X A7 = $%08X\n", m68k_areg(regs, 4), m68k_areg(regs, 5), m68k_areg(regs, 6), m68k_areg(regs, 7));
+WriteLog("D0 = $%08X D1 = $%08X D2 = $%08X D3 = $%08X\n", m68k_dreg(regs, 0), m68k_dreg(regs, 1), m68k_dreg(regs, 2), m68k_dreg(regs, 3));
+WriteLog("D4 = $%08X D5 = $%08X D6 = $%08X D7 = $%08X\n", m68k_dreg(regs, 4), m68k_dreg(regs, 5), m68k_dreg(regs, 6), m68k_dreg(regs, 7));
+WriteLog("\n");
 
 uint32_t disPC = currpc - 10;
 char buffer[128];
@@ -145,7 +182,7 @@ do
 {
        uint32_t oldpc = disPC;
        disPC += m68k_disassemble(buffer, disPC, 0);
-       printf("%s%08X: %s\n", (oldpc == currpc ? ">" : " "), oldpc, buffer);
+       WriteLog("%s%08X: %s\n", (oldpc == currpc ? ">" : " "), oldpc, buffer);
 }
 while (disPC < (currpc + 10));
 #endif
index 8dab55d7690610964ab1e6efaeaa5ab04b2548fc..d896cdfe10ac3361fd909ff4ebd315d9c58bc2e9 100644 (file)
@@ -199,6 +199,7 @@ void m68k_pulse_reset(void)
        REG_PC = m68ki_read_imm_32();
        m68ki_jump(REG_PC);
 #else
+       checkForIRQToHandle = 0;
        regs.spcflags = 0;
        regs.stopped = 0;
        regs.remainingCycles = 0;
@@ -496,7 +497,7 @@ void m68ki_exception_interrupt(uint32_t intLevel)
 // prolly, for debugging/alpine mode... :-/
 // but then again, this should be handled already by the main execution loop :-P
        // If we are halted, don't do anything
-//     if (regs.stopped)
+//     if (regs.halted)
 //             return;
 
        // Acknowledge the interrupt (NOTE: This is a user supplied function!)