Update the breakpoint feature
[clinton/Virtual-Jaguar-Rx.git] / src / debugger / DSPDasmWin.cpp
1 //
2 // DSPDasmWin.cpp - Jaguar DSP disassembly window
3 //
4 // by Jean-Paul Mari
5 //
6 // JPM = Jean-Paul Mari <djipi.mari@gmail.com>
7 //
8 // Who When What
9 // --- ---------- -------------------------------------------------------------
10 // JPM 02/02/2017 Created this file
11 //
12
13 // STILL TO DO:
14 //
15
16 #include "DSPDasmWin.h"
17 #include "dsp.h"
18 #include "gpu.h"
19 #include "jagdasm.h"
20 #include "settings.h"
21
22
23 DSPDasmWindow::DSPDasmWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog),
24 layout(new QVBoxLayout), text(new QLabel),
25 memBase(DSPReadLong(0xF1A110, DEBUG))
26 {
27 QFont fixedFont("Lucida Console", 8, QFont::Normal);
28 fixedFont.setStyleHint(QFont::TypeWriter);
29 text->setFont(fixedFont);
30 setLayout(layout);
31
32 layout->addWidget(text);
33 }
34
35
36 void DSPDasmWindow::RefreshContents(void)
37 {
38 char string[1024];
39 QString s;
40 char buffer[2048];
41 int pc = memBase, oldpc;
42 uint32_t DSPPC = DSPReadLong(0xF1A110, DEBUG);
43 bool DSPPCShow = false;
44
45 text->clear();
46
47 for(uint32_t i=0; i<vjs.nbrdisasmlines; i++)
48 {
49 oldpc = pc;
50 pc += dasmjag(JAGUAR_DSP, buffer, pc);
51
52 if (DSPPC == oldpc)
53 {
54 sprintf(string, "=> %06X: %s<br>", oldpc, buffer);
55 DSPPCShow = true;
56 }
57 else
58 {
59 sprintf(string, " %06X: %s<br>", oldpc, buffer);
60 }
61
62 buffer[0] = 0; // Clear string
63 char singleCharString[2] = { 0, 0 };
64
65 for(uint j=0; j<strlen(string); j++)
66 {
67 if (string[j] == 32)
68 strcat(buffer, "&nbsp;");
69 else
70 {
71 singleCharString[0] = string[j];
72 strcat(buffer, singleCharString);
73 }
74 }
75
76 s += QString(buffer);
77 }
78
79 if (DSPPCShow)
80 {
81 text->setText(s);
82 }
83 else
84 {
85 UseDSPPCAddress();
86 RefreshContents();
87 }
88 }
89
90
91 // Set mem base PC address using the 68K pc current address
92 void DSPDasmWindow::UseDSPPCAddress(void)
93 {
94 memBase = DSPReadLong(0xF1A110, DEBUG);
95 }
96