mirror of
https://github.com/tuz358/cpu-emulator.git
synced 2025-12-18 21:14:35 +03:00
Add mov_esp_imm32(0xbc) instruction
This commit is contained in:
@@ -38,6 +38,7 @@ public:
|
|||||||
void mov_ecx_imm32(); // 0xb9
|
void mov_ecx_imm32(); // 0xb9
|
||||||
void mov_edx_imm32(); // 0xba
|
void mov_edx_imm32(); // 0xba
|
||||||
void mov_ebx_imm32(); // 0xbb
|
void mov_ebx_imm32(); // 0xbb
|
||||||
|
void mov_esp_imm32(); // 0xbc
|
||||||
void jmp_imm8(); // 0xeb
|
void jmp_imm8(); // 0xeb
|
||||||
void hlt(); // 0xf4
|
void hlt(); // 0xf4
|
||||||
void opcode_ff(); // 0xff
|
void opcode_ff(); // 0xff
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ void Instructions::init_instructions(){
|
|||||||
this->instructions[0xb9] = &Instructions::mov_ecx_imm32;
|
this->instructions[0xb9] = &Instructions::mov_ecx_imm32;
|
||||||
this->instructions[0xba] = &Instructions::mov_edx_imm32;
|
this->instructions[0xba] = &Instructions::mov_edx_imm32;
|
||||||
this->instructions[0xbb] = &Instructions::mov_ebx_imm32;
|
this->instructions[0xbb] = &Instructions::mov_ebx_imm32;
|
||||||
|
this->instructions[0xbc] = &Instructions::mov_esp_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;
|
this->instructions[0xff] = &Instructions::opcode_ff;
|
||||||
@@ -270,6 +271,15 @@ void Instructions::mov_ebx_imm32(){
|
|||||||
this->eip += 4;
|
this->eip += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Instructions::mov_edx_imm32(){
|
||||||
|
//printf("mov_esp_imm32 called.\n");
|
||||||
|
|
||||||
|
uint32_t imm32 = memory.read_uint32(this->eip);
|
||||||
|
imm32 = swap_endian32(imm32);
|
||||||
|
this->registers[4] = imm32;
|
||||||
|
this->eip += 4;
|
||||||
|
}
|
||||||
|
|
||||||
void Instructions::jmp_imm8() {
|
void Instructions::jmp_imm8() {
|
||||||
//printf("jmp_imm8 called.\n");
|
//printf("jmp_imm8 called.\n");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user