#include "m68000/m68kinterface.h"
#include "dsp.h"
#include "gpu.h"
+#include "jaguar.h"
CPUBrowserWindow::CPUBrowserWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog),
-// layout(new QVBoxLayout), text(new QTextBrowser),
layout(new QVBoxLayout), text(new QLabel),
refresh(new QPushButton(tr("Refresh"))),
- memBase(0)
+ bpm(new QCheckBox(tr("BPM"))), bpmAddress(new QLineEdit)
{
setWindowTitle(tr("CPU Browser"));
// Need to set the size as well...
// resize(560, 480);
+ // Limit input to 6 hex digits
+ bpmAddress->setInputMask("hhhhhh");
+ QHBoxLayout * hbox1 = new QHBoxLayout;
+ hbox1->addWidget(bpm);
+ hbox1->addWidget(bpmAddress);
+
// QFont fixedFont("Lucida Console", 8, QFont::Normal);
QFont fixedFont("", 8, QFont::Normal);
fixedFont.setStyleHint(QFont::TypeWriter);
setLayout(layout);
layout->addWidget(text);
+ layout->addLayout(hbox1);
layout->addWidget(refresh);
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 &)));
}
uint32_t m68kSR = m68k_get_reg(NULL, M68K_REG_SR);
sprintf(string, "PC: %06X SR: %04X<br><br>", m68kPC, m68kSR);
s += QString(string);
+/*
+SR format:
++--+--+--+--+ +--+--+--+--+ +--+--+--+--+ +--+--+--+--+
+|T1|T0| S| M| |--|I2|I1|I0| |--|--|--| X| | N| Z| V| C|
++--+--+--+--+ +--+--+--+--+ +--+--+--+--+ +--+--+--+--+
+ T - Trace (T1 only in 68K, T0 = 0)
+ S - Supervisor flag
+ M - Master/Interrupt flag (= 0 in 68K)
+ I - Interrupt level mask
+ X - Extend flag
+ N - Negative flag
+ Z - Zero flag
+ V - Overflow flag
+ C - Carry flag
+*/
uint32_t m68kA0 = m68k_get_reg(NULL, M68K_REG_A0);
uint32_t m68kA1 = m68k_get_reg(NULL, M68K_REG_A1);
s += QString(string);
// GPU
- sprintf(string, "GPU PC: %06X FLAGS: %08X<br><br>", GPUReadLong(0xF02010), GPUReadLong(0xF02000));
+ sprintf(string, "GPU PC: %06X FLAGS: %04X SR: %04X<br><br>", GPUReadLong(0xF02110, DEBUG), GPUReadLong(0xF02100, DEBUG), GPUReadLong(0xF02114, DEBUG));
s += QString(string);
+/*
+GPU Flags:
+0 - Zero flag
+1 - Carry flag
+2 - Negative flag
+3 - IMASK (writing 0 clears, 1 has no effect)
+4-8 - IRQ enable 0 - 4
+9-13 - IRQ latch clear 0 - 4
+14 - REGPAGE
+15 - DMAEN
+
+GPU Control:
+0 - GPU Go
+1 - CPUINT
+2 - GPUINT0
+3 - Single Step
+4 - Single step go
+5 - Unused
+6-10 - IRQ Latch 0 - 4
+11 - Bus Hog
+12-15 - Version
+*/
sprintf(string, "Bank 0:<br>"
"R00: %08X R01: %08X R02: %08X R03: %08X<br>"
s += QString(string);
// DSP
- sprintf(string, "DSP PC: %06X FLAGS: %08X<br><br>", DSPReadLong(0xF1A110), DSPReadLong(0xF1A100));
+ sprintf(string, "DSP PC: %06X FLAGS: %05X SR: %05X<br><br>", DSPReadLong(0xF1A110, DEBUG), DSPReadLong(0xF1A100, DEBUG), DSPReadLong(0xF1A114, DEBUG));
s += QString(string);
+/*
+DSP Flags:
+0 - Zero flag
+1 - Carry flag
+2 - Negative flag
+3 - IMASK (writing 0 clears, 1 has no effect)
+4-8 - IRQ enable 0 - 4
+9-13 - IRQ latch clear 0 - 4
+14 - REGPAGE
+15 - DMAEN
+16 - IRQ enable 5
+17 - IRQ latch clear 5
+
+DSP Control:
+0 - DSP Go
+1 - CPUINT
+2 - DSPINT0
+3 - Single Step
+4 - Single step go
+5 - Unused
+6-10 - IRQ Latch 0 - 4
+11 - Bus Hog
+12-15 - Version
+16 - IRQ Latch 5
+*/
sprintf(string, "Bank 0:<br>"
"R00: %08X R01: %08X R02: %08X R03: %08X<br>"
}
+void CPUBrowserWindow::HandleBPM(bool state)
+{
+ bpmActive = state;
+if (bpmActive)
+ printf("BPM Set: $%06X\n", bpmAddress1);
+}
+
+
+void CPUBrowserWindow::HandleBPMAddress(const QString & newText)
+{
+ bool ok;
+ bpmAddress1 = newText.toUInt(&ok, 16);
+}
+
+
void CPUBrowserWindow::keyPressEvent(QKeyEvent * e)
{
if (e->key() == Qt::Key_Escape)
hide();
+#if 0
else if (e->key() == Qt::Key_PageUp)
{
memBase -= 480;
RefreshContents();
}
+#endif
}