mirror of
https://github.com/tuz358/cpu-emulator.git
synced 2025-12-18 13:04:35 +03:00
Add cmp_eax_imm32(0x3d) instruction
This commit is contained in:
@@ -43,6 +43,7 @@ public:
|
||||
void xor_r32_rm32(); // 0x33
|
||||
void xor_eax_imm32(); // 0x35
|
||||
void cmp_rm32_r32(); // 0x39
|
||||
void cmp_eax_imm32(); // 0x3d
|
||||
void inc_eax(); // 0x40
|
||||
void inc_ecx(); // 0x41
|
||||
void inc_edx(); // 0x42
|
||||
|
||||
@@ -36,6 +36,8 @@ void Instructions::init_instructions(){
|
||||
this->instructions[0x33] = &Instructions::xor_r32_rm32;
|
||||
this->instructions[0x35] = &Instructions::xor_eax_imm32;
|
||||
this->instructions[0x39] = &Instructions::cmp_rm32_r32;
|
||||
this->instructions[0x3b] = &Instructions::cmp_rm32_r32;
|
||||
this->instructions[0x3d] = &Instructions::cmp_eax_imm32;
|
||||
this->instructions[0x40] = &Instructions::inc_eax;
|
||||
this->instructions[0x41] = &Instructions::inc_ecx;
|
||||
this->instructions[0x42] = &Instructions::inc_edx;
|
||||
@@ -694,6 +696,14 @@ void Instructions::cmp_rm32_r32(){
|
||||
}
|
||||
}
|
||||
|
||||
void Instructions::cmp_eax_imm32(){
|
||||
this->eip++;
|
||||
uint32_t imm32 = memory.read_uint32(this->eip);
|
||||
imm32 = swap_endian32(imm32);
|
||||
uint32_t result = this->registers[0] - imm32;
|
||||
set_flag(!result, ZF);
|
||||
}
|
||||
|
||||
void Instructions::inc_eax(){
|
||||
//printf("inc_eax called.\n");
|
||||
this->registers[0]++;
|
||||
|
||||
Reference in New Issue
Block a user