diff --git a/include/instructions.h b/include/instructions.h index b77fe79..895b62c 100644 --- a/include/instructions.h +++ b/include/instructions.h @@ -32,4 +32,5 @@ public: void mov_ebx_imm32(); // 0xbb void jmp_imm8(); // 0xeb void hlt(); // 0xf4 + void opcode_ff(); // 0xff }; diff --git a/instructions.cpp b/instructions.cpp index 094e5ea..a166212 100644 --- a/instructions.cpp +++ b/instructions.cpp @@ -29,6 +29,7 @@ void Instructions::init_instructions(){ this->instructions[0xbb] = &Instructions::mov_ebx_imm32; this->instructions[0xeb] = &Instructions::jmp_imm8; this->instructions[0xf4] = &Instructions::hlt; + this->instructions[0xff] = &Instructions::opcode_ff; } void Instructions::init_modrm(){ @@ -230,3 +231,23 @@ void Instructions::hlt(){ printf("hlt called.\n"); this->eip = 0x00; } + +void Instructions::opcode_ff(){ + printf("opcode_ff called.\n"); + + this->modrm = memory.read_uint8(this->eip); + this->calc_modrm(); + + switch (this->R) { + case 0: + // TODO: add inc_r32() function + // this->execute_opcode(0x40+this->M) + break; + case 1: + this->execute_opcode(0x48+this->M); // dec r32 + this->eip++; + break; + default: + break; + } +}