From c91899306035904e99f19a6a837c5e190f0004cf Mon Sep 17 00:00:00 2001 From: zanostro Date: Thu, 13 Nov 2025 22:44:11 +0100 Subject: [PATCH] first gui --- simulator_SIC_XE/gui/qt/mainwindow.cpp | 402 ++++++++++++++++- simulator_SIC_XE/gui/qt/mainwindow.h | 27 ++ simulator_SIC_XE/gui/qt/mainwindow.ui | 575 +++++++++++++++++++++++-- simulator_SIC_XE/include/utils.h | 15 + simulator_SIC_XE/src/instructions.cpp | 33 ++ simulator_SIC_XE/src/opcode.cpp | 8 +- 6 files changed, 1027 insertions(+), 33 deletions(-) diff --git a/simulator_SIC_XE/gui/qt/mainwindow.cpp b/simulator_SIC_XE/gui/qt/mainwindow.cpp index 49d64fc..e024b67 100644 --- a/simulator_SIC_XE/gui/qt/mainwindow.cpp +++ b/simulator_SIC_XE/gui/qt/mainwindow.cpp @@ -1,14 +1,414 @@ #include "mainwindow.h" #include "ui_mainwindow.h" +#include "MachineController.h" +#include "../../include/machine.h" +#include "../../include/instructions.h" + +#include +#include +#include +#include +#include +#include +#include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), - ui(new Ui::MainWindow) + ui(new Ui::MainWindow), + m_machine(std::make_shared()), + m_controller(std::make_unique(m_machine, this)) { ui->setupUi(this); + + ui->regA_dec_field->setValidator(new QIntValidator(-8388608, 8388607, this)); + ui->regB_dec_field->setValidator(new QIntValidator(-8388608, 8388607, this)); + ui->regS_dec_field->setValidator(new QIntValidator(-8388608, 8388607, this)); + ui->regT_dec_field->setValidator(new QIntValidator(-8388608, 8388607, this)); + ui->regX_dec_field->setValidator(new QIntValidator(-8388608, 8388607, this)); + // unsigned 24 bit + ui->regL_dec_field->setValidator(new QIntValidator(0, 16777215, this)); + ui->regPC_dec_field->setValidator(new QIntValidator(0, 16777215, this)); + ui->regSW_dec_field->setValidator(new QIntValidator(0, 16777215, this)); + // float + ui->regF_dec_field->setValidator(new QDoubleValidator(-3.402823e38, 3.402823e38, 6, this)); + + QRegularExpressionValidator* hexValidator = new QRegularExpressionValidator(QRegularExpression("^(0x)?[0-9A-Fa-f]{1,6}$"), this); + ui->regA_hex_field->setValidator(hexValidator); + ui->regB_hex_field->setValidator(hexValidator); + ui->regX_hex_field->setValidator(hexValidator); + ui->regS_hex_field->setValidator(hexValidator); + ui->regT_hex_field->setValidator(hexValidator); + ui->regL_hex_field->setValidator(hexValidator); + ui->regPC_hex_field->setValidator(hexValidator); + ui->regSW_hex_field->setValidator(hexValidator); + + QRegularExpressionValidator* binValidator = new QRegularExpressionValidator(QRegularExpression("^[01]{1,24}$"), this); + ui->regA_bin_field->setValidator(binValidator); + ui->regB_bin_field->setValidator(binValidator); + ui->regX_bin_field->setValidator(binValidator); + ui->regS_bin_field->setValidator(binValidator); + ui->regT_bin_field->setValidator(binValidator); + ui->regL_bin_field->setValidator(binValidator); + ui->regPC_bin_field->setValidator(binValidator); + ui->regSW_bin_field->setValidator(binValidator); + + QRegularExpressionValidator* floatHexValidator = new QRegularExpressionValidator(QRegularExpression("^(0x)?[0-9A-Fa-f]{1,12}$"), this); + ui->regF_hex_field->setValidator(floatHexValidator); + + QRegularExpressionValidator* floatBinValidator = new QRegularExpressionValidator(QRegularExpression("^[01]{1,48}$"), this); + ui->regF_bin_field->setValidator(floatBinValidator); + + + connect(m_controller.get(), &MachineController::tick, this, &MainWindow::updateRegisterDisplays); + + connectRegisterFields(); + + connect(ui->StartBtn, &QPushButton::clicked, this, &MainWindow::startExecution); + connect(ui->StopBtn, &QPushButton::clicked, this, &MainWindow::stopExecution); + connect(ui->StepBtn, &QPushButton::clicked, this, &MainWindow::stepExecution); + + loadDemoProgram(); + + updateRegisterDisplays(); } MainWindow::~MainWindow() { delete ui; } + +void MainWindow::updateRegisterDisplays() +{ + if (!m_machine) return; + + // Update all register display formats (decimal, hex, binary) + updateAllFormatsForRegister("regA", m_machine->getA()); + updateAllFormatsForRegister("regB", m_machine->getB()); + updateAllFormatsForRegister("regX", m_machine->getX()); + updateAllFormatsForRegister("regS", m_machine->getS()); + updateAllFormatsForRegister("regT", m_machine->getT()); + updateAllFormatsForRegister("regL", m_machine->getL()); + updateAllFormatsForRegister("regPC", m_machine->getPC()); + updateAllFormatsForRegister("regSW", m_machine->getSW()); + updateFloatRegisterFormats("regF", m_machine->getF()); +} + +void MainWindow::updateSingleRegisterDisplay(const QString& fieldName, int value) +{ + QLineEdit* field = findChild(fieldName); + if (field) { + // Only update if the field doesn't have focus (to avoid interfering with user input) + if (!field->hasFocus()) { + field->setText(QString::number(value)); + } + } +} + +void MainWindow::updateAllFormatsForRegister(const QString& regPrefix, int value) +{ + // Update decimal field + QLineEdit* decField = findChild(regPrefix + "_dec_field"); + if (decField && !decField->hasFocus()) { + decField->setText(QString::number(value)); + } + + // Update hex field + QLineEdit* hexField = findChild(regPrefix + "_hex_field"); + if (hexField && !hexField->hasFocus()) { + // Convert to 24-bit representation, handle negative numbers + unsigned int unsignedValue = static_cast(value) & 0xFFFFFF; + hexField->setText(QString("0x%1").arg(unsignedValue, 6, 16, QChar('0')).toUpper()); + } + + // Update binary field + QLineEdit* binField = findChild(regPrefix + "_bin_field"); + if (binField && !binField->hasFocus()) { + // Convert to 24-bit binary representation + unsigned int unsignedValue = static_cast(value) & 0xFFFFFF; + QString binaryStr = QString::number(unsignedValue, 2); + // Pad to 24 bits + binaryStr = binaryStr.rightJustified(24, '0'); + binField->setText(binaryStr); + } +} + +void MainWindow::updateFloatRegisterFormats(const QString& regPrefix, double value) +{ + // Update decimal field + QLineEdit* decField = findChild(regPrefix + "_dec_field"); + if (decField && !decField->hasFocus()) { + decField->setText(QString::number(value, 'g', 10)); + } + + // Update hex field (48-bit float representation) + QLineEdit* hexField = findChild(regPrefix + "_hex_field"); + if (hexField && !hexField->hasFocus()) { + // Convert double to 48-bit hex representation + // For SIC/XE, we need to convert to the 48-bit float format + uint64_t* intPtr = reinterpret_cast(&value); + uint64_t bits48 = (*intPtr) & 0xFFFFFFFFFFFFULL; // Mask to 48 bits + hexField->setText(QString("0x%1").arg(bits48, 12, 16, QChar('0')).toUpper()); + } + + // Update binary field (48-bit float representation) + QLineEdit* binField = findChild(regPrefix + "_bin_field"); + if (binField && !binField->hasFocus()) { + // Convert double to 48-bit binary representation + uint64_t* intPtr = reinterpret_cast(&value); + uint64_t bits48 = (*intPtr) & 0xFFFFFFFFFFFFULL; // Mask to 48 bits + QString binaryStr = QString::number(bits48, 2); + // Pad to 48 bits + binaryStr = binaryStr.rightJustified(48, '0'); + binField->setText(binaryStr); + } +} + +void MainWindow::connectRegisterFields() +{ + // Connect decimal register fields to update machine registers when changed + connect(ui->regA_dec_field, &QLineEdit::editingFinished, this, &MainWindow::onRegisterFieldChanged); + connect(ui->regB_dec_field, &QLineEdit::editingFinished, this, &MainWindow::onRegisterFieldChanged); + connect(ui->regX_dec_field, &QLineEdit::editingFinished, this, &MainWindow::onRegisterFieldChanged); + connect(ui->regS_dec_field, &QLineEdit::editingFinished, this, &MainWindow::onRegisterFieldChanged); + connect(ui->regT_dec_field, &QLineEdit::editingFinished, this, &MainWindow::onRegisterFieldChanged); + connect(ui->regL_dec_field, &QLineEdit::editingFinished, this, &MainWindow::onRegisterFieldChanged); + connect(ui->regPC_dec_field, &QLineEdit::editingFinished, this, &MainWindow::onRegisterFieldChanged); + connect(ui->regSW_dec_field, &QLineEdit::editingFinished, this, &MainWindow::onRegisterFieldChanged); + connect(ui->regF_dec_field, &QLineEdit::editingFinished, this, &MainWindow::onRegisterFieldChanged); + + // Connect hex register fields + QLineEdit* hexFields[] = { + ui->regA_hex_field, ui->regB_hex_field, ui->regX_hex_field, + ui->regS_hex_field, ui->regT_hex_field, ui->regL_hex_field, + ui->regPC_hex_field, ui->regSW_hex_field, ui->regF_hex_field + }; + for (auto* field : hexFields) { + if (field) { + connect(field, &QLineEdit::editingFinished, this, &MainWindow::onRegisterFieldChanged); + } + } + + // Connect binary register fields + QLineEdit* binFields[] = { + ui->regA_bin_field, ui->regB_bin_field, ui->regX_bin_field, + ui->regS_bin_field, ui->regT_bin_field, ui->regL_bin_field, + ui->regPC_bin_field, ui->regSW_bin_field, ui->regF_bin_field + }; + for (auto* field : binFields) { + if (field) { + connect(field, &QLineEdit::editingFinished, this, &MainWindow::onRegisterFieldChanged); + } + } +} + +void MainWindow::onRegisterFieldChanged() +{ + if (!m_machine) return; + + QLineEdit* field = qobject_cast(sender()); + if (!field) return; + + QString objectName = field->objectName(); + QString regName = objectName.split('_')[0]; + + + if (regName == "regF") { + handleFloatRegisterFieldChanged(field, objectName); + return; + } + + // Handle integer registers + int value = 0; + bool ok = false; + + // Parse value based on field type + if (objectName.contains("_dec_field")) { + value = field->text().toInt(&ok); + } else if (objectName.contains("_hex_field")) { + QString hexText = field->text(); + // Remove 0x prefix if present + if (hexText.startsWith("0x", Qt::CaseInsensitive)) { + hexText = hexText.mid(2); + } + value = hexText.toInt(&ok, 16); + + if (ok && (regName == "regA" || regName == "regB" || regName == "regX" || + regName == "regS" || regName == "regT")) { + if (value > 0x7FFFFF) { + value = value - 0x1000000; + } + } + } else if (objectName.contains("_bin_field")) { + value = field->text().toInt(&ok, 2); + + if (ok && (regName == "regA" || regName == "regB" || regName == "regX" || + regName == "regS" || regName == "regT")) { + if (value > 0x7FFFFF) { + value = value - 0x1000000; + } + } + } + + if (!ok) { + + updateRegisterDisplays(); + return; + } + + if (regName == "regA") { + m_machine->setA(value); + updateAllFormatsForRegister("regA", m_machine->getA()); + } else if (regName == "regB") { + m_machine->setB(value); + updateAllFormatsForRegister("regB", m_machine->getB()); + } else if (regName == "regX") { + m_machine->setX(value); + updateAllFormatsForRegister("regX", m_machine->getX()); + } else if (regName == "regS") { + m_machine->setS(value); + updateAllFormatsForRegister("regS", m_machine->getS()); + } else if (regName == "regT") { + m_machine->setT(value); + updateAllFormatsForRegister("regT", m_machine->getT()); + } else if (regName == "regL") { + m_machine->setL(value); + updateAllFormatsForRegister("regL", m_machine->getL()); + } else if (regName == "regPC") { + m_machine->setPC(value); + updateAllFormatsForRegister("regPC", m_machine->getPC()); + } else if (regName == "regSW") { + m_machine->setSW(value); + updateAllFormatsForRegister("regSW", m_machine->getSW()); + } +} + +void MainWindow::handleFloatRegisterFieldChanged(QLineEdit* field, const QString& objectName) +{ + double value = 0.0; + bool ok = false; + + if (objectName.contains("_dec_field")) { + value = field->text().toDouble(&ok); + } else if (objectName.contains("_hex_field")) { + QString hexText = field->text(); + if (hexText.startsWith("0x", Qt::CaseInsensitive)) { + hexText = hexText.mid(2); + } + + uint64_t intValue = hexText.toULongLong(&ok, 16); + if (ok) { + intValue &= 0xFFFFFFFFFFFFULL; + double* floatPtr = reinterpret_cast(&intValue); + value = *floatPtr; + } + } else if (objectName.contains("_bin_field")) { + uint64_t intValue = field->text().toULongLong(&ok, 2); + if (ok) { + intValue &= 0xFFFFFFFFFFFFULL; + double* floatPtr = reinterpret_cast(&intValue); + value = *floatPtr; + } + } + + if (!ok) { + updateRegisterDisplays(); + return; + } + + m_machine->setF(value); + updateFloatRegisterFormats("regF", m_machine->getF()); +} + +void MainWindow::setTestRegisterValues() +{ + if (!m_machine) return; + + // Set some test values to demonstrate the register updating + m_machine->setA(12345); // Decimal: 12345, Hex: 0x003039, Binary: 000000011000000111001 + m_machine->setB(-1000); // Negative value to test signed representation + m_machine->setX(0xABCDEF); // Hex value to test various formats + m_machine->setS(255); // Simple power of 2 minus 1 + m_machine->setT(0x7FFFFF); // Maximum positive 24-bit value + + // Update all displays + updateRegisterDisplays(); +} + +void MainWindow::startExecution() +{ + if (m_controller) { + m_controller->start(); + } +} + +void MainWindow::stopExecution() +{ + if (m_controller) { + m_controller->stop(); + } +} + +void MainWindow::stepExecution() +{ + if (m_controller) { + m_controller->step(); + } +} + +void MainWindow::loadDemoProgram() +{ + if (!m_machine) return; + + // Load the instruction set first + loadInstructionSet(); + + qDebug() << "Loading SIC/XE Demo Program: Accumulator Loop"; + + const int TEMP_ADDR = 0x50; + const int LOOP_ADDR = 0x03; + + // clear TEMP + m_machine->setByte(TEMP_ADDR, 0); + + // Program (addresses): + // 0x00 LDA #1 + // 0x03 LDB TEMP + // 0x06 ADDR A,B + // 0x08 RMO B,A + // 0x0A STA TEMP + // 0x0D J LOOP + + // LDA #1 + m_machine->setByte(0x00, 0x01); + m_machine->setByte(0x01, 0x00); + m_machine->setByte(0x02, 0x01); + + // LDB TEMP + m_machine->setByte(0x03, 0x6B); + m_machine->setByte(0x04, 0x00); + m_machine->setByte(0x05, TEMP_ADDR); + + // ADDR A,B + m_machine->setByte(0x06, 0x90); + m_machine->setByte(0x07, 0x03); + + // RMO B,A + m_machine->setByte(0x08, 0xAC); + m_machine->setByte(0x09, 0x30); + + // STA TEMP + m_machine->setByte(0x0A, 0x0F); + m_machine->setByte(0x0B, 0x00); + m_machine->setByte(0x0C, TEMP_ADDR); + + // J LOOP + m_machine->setByte(0x0D, 0x3F); + m_machine->setByte(0x0E, 0x00); + m_machine->setByte(0x0F, LOOP_ADDR); + + // Set PC to start of program + m_machine->setPC(0x00); + + qDebug() << "Program loaded. TEMP at 0x" << QString::number(TEMP_ADDR, 16).toUpper(); + qDebug() << "PC set to 0x00. Ready to execute."; +} diff --git a/simulator_SIC_XE/gui/qt/mainwindow.h b/simulator_SIC_XE/gui/qt/mainwindow.h index 9353441..e6c6c46 100644 --- a/simulator_SIC_XE/gui/qt/mainwindow.h +++ b/simulator_SIC_XE/gui/qt/mainwindow.h @@ -2,6 +2,11 @@ #define MAINWINDOW_H #include +#include + +class MachineController; +class Machine; +class QLineEdit; namespace Ui { class MainWindow; @@ -14,9 +19,31 @@ class MainWindow : public QMainWindow public: explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); + + std::shared_ptr machine() const { return m_machine; } + MachineController* controller() const { return m_controller.get(); } + + void startExecution(); + void stopExecution(); + void stepExecution(); + + void setTestRegisterValues(); + +private slots: + void updateRegisterDisplays(); + void onRegisterFieldChanged(); private: Ui::MainWindow *ui; + std::shared_ptr m_machine; + std::unique_ptr m_controller; + + void connectRegisterFields(); + void updateSingleRegisterDisplay(const QString& fieldName, int value); + void updateAllFormatsForRegister(const QString& regPrefix, int value); + void updateFloatRegisterFormats(const QString& regPrefix, double value); + void handleFloatRegisterFieldChanged(QLineEdit* field, const QString& objectName); + void loadDemoProgram(); }; #endif // MAINWINDOW_H diff --git a/simulator_SIC_XE/gui/qt/mainwindow.ui b/simulator_SIC_XE/gui/qt/mainwindow.ui index 9f505ab..3de39ab 100644 --- a/simulator_SIC_XE/gui/qt/mainwindow.ui +++ b/simulator_SIC_XE/gui/qt/mainwindow.ui @@ -19,17 +19,7 @@ 0 0 - 231 - 601 - - - - - - - 230 - 0 - 891 + 431 601 @@ -37,34 +27,563 @@ 0 - 0 - 881 - 181 + 280 + 431 + 321 Register values - + - 0 - 20 - 881 - 161 + 70 + 40 + 113 + 23 + + + + + + + 20 + 41 + 57 + 20 + + + + + 10 + + + + Reg A + + + + + + 190 + 40 + 113 + 23 + + + + + + + 310 + 40 + 113 + 23 + + + + + + + 110 + 20 + 57 + 20 + + + + + 10 + + + + Bin + + + + + + 230 + 20 + 57 + 20 + + + + + 10 + + + + Hex + + + + + + 350 + 20 + 57 + 20 + + + + + 10 + + + + Dec + + + + + + 310 + 70 + 113 + 23 + + + + + + + 20 + 71 + 57 + 20 + + + + + 10 + + + + Reg B + + + + + + 190 + 70 + 113 + 23 + + + + + + + 70 + 70 + 113 + 23 + + + + + + + 310 + 100 + 113 + 23 + + + + + + + 20 + 101 + 57 + 20 + + + + + 10 + + + + Reg X + + + + + + 190 + 100 + 113 + 23 + + + + + + + 70 + 100 + 113 + 23 + + + + + + + 310 + 130 + 113 + 23 + + + + + + + 20 + 131 + 57 + 20 + + + + + 10 + + + + Reg S + + + + + + 190 + 130 + 113 + 23 + + + + + + + 70 + 130 + 113 + 23 + + + + + + + 310 + 160 + 113 + 23 + + + + + + + 20 + 161 + 57 + 20 + + + + + 10 + + + + Reg T + + + + + + 190 + 160 + 113 + 23 + + + + + + + 70 + 160 + 113 + 23 + + + + + + + 190 + 190 + 113 + 23 + + + + + + + 70 + 190 + 113 + 23 + + + + + + + 20 + 191 + 57 + 20 + + + + + 10 + + + + Reg L + + + + + + 310 + 190 + 113 + 23 + + + + + + + 20 + 221 + 57 + 20 + + + + + 10 + + + + Reg PC + + + + + + 310 + 220 + 113 + 23 + + + + + + + 70 + 220 + 113 + 23 + + + + + + + 190 + 220 + 113 + 23 + + + + + + + 20 + 250 + 57 + 20 + + + + + 10 + + + + Reg SW + + + + + + 310 + 249 + 113 + 23 + + + + + + + 70 + 249 + 113 + 23 + + + + + + + 190 + 249 + 113 + 23 + + + + + + + 20 + 281 + 57 + 20 + + + + + 10 + + + + Reg L + + + + + + 310 + 280 + 113 + 23 + + + + + + + 70 + 280 + 113 + 23 + + + + + + + 190 + 280 + 113 + 23 - - - - - TextLabel - - - - + + + + 0 + 0 + 431 + 161 + + + + Control + + + + + 40 + 70 + 80 + 23 + + + + Start + + + + + + 180 + 70 + 80 + 23 + + + + Stop + + + + + + 320 + 70 + 80 + 23 + + + + Step + + + + + + + + 430 + 0 + 711 + 601 + + diff --git a/simulator_SIC_XE/include/utils.h b/simulator_SIC_XE/include/utils.h index 754b256..3197a95 100644 --- a/simulator_SIC_XE/include/utils.h +++ b/simulator_SIC_XE/include/utils.h @@ -3,6 +3,8 @@ #include "constants.h" +#include + // ============================== // SIC/XE Utility Functions // ============================== @@ -77,4 +79,17 @@ inline int getCC(int sw) { return sw & CC_MASK; } +inline double normaliseFloat(double value) +{ + if (value == 0.0 )return 0.0; + if (!std::isfinite(value)) return value; + double mantissa = value; + while (std::fabs(mantissa) >= 10.0) mantissa /= 10.0; + while (std::fabs(mantissa) < 1.0) mantissa *= 10.0; + return mantissa; +} + + + + #endif // UTILS_H \ No newline at end of file diff --git a/simulator_SIC_XE/src/instructions.cpp b/simulator_SIC_XE/src/instructions.cpp index 85e3bd9..5286311 100644 --- a/simulator_SIC_XE/src/instructions.cpp +++ b/simulator_SIC_XE/src/instructions.cpp @@ -73,6 +73,11 @@ void float_handler(Machine &m) m.setF(static_cast(m.getA())); } +void norm_handler(Machine &m) +{ + m.setF(normaliseFloat(m.getF())); +} + void addr_handler(Machine &m, int r1, int r2) { m.setReg(r2, m.getReg(r1) + m.getReg(r2)); @@ -303,6 +308,14 @@ void or_handler(Machine &m, int ea, AddressingMode mode) m.setA(m.getA() | val); } +void rd_handler(Machine &m, int ea, AddressingMode mode) +{ + int deviceNum = resolveWordOperand(m, ea, mode); + Device& device = m.getDevice(deviceNum); + // Load byte into rightmost byte of A register + m.setA((m.getA() & 0xFFFF00) | device.read()); +} + void rsub_handler(Machine &m, int ea, AddressingMode mode) { m.setPC(m.getL()); @@ -372,6 +385,18 @@ void subf_handler(Machine &m, int ea, AddressingMode mode) m.setF(m.getF() - val); } +void td_handler(Machine &m, int ea, AddressingMode mode) +{ + int deviceNum = resolveWordOperand(m, ea, mode); + Device& device = m.getDevice(deviceNum); + // Test device and set SW accordingly + if (device.test()) { + m.setSW(setCC(m.getSW(), CC_EQ)); + } else { + m.setSW(setCC(m.getSW(), CC_LT)); + } +} + void tix_handler(Machine &m, int ea, AddressingMode mode) { m.setX(m.getX() + 1); @@ -379,3 +404,11 @@ void tix_handler(Machine &m, int ea, AddressingMode mode) int memVal = resolveWordOperand(m, ea, mode); m.setSW(sic_comp(valX, memVal, m.getSW())); } + +void wd_handler(Machine &m, int ea, AddressingMode mode) +{ + int deviceNum = resolveWordOperand(m, ea, mode); + Device& device = m.getDevice(deviceNum); + // Write rightmost byte of A register to device + device.write(static_cast(m.getA() & 0xFF)); +} diff --git a/simulator_SIC_XE/src/opcode.cpp b/simulator_SIC_XE/src/opcode.cpp index 6095307..f5d63cf 100644 --- a/simulator_SIC_XE/src/opcode.cpp +++ b/simulator_SIC_XE/src/opcode.cpp @@ -38,9 +38,9 @@ void loadInstructionSet() instructions[MUL] = {"MUL", InstructionType::TYPE3_4, reinterpret_cast(mul_handler)}; instructions[MULF] = {"MULF", InstructionType::TYPE3_4, reinterpret_cast(mulf_handler)}; instructions[MULR] = {"MULR", InstructionType::TYPE2, reinterpret_cast(mulr_handler)}; - instructions[NORM] = {"NORM", InstructionType::TYPE1, nullptr}; + instructions[NORM] = {"NORM", InstructionType::TYPE1, reinterpret_cast(norm_handler)}; instructions[OR] = {"OR", InstructionType::TYPE3_4, reinterpret_cast(or_handler)}; - instructions[RD] = {"RD", InstructionType::TYPE3_4, nullptr}; + instructions[RD] = {"RD", InstructionType::TYPE3_4, reinterpret_cast(rd_handler)}; instructions[RMO] = {"RMO", InstructionType::TYPE2, reinterpret_cast(rmo_handler)}; instructions[RSUB] = {"RSUB", InstructionType::TYPE3_4, reinterpret_cast(rsub_handler)}; instructions[SHIFTL] = {"SHIFTL", InstructionType::TYPE2, reinterpret_cast(shiftl_handler)}; @@ -62,10 +62,10 @@ void loadInstructionSet() instructions[SUBR] = {"SUBR", InstructionType::TYPE2, reinterpret_cast(subr_handler)}; instructions[SVC] = {"SVC", InstructionType::TYPE2, reinterpret_cast(svc_handler)}; instructions[TIXR] = {"TIXR", InstructionType::TYPE2, reinterpret_cast(tixr_handler)}; - instructions[TD] = {"TD", InstructionType::TYPE3_4, nullptr}; + instructions[TD] = {"TD", InstructionType::TYPE3_4, reinterpret_cast(td_handler)}; instructions[TIX] = {"TIX", InstructionType::TYPE3_4, reinterpret_cast(tix_handler)}; instructions[TIO] = {"TIO", InstructionType::TYPE1, nullptr}; - instructions[WD] = {"WD", InstructionType::TYPE3_4, nullptr}; + instructions[WD] = {"WD", InstructionType::TYPE3_4, reinterpret_cast(wd_handler)}; // Mark uninitialized opcodes as INVALID for (int i = 0; i < 0xff; ++i) {