mirror of
https://github.com/nzeemin/ukncbtl-qt.git
synced 2025-04-18 06:04:01 +03:00
AStyle
This commit is contained in:
parent
76ae66427b
commit
1c3a779cbc
5
!astyle.bat
Normal file
5
!astyle.bat
Normal file
@ -0,0 +1,5 @@
|
||||
@echo off
|
||||
set ASTYLEEXE=c:\bin\astyle.exe
|
||||
set ASTYLEOPT=-n -Q --options=astyle-cpp-options
|
||||
%ASTYLEEXE% %ASTYLEOPT% Util\*.h Util\*.cpp
|
||||
%ASTYLEEXE% %ASTYLEOPT% *.h *.cpp
|
34
Common.cpp
34
Common.cpp
@ -15,19 +15,19 @@ bool AssertFailedLine(const char * lpszFileName, int nLine)
|
||||
char buffer[360];
|
||||
_snprintf(buffer, 360,
|
||||
QT_TRANSLATE_NOOP("Common",
|
||||
"ASSERTION FAILED\n\nFile: %s\nLine: %d\n\n"
|
||||
"Press Abort to stop the program, Retry to break to the debugger, or Ignore to continue execution."),
|
||||
"ASSERTION FAILED\n\nFile: %s\nLine: %d\n\n"
|
||||
"Press Abort to stop the program, Retry to break to the debugger, or Ignore to continue execution."),
|
||||
lpszFileName, nLine);
|
||||
int result = QMessageBox::question(NULL, QT_TRANSLATE_NOOP("Common", "UKNC Back to Life"),
|
||||
buffer, QMessageBox::Abort, QMessageBox::Retry, QMessageBox::Ignore);
|
||||
switch (result)
|
||||
{
|
||||
case QMessageBox::Retry:
|
||||
return true;
|
||||
case QMessageBox::Ignore:
|
||||
return false;
|
||||
case QMessageBox::Abort:
|
||||
QCoreApplication::exit(255);
|
||||
case QMessageBox::Retry:
|
||||
return true;
|
||||
case QMessageBox::Ignore:
|
||||
return false;
|
||||
case QMessageBox::Abort:
|
||||
QCoreApplication::exit(255);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -138,7 +138,8 @@ void Common_Cleanup()
|
||||
// buffer size at least 7 characters
|
||||
void PrintOctalValue(char* buffer, quint16 value)
|
||||
{
|
||||
for (int p = 0; p < 6; p++) {
|
||||
for (int p = 0; p < 6; p++)
|
||||
{
|
||||
int digit = value & 7;
|
||||
buffer[5 - p] = '0' + digit;
|
||||
value = (value >> 3);
|
||||
@ -149,7 +150,8 @@ void PrintOctalValue(char* buffer, quint16 value)
|
||||
// buffer size at least 5 characters
|
||||
void PrintHexValue(char* buffer, quint16 value)
|
||||
{
|
||||
for (int p = 0; p < 4; p++) {
|
||||
for (int p = 0; p < 4; p++)
|
||||
{
|
||||
int digit = value & 15;
|
||||
buffer[3 - p] = (digit < 10) ? '0' + (char)digit : 'a' + (char)(digit - 10);
|
||||
value = (value >> 4);
|
||||
@ -160,7 +162,8 @@ void PrintHexValue(char* buffer, quint16 value)
|
||||
// buffer size at least 17 characters
|
||||
void PrintBinaryValue(char * buffer, quint16 value)
|
||||
{
|
||||
for (int b = 0; b < 16; b++) {
|
||||
for (int b = 0; b < 16; b++)
|
||||
{
|
||||
int bit = (value >> b) & 1;
|
||||
buffer[15 - b] = bit ? '1' : '0';
|
||||
}
|
||||
@ -191,7 +194,8 @@ bool ParseOctalValue(const char* text, quint16* pValue)
|
||||
{
|
||||
quint16 value = 0;
|
||||
char* pChar = (char*) text;
|
||||
for (int p = 0; ; p++) {
|
||||
for (int p = 0; ; p++)
|
||||
{
|
||||
if (p > 6) return false;
|
||||
char ch = *pChar; pChar++;
|
||||
if (ch == 0) break;
|
||||
@ -208,7 +212,8 @@ bool ParseOctalValue(const char* text, quint16* pValue)
|
||||
bool ParseOctalValue(const QString &text, quint16* pValue)
|
||||
{
|
||||
quint16 value = 0;
|
||||
for (int p = 0; p < text.length(); p++) {
|
||||
for (int p = 0; p < text.length(); p++)
|
||||
{
|
||||
if (p > 6) return false;
|
||||
char ch = text.at(p).toLatin1();
|
||||
if (ch == 0) break;
|
||||
@ -223,7 +228,8 @@ bool ParseOctalValue(const QString &text, quint16* pValue)
|
||||
|
||||
|
||||
// KOI8-R (Russian) to Unicode conversion table
|
||||
const ushort KOI8R_CODES[] = {
|
||||
const ushort KOI8R_CODES[] =
|
||||
{
|
||||
0x2500, 0x2502, 0x250c, 0x2510, 0x2514, 0x2518, 0x251c, 0x2524, 0x252c, 0x2534, 0x253c, 0x2580, 0x2584, 0x2588, 0x258c, 0x2590,
|
||||
0x2591, 0x2592, 0x2593, 0x2320, 0x25a0, 0x2219, 0x221a, 0x2248, 0x2264, 0x2265, 0x00a0, 0x2321, 0x00b0, 0x00b2, 0x00b7, 0x00f7,
|
||||
0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d, 0x255e,
|
||||
|
4
Common.h
4
Common.h
@ -41,9 +41,9 @@ typedef const char * LPCTSTR;
|
||||
//#define HIBYTE(w) ((quint8)((((quint32)(w)) >> 8) & 0xff))
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define CALLBACK
|
||||
#define CALLBACK
|
||||
#else
|
||||
#define CALLBACK __stdcall
|
||||
#define CALLBACK __stdcall
|
||||
#endif
|
||||
|
||||
typedef void *HANDLE;
|
||||
|
@ -110,7 +110,7 @@ void Emulator_Done()
|
||||
CProcessor::Done();
|
||||
|
||||
g_pBoard->SetSoundGenCallback(NULL);
|
||||
if(g_sound)
|
||||
if (g_sound)
|
||||
{
|
||||
delete g_sound;
|
||||
g_sound = NULL;
|
||||
@ -188,7 +188,7 @@ int Emulator_SystemFrame()
|
||||
|
||||
//ScreenView_ScanKeyboard();
|
||||
Emulator_ProcessKeyEvent();
|
||||
|
||||
|
||||
if (!g_pBoard->SystemFrame())
|
||||
return 0;
|
||||
|
||||
@ -491,7 +491,7 @@ void CALLBACK Emulator_FeedDAC(unsigned short l, unsigned short r)
|
||||
if (g_sound)
|
||||
{
|
||||
if (m_okEmulatorSound)
|
||||
g_sound->FeedDAC(l,r);
|
||||
g_sound->FeedDAC(l, r);
|
||||
}
|
||||
}
|
||||
|
||||
|
32
astyle-cpp-options
Normal file
32
astyle-cpp-options
Normal file
@ -0,0 +1,32 @@
|
||||
## Formatting options for
|
||||
## Astyle - Source code indenter, formatter, and beautifier for C, C++, and Java Source Code
|
||||
## http://astyle.sourceforge.net/
|
||||
|
||||
# Indent as C/C++
|
||||
--mode=c
|
||||
# Use CRLF line end style
|
||||
--lineend=windows
|
||||
|
||||
# Allman style formatting/indenting uses broken brackets
|
||||
--style=break
|
||||
|
||||
# Indent using 4 spaces per indent
|
||||
--indent=spaces=4
|
||||
--indent-namespaces
|
||||
# Indent 'case X:' blocks from the 'case X:' headers. Case statements not enclosed in blocks are NOT indented.
|
||||
--indent-cases
|
||||
|
||||
--min-conditional-indent=0
|
||||
--max-instatement-indent=8
|
||||
|
||||
# Insert space padding around operators
|
||||
--pad-oper
|
||||
# Insert space padding after paren headers only (e.g. 'if', 'for', 'while'...)
|
||||
--pad-header
|
||||
|
||||
--break-closing-brackets
|
||||
|
||||
# Don't break one-line blocks
|
||||
--keep-one-line-blocks
|
||||
# Don't break complex statements and multiple statements residing on a single line
|
||||
--keep-one-line-statements
|
@ -128,7 +128,8 @@ MainWindow::~MainWindow()
|
||||
void MainWindow::changeEvent(QEvent *e)
|
||||
{
|
||||
QMainWindow::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
switch (e->type())
|
||||
{
|
||||
case QEvent::LanguageChange:
|
||||
ui->retranslateUi(this);
|
||||
break;
|
||||
@ -332,14 +333,14 @@ void MainWindow::saveScreenshot(const QString& strFileName)
|
||||
void MainWindow::helpAbout()
|
||||
{
|
||||
QMessageBox::about(this, tr("About"), tr(
|
||||
"UKNCBTL Qt Version 1.0\n"
|
||||
"Copyright (C) 2007-2018\n\n"
|
||||
"https://github.com/nzeemin/ukncbtl-qt\n\n"
|
||||
"Authors:\r\nNikita Zimin\nFelix Lazarev\nAlexey Kisly\n\n"
|
||||
"Special thanks to:\nArseny Gordin\n\n"
|
||||
"Build date:\t%1 %2\n"
|
||||
"Qt version:\t%3")
|
||||
.arg(__DATE__).arg(__TIME__).arg(QT_VERSION_STR));
|
||||
"UKNCBTL Qt Version 1.0\n"
|
||||
"Copyright (C) 2007-2018\n\n"
|
||||
"https://github.com/nzeemin/ukncbtl-qt\n\n"
|
||||
"Authors:\r\nNikita Zimin\nFelix Lazarev\nAlexey Kisly\n\n"
|
||||
"Special thanks to:\nArseny Gordin\n\n"
|
||||
"Build date:\t%1 %2\n"
|
||||
"Qt version:\t%3")
|
||||
.arg(__DATE__).arg(__TIME__).arg(QT_VERSION_STR));
|
||||
}
|
||||
|
||||
void MainWindow::viewKeyboard()
|
||||
|
@ -11,11 +11,13 @@ class QDisasmView;
|
||||
class QMemoryView;
|
||||
class QLabel;
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class MainWindow : public QMainWindow {
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MainWindow(QWidget *parent = 0);
|
||||
|
@ -117,7 +117,7 @@ void QConsoleView::printHelp()
|
||||
" s Step Into; executes one instruction\r\n"
|
||||
" so Step Over; executes and stops after the current instruction\r\n"
|
||||
// " u Save memory dump to file memdumpXPU.bin\r\n"
|
||||
));
|
||||
));
|
||||
}
|
||||
|
||||
int QConsoleView::printDisassemble(CProcessor* pProc, quint16 address, bool okOneInstr, bool okShort)
|
||||
@ -129,7 +129,7 @@ int QConsoleView::printDisassemble(CProcessor* pProc, quint16 address, bool okOn
|
||||
quint16 memory[nWindowSize + 2];
|
||||
int addrType;
|
||||
for (int i = 0; i < nWindowSize + 2; i++)
|
||||
memory[i] = pMemCtl->GetWordView(address + i*2, okHaltMode, true, &addrType);
|
||||
memory[i] = pMemCtl->GetWordView(address + i * 2, okHaltMode, true, &addrType);
|
||||
|
||||
char bufaddr[7];
|
||||
char bufvalue[7];
|
||||
@ -137,7 +137,8 @@ int QConsoleView::printDisassemble(CProcessor* pProc, quint16 address, bool okOn
|
||||
|
||||
int lastLength = 0;
|
||||
int length = 0;
|
||||
for (int index = 0; index < nWindowSize; index++) { // Ðèñóåì ñòðîêè
|
||||
for (int index = 0; index < nWindowSize; index++) // Ðèñóåì ñòðîêè
|
||||
{
|
||||
PrintOctalValue(bufaddr, address);
|
||||
quint16 value = memory[index];
|
||||
PrintOctalValue(bufvalue, value);
|
||||
@ -201,16 +202,17 @@ void QConsoleView::printMemoryDump(CProcessor *pProc, quint16 address, int lines
|
||||
{
|
||||
quint16 dump[8];
|
||||
for (int i = 0; i < 8; i++)
|
||||
dump[i] = pMemCtl->GetWord(address + i*2, okHaltMode);
|
||||
dump[i] = pMemCtl->GetWord(address + i * 2, okHaltMode);
|
||||
|
||||
char buffer[2+6+2 + 7*8 + 1 + 16 + 1 + 2];
|
||||
char buffer[2 + 6 + 2 + 7 * 8 + 1 + 16 + 1 + 2];
|
||||
char* pBuf = buffer;
|
||||
*pBuf = ' '; pBuf++;
|
||||
*pBuf = ' '; pBuf++;
|
||||
PrintOctalValue(pBuf, address); pBuf += 6;
|
||||
*pBuf = ' '; pBuf++;
|
||||
*pBuf = ' '; pBuf++;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
PrintOctalValue(pBuf, dump[i]); pBuf += 6;
|
||||
*pBuf = ' '; pBuf++;
|
||||
}
|
||||
@ -353,7 +355,7 @@ void QConsoleView::execConsoleCommand(const QString &command)
|
||||
okUpdateMenu = true;
|
||||
}
|
||||
else if (command.startsWith("d") || // Disassemble
|
||||
command.startsWith("D")) // Disassemble, short format
|
||||
command.startsWith("D")) // Disassemble, short format
|
||||
{
|
||||
bool okShort = (command[0] == 'D');
|
||||
if (command.length() == 1) // "d" - disassemble at current address
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
QDebugView::QDebugView(QWidget *mainWindow) :
|
||||
QWidget()
|
||||
QWidget()
|
||||
{
|
||||
m_okDebugProcessor = false;
|
||||
|
||||
@ -65,7 +65,8 @@ void QDebugView::updateData()
|
||||
ASSERT(pCPU != NULL);
|
||||
|
||||
// Get new register values and set change flags
|
||||
for (int r = 0; r < 8; r++) {
|
||||
for (int r = 0; r < 8; r++)
|
||||
{
|
||||
quint16 value = pCPU->GetReg(r);
|
||||
m_okDebugCpuRChanged[r] = (m_wDebugCpuR[r] != value);
|
||||
m_wDebugCpuR[r] = value;
|
||||
@ -78,7 +79,8 @@ void QDebugView::updateData()
|
||||
ASSERT(pPPU != NULL);
|
||||
|
||||
// Get new register values and set change flags
|
||||
for (int r = 0; r < 8; r++) {
|
||||
for (int r = 0; r < 8; r++)
|
||||
{
|
||||
quint16 value = pPPU->GetReg(r);
|
||||
m_okDebugPpuRChanged[r] = (m_wDebugPpuR[r] != value);
|
||||
m_wDebugPpuR[r] = value;
|
||||
@ -115,7 +117,7 @@ void QDebugView::paintEvent(QPaintEvent * /*event*/)
|
||||
if (g_pBoard == NULL) return;
|
||||
|
||||
QPainter painter(this);
|
||||
painter.fillRect(0,0, this->width(), this->height(), Qt::white);
|
||||
painter.fillRect(0, 0, this->width(), this->height(), Qt::white);
|
||||
|
||||
QFont font = Common_GetMonospacedFont();
|
||||
painter.setFont(font);
|
||||
@ -162,10 +164,11 @@ void QDebugView::drawProcessor(QPainter &painter, const CProcessor *pProc, int x
|
||||
QColor colorText = painter.pen().color();
|
||||
|
||||
painter.setPen(QColor(Qt::gray));
|
||||
painter.drawRect(x - cxChar, y - cyLine/2, 33 * cxChar, cyLine * 15 + cyLine/2);
|
||||
painter.drawRect(x - cxChar, y - cyLine / 2, 33 * cxChar, cyLine * 15 + cyLine / 2);
|
||||
|
||||
// Registers
|
||||
for (int r = 0; r < 8; r++) {
|
||||
for (int r = 0; r < 8; r++)
|
||||
{
|
||||
painter.setPen(QColor(arrRChanged[r] ? Qt::red : colorText));
|
||||
|
||||
LPCTSTR strRegName = REGISTER_NAME[r];
|
||||
@ -225,13 +228,15 @@ void QDebugView::drawMemoryForRegister(QPainter &painter, int reg, CProcessor *p
|
||||
quint16 memory[16];
|
||||
int addrtype[16];
|
||||
CMemoryController* pMemCtl = pProc->GetMemoryController();
|
||||
for (int idx = 0; idx < 16; idx++) {
|
||||
for (int idx = 0; idx < 16; idx++)
|
||||
{
|
||||
memory[idx] = pMemCtl->GetWordView(
|
||||
current + idx * 2 - 16, pProc->IsHaltMode(), okExec, addrtype + idx);
|
||||
}
|
||||
|
||||
quint16 address = current - 16;
|
||||
for (int index = 0; index < 16; index++) { // Ðèñóåì ñòðîêè
|
||||
for (int index = 0; index < 16; index++) // Ðèñóåì ñòðîêè
|
||||
{
|
||||
// Àäðåñ
|
||||
DrawOctalValue(painter, x + 3 * cxChar, y, address);
|
||||
|
||||
@ -243,7 +248,8 @@ void QDebugView::drawMemoryForRegister(QPainter &painter, int reg, CProcessor *p
|
||||
painter.setPen(colorText);
|
||||
|
||||
// Òåêóùàÿ ïîçèöèÿ
|
||||
if (address == current) {
|
||||
if (address == current)
|
||||
{
|
||||
painter.drawText(x + 2 * cxChar, y, ">");
|
||||
painter.setPen(m_okDebugCpuRChanged[reg] != 0 ? Qt::red : colorText);
|
||||
painter.drawText(x, y, REGISTER_NAME[reg]);
|
||||
@ -319,7 +325,7 @@ void QDebugView::drawPorts(QPainter &painter, bool okProcessor, CMemoryControlle
|
||||
quint16 value177714 = pBoard->GetTimerValueView();
|
||||
DrawOctalValue(painter, x + 0 * cxChar, y + 15 * cyLine, 0177714);
|
||||
DrawOctalValue(painter, x + 7 * cxChar, y + 15 * cyLine, value177714);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QDebugView::drawCPUMemoryMap(QPainter &painter, int x, int y, bool okHalt)
|
||||
@ -347,12 +353,12 @@ void QDebugView::drawCPUMemoryMap(QPainter &painter, int x, int y, bool okHalt)
|
||||
else
|
||||
painter.drawLine(x1, ycur, x2, ycur);
|
||||
quint16 addr = (quint16)i * 020000;
|
||||
DrawOctalValue(painter, x, y2 - cyLine * i * 2 + cyLine/3, addr);
|
||||
DrawOctalValue(painter, x, y2 - cyLine * i * 2 + cyLine / 3, addr);
|
||||
}
|
||||
|
||||
painter.drawText(xtype, ybase - cyLine * 6 - cyLine/3, "RAM12");
|
||||
painter.drawText(xtype, ybase - cyLine * 6 - cyLine / 3, "RAM12");
|
||||
|
||||
int ytop = ybase - cyLine * 14 - cyLine/3;
|
||||
int ytop = ybase - cyLine * 14 - cyLine / 3;
|
||||
if (okHalt)
|
||||
painter.drawText(xtype, ytop, "RAM12");
|
||||
else
|
||||
@ -386,17 +392,17 @@ void QDebugView::drawPPUMemoryMap(QPainter &painter, int x, int y, const CMemory
|
||||
else
|
||||
painter.drawLine(x1, ycur, x2, ycur);
|
||||
quint16 addr = (quint16)i * 020000;
|
||||
DrawOctalValue(painter, x, y2 - cyLine * i * 2 + cyLine/3, addr);
|
||||
DrawOctalValue(painter, x, y2 - cyLine * i * 2 + cyLine / 3, addr);
|
||||
}
|
||||
|
||||
int yp = y1 + cyLine / 4;
|
||||
painter.drawLine(x1, yp, x2, yp);
|
||||
|
||||
painter.drawText(x, ybase - cyLine * 15, "177000");
|
||||
painter.drawText(xtype, ybase - cyLine * 3 - cyLine/2, "RAM0");
|
||||
painter.drawText(xtype, ybase - cyLine * 3 - cyLine / 2, "RAM0");
|
||||
|
||||
// 100000-117777 - Window block 0
|
||||
int yb0 = ybase - cyLine * 8 - cyLine/3;
|
||||
int yb0 = ybase - cyLine * 8 - cyLine / 3;
|
||||
if ((value177054 & 16) != 0) // Port 177054 bit 4 set => RAM selected
|
||||
painter.drawText(xtype, yb0, "RAM0");
|
||||
else if ((value177054 & 1) != 0) // ROM selected
|
||||
@ -410,21 +416,21 @@ void QDebugView::drawPPUMemoryMap(QPainter &painter, int x, int y, const CMemory
|
||||
}
|
||||
|
||||
// 120000-137777 - Window block 1
|
||||
int yb1 = ybase - cyLine * 10 - cyLine/3;
|
||||
int yb1 = ybase - cyLine * 10 - cyLine / 3;
|
||||
if ((value177054 & 32) != 0) // Port 177054 bit 5 set => RAM selected
|
||||
painter.drawText(xtype, yb1, "RAM0");
|
||||
else
|
||||
painter.drawText(xtype, yb1, "ROM");
|
||||
|
||||
// 140000-157777 - Window block 2
|
||||
int yb2 = ybase - cyLine * 12 - cyLine/3;
|
||||
int yb2 = ybase - cyLine * 12 - cyLine / 3;
|
||||
if ((value177054 & 64) != 0) // Port 177054 bit 6 set => RAM selected
|
||||
painter.drawText(xtype, yb2, "RAM0");
|
||||
else
|
||||
painter.drawText(xtype, yb2, "ROM");
|
||||
|
||||
// 160000-176777 - Window block 3
|
||||
int yb3 = ybase - cyLine * 14 - cyLine/3;
|
||||
int yb3 = ybase - cyLine * 14 - cyLine / 3;
|
||||
if ((value177054 & 128) != 0) // Port 177054 bit 7 set => RAM selected
|
||||
painter.drawText(xtype, yb3, "RAM0");
|
||||
else
|
||||
|
@ -183,7 +183,7 @@ void QDisasmView::paintEvent(QPaintEvent * /*event*/)
|
||||
if (g_pBoard == NULL) return;
|
||||
|
||||
QPainter painter(this);
|
||||
painter.fillRect(0,0, this->width(), this->height(), Qt::white);
|
||||
painter.fillRect(0, 0, this->width(), this->height(), Qt::white);
|
||||
|
||||
QFont font = Common_GetMonospacedFont();
|
||||
painter.setFont(font);
|
||||
@ -220,7 +220,7 @@ const DisasmSubtitleItem * QDisasmView::findSubtitle(quint16 address, quint16 ty
|
||||
if (item->address > address)
|
||||
return 0;
|
||||
if (item->address == address &&
|
||||
(item->type &typemask) != 0)
|
||||
(item->type & typemask) != 0)
|
||||
return item;
|
||||
++item;
|
||||
}
|
||||
@ -503,7 +503,8 @@ int QDisasmView::DrawDisassemble(QPainter &painter, CProcessor *pProc, quint16 b
|
||||
const int nWindowSize = 30; //this->height() / cyLine;
|
||||
quint16 memory[nWindowSize + 2];
|
||||
int addrtype[nWindowSize + 2];
|
||||
for (int idx = 0; idx < nWindowSize; idx++) {
|
||||
for (int idx = 0; idx < nWindowSize; idx++)
|
||||
{
|
||||
memory[idx] = pMemCtl->GetWordView(
|
||||
current + idx * 2 - 10, pProc->IsHaltMode(), true, addrtype + idx);
|
||||
}
|
||||
|
@ -5,110 +5,111 @@
|
||||
|
||||
|
||||
// Keyboard key mapping to bitmap
|
||||
const quint16 m_arrKeyboardKeys[] = {
|
||||
/* x1,y1 w,h UKNCscan */
|
||||
18,15, 42,27, 0010, // K1
|
||||
62,15, 42,27, 0011, // K2
|
||||
106,15, 42,27, 0012, // K3
|
||||
151,15, 42,27, 0014, // K4
|
||||
195,15, 42,27, 0015, // K5
|
||||
343,15, 42,27, 0172, // POM
|
||||
387,15, 42,27, 0152, // UST
|
||||
431,15, 42,27, 0151, // ISP
|
||||
506,15, 42,27, 0171, // SBROS (RESET)
|
||||
551,15, 42,27, 0004, // STOP
|
||||
const quint16 m_arrKeyboardKeys[] =
|
||||
{
|
||||
/* x1,y1 w,h UKNCscan */
|
||||
18, 15, 42, 27, 0010, // K1
|
||||
62, 15, 42, 27, 0011, // K2
|
||||
106, 15, 42, 27, 0012, // K3
|
||||
151, 15, 42, 27, 0014, // K4
|
||||
195, 15, 42, 27, 0015, // K5
|
||||
343, 15, 42, 27, 0172, // POM
|
||||
387, 15, 42, 27, 0152, // UST
|
||||
431, 15, 42, 27, 0151, // ISP
|
||||
506, 15, 42, 27, 0171, // SBROS (RESET)
|
||||
551, 15, 42, 27, 0004, // STOP
|
||||
|
||||
18,56, 28,27, 0006, // AR2
|
||||
47,56, 28,27, 0007, // ; +
|
||||
77,56, 27,27, 0030, // 1
|
||||
106,56, 28,27, 0031, // 2
|
||||
136,56, 27,27, 0032, // 3
|
||||
165,56, 28,27, 0013, // 4
|
||||
195,56, 27,27, 0034, // 5
|
||||
224,56, 28,27, 0035, // 6
|
||||
254,56, 27,27, 0016, // 7
|
||||
283,56, 28,27, 0017, // 8
|
||||
313,56, 27,27, 0177, // 9
|
||||
342,56, 28,27, 0176, // 0
|
||||
372,56, 27,27, 0175, // - =
|
||||
401,56, 28,27, 0173, // / ?
|
||||
431,56, 42,27, 0132, // Backspace
|
||||
18, 56, 28, 27, 0006, // AR2
|
||||
47, 56, 28, 27, 0007, // ; +
|
||||
77, 56, 27, 27, 0030, // 1
|
||||
106, 56, 28, 27, 0031, // 2
|
||||
136, 56, 27, 27, 0032, // 3
|
||||
165, 56, 28, 27, 0013, // 4
|
||||
195, 56, 27, 27, 0034, // 5
|
||||
224, 56, 28, 27, 0035, // 6
|
||||
254, 56, 27, 27, 0016, // 7
|
||||
283, 56, 28, 27, 0017, // 8
|
||||
313, 56, 27, 27, 0177, // 9
|
||||
342, 56, 28, 27, 0176, // 0
|
||||
372, 56, 27, 27, 0175, // - =
|
||||
401, 56, 28, 27, 0173, // / ?
|
||||
431, 56, 42, 27, 0132, // Backspace
|
||||
|
||||
18,86, 42,27, 0026, // TAB
|
||||
62,86, 27,27, 0027, // É J
|
||||
91,86, 28,27, 0050, // Ö C
|
||||
121,86, 27,27, 0051, // Ó U
|
||||
150,86, 28,27, 0052, // Ê K
|
||||
180,86, 27,27, 0033, // Å E
|
||||
210,86, 28,27, 0054, // Í N
|
||||
239,86, 27,27, 0055, // Ã G
|
||||
269,86, 27,27, 0036, // Ø [
|
||||
298,86, 28,27, 0037, // Ù ]
|
||||
328,86, 27,27, 0157, // Ç Z
|
||||
357,86, 28,27, 0156, // Õ H
|
||||
387,86, 27,27, 0155, // Ú
|
||||
416,86, 28,27, 0174, // : *
|
||||
18, 86, 42, 27, 0026, // TAB
|
||||
62, 86, 27, 27, 0027, // É J
|
||||
91, 86, 28, 27, 0050, // Ö C
|
||||
121, 86, 27, 27, 0051, // Ó U
|
||||
150, 86, 28, 27, 0052, // Ê K
|
||||
180, 86, 27, 27, 0033, // Å E
|
||||
210, 86, 28, 27, 0054, // Í N
|
||||
239, 86, 27, 27, 0055, // Ã G
|
||||
269, 86, 27, 27, 0036, // Ø [
|
||||
298, 86, 28, 27, 0037, // Ù ]
|
||||
328, 86, 27, 27, 0157, // Ç Z
|
||||
357, 86, 28, 27, 0156, // Õ H
|
||||
387, 86, 27, 27, 0155, // Ú
|
||||
416, 86, 28, 27, 0174, // : *
|
||||
|
||||
18,115, 49,27, 0046, // UPR
|
||||
69,115, 28,27, 0047, // Ô F
|
||||
99,115, 27,27, 0070, // Û Y
|
||||
128,115, 28,27, 0071, // Â W
|
||||
158,115, 27,27, 0072, // À A
|
||||
187,115, 28,27, 0053, // Ï P
|
||||
217,115, 27,27, 0074, // Ð R
|
||||
246,115, 28,27, 0075, // Î O
|
||||
276,115, 27,27, 0056, // Ë L
|
||||
305,115, 28,27, 0057, // Ä D
|
||||
335,115, 27,27, 0137, // Æ V
|
||||
364,115, 28,27, 0136, // Ý Backslash
|
||||
394,115, 35,27, 0135, // . >
|
||||
431,115, 16,27, 0153, // ENTER - left part
|
||||
446,86, 27,56, 0153, // ENTER - right part
|
||||
18, 115, 49, 27, 0046, // UPR
|
||||
69, 115, 28, 27, 0047, // Ô F
|
||||
99, 115, 27, 27, 0070, // Û Y
|
||||
128, 115, 28, 27, 0071, // Â W
|
||||
158, 115, 27, 27, 0072, // À A
|
||||
187, 115, 28, 27, 0053, // Ï P
|
||||
217, 115, 27, 27, 0074, // Ð R
|
||||
246, 115, 28, 27, 0075, // Î O
|
||||
276, 115, 27, 27, 0056, // Ë L
|
||||
305, 115, 28, 27, 0057, // Ä D
|
||||
335, 115, 27, 27, 0137, // Æ V
|
||||
364, 115, 28, 27, 0136, // Ý Backslash
|
||||
394, 115, 35, 27, 0135, // . >
|
||||
431, 115, 16, 27, 0153, // ENTER - left part
|
||||
446, 86, 27, 56, 0153, // ENTER - right part
|
||||
|
||||
18,145, 34,27, 0106, // ALF
|
||||
55,145, 27,27, 0066, // GRAF
|
||||
84,145, 27,27, 0067, // ß Q
|
||||
114,145, 27,27, 0110, // × ^
|
||||
143,145, 27,27, 0111, // Ñ S
|
||||
173,145, 27,27, 0112, // Ì
|
||||
202,145, 27,27, 0073, // È I
|
||||
232,145, 27,27, 0114, // Ò
|
||||
261,145, 27,27, 0115, // Ü X
|
||||
291,145, 27,27, 0076, // Á B
|
||||
320,145, 28,27, 0077, // Þ @
|
||||
350,145, 34,27, 0117, // , <
|
||||
18, 145, 34, 27, 0106, // ALF
|
||||
55, 145, 27, 27, 0066, // GRAF
|
||||
84, 145, 27, 27, 0067, // ß Q
|
||||
114, 145, 27, 27, 0110, // × ^
|
||||
143, 145, 27, 27, 0111, // Ñ S
|
||||
173, 145, 27, 27, 0112, // Ì
|
||||
202, 145, 27, 27, 0073, // È I
|
||||
232, 145, 27, 27, 0114, // Ò
|
||||
261, 145, 27, 27, 0115, // Ü X
|
||||
291, 145, 27, 27, 0076, // Á B
|
||||
320, 145, 28, 27, 0077, // Þ @
|
||||
350, 145, 34, 27, 0117, // , <
|
||||
|
||||
18,174, 56,27, 0105, // Left Shift
|
||||
77,174, 34,27, 0107, // FIKS
|
||||
114,174,211,27, 0113, // Space bar
|
||||
328,174, 56,27, 0105, // Right Shift
|
||||
18, 174, 56, 27, 0105, // Left Shift
|
||||
77, 174, 34, 27, 0107, // FIKS
|
||||
114, 174, 211, 27, 0113, // Space bar
|
||||
328, 174, 56, 27, 0105, // Right Shift
|
||||
|
||||
387,145, 27,56, 0116, // Left
|
||||
416,145, 28,27, 0154, // Up
|
||||
416,174, 28,27, 0134, // Down
|
||||
446,145, 27,56, 0133, // Right
|
||||
387, 145, 27, 56, 0116, // Left
|
||||
416, 145, 28, 27, 0154, // Up
|
||||
416, 174, 28, 27, 0134, // Down
|
||||
446, 145, 27, 56, 0133, // Right
|
||||
|
||||
506,56, 28,27, 0131, // + NumPad
|
||||
536,56, 27,27, 0025, // - NumPad
|
||||
565,56, 28,27, 0005, // , NumPad
|
||||
506,86, 28,27, 0125, // 7 NumPad
|
||||
536,86, 27,27, 0145, // 8 NumPad
|
||||
565,86, 28,27, 0165, // 9 NumPad
|
||||
506,115, 28,27, 0130, // 4 NumPad
|
||||
536,115, 27,27, 0150, // 5 NumPad
|
||||
565,115, 28,27, 0170, // 6 NumPad
|
||||
506,145, 28,27, 0127, // 1 NumPad
|
||||
536,145, 27,27, 0147, // 2 NumPad
|
||||
565,145, 28,27, 0167, // 3 NumPad
|
||||
506,174, 28,27, 0126, // 0 NumPad
|
||||
536,174, 27,27, 0146, // . NumPad
|
||||
565,174, 28,27, 0166, // ENTER NumPad
|
||||
506, 56, 28, 27, 0131, // + NumPad
|
||||
536, 56, 27, 27, 0025, // - NumPad
|
||||
565, 56, 28, 27, 0005, // , NumPad
|
||||
506, 86, 28, 27, 0125, // 7 NumPad
|
||||
536, 86, 27, 27, 0145, // 8 NumPad
|
||||
565, 86, 28, 27, 0165, // 9 NumPad
|
||||
506, 115, 28, 27, 0130, // 4 NumPad
|
||||
536, 115, 27, 27, 0150, // 5 NumPad
|
||||
565, 115, 28, 27, 0170, // 6 NumPad
|
||||
506, 145, 28, 27, 0127, // 1 NumPad
|
||||
536, 145, 27, 27, 0147, // 2 NumPad
|
||||
565, 145, 28, 27, 0167, // 3 NumPad
|
||||
506, 174, 28, 27, 0126, // 0 NumPad
|
||||
536, 174, 27, 27, 0146, // . NumPad
|
||||
565, 174, 28, 27, 0166, // ENTER NumPad
|
||||
|
||||
};
|
||||
const int m_nKeyboardKeysCount = sizeof(m_arrKeyboardKeys) / sizeof(unsigned short) / 5;
|
||||
|
||||
QKeyboardView::QKeyboardView(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
QWidget(parent)
|
||||
{
|
||||
setMinimumSize(UKNC_SCREEN_WIDTH, 200);
|
||||
setMaximumSize(UKNC_SCREEN_WIDTH + 60, 210 + 20);
|
||||
|
@ -14,7 +14,8 @@
|
||||
#include "qdialogs.h"
|
||||
|
||||
|
||||
enum MemoryViewMode {
|
||||
enum MemoryViewMode
|
||||
{
|
||||
MEMMODE_RAM0 = 0, // RAM plane 0
|
||||
MEMMODE_RAM1 = 1, // RAM plane 1
|
||||
MEMMODE_RAM2 = 2, // RAM plane 2
|
||||
@ -24,7 +25,8 @@ enum MemoryViewMode {
|
||||
MEMMODE_LAST = 5 // Last mode number
|
||||
};
|
||||
|
||||
static const char * MemoryView_ModeNames[] = {
|
||||
static const char * MemoryView_ModeNames[] =
|
||||
{
|
||||
"RAM0", "RAM1", "RAM2", "ROM", "CPU", "PPU"
|
||||
};
|
||||
|
||||
@ -187,7 +189,7 @@ void QMemoryView::paintEvent(QPaintEvent * /*event*/)
|
||||
if (g_pBoard == NULL) return;
|
||||
|
||||
QPainter painter(this);
|
||||
painter.fillRect(0,0, this->width(), this->height(), Qt::white);
|
||||
painter.fillRect(0, 0, this->width(), this->height(), Qt::white);
|
||||
|
||||
QFont font = Common_GetMonospacedFont();
|
||||
painter.setFont(font);
|
||||
@ -208,47 +210,50 @@ void QMemoryView::paintEvent(QPaintEvent * /*event*/)
|
||||
|
||||
quint16 address = m_wBaseAddress;
|
||||
int y = 2 * cyLine;
|
||||
for (;;) { // Draw lines
|
||||
for (;;) // Draw lines
|
||||
{
|
||||
DrawOctalValue(painter, 30 + 1 * cxChar, y, address);
|
||||
|
||||
int x = 30 + 9 * cxChar;
|
||||
ushort wchars[16];
|
||||
|
||||
for (int j = 0; j < 8; j++) { // Draw words as octal value
|
||||
for (int j = 0; j < 8; j++) // Draw words as octal value
|
||||
{
|
||||
// Get word from memory
|
||||
quint16 word = 0;
|
||||
int okValid = true;
|
||||
int addrtype = ADDRTYPE_NONE;
|
||||
bool okHalt = false;
|
||||
quint16 wChanged = 0;
|
||||
switch (m_Mode) {
|
||||
case MEMMODE_RAM0:
|
||||
case MEMMODE_RAM1:
|
||||
case MEMMODE_RAM2:
|
||||
word = g_pBoard->GetRAMWord(m_Mode, address);
|
||||
wChanged = Emulator_GetChangeRamStatus(m_Mode, address);
|
||||
break;
|
||||
case MEMMODE_ROM: // ROM - only 32 Kbytes
|
||||
if (address < 0100000)
|
||||
okValid = false;
|
||||
else
|
||||
word = g_pBoard->GetROMWord(address - 0100000);
|
||||
break;
|
||||
case MEMMODE_CPU:
|
||||
okHalt = g_pBoard->GetCPU()->IsHaltMode();
|
||||
word = g_pBoard->GetCPUMemoryController()->GetWordView(address, okHalt, false, &addrtype);
|
||||
okValid = (addrtype != ADDRTYPE_IO) && (addrtype != ADDRTYPE_DENY);
|
||||
wChanged = Emulator_GetChangeRamStatus(ADDRTYPE_RAM12, address);
|
||||
break;
|
||||
case MEMMODE_PPU:
|
||||
okHalt = g_pBoard->GetPPU()->IsHaltMode();
|
||||
word = g_pBoard->GetPPUMemoryController()->GetWordView(address, okHalt, false, &addrtype);
|
||||
okValid = (addrtype != ADDRTYPE_IO) && (addrtype != ADDRTYPE_DENY);
|
||||
if (address < 0100000)
|
||||
wChanged = Emulator_GetChangeRamStatus(ADDRTYPE_RAM0, address);
|
||||
else
|
||||
wChanged = 0;
|
||||
break;
|
||||
switch (m_Mode)
|
||||
{
|
||||
case MEMMODE_RAM0:
|
||||
case MEMMODE_RAM1:
|
||||
case MEMMODE_RAM2:
|
||||
word = g_pBoard->GetRAMWord(m_Mode, address);
|
||||
wChanged = Emulator_GetChangeRamStatus(m_Mode, address);
|
||||
break;
|
||||
case MEMMODE_ROM: // ROM - only 32 Kbytes
|
||||
if (address < 0100000)
|
||||
okValid = false;
|
||||
else
|
||||
word = g_pBoard->GetROMWord(address - 0100000);
|
||||
break;
|
||||
case MEMMODE_CPU:
|
||||
okHalt = g_pBoard->GetCPU()->IsHaltMode();
|
||||
word = g_pBoard->GetCPUMemoryController()->GetWordView(address, okHalt, false, &addrtype);
|
||||
okValid = (addrtype != ADDRTYPE_IO) && (addrtype != ADDRTYPE_DENY);
|
||||
wChanged = Emulator_GetChangeRamStatus(ADDRTYPE_RAM12, address);
|
||||
break;
|
||||
case MEMMODE_PPU:
|
||||
okHalt = g_pBoard->GetPPU()->IsHaltMode();
|
||||
word = g_pBoard->GetPPUMemoryController()->GetWordView(address, okHalt, false, &addrtype);
|
||||
okValid = (addrtype != ADDRTYPE_IO) && (addrtype != ADDRTYPE_DENY);
|
||||
if (address < 0100000)
|
||||
wChanged = Emulator_GetChangeRamStatus(ADDRTYPE_RAM0, address);
|
||||
else
|
||||
wChanged = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (okValid)
|
||||
|
93
qscreen.cpp
93
qscreen.cpp
@ -8,16 +8,19 @@
|
||||
// Colors
|
||||
|
||||
// Table for color conversion yrgb (4 bits) -> DWORD (32 bits)
|
||||
const quint32 ScreenView_StandardRGBColors[16] = {
|
||||
const quint32 ScreenView_StandardRGBColors[16] =
|
||||
{
|
||||
0x000000, 0x000080, 0x008000, 0x008080, 0x800000, 0x800080, 0x808000, 0x808080,
|
||||
0x000000, 0x0000FF, 0x00FF00, 0x00FFFF, 0xFF0000, 0xFF00FF, 0xFFFF00, 0xFFFFFF,
|
||||
};
|
||||
const quint32 ScreenView_StandardGRBColors[16] = {
|
||||
const quint32 ScreenView_StandardGRBColors[16] =
|
||||
{
|
||||
0x000000, 0x000080, 0x800000, 0x800080, 0x008000, 0x008080, 0x808000, 0x808080,
|
||||
0x000000, 0x0000FF, 0xFF0000, 0xFF00FF, 0x00FF00, 0x00FFFF, 0xFFFF00, 0xFFFFFF,
|
||||
};
|
||||
// Table for color conversion, gray (black and white) display
|
||||
const quint32 ScreenView_GrayColors[16] = {
|
||||
const quint32 ScreenView_GrayColors[16] =
|
||||
{
|
||||
0x000000, 0x242424, 0x484848, 0x6C6C6C, 0x909090, 0xB4B4B4, 0xD8D8D8, 0xFFFFFF,
|
||||
0x000000, 0x242424, 0x484848, 0x6C6C6C, 0x909090, 0xB4B4B4, 0xD8D8D8, 0xFFFFFF,
|
||||
};
|
||||
@ -43,7 +46,7 @@ static void UpscaleScreen(void* pImageBits)
|
||||
if (i % 4 == 3)
|
||||
*pdst1 = 0;
|
||||
else
|
||||
*pdst1 = (quint8)((((quint16)*psrc1) + ((quint16)*psrc2)) / 2);
|
||||
*pdst1 = (quint8)((((quint16) * psrc1) + ((quint16) * psrc2)) / 2);
|
||||
psrc1++; psrc2++; pdst1++;
|
||||
}
|
||||
}
|
||||
@ -197,10 +200,10 @@ void QEmulatorScreen::paintEvent(QPaintEvent * /*event*/)
|
||||
const quint32* colors;
|
||||
switch (m_mode)
|
||||
{
|
||||
case RGBScreen: colors = ScreenView_StandardRGBColors; break;
|
||||
case GrayScreen: colors = ScreenView_GrayColors; break;
|
||||
case GRBScreen: colors = ScreenView_StandardGRBColors; break;
|
||||
default: colors = ScreenView_StandardRGBColors; break;
|
||||
case RGBScreen: colors = ScreenView_StandardRGBColors; break;
|
||||
case GrayScreen: colors = ScreenView_GrayColors; break;
|
||||
case GRBScreen: colors = ScreenView_StandardGRBColors; break;
|
||||
default: colors = ScreenView_StandardRGBColors; break;
|
||||
}
|
||||
|
||||
Emulator_PrepareScreenRGB32(m_image->bits(), colors);
|
||||
@ -238,43 +241,45 @@ void QEmulatorScreen::keyReleaseEvent(QKeyEvent *event)
|
||||
event->accept();
|
||||
}
|
||||
|
||||
const unsigned char arrQtkey2UkncscanLat[256] = { // ËÀÒ
|
||||
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
|
||||
/*0*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*1*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*2*/ 0113, 0004, 0151, 0172, 0000, 0116, 0154, 0133, 0134, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*3*/ 0176, 0030, 0031, 0032, 0013, 0034, 0035, 0016, 0017, 0177, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*4*/ 0000, 0072, 0076, 0050, 0057, 0033, 0047, 0055, 0156, 0073, 0027, 0052, 0056, 0112, 0054, 0075,
|
||||
/*5*/ 0053, 0067, 0074, 0111, 0114, 0051, 0137, 0071, 0115, 0070, 0157, 0000, 0000, 0000, 0000, 0000,
|
||||
/*6*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*7*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*8*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*9*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*a*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*b*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*c*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*d*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*e*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*f*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
const unsigned char arrQtkey2UkncscanLat[256] = // ËÀÒ
|
||||
{
|
||||
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
|
||||
/*0*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*1*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*2*/ 0113, 0004, 0151, 0172, 0000, 0116, 0154, 0133, 0134, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*3*/ 0176, 0030, 0031, 0032, 0013, 0034, 0035, 0016, 0017, 0177, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*4*/ 0000, 0072, 0076, 0050, 0057, 0033, 0047, 0055, 0156, 0073, 0027, 0052, 0056, 0112, 0054, 0075,
|
||||
/*5*/ 0053, 0067, 0074, 0111, 0114, 0051, 0137, 0071, 0115, 0070, 0157, 0000, 0000, 0000, 0000, 0000,
|
||||
/*6*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*7*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*8*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*9*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*a*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*b*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*c*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*d*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*e*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*f*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
};
|
||||
const unsigned char arrQtkey2UkncscanRus[256] = { // ÐÓÑ
|
||||
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
|
||||
/*0*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*1*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*2*/ 0113, 0004, 0151, 0172, 0000, 0116, 0154, 0133, 0134, 0000, 0000, 0000, 0000, 0171, 0152, 0000,
|
||||
/*3*/ 0176, 0030, 0031, 0032, 0013, 0034, 0035, 0016, 0017, 0177, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*4*/ 0000, 0047, 0073, 0111, 0071, 0051, 0072, 0053, 0074, 0036, 0075, 0056, 0057, 0115, 0114, 0037,
|
||||
/*5*/ 0157, 0027, 0052, 0070, 0033, 0055, 0112, 0050, 0110, 0054, 0067, 0000, 0000, 0000, 0000, 0000,
|
||||
/*6*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*7*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*8*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*9*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*a*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*b*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*c*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*d*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*e*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*f*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
const unsigned char arrQtkey2UkncscanRus[256] = // ÐÓÑ
|
||||
{
|
||||
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
|
||||
/*0*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*1*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*2*/ 0113, 0004, 0151, 0172, 0000, 0116, 0154, 0133, 0134, 0000, 0000, 0000, 0000, 0171, 0152, 0000,
|
||||
/*3*/ 0176, 0030, 0031, 0032, 0013, 0034, 0035, 0016, 0017, 0177, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*4*/ 0000, 0047, 0073, 0111, 0071, 0051, 0072, 0053, 0074, 0036, 0075, 0056, 0057, 0115, 0114, 0037,
|
||||
/*5*/ 0157, 0027, 0052, 0070, 0033, 0055, 0112, 0050, 0110, 0054, 0067, 0000, 0000, 0000, 0000, 0000,
|
||||
/*6*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*7*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*8*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*9*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*a*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*b*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*c*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*d*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*e*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*f*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
};
|
||||
|
||||
|
||||
|
@ -3,13 +3,15 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
enum ScreenViewMode {
|
||||
enum ScreenViewMode
|
||||
{
|
||||
RGBScreen = 1,
|
||||
GrayScreen = 2,
|
||||
GRBScreen = 3
|
||||
};
|
||||
|
||||
enum ScreenSizeMode {
|
||||
enum ScreenSizeMode
|
||||
{
|
||||
RegularScreen = 1,
|
||||
DoubleScreen = 2,
|
||||
UpscaledScreen = 3,
|
||||
|
@ -131,28 +131,30 @@ void QEmulator::keyScanShift(uchar ukncscan, int timeout)
|
||||
run(3);
|
||||
}
|
||||
|
||||
const uchar arrChar2UkncScan[128] = {
|
||||
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
|
||||
/*0*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0153, 0000, 0000, 0153, 0000, 0000,
|
||||
/*1*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*2*/ 0113, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0117, 0175, 0146, 0173,
|
||||
/*3*/ 0176, 0030, 0031, 0032, 0013, 0034, 0035, 0016, 0017, 0177, 0174, 0007, 0000, 0000, 0000, 0000,
|
||||
/*4*/ 0077, 0072, 0076, 0050, 0057, 0033, 0047, 0055, 0156, 0073, 0027, 0052, 0056, 0112, 0054, 0075,
|
||||
/*5*/ 0053, 0067, 0074, 0111, 0114, 0051, 0137, 0071, 0115, 0070, 0157, 0036, 0136, 0037, 0110, 0155,
|
||||
/*6*/ 0126, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*7*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0155, 0000, 0000, 0000, 0000,
|
||||
const uchar arrChar2UkncScan[128] =
|
||||
{
|
||||
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
|
||||
/*0*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0153, 0000, 0000, 0153, 0000, 0000,
|
||||
/*1*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*2*/ 0113, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0117, 0175, 0146, 0173,
|
||||
/*3*/ 0176, 0030, 0031, 0032, 0013, 0034, 0035, 0016, 0017, 0177, 0174, 0007, 0000, 0000, 0000, 0000,
|
||||
/*4*/ 0077, 0072, 0076, 0050, 0057, 0033, 0047, 0055, 0156, 0073, 0027, 0052, 0056, 0112, 0054, 0075,
|
||||
/*5*/ 0053, 0067, 0074, 0111, 0114, 0051, 0137, 0071, 0115, 0070, 0157, 0036, 0136, 0037, 0110, 0155,
|
||||
/*6*/ 0126, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*7*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0155, 0000, 0000, 0000, 0000,
|
||||
};
|
||||
|
||||
const uchar arrChar2UkncScanShift[128] = {
|
||||
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
|
||||
/*0*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*1*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*2*/ 0000, 0030, 0031, 0032, 0013, 0034, 0035, 0016, 0017, 0177, 0174, 0007, 0000, 0000, 0000, 0000,
|
||||
/*3*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0117, 0175, 0135, 0173,
|
||||
/*4*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*5*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*6*/ 0077, 0072, 0076, 0050, 0057, 0033, 0047, 0055, 0156, 0073, 0027, 0052, 0056, 0112, 0054, 0075,
|
||||
/*7*/ 0053, 0067, 0074, 0111, 0114, 0051, 0137, 0071, 0115, 0070, 0157, 0036, 0136, 0037, 0110, 0000,
|
||||
const uchar arrChar2UkncScanShift[128] =
|
||||
{
|
||||
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
|
||||
/*0*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*1*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*2*/ 0000, 0030, 0031, 0032, 0013, 0034, 0035, 0016, 0017, 0177, 0174, 0007, 0000, 0000, 0000, 0000,
|
||||
/*3*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0117, 0175, 0135, 0173,
|
||||
/*4*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*5*/ 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000,
|
||||
/*6*/ 0077, 0072, 0076, 0050, 0057, 0033, 0047, 0055, 0156, 0073, 0027, 0052, 0056, 0112, 0054, 0075,
|
||||
/*7*/ 0053, 0067, 0074, 0111, 0114, 0051, 0137, 0071, 0115, 0070, 0157, 0036, 0136, 0037, 0110, 0000,
|
||||
};
|
||||
|
||||
void QEmulator::keyChar(char ch, int timeout)
|
||||
@ -322,9 +324,9 @@ void QScriptWindow::runScript(const QString & script)
|
||||
if (checkResult.state() != QScriptSyntaxCheckResult::Valid)
|
||||
{
|
||||
message = QString("Syntax check FAILED:\n\n%1\n\nat line %2 column %3.")
|
||||
.arg(checkResult.errorMessage())
|
||||
.arg(checkResult.errorLineNumber())
|
||||
.arg(checkResult.errorColumnNumber());
|
||||
.arg(checkResult.errorMessage())
|
||||
.arg(checkResult.errorLineNumber())
|
||||
.arg(checkResult.errorColumnNumber());
|
||||
break;
|
||||
}
|
||||
|
||||
@ -340,7 +342,7 @@ void QScriptWindow::runScript(const QString & script)
|
||||
}
|
||||
|
||||
message.append("The script FINISHED. The result is:\n\n")
|
||||
.append(result.toString());
|
||||
.append(result.toString());
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3,12 +3,12 @@
|
||||
QSoundOut::QSoundOut(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
rcnt=0;
|
||||
rrd=0;
|
||||
rwr=0;
|
||||
fptr=0;
|
||||
m_audio=NULL;
|
||||
m_dev=NULL;
|
||||
rcnt = 0;
|
||||
rrd = 0;
|
||||
rwr = 0;
|
||||
fptr = 0;
|
||||
m_audio = NULL;
|
||||
m_dev = NULL;
|
||||
|
||||
QAudioFormat fmt;
|
||||
fmt.setSampleRate(SAMPLERATE);
|
||||
@ -18,35 +18,35 @@ QSoundOut::QSoundOut(QObject *parent) :
|
||||
fmt.setCodec("audio/pcm");
|
||||
fmt.setSampleType(QAudioFormat::SignedInt);
|
||||
|
||||
m_audio=new QAudioOutput(fmt,this);
|
||||
if(m_audio==NULL)
|
||||
m_audio = new QAudioOutput(fmt, this);
|
||||
if (m_audio == NULL)
|
||||
return;
|
||||
connect(m_audio,SIGNAL(notify()),this,SLOT(OnNotify()));
|
||||
m_audio->setBufferSize(FRAMEBYTES*2);
|
||||
connect(m_audio, SIGNAL(notify()), this, SLOT(OnNotify()));
|
||||
m_audio->setBufferSize(FRAMEBYTES * 2);
|
||||
m_audio->setNotifyInterval(40); //1/25 sec = 40mS
|
||||
m_dev=m_audio->start();
|
||||
if(m_dev==NULL)
|
||||
m_dev = m_audio->start();
|
||||
if (m_dev == NULL)
|
||||
{
|
||||
disconnect(this,SLOT(OnNotify()));
|
||||
disconnect(this, SLOT(OnNotify()));
|
||||
delete(m_audio);
|
||||
m_audio=NULL;
|
||||
m_audio = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
m_kick.setSingleShot(true);
|
||||
m_kick.connect(&m_kick,SIGNAL(timeout()),this,SLOT(OnNotify()));
|
||||
m_kick.connect(&m_kick, SIGNAL(timeout()), this, SLOT(OnNotify()));
|
||||
m_kick.start(40); //kick it first!
|
||||
|
||||
}
|
||||
|
||||
QSoundOut::~QSoundOut()
|
||||
{
|
||||
if(m_dev)
|
||||
if (m_dev)
|
||||
{
|
||||
m_audio->stop();
|
||||
disconnect(this,SLOT(OnNotify()));
|
||||
disconnect(this, SLOT(OnNotify()));
|
||||
delete(m_audio); //this will delete m_dev too!!!!
|
||||
m_audio=NULL;
|
||||
m_audio = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,59 +54,59 @@ void QSoundOut::OnNotify()
|
||||
{
|
||||
char dummy[FRAMEBYTES];
|
||||
|
||||
if((m_dev==NULL)||(m_audio==NULL))
|
||||
if ((m_dev == NULL) || (m_audio == NULL))
|
||||
return;
|
||||
|
||||
m_lock.lock();
|
||||
if(rcnt)
|
||||
if (rcnt)
|
||||
{
|
||||
m_dev->write((const char*)&rbuf[rrd],(qint64)FRAMEBYTES);
|
||||
m_dev->write((const char*)&rbuf[rrd], (qint64)FRAMEBYTES);
|
||||
rrd++;
|
||||
if(rrd>=BUFFERS)
|
||||
rrd=0;
|
||||
if (rrd >= BUFFERS)
|
||||
rrd = 0;
|
||||
rcnt--;
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(dummy,0,FRAMEBYTES);
|
||||
m_dev->write((const char*)dummy,(qint64)FRAMEBYTES);
|
||||
memset(dummy, 0, FRAMEBYTES);
|
||||
m_dev->write((const char*)dummy, (qint64)FRAMEBYTES);
|
||||
}
|
||||
m_lock.unlock();
|
||||
}
|
||||
|
||||
void QSoundOut::FeedDAC(unsigned short left, unsigned short right)
|
||||
{
|
||||
if((m_dev==NULL)||(m_audio==NULL))
|
||||
if ((m_dev == NULL) || (m_audio == NULL))
|
||||
return;
|
||||
switch(SAMPLESIZE)
|
||||
switch (SAMPLESIZE)
|
||||
{
|
||||
case 8:
|
||||
fbuf[fptr++]=left>>8;
|
||||
fbuf[fptr++]=right>>8;
|
||||
case 8:
|
||||
fbuf[fptr++] = left >> 8;
|
||||
fbuf[fptr++] = right >> 8;
|
||||
break;
|
||||
case 16:
|
||||
fbuf[fptr++]=left&0xff;
|
||||
fbuf[fptr++]=left>>8;
|
||||
fbuf[fptr++]=right&0xff;
|
||||
fbuf[fptr++]=right>>8;
|
||||
case 16:
|
||||
fbuf[fptr++] = left & 0xff;
|
||||
fbuf[fptr++] = left >> 8;
|
||||
fbuf[fptr++] = right & 0xff;
|
||||
fbuf[fptr++] = right >> 8;
|
||||
break;
|
||||
}
|
||||
if(fptr>=FRAMEBYTES)
|
||||
if (fptr >= FRAMEBYTES)
|
||||
{
|
||||
fptr=0;
|
||||
fptr = 0;
|
||||
m_lock.lock();
|
||||
if(rcnt>=BUFFERS)
|
||||
if (rcnt >= BUFFERS)
|
||||
{
|
||||
m_dev->write((const char*)&rbuf[rrd],(qint64)FRAMEBYTES);
|
||||
m_dev->write((const char*)&rbuf[rrd], (qint64)FRAMEBYTES);
|
||||
rrd++;
|
||||
if(rrd>=BUFFERS)
|
||||
rrd=0;
|
||||
if (rrd >= BUFFERS)
|
||||
rrd = 0;
|
||||
rcnt--;
|
||||
}
|
||||
memcpy(&rbuf[rwr],fbuf,FRAMEBYTES);
|
||||
memcpy(&rbuf[rwr], fbuf, FRAMEBYTES);
|
||||
rwr++;
|
||||
if(rwr>=BUFFERS)
|
||||
rwr=0;
|
||||
if (rwr >= BUFFERS)
|
||||
rwr = 0;
|
||||
rcnt++;
|
||||
m_lock.unlock();
|
||||
}
|
||||
|
@ -20,12 +20,12 @@ class QSoundOut : public QObject
|
||||
public:
|
||||
explicit QSoundOut(QObject *parent = 0);
|
||||
~QSoundOut();
|
||||
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void FeedDAC(unsigned short left, unsigned short right);
|
||||
|
||||
|
||||
private slots:
|
||||
void OnNotify();
|
||||
|
||||
|
@ -99,7 +99,7 @@ HWAVPCMFILE WavPcmFile_Create(LPCTSTR filename, int sampleRate)
|
||||
|
||||
memcpy(&consolidated_header[0], magic1, 4); // RIFF
|
||||
memcpy(&consolidated_header[8], magic2, 4); // WAVE
|
||||
|
||||
|
||||
memcpy(&consolidated_header[12], format_tag_id, 4); // fmt
|
||||
*((quint32*)(consolidated_header + 16)) = 16; // Size of "fmt" chunk
|
||||
*((quint16*)(consolidated_header + 20)) = WAV_FORMAT_PCM; // AudioFormat = PCM
|
||||
|
Loading…
x
Reference in New Issue
Block a user