2026-02-04 12:52:42 +01:00
|
|
|
#include "ExecutorCases.h"
|
|
|
|
|
|
2026-02-05 00:42:25 +01:00
|
|
|
#include "DataTransfer.h"
|
|
|
|
|
#include "ControlFlow.h"
|
|
|
|
|
#include "Arithmetic.h"
|
|
|
|
|
#include "Misc.h"
|
|
|
|
|
|
2026-02-04 12:52:42 +01:00
|
|
|
#include "Instruction.h"
|
|
|
|
|
#include "Bus.h"
|
|
|
|
|
|
|
|
|
|
#include <bitset>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
2026-02-04 22:28:36 +01:00
|
|
|
CPUContext::CPUContext(Instruction& i, uint32_t& ip, uint32_t& flags, uint32_t* reg, std::shared_ptr<Bus>& bus, bool& isHalted) : m_Instruction(i), m_InstructionPointer(ip), m_Flags(flags), m_Registers(reg), m_Bus(bus), m_IsHalted(isHalted) { }
|
2026-02-04 12:52:42 +01:00
|
|
|
|
|
|
|
|
CPUContext::~CPUContext() = default;
|
|
|
|
|
|
|
|
|
|
constexpr std::array<ExecutorCase, 255> GenerateExecutorTable(){
|
|
|
|
|
std::array<ExecutorCase, 255> table{};
|
|
|
|
|
table[Opcode::NOP] = executor_cases::Nop;
|
|
|
|
|
table[Opcode::HLT] = executor_cases::Hlt;
|
2026-02-05 00:42:25 +01:00
|
|
|
table[Opcode::MOV_R32_IMM32] = executor_cases::Mov_r32_imm32;
|
2026-02-04 12:52:42 +01:00
|
|
|
table[Opcode::ADD_RM32_R32] = executor_cases::Add_rm32_r32;
|
|
|
|
|
return table;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static constexpr std::array<ExecutorCase, 255> s_ExecutorTable = GenerateExecutorTable();
|
|
|
|
|
|
|
|
|
|
const std::array<ExecutorCase, 255>& GetExecutorTable() {
|
|
|
|
|
return s_ExecutorTable;
|
|
|
|
|
}
|