Add dec_r32(0x48~0x4f) instruction

This commit is contained in:
tuz358
2018-03-05 09:57:32 +09:00
parent d4ec188ef1
commit 6a06934dde
2 changed files with 13 additions and 0 deletions

View File

@@ -22,6 +22,12 @@ void Instructions::init_instructions(){
this->instructions[0x01] = &Instructions::add_rm32_r32;
this->instructions[0x31] = &Instructions::xor_rm32_r32;
for(int i = 0;i < 8;i++){
// 0x48 ~ 0x4f : dec_r32
this->instructions[0x48+i] = &Instructions::dec_r32;
}
this->instructions[0x89] = &Instructions::mov_rm32_r32;
this->instructions[0x90] = &Instructions::nop;
this->instructions[0xb9] = &Instructions::mov_ecx_imm32;
@@ -146,6 +152,12 @@ void Instructions::xor_rm32_r32(){
}
}
void Instructions::dec_r32(){
printf("dec_r32 called.\n");
uint8_t opcode = memory.read_uint8(this->eip-1);
this->registers[opcode - 0x48]--;
}
void Instructions::mov_rm32_r32(){
printf("mov_rm32_r32 called.\n");
uint32_t addr, imm32;