From 0588b1ad00078daeda76a810b9ba6c68f97206a2 Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Tue, 4 Oct 2016 22:15:25 +0200 Subject: Adds shr and cmp (with flags), and adds flags for sub. --- emulate/cpustate.hpp | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'emulate/cpustate.hpp') 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 #include #include +#include #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; +} -- cgit v1.2.3-70-g09d2