diff options
Diffstat (limited to 'src/DataTransfer.h')
| -rw-r--r-- | src/DataTransfer.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/DataTransfer.h b/src/DataTransfer.h new file mode 100644 index 0000000..a8ee9a1 --- /dev/null +++ b/src/DataTransfer.h @@ -0,0 +1,21 @@ +#pragma once + +#include <type_traits> +#include <cstdint> +#include <iostream> +#include <cstring> + +#include "CPUContext.h" +#include "Instruction.h" + +namespace executor_cases { + template<typename T, int O> + void Mov_rX_immX(CPUContext& cc) { + static_assert(std::is_unsigned_v<T>, "Mov_rX_immX requires an unsigned type!"); + uint8_t reg = cc.m_Instruction.m_Opcode - O; + std::cout << "[Instruction] mov " << x86::Register2Str((x86::Register)reg) << ", " << std::hex << cc.m_Instruction.m_Operand1 << std::endl; + std::memcpy(&cc.m_Registers[reg], &cc.m_Instruction.m_Operand1, sizeof(T)); + } + + void Mov_rm32_r32(CPUContext& cc); +} |
