about summary refs log tree commit diff
path: root/src/instructions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/instructions.cpp')
-rw-r--r--src/instructions.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/instructions.cpp b/src/instructions.cpp
new file mode 100644
index 0000000..f32c3e1
--- /dev/null
+++ b/src/instructions.cpp
@@ -0,0 +1,13 @@
+#include "include/instructions.hpp"
+
+Instruction::Instruction(uint8_t* hex, uint32_t offset, uint32_t pos)
+{
+    this->hex = (hex[3] << 24) | (hex[2] << 16)| (hex[1] << 8) | hex[0];
+    Utils::getbinaryrepresentation(hex, 4, this->bits);
+    this->bits[32] = '\0';
+    this->offset = offset;
+    this->pos = pos;
+    this->addr = this->offset + this->pos;
+    this->string = InstructionHanlder::getInstructionString(this);
+    this->type = InstructionHanlder::getInstruction(this);
+}