diff --git a/include/instructions.h b/include/instructions.h index f1de068..d6f00f9 100644 --- a/include/instructions.h +++ b/include/instructions.h @@ -11,6 +11,7 @@ class Instructions{ private: void init_instructions(); void set_flag(int flag, uint32_t flag_type); + int get_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 1409a06..cf9636d 100644 --- a/instructions.cpp +++ b/instructions.cpp @@ -288,3 +288,15 @@ void Instructions::set_flag(int flag, uint32_t flag_type){ this->eflags |= flag_type; } } + +int Instructions::get_flag(uint32_t flag_type){ + int flag_status = 0; + + if ((this->eflags & flag_type) == 0) { + flag_status = 0; + } else { + flag_status = 1; + } + + return flag_status; +}