mirror of
https://github.com/tuz358/cpu-emulator.git
synced 2025-12-18 21:14:35 +03:00
Add push_imm8(0x6a) instruction
This commit is contained in:
@@ -77,6 +77,7 @@ public:
|
|||||||
void pop_esi(); // 0x5e
|
void pop_esi(); // 0x5e
|
||||||
void pop_edi(); // 0x5f
|
void pop_edi(); // 0x5f
|
||||||
void push_imm32(); // 0x68
|
void push_imm32(); // 0x68
|
||||||
|
void push_imm8(); // 0x6a
|
||||||
void jne_imm8(); // 0x75
|
void jne_imm8(); // 0x75
|
||||||
void opcode_83(); // 0x83
|
void opcode_83(); // 0x83
|
||||||
void mov_rm32_r32(); // 0x89
|
void mov_rm32_r32(); // 0x89
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ void Instructions::init_instructions(){
|
|||||||
this->instructions[0x5e] = &Instructions::pop_esi;
|
this->instructions[0x5e] = &Instructions::pop_esi;
|
||||||
this->instructions[0x5f] = &Instructions::pop_edi;
|
this->instructions[0x5f] = &Instructions::pop_edi;
|
||||||
this->instructions[0x68] = &Instructions::push_imm32;
|
this->instructions[0x68] = &Instructions::push_imm32;
|
||||||
|
this->instructions[0x6a] = &Instructions::push_imm8;
|
||||||
this->instructions[0x75] = &Instructions::jne_imm8;
|
this->instructions[0x75] = &Instructions::jne_imm8;
|
||||||
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;
|
||||||
@@ -895,6 +896,15 @@ void Instructions::push_imm32(){
|
|||||||
imm32 = swap_endian32(imm32);
|
imm32 = swap_endian32(imm32);
|
||||||
this->registers[4] -= 4; // esp -= 4
|
this->registers[4] -= 4; // esp -= 4
|
||||||
memory.write_uint32(this->registers[4], imm32);
|
memory.write_uint32(this->registers[4], imm32);
|
||||||
|
this->eip += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Instructions::push_imm8(){
|
||||||
|
//printf("push_imm8 called.\n");
|
||||||
|
uint8_t imm8 = memory.read_uint8(this->eip);
|
||||||
|
this->registers[4] -= 4; // esp -= 4
|
||||||
|
memory.write_uint8(this->registers[4], imm8);
|
||||||
|
this->eip++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Instructions::jne_imm8(){
|
void Instructions::jne_imm8(){
|
||||||
|
|||||||
Reference in New Issue
Block a user