mirror of
https://github.com/tuz358/cpu-emulator.git
synced 2025-12-18 13:04:35 +03:00
Add ret(0xc3) instruction
This commit is contained in:
@@ -91,6 +91,7 @@ public:
|
|||||||
void mov_ebp_imm32(); // 0xbd
|
void mov_ebp_imm32(); // 0xbd
|
||||||
void mov_esi_imm32(); // 0xbe
|
void mov_esi_imm32(); // 0xbe
|
||||||
void mov_edi_imm32(); // 0xbf
|
void mov_edi_imm32(); // 0xbf
|
||||||
|
void ret(); // 0xc3
|
||||||
void leave(); // 0xc9
|
void leave(); // 0xc9
|
||||||
void call_imm32(); // 0xe8
|
void call_imm32(); // 0xe8
|
||||||
void jmp_imm8(); // 0xeb
|
void jmp_imm8(); // 0xeb
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ void Instructions::init_instructions(){
|
|||||||
this->instructions[0xbd] = &Instructions::mov_ebp_imm32;
|
this->instructions[0xbd] = &Instructions::mov_ebp_imm32;
|
||||||
this->instructions[0xbe] = &Instructions::mov_esi_imm32;
|
this->instructions[0xbe] = &Instructions::mov_esi_imm32;
|
||||||
this->instructions[0xbf] = &Instructions::mov_edi_imm32;
|
this->instructions[0xbf] = &Instructions::mov_edi_imm32;
|
||||||
|
this->instructions[0xc3] = &Instructions::ret;
|
||||||
this->instructions[0xc9] = &Instructions::leave;
|
this->instructions[0xc9] = &Instructions::leave;
|
||||||
this->instructions[0xe8] = &Instructions::call_imm32;
|
this->instructions[0xe8] = &Instructions::call_imm32;
|
||||||
this->instructions[0xeb] = &Instructions::jmp_imm8;
|
this->instructions[0xeb] = &Instructions::jmp_imm8;
|
||||||
@@ -1064,6 +1065,12 @@ void Instructions::mov_edi_imm32(){
|
|||||||
this->eip += 4;
|
this->eip += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Instructions::ret(){
|
||||||
|
//printf("ret called.\n");
|
||||||
|
this->eip = memory.read_uint32(this->registers[4]);
|
||||||
|
this->eip = swap_endian32(this->eip);
|
||||||
|
}
|
||||||
|
|
||||||
void Instructions::leave(){
|
void Instructions::leave(){
|
||||||
//printf("leave called.\n");
|
//printf("leave called.\n");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user