mirror of
https://github.com/tuz358/cpu-emulator.git
synced 2025-12-18 21:14:35 +03:00
Add mov_eax_imm32(0xb8) instruction
This commit is contained in:
@@ -34,6 +34,7 @@ public:
|
|||||||
void opcode_83(); // 0x83
|
void opcode_83(); // 0x83
|
||||||
void mov_rm32_r32(); // 0x89
|
void mov_rm32_r32(); // 0x89
|
||||||
void nop(); // 0x90
|
void nop(); // 0x90
|
||||||
|
void mov_eax_imm32(); // 0xb8
|
||||||
void mov_ecx_imm32(); // 0xb9
|
void mov_ecx_imm32(); // 0xb9
|
||||||
void mov_ebx_imm32(); // 0xbb
|
void mov_ebx_imm32(); // 0xbb
|
||||||
void jmp_imm8(); // 0xeb
|
void jmp_imm8(); // 0xeb
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ void Instructions::init_instructions(){
|
|||||||
this->instructions[0x83] = &Instructions::opcode_83;
|
this->instructions[0x83] = &Instructions::opcode_83;
|
||||||
this->instructions[0x89] = &Instructions::mov_rm32_r32;
|
this->instructions[0x89] = &Instructions::mov_rm32_r32;
|
||||||
this->instructions[0x90] = &Instructions::nop;
|
this->instructions[0x90] = &Instructions::nop;
|
||||||
|
this->instructions[0xb8] = &Instructions::mov_eax_imm32;
|
||||||
this->instructions[0xb9] = &Instructions::mov_ecx_imm32;
|
this->instructions[0xb9] = &Instructions::mov_ecx_imm32;
|
||||||
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;
|
||||||
@@ -228,6 +229,15 @@ void Instructions::nop(){
|
|||||||
printf("nop called.\n");
|
printf("nop called.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Instructions::mov_eax_imm32(){
|
||||||
|
printf("mov_eax_imm32 called.\n");
|
||||||
|
|
||||||
|
this->eip++;
|
||||||
|
uint32_t imm32 = memory.read_uint32(this->eip);
|
||||||
|
this->registers[0] = imm32;
|
||||||
|
this->eip += 3;
|
||||||
|
}
|
||||||
|
|
||||||
void Instructions::mov_ecx_imm32(){
|
void Instructions::mov_ecx_imm32(){
|
||||||
printf("mov_ecx_imm32 called.\n");
|
printf("mov_ecx_imm32 called.\n");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user