mirror of
https://github.com/tuz358/cpu-emulator.git
synced 2025-12-18 21:14:35 +03:00
Add cmp_rm32_imm8 instruction
This commit is contained in:
@@ -36,4 +36,6 @@ public:
|
|||||||
void jmp_imm8(); // 0xeb
|
void jmp_imm8(); // 0xeb
|
||||||
void hlt(); // 0xf4
|
void hlt(); // 0xf4
|
||||||
void opcode_ff(); // 0xff
|
void opcode_ff(); // 0xff
|
||||||
|
|
||||||
|
void cmp_rm32_imm8();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -252,6 +252,19 @@ void Instructions::opcode_ff(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Instructions::cmp_rm32_imm8(){
|
||||||
|
printf("cmp_rm32_imm8 called.\n");
|
||||||
|
|
||||||
|
this->modrm = memory.read_uint8(this->eip);
|
||||||
|
this->calc_modrm();
|
||||||
|
|
||||||
|
this->eip++;
|
||||||
|
uint8_t imm8 = memory.read_uint8(this->eip);
|
||||||
|
uint32_t result = this->registers[this->M] - imm8;
|
||||||
|
|
||||||
|
set_flag(!result, ZF);
|
||||||
|
}
|
||||||
|
|
||||||
void Instructions::set_flag(int flag, uint32_t flag_type){
|
void Instructions::set_flag(int flag, uint32_t flag_type){
|
||||||
if (flag) {
|
if (flag) {
|
||||||
this->eflags &= ~flag_type;
|
this->eflags &= ~flag_type;
|
||||||
|
|||||||
Reference in New Issue
Block a user