2 // m68kdasmbrowser.cpp - Jaguar M68K disassembly browser
5 // (C) 2012 Underground Software
7 // JLH = James Hammons <jlhamm@acm.org>
10 // --- ---------- -------------------------------------------------------------
11 // JLH 12/01/2012 Created this file
17 #include "m68kdasmbrowser.h"
19 #include "m68000/m68kinterface.h"
24 M68KDasmBrowserWindow::M68KDasmBrowserWindow(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"))),
30 setWindowTitle(tr("M68K Disassembly Browser"));
32 // Need to set the size as well...
35 QFont fixedFont("Lucida Console", 10, QFont::Normal);
36 text->setFont(fixedFont);
37 //// layout->setSizeConstraint(QLayout::SetFixedSize);
40 layout->addWidget(text);
41 layout->addWidget(refresh);
43 connect(refresh, SIGNAL(clicked()), this, SLOT(RefreshContents()));
47 void M68KDasmBrowserWindow::RefreshContents(void)
49 char string[1024];//, buf[64];
53 int pc = memBase, oldpc;
55 for(uint32_t i=0; i<32; i++)
58 pc += m68k_disassemble(buffer, pc, 0);
59 // WriteLog("%06X: %s\n", oldpc, buffer);
60 sprintf(string, "%06X: %s<br>", oldpc, buffer);
62 buffer[0] = 0; // Clear string
63 char singleCharString[2] = { 0, 0 };
65 for(int j=0; j<strlen(string); j++)
68 strcat(buffer, " ");
71 singleCharString[0] = string[j];
72 strcat(buffer, singleCharString);
76 // s += QString(string);
85 void M68KDasmBrowserWindow::keyPressEvent(QKeyEvent * e)
87 if (e->key() == Qt::Key_Escape || e->key() == Qt::Key_Return)
90 else if (e->key() == Qt::Key_PageUp)
99 else if (e->key() == Qt::Key_PageDown)
103 if (memBase > (0x200000 - 480))
104 memBase = 0x200000 - 480;
108 else if (e->key() == Qt::Key_Up || e->key() == Qt::Key_Minus)
117 else if (e->key() == Qt::Key_Down || e->key() == Qt::Key_Equal)
121 if (memBase > (0x200000 - 480))
122 memBase = 0x200000 - 480;