Started refactoring to a library-based model to easily integrate comprehensive unit testing. Added CPU exception handling system for the GUI. Non-critical exceptions (though critical to execution of emulated application) will not shutdown the application in the future releases. Refactored Userspace::Run() logic so that the GUI-controls reflect emulator behavior.
31 lines
865 B
C++
31 lines
865 B
C++
#include "DataTransfer.h"
|
|
|
|
#include "ExecutorCases.h"
|
|
#include "Instruction.h"
|
|
#include "CPUContext.h"
|
|
#include "Bus.h"
|
|
|
|
#include <iostream>
|
|
|
|
namespace executor_cases {
|
|
|
|
void Mov_rm32_r32(CPUContext& cc) {
|
|
x86::ModRM modrm = cc.m_Instruction.m_ModRM;
|
|
|
|
std::cout << "[Instruction] ";
|
|
|
|
switch(modrm.m_State) {
|
|
case x86::ModRMState::R:
|
|
cc.m_Registers[modrm.m_Rm] = cc.m_Registers[modrm.m_Reg];
|
|
std::cout << "mov " << x86::Register2Str((x86::Register)modrm.m_Rm) << ", " << x86::Register2Str((x86::Register)modrm.m_Rm);
|
|
break;
|
|
default:
|
|
cc.m_Bus->WriteX<uint32_t>(helpers::ResolveModRMAddress(cc), cc.m_Registers[modrm.m_Reg]);
|
|
std::cout << "mov DWORD PTR [0x" << helpers::ResolveModRMAddress(cc) << "], " << x86::Register2Str((x86::Register)modrm.m_Reg);
|
|
break;
|
|
}
|
|
|
|
std::cout << std::endl;
|
|
}
|
|
}
|