diff --git a/include/instructions.h b/include/instructions.h index d6f00f9..6ea7fe1 100644 --- a/include/instructions.h +++ b/include/instructions.h @@ -30,6 +30,7 @@ public: void add_rm32_r32(); // 0x01 void xor_rm32_r32(); // 0x31 void dec_ecx(); // 0x49 + void jne_imm8(); // 0x75 void opcode_83(); // 0x83 void mov_rm32_r32(); // 0x89 void nop(); // 0x90 diff --git a/instructions.cpp b/instructions.cpp index cf9636d..7660aaa 100644 --- a/instructions.cpp +++ b/instructions.cpp @@ -23,6 +23,7 @@ void Instructions::init_instructions(){ this->instructions[0x01] = &Instructions::add_rm32_r32; this->instructions[0x31] = &Instructions::xor_rm32_r32; this->instructions[0x49] = &Instructions::dec_ecx; + this->instructions[0x75] = &Instructions::jne_imm8; this->instructions[0x83] = &Instructions::opcode_83; this->instructions[0x89] = &Instructions::mov_rm32_r32; this->instructions[0x90] = &Instructions::nop; @@ -154,6 +155,16 @@ void Instructions::dec_ecx(){ this->registers[1]--; } +void Instructions::jne_imm8(){ + printf("jne_imm8 called.\n"); + + this->eip++; + imm8 = memory.read_uint8(this->eip); + + int zero_flag = this->get_flag(ZF); + if (!zero_flag) this->eip += imm8; +} + void Instructions::opcode_83(){ printf("opcode_83 called.\n");