summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <tstellar@gmail.com>2011-01-03 22:44:29 -0800
committerTom Stellard <tstellar@gmail.com>2011-01-03 22:44:29 -0800
commitc8365d7ec42498b1eeab9ea0ded84fda7b22fe76 (patch)
tree28a7029d5c853f58975a9adc5740bf8cdd819c14
parent8173cb8d9f4ef1311b3dbb261cc96d8e670d47fa (diff)
emulator: Make dump regs wine friendly
-rw-r--r--emulator.cpp26
-rw-r--r--emulator.h4
2 files changed, 20 insertions, 10 deletions
diff --git a/emulator.cpp b/emulator.cpp
index e93b640..3b3a246 100644
--- a/emulator.cpp
+++ b/emulator.cpp
@@ -1,6 +1,7 @@
#include <iostream>
#include <assert.h>
+#include <stdio.h>
#include "emulator.h"
@@ -187,11 +188,7 @@ emulator::dump_regs(
{
unsigned int i;
for (i = 0; i < registers.size(); i++) {
- value * val = registers[i];
- if (val) {
- std::cerr << register_address(type, i).to_string()
- << "=" << val->to_string() << "\n";
- }
+ print_reg(type, i, registers[i]);
}
}
@@ -202,10 +199,19 @@ emulator::dump_regs(
{
unsigned int i;
for (i = 0; i < registers.size(); i++) {
- value * val = registers[i];
- if (val) {
- std::cerr << register_address(type, i).to_string()
- << "=" << val->to_string() << "\n";
- }
+ print_reg(type, i, registers[i]);
+ }
+}
+
+void
+emulator::print_reg(
+ enum register_type type,
+ unsigned int index,
+ value * val)
+{
+ if (val) {
+ fprintf(stderr, "%s=%s\n",
+ register_address(type, index).to_string().c_str(),
+ val->to_string().c_str());
}
}
diff --git a/emulator.h b/emulator.h
index f52859a..076a6ab 100644
--- a/emulator.h
+++ b/emulator.h
@@ -54,6 +54,10 @@ private:
void dump_regs(
std::vector<float_value *> & registers,
enum register_type type);
+ void print_reg(
+ enum register_type type,
+ unsigned int index,
+ value * val);
program_loader * m_loader;
std::vector<value *> m_temp_regs;