mirror of
https://github.com/tuz358/cpu-emulator.git
synced 2025-12-18 21:14:35 +03:00
Add xchg_eax_r32(0x91~0x97) instruction
This commit is contained in:
@@ -58,6 +58,9 @@ void Instructions::init_instructions(){
|
||||
this->instructions[0x83] = &Instructions::opcode_83;
|
||||
this->instructions[0x89] = &Instructions::mov_rm32_r32;
|
||||
this->instructions[0x90] = &Instructions::nop;
|
||||
for(int i=0;i<7;i++){
|
||||
this->instructions[0x91+i] = &Instructions::xchg_eax_r32;
|
||||
}
|
||||
this->instructions[0xb8] = &Instructions::mov_eax_imm32;
|
||||
this->instructions[0xb9] = &Instructions::mov_ecx_imm32;
|
||||
this->instructions[0xba] = &Instructions::mov_edx_imm32;
|
||||
@@ -448,6 +451,14 @@ void Instructions::nop(){
|
||||
//printf("nop called.\n");
|
||||
}
|
||||
|
||||
void Instructions::xchg_eax_r32(){
|
||||
//printf("xchg_eax_r32 called.\n");
|
||||
uint8_t opcode = memory.read_uint8(this->eip - 1);
|
||||
this->registers[0] ^= this->registers[opcode - 0x90];
|
||||
this->registers[opcode - 0x90] ^= this->registers[0];
|
||||
this->registers[0] ^= this->registers[opcode - 0x90];
|
||||
}
|
||||
|
||||
void Instructions::mov_eax_imm32(){
|
||||
//printf("mov_eax_imm32 called.\n");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user