diff --git a/include/instructions.h b/include/instructions.h index e3366a5..490d914 100644 --- a/include/instructions.h +++ b/include/instructions.h @@ -108,5 +108,7 @@ public: void hlt(); // 0xf4 void opcode_ff(); // 0xff - void cmp_rm32_imm8(); // called by opcode_83 + // called by opcode_83 + void add_rm32_imm8(); + void cmp_rm32_imm8(); }; diff --git a/instructions.cpp b/instructions.cpp index c4c4908..a3d5540 100644 --- a/instructions.cpp +++ b/instructions.cpp @@ -1164,6 +1164,9 @@ void Instructions::opcode_83(){ this->calc_modrm(); switch (this->R) { + case 0: + add_rm32_imm8(); + break; case 7: cmp_rm32_imm8(); break; @@ -1420,6 +1423,17 @@ void Instructions::opcode_ff(){ } } +void Instructions::add_rm32_imm8(){ + //printf("add_rm32_imm8 called.\n"); + + this->eip++; + uint8_t imm8 = memory.read_uint8(this->eip); + //printf("imm8: 0x%08x (%d)\n", imm8, imm8); + this->registers[this->M] += imm8; + + this->eip++; +} + void Instructions::cmp_rm32_imm8(){ //printf("cmp_rm32_imm8 called.\n");