Add inc_e**(0x40~0x47) instruction

This commit is contained in:
tuz358
2018-03-06 00:24:47 +09:00
parent 748168c5a4
commit de00d14cc4
2 changed files with 56 additions and 0 deletions

View File

@@ -29,6 +29,14 @@ public:
void add_rm32_r32(); // 0x01 void add_rm32_r32(); // 0x01
void xor_rm32_r32(); // 0x31 void xor_rm32_r32(); // 0x31
void inc_eax(); // 0x40
void inc_ecx(); // 0x41
void inc_edx(); // 0x42
void inc_ebx(); // 0x43
void inc_esp(); // 0x44
void inc_ebp(); // 0x45
void inc_esi(); // 0x46
void inc_edi(); // 0x47
void dec_eax(); // 0x48 void dec_eax(); // 0x48
void dec_ecx(); // 0x49 void dec_ecx(); // 0x49
void dec_edx(); // 0x4a void dec_edx(); // 0x4a

View File

@@ -22,6 +22,14 @@ void Instructions::init_instructions(){
this->instructions[0x01] = &Instructions::add_rm32_r32; this->instructions[0x01] = &Instructions::add_rm32_r32;
this->instructions[0x31] = &Instructions::xor_rm32_r32; this->instructions[0x31] = &Instructions::xor_rm32_r32;
this->instructions[0x40] = &Instructions::inc_eax;
this->instructions[0x41] = &Instructions::inc_ecx;
this->instructions[0x42] = &Instructions::inc_edx;
this->instructions[0x43] = &Instructions::inc_ebx;
this->instructions[0x44] = &Instructions::inc_esp;
this->instructions[0x45] = &Instructions::inc_ebp;
this->instructions[0x46] = &Instructions::inc_esi;
this->instructions[0x47] = &Instructions::inc_edi;
this->instructions[0x48] = &Instructions::dec_eax; this->instructions[0x48] = &Instructions::dec_eax;
this->instructions[0x49] = &Instructions::dec_ecx; this->instructions[0x49] = &Instructions::dec_ecx;
this->instructions[0x4a] = &Instructions::dec_edx; this->instructions[0x4a] = &Instructions::dec_edx;
@@ -165,6 +173,46 @@ void Instructions::xor_rm32_r32(){
} }
} }
void Instructions::inc_eax(){
//printf("inc_eax called.\n");
this->registers[0]++;
}
void Instructions::inc_ecx(){
//printf("inc_ecx called.\n");
this->registers[1]++;
}
void Instructions::inc_edx(){
//printf("inc_edx called.\n");
this->registers[2]++;
}
void Instructions::inc_ebx(){
//printf("inc_ebx called.\n");
this->registers[3]++;
}
void Instructions::inc_esp(){
//printf("inc_esp called.\n");
this->registers[4]++;
}
void Instructions::inc_ebp(){
//printf("inc_ebp called.\n");
this->registers[5]++;
}
void Instructions::inc_esi(){
//printf("inc_esi called.\n");
this->registers[6]++;
}
void Instructions::inc_edi(){
//printf("inc_edi called.\n");
this->registers[7]++;
}
void Instructions::dec_eax(){ void Instructions::dec_eax(){
//printf("dec_eax called.\n"); //printf("dec_eax called.\n");
this->registers[0]--; this->registers[0]--;