summaryrefslogtreecommitdiff
path: root/emulate/cpustate.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'emulate/cpustate.hpp')
-rw-r--r--emulate/cpustate.hpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/emulate/cpustate.hpp b/emulate/cpustate.hpp
index fb9c377..6b80551 100644
--- a/emulate/cpustate.hpp
+++ b/emulate/cpustate.hpp
@@ -3,6 +3,7 @@
#include <iostream>
#include <array>
#include <bitset>
+#include <iomanip>
#define REGISTER1( NAME ) \
private: \
@@ -74,4 +75,35 @@ struct CpuState {
#undef REGISTER1
#undef REGISTER2
-#undef EFLAGS \ No newline at end of file
+#undef EFLAGS
+
+std::ostream& operator<<(std::ostream& os, CpuState& cpu) {
+ os << "EIP: 0x" << std::hex << std::setw(8) << std::setfill('0') << cpu.eip() << std::endl
+ << "EAX: 0x" << std::hex << std::setw(8) << std::setfill('0') << cpu.eax() << std::endl
+ << "EBX: 0x" << std::hex << std::setw(8) << std::setfill('0') << cpu.ebx() << std::endl
+ << "ECX: 0x" << std::hex << std::setw(8) << std::setfill('0') << cpu.ecx() << std::endl
+ << "EDX: 0x" << std::hex << std::setw(8) << std::setfill('0') << cpu.edx() << std::endl
+ << "ESP: 0x" << std::hex << std::setw(8) << std::setfill('0') << cpu.esp() << std::endl
+ << "EBP: 0x" << std::hex << std::setw(8) << std::setfill('0') << cpu.ebp() << std::endl
+ << "ESI: 0x" << std::hex << std::setw(8) << std::setfill('0') << cpu.esi() << std::endl
+ << "EDI: 0x" << std::hex << std::setw(8) << std::setfill('0') << cpu.edi() << std::endl
+ << "cf \tpf \taf \tzf \tsf \ttf \tintf \tdf \tof \tnt \trf \tvm \tac \tvif \tvip \tid" << std::endl
+ << cpu.cf() << "\t"
+ << cpu.pf() << "\t"
+ << cpu.af() << "\t"
+ << cpu.zf() << "\t"
+ << cpu.sf() << "\t"
+ << cpu.tf() << "\t"
+ << cpu.intf() << "\t"
+ << cpu.df() << "\t"
+ << cpu.of() << "\t"
+ << cpu.nt() << "\t"
+ << cpu.rf() << "\t"
+ << cpu.vm() << "\t"
+ << cpu.ac() << "\t"
+ << cpu.vif() << "\t"
+ << cpu.vip() << "\t"
+ << cpu.id() << "\t"
+ << std::endl;
+ return os;
+}