diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2018-06-16 15:36:39 +0200 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2018-06-16 15:36:39 +0200 |
| commit | ca642d0c8b0a3dd5f768749b58ba66ac35472610 (patch) | |
| tree | 33eb95aee362703eb424fdb93c381acf7111876b /emulate/cpustate.cpp | |
| parent | 44320ada80b08ecf88caf114b2b0be8c8e08e505 (diff) | |
| download | openwar-ca642d0c8b0a3dd5f768749b58ba66ac35472610.tar.gz openwar-ca642d0c8b0a3dd5f768749b58ba66ac35472610.tar.bz2 openwar-ca642d0c8b0a3dd5f768749b58ba66ac35472610.zip | |
Fixes a bug with calculating memory offsets and exposes some more registers.
Diffstat (limited to 'emulate/cpustate.cpp')
| -rw-r--r-- | emulate/cpustate.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/emulate/cpustate.cpp b/emulate/cpustate.cpp new file mode 100644 index 0000000..76611b5 --- /dev/null +++ b/emulate/cpustate.cpp @@ -0,0 +1,47 @@ + +#include "cpustate.hpp" + +#include <ostream> +#include <iomanip> + +#define PRINT_REGISTER(NAME, FNAME) #NAME": 0x" << std::hex << std::setw(8) << std::setfill('0') << cpu.FNAME() << std::endl + + +std::ostream&operator<<(std::ostream& os, CpuState& cpu) { + os << PRINT_REGISTER(EIP, eip) + << PRINT_REGISTER(EAX, eax) + << PRINT_REGISTER(EBX, ebx) + << PRINT_REGISTER(ECX, ecx) + << PRINT_REGISTER(EDX, edx) + << PRINT_REGISTER(ESP, esp) + << PRINT_REGISTER(EBP, ebp) + << PRINT_REGISTER(ESI, esi) + << PRINT_REGISTER(EDI, edi) + << PRINT_REGISTER( CS, cs) + << PRINT_REGISTER( DS, ds) + << PRINT_REGISTER( ES, es) + << PRINT_REGISTER( SS, ss) + << PRINT_REGISTER( FS, fs) + << PRINT_REGISTER( GS, gs) + << "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; +} + +#undef PRINT_REGISTER
\ No newline at end of file |
