mirror of
https://github.com/tuz358/cpu-emulator.git
synced 2025-12-18 21:14:35 +03:00
Add mov_ebx_imm32(0xbb) instruction
This commit is contained in:
@@ -26,5 +26,6 @@ public:
|
|||||||
void xor_rm32_r32(); // 0x31
|
void xor_rm32_r32(); // 0x31
|
||||||
void nop(); // 0x90
|
void nop(); // 0x90
|
||||||
void mov_ecx_imm32(); // 0xb9
|
void mov_ecx_imm32(); // 0xb9
|
||||||
|
void mov_ebx_imm32(); // 0xbb
|
||||||
void hlt(); // 0xf4
|
void hlt(); // 0xf4
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ void Instructions::init_instructions(){
|
|||||||
this->instructions[0x31] = &Instructions::xor_rm32_r32;
|
this->instructions[0x31] = &Instructions::xor_rm32_r32;
|
||||||
this->instructions[0x90] = &Instructions::nop;
|
this->instructions[0x90] = &Instructions::nop;
|
||||||
this->instructions[0xb9] = &Instructions::mov_ecx_imm32;
|
this->instructions[0xb9] = &Instructions::mov_ecx_imm32;
|
||||||
|
this->instructions[0xbb] = &Instructions::mov_ebx_imm32;
|
||||||
this->instructions[0xf4] = &Instructions::hlt;
|
this->instructions[0xf4] = &Instructions::hlt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,6 +106,15 @@ void Instructions::mov_ecx_imm32(){
|
|||||||
this->eip += 3;
|
this->eip += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Instructions::mov_ebx_imm32(){
|
||||||
|
printf("mov_ebx_imm32 called.\n");
|
||||||
|
|
||||||
|
this->eip++;
|
||||||
|
uint32_t imm32 = memory.read_uint32(this->eip);
|
||||||
|
this->registers[3] = imm32;
|
||||||
|
this->eip += 3;
|
||||||
|
}
|
||||||
|
|
||||||
void Instructions::hlt(){
|
void Instructions::hlt(){
|
||||||
printf("hlt called.\n");
|
printf("hlt called.\n");
|
||||||
this->eip = 0x00;
|
this->eip = 0x00;
|
||||||
|
|||||||
Reference in New Issue
Block a user