Patch: ADD_RM32_R32 support LR_DISP32, LR_DISP8
This commit is contained in:
@@ -17,6 +17,8 @@ public:
|
|||||||
{
|
{
|
||||||
static_assert(std::is_unsigned_v<T>, "T must be an unsigned int of any size smaller than 8 bytes!");
|
static_assert(std::is_unsigned_v<T>, "T must be an unsigned int of any size smaller than 8 bytes!");
|
||||||
|
|
||||||
|
std::cout << "Bus write: " << std::hex << address << std::endl;
|
||||||
|
|
||||||
switch(address)
|
switch(address)
|
||||||
{
|
{
|
||||||
case 0x00008000 ... 0x000FFFFF:
|
case 0x00008000 ... 0x000FFFFF:
|
||||||
|
|||||||
@@ -43,8 +43,9 @@ namespace executor_cases {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case x86::ModRMState::LR_DISP8:
|
case x86::ModRMState::LR_DISP8:
|
||||||
|
case x86::ModRMState::LR_DISP32:
|
||||||
{
|
{
|
||||||
uint32_t dstAddress = cc.m_Registers[modrm.m_Rm] + cc.m_Instruction.m_Operand2;
|
uint32_t dstAddress = cc.m_Registers[modrm.m_Rm] + cc.m_Instruction.m_Operand1;
|
||||||
uint32_t dstPrevValue = cc.m_Bus->AccessX<uint32_t>(dstAddress);
|
uint32_t dstPrevValue = cc.m_Bus->AccessX<uint32_t>(dstAddress);
|
||||||
uint32_t currRegValue = cc.m_Registers[modrm.m_Reg];
|
uint32_t currRegValue = cc.m_Registers[modrm.m_Reg];
|
||||||
uint32_t result = dstPrevValue + currRegValue;
|
uint32_t result = dstPrevValue + currRegValue;
|
||||||
|
|||||||
10
src/main.cpp
10
src/main.cpp
@@ -3,18 +3,18 @@
|
|||||||
#include "Metal.h"
|
#include "Metal.h"
|
||||||
|
|
||||||
// mov eax, 0xF4
|
// mov eax, 0xF4
|
||||||
// mov ecx, 0x800c
|
// mov ecx, 0x8000
|
||||||
// add [ecx], eax
|
// add [ecx + 0x0010], eax
|
||||||
uint8_t test[] = {
|
uint8_t test[] = {
|
||||||
0xB8, 0xF4, 0x00, 0x00, 0x00,
|
0xB8, 0xF4, 0x00, 0x00, 0x00,
|
||||||
0xB9, 0x0c, 0x80, 0x00, 0x00,
|
0xB9, 0x00, 0x80, 0x00, 0x00,
|
||||||
0x01, 0x01,
|
0x01, 0x81, 0x10, 0x00, 0x00, 0x00,
|
||||||
0x00,
|
0x00,
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
Metal metal;
|
Metal metal;
|
||||||
metal.Upload2Memory(test, 13);
|
metal.Upload2Memory(test, 17);
|
||||||
metal.Run();
|
metal.Run();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user