2 // DasmWin.cpp - Jaguar disassembly window
6 // JPM = Jean-Paul Mari <djipi.mari@gmail.com>
9 // --- ---------- -------------------------------------------------------------
10 // JPM 06/26/2016 Created this file
16 #include "debugger/DasmWin.h"
17 #include "debugger/m68kDasmWin.h"
19 #include "m68000/m68kinterface.h"
24 //DasmWindow::DasmWindow(QMdiArea * parent/*= 0*/) : QMdiSubWindow(parent, Qt::Dialog),
25 DasmWindow::DasmWindow(QWidget
* parent
/*= 0*/): QWidget(parent
, Qt::Dialog
),
26 // layout(new QVBoxLayout), text(new QTextBrowser),
27 layout1(new QDockWidget
), layout(new QVBoxLayout
), text(new QLabel
),
28 refresh(new QPushButton(tr("Refresh"))),
29 address(new QLineEdit
),
30 go(new QPushButton(tr("Go"))),
33 // m68kDasmWindow *m68kDasmWin = new m68kDasmWindow();
34 setWindowTitle(tr("Jaguar Disassembly Window"));
35 layout1
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
36 //addDockWidget(Qt::RightDockWidgetArea, layout1);
37 //layout1->addTab(new m68KDasmWindow(), tr("M68K Disassembly"));
38 //layout = new QTabWidget;
41 //QDockWidget *shapesDockWidget = new QDockWidget(tr("Shapes"));
42 //shapesDockWidget->setObjectName("shapesDockWidget");
43 //shapesDockWidget->setWidget(treeWidget);
44 //shapesDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
45 //shapesDockWidget->show();
48 address
->setInputMask("hhhhhh");
49 QHBoxLayout
* hbox1
= new QHBoxLayout
;
50 hbox1
->addWidget(refresh
);
51 hbox1
->addWidget(address
);
54 // Need to set the size as well...
57 QFont
fixedFont("Lucida Console", 8, QFont::Normal
);
58 // QFont fixedFont("", 8, QFont::Normal);
59 fixedFont
.setStyleHint(QFont::TypeWriter
);
60 text
->setFont(fixedFont
);
61 //// layout->setSizeConstraint(QLayout::SetFixedSize);
64 layout
->addWidget(text
);
65 // layout->addWidget(refresh);
66 layout
->addLayout(hbox1
);
68 connect(refresh
, SIGNAL(clicked()), this, SLOT(RefreshContents()));
69 connect(go
, SIGNAL(clicked()), this, SLOT(GoToAddress()));
74 void DasmWindow::RefreshContents(void)
76 char string
[1024];//, buf[64];
80 int pc
= memBase
, oldpc
;
82 for(uint32_t i
=0; i
<32; i
++)
85 pc
+= m68k_disassemble(buffer
, pc
, 0, 1);
86 // WriteLog("%06X: %s\n", oldpc, buffer);
87 sprintf(string
, "%06X: %s<br>", oldpc
, buffer
);
89 buffer
[0] = 0; // Clear string
90 char singleCharString
[2] = { 0, 0 };
92 for(int j
=0; j
<strlen(string
); j
++)
95 strcat(buffer
, " ");
98 singleCharString
[0] = string
[j
];
99 strcat(buffer
, singleCharString
);
103 // s += QString(string);
104 s
+= QString(buffer
);
112 void DasmWindow::keyPressEvent(QKeyEvent
* e
)
114 if (e
->key() == Qt::Key_Escape
|| e
->key() == Qt::Key_Return
)
117 else if (e
->key() == Qt::Key_PageUp
)
126 else if (e
->key() == Qt::Key_PageDown
)
130 if (memBase
> (0xF00000 - 64))
131 memBase
= 0xF00000 - 64;
135 else if (e
->key() == Qt::Key_Up
|| e
->key() == Qt::Key_Minus
)
144 else if (e
->key() == Qt::Key_Down
|| e
->key() == Qt::Key_Equal
)
148 if (memBase
> (0xF00000 - 64))
149 memBase
= 0xF00000 - 64;
157 void DasmWindow::GoToAddress(void)
160 QString newAddress
= address
->text();
161 memBase
= newAddress
.toUInt(&ok
, 16);