3366f7cc602d733cf85760e1ce6d4c73d0d418b3
2 // GPUdasmWin.cpp - Jaguar GPU disassembly window
6 // JPM = Jean-Paul Mari <djipi.mari@gmail.com>
9 // --- ---------- -------------------------------------------------------------
10 // JPM 02/01/2017 Created this file
16 #include "GPUDasmWin.h"
24 GPUDasmWindow::GPUDasmWindow(QWidget
* parent
/*= 0*/): QWidget(parent
, Qt::Dialog
),
25 // layout(new QVBoxLayout), text(new QTextBrowser),
26 layout(new QVBoxLayout
), text(new QLabel
),
27 //refresh(new QPushButton(tr("Refresh"))),
28 //go(new QPushButton(tr("Go"))),
29 //address(new QLineEdit),
30 //gpu(new QRadioButton(tr("GPU"))),
31 //dsp(new QRadioButton(tr("DSP"))),
33 memBase(GPUReadLong(0xF02110, DEBUG
))
35 //setWindowTitle(tr("RISC Disassembly Browser"));
37 //address->setInputMask("hhhhhh");
38 //QHBoxLayout * hbox1 = new QHBoxLayout;
39 //hbox1->addWidget(refresh);
40 //hbox1->addWidget(address);
41 //hbox1->addWidget(go);
43 // Need to set the size as well...
46 QFont
fixedFont("Lucida Console", 8, QFont::Normal
);
47 // QFont fixedFont("", 8, QFont::Normal);
48 fixedFont
.setStyleHint(QFont::TypeWriter
);
49 text
->setFont(fixedFont
);
50 //// layout->setSizeConstraint(QLayout::SetFixedSize);
53 layout
->addWidget(text
);
54 // layout->addWidget(refresh);
55 //layout->addLayout(hbox1);
57 //connect(refresh, SIGNAL(clicked()), this, SLOT(RefreshContents()));
58 //connect(go, SIGNAL(clicked()), this, SLOT(GoToAddress()));
62 void GPUDasmWindow::RefreshContents(void)
64 char string
[1024];//, buf[64];
67 int pc
= memBase
, oldpc
;
68 uint32_t GPUPC
= GPUReadLong(0xF02110, DEBUG
);
69 bool GPUPCShow
= false;
73 for(uint32_t i
=0; i
<vjs
.nbrdisasmlines
; i
++)
76 pc
+= dasmjag(JAGUAR_GPU
, buffer
, pc
);
80 sprintf(string
, "=> %06X: %s<br>", oldpc
, buffer
);
85 sprintf(string
, " %06X: %s<br>", oldpc
, buffer
);
88 buffer
[0] = 0; // Clear string
89 char singleCharString
[2] = { 0, 0 };
91 for(uint j
=0; j
<strlen(string
); j
++)
94 strcat(buffer
, " ");
97 singleCharString
[0] = string
[j
];
98 strcat(buffer
, singleCharString
);
102 s
+= QString(buffer
);
119 void GPUDasmWindow::keyPressEvent(QKeyEvent
* e
)
121 if (e
->key() == Qt::Key_Escape
|| e
->key() == Qt::Key_Return
)
124 else if (e
->key() == Qt::Key_PageUp
)
133 else if (e
->key() == Qt::Key_PageDown
)
137 if (memBase
> (0x1000000 - 480))
138 memBase
= 0x1000000 - 480;
142 else if (e
->key() == Qt::Key_Up
|| e
->key() == Qt::Key_Minus
)
151 else if (e
->key() == Qt::Key_Down
|| e
->key() == Qt::Key_Equal
)
155 if (memBase
> (0x1000000 - 480))
156 memBase
= 0x1000000 - 480;
166 void GPUDasmWindow::GoToAddress(void)
169 QString newAddress
= address
->text();
170 memBase
= newAddress
.toUInt(&ok
, 16);
176 // Set mem base PC address using the 68K pc current address
177 void GPUDasmWindow::UseGPUPCAddress(void)
179 memBase
= GPUReadLong(0xF02110, DEBUG
);
183 // Set mem base PC address
185 void GPUDasmWindow::SetAddress(int address
)
188 // RefreshContents();