diff --git a/include/instructions.h b/include/instructions.h index ee813b5..67b51e7 100644 --- a/include/instructions.h +++ b/include/instructions.h @@ -36,4 +36,6 @@ public: void jmp_imm8(); // 0xeb void hlt(); // 0xf4 void opcode_ff(); // 0xff + + void cmp_rm32_imm8(); }; diff --git a/instructions.cpp b/instructions.cpp index 54b0a7d..f9442ea 100644 --- a/instructions.cpp +++ b/instructions.cpp @@ -252,6 +252,19 @@ void Instructions::opcode_ff(){ } } +void Instructions::cmp_rm32_imm8(){ + printf("cmp_rm32_imm8 called.\n"); + + this->modrm = memory.read_uint8(this->eip); + this->calc_modrm(); + + this->eip++; + uint8_t imm8 = memory.read_uint8(this->eip); + uint32_t result = this->registers[this->M] - imm8; + + set_flag(!result, ZF); +} + void Instructions::set_flag(int flag, uint32_t flag_type){ if (flag) { this->eflags &= ~flag_type;