mirror of
https://github.com/tuz358/cpu-emulator.git
synced 2025-12-18 13:04:35 +03:00
Add dec_r32(0x48~0x4f) instruction
This commit is contained in:
@@ -25,6 +25,7 @@ public:
|
||||
|
||||
void add_rm32_r32(); // 0x01
|
||||
void xor_rm32_r32(); // 0x31
|
||||
void dec_r32(); // 0x48 ~ 0x4f
|
||||
void mov_rm32_r32(); // 0x89
|
||||
void nop(); // 0x90
|
||||
void mov_ecx_imm32(); // 0xb9
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user