From 1ce883a1a0ac49d0b0c16849303a1b0a02fa53a4 Mon Sep 17 00:00:00 2001 From: tuz358 Date: Mon, 5 Mar 2018 10:12:34 +0900 Subject: [PATCH] Add dec_ecx(0x49) instruction --- include/instructions.h | 1 + instructions.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/instructions.h b/include/instructions.h index 2373cc4..b77fe79 100644 --- a/include/instructions.h +++ b/include/instructions.h @@ -25,6 +25,7 @@ public: void add_rm32_r32(); // 0x01 void xor_rm32_r32(); // 0x31 + void dec_ecx(); // 0x49 void mov_rm32_r32(); // 0x89 void nop(); // 0x90 void mov_ecx_imm32(); // 0xb9 diff --git a/instructions.cpp b/instructions.cpp index 511be6d..094e5ea 100644 --- a/instructions.cpp +++ b/instructions.cpp @@ -22,6 +22,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[0x89] = &Instructions::mov_rm32_r32; this->instructions[0x90] = &Instructions::nop; this->instructions[0xb9] = &Instructions::mov_ecx_imm32; @@ -146,6 +147,11 @@ void Instructions::xor_rm32_r32(){ } } +void Instructions::dec_ecx(){ + printf("dec_ecx called.\n"); + this->registers[1]--; +} + void Instructions::mov_rm32_r32(){ printf("mov_rm32_r32 called.\n"); uint32_t addr, imm32;