diff --git a/include/instructions.h b/include/instructions.h index 895b62c..ee813b5 100644 --- a/include/instructions.h +++ b/include/instructions.h @@ -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 diff --git a/instructions.cpp b/instructions.cpp index a166212..54b0a7d 100644 --- a/instructions.cpp +++ b/instructions.cpp @@ -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; + } +}