mirror of
https://github.com/tuz358/cpu-emulator.git
synced 2025-12-18 21:14:35 +03:00
Add set_flag(int flag, uint32_t flag_type) func and a minor upate
This commit is contained in:
@@ -5,9 +5,12 @@
|
||||
#include "memory.h"
|
||||
#include "utils.h"
|
||||
|
||||
const uint32_t ZF = 1 << 6;
|
||||
|
||||
class Instructions{
|
||||
private:
|
||||
void init_instructions();
|
||||
void set_flag(int flag, uint32_t flag_type);
|
||||
public:
|
||||
Memory memory;
|
||||
uint32_t registers[8]; // eax, ecx, edx, ebx, esp, ebp, esi, edi
|
||||
|
||||
@@ -251,3 +251,11 @@ void Instructions::opcode_ff(){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Instructions::set_flag(int flag, uint32_t flag_type){
|
||||
if (flag) {
|
||||
this->eflags &= ~flag_type;
|
||||
} else {
|
||||
this->eflags |= flag_type;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user