Patch: ADD_RM32_R32 support LR_DISP32, LR_DISP8

This commit is contained in:
0x221E
2026-02-04 22:48:20 +01:00
parent b1a012fb82
commit 92b4d0b546
3 changed files with 9 additions and 6 deletions

View File

@@ -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!");
std::cout << "Bus write: " << std::hex << address << std::endl;
switch(address)
{
case 0x00008000 ... 0x000FFFFF:

View File

@@ -43,8 +43,9 @@ namespace executor_cases {
break;
}
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 currRegValue = cc.m_Registers[modrm.m_Reg];
uint32_t result = dstPrevValue + currRegValue;

View File

@@ -3,18 +3,18 @@
#include "Metal.h"
// mov eax, 0xF4
// mov ecx, 0x800c
// add [ecx], eax
// mov ecx, 0x8000
// add [ecx + 0x0010], eax
uint8_t test[] = {
0xB8, 0xF4, 0x00, 0x00, 0x00,
0xB9, 0x0c, 0x80, 0x00, 0x00,
0x01, 0x01,
0xB9, 0x00, 0x80, 0x00, 0x00,
0x01, 0x81, 0x10, 0x00, 0x00, 0x00,
0x00,
};
int main(int argc, char** argv) {
Metal metal;
metal.Upload2Memory(test, 13);
metal.Upload2Memory(test, 17);
metal.Run();
return 0;
}