summaryrefslogtreecommitdiff
path: root/emulate/cpustate.hpp
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-10-04 22:15:25 +0200
committerDennis Brentjes <d.brentjes@gmail.com>2016-10-04 22:18:53 +0200
commit0588b1ad00078daeda76a810b9ba6c68f97206a2 (patch)
tree9f44fd94107e73c52c0262f049c3e745d58b2360 /emulate/cpustate.hpp
parentcfb414ebd63e3dc735fcf415117cf06d93385741 (diff)
downloadopenwar-0588b1ad00078daeda76a810b9ba6c68f97206a2.tar.gz
openwar-0588b1ad00078daeda76a810b9ba6c68f97206a2.tar.bz2
openwar-0588b1ad00078daeda76a810b9ba6c68f97206a2.zip
Adds shr and cmp (with flags), and adds flags for sub.
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;
+}