mirror of
https://github.com/tuz358/cpu-emulator.git
synced 2025-12-18 21:14:35 +03:00
Add opcode_ff(0xff) instruction
This commit is contained in:
@@ -32,4 +32,5 @@ public:
|
|||||||
void mov_ebx_imm32(); // 0xbb
|
void mov_ebx_imm32(); // 0xbb
|
||||||
void jmp_imm8(); // 0xeb
|
void jmp_imm8(); // 0xeb
|
||||||
void hlt(); // 0xf4
|
void hlt(); // 0xf4
|
||||||
|
void opcode_ff(); // 0xff
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ void Instructions::init_instructions(){
|
|||||||
this->instructions[0xbb] = &Instructions::mov_ebx_imm32;
|
this->instructions[0xbb] = &Instructions::mov_ebx_imm32;
|
||||||
this->instructions[0xeb] = &Instructions::jmp_imm8;
|
this->instructions[0xeb] = &Instructions::jmp_imm8;
|
||||||
this->instructions[0xf4] = &Instructions::hlt;
|
this->instructions[0xf4] = &Instructions::hlt;
|
||||||
|
this->instructions[0xff] = &Instructions::opcode_ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Instructions::init_modrm(){
|
void Instructions::init_modrm(){
|
||||||
@@ -230,3 +231,23 @@ void Instructions::hlt(){
|
|||||||
printf("hlt called.\n");
|
printf("hlt called.\n");
|
||||||
this->eip = 0x00;
|
this->eip = 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Instructions::opcode_ff(){
|
||||||
|
printf("opcode_ff called.\n");
|
||||||
|
|
||||||
|
this->modrm = memory.read_uint8(this->eip);
|
||||||
|
this->calc_modrm();
|
||||||
|
|
||||||
|
switch (this->R) {
|
||||||
|
case 0:
|
||||||
|
// TODO: add inc_r32() function
|
||||||
|
// this->execute_opcode(0x40+this->M)
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
this->execute_opcode(0x48+this->M); // dec r32
|
||||||
|
this->eip++;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user