aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei <ericbunnie@gmail.com>2014-04-10 19:55:59 -0400
committerGravatar bunnei <ericbunnie@gmail.com>2014-04-10 19:55:59 -0400
commit95e5436f41a3cffaace7c48be72373bebcaf91e4 (patch)
treeae2b7f883872d38c69054ca9bb344be3ad22a6c3 /src
parent59d00e6e4b233a919a96fad9e8cb9f7fc4c73911 (diff)
cleaned up arm_interface, added a setter to set registers for use with HLE return values
Diffstat (limited to 'src')
-rw-r--r--src/core/arm/interpreter/arm_interpreter.cpp39
-rw-r--r--src/core/arm/interpreter/arm_interpreter.h37
2 files changed, 70 insertions, 6 deletions
diff --git a/src/core/arm/interpreter/arm_interpreter.cpp b/src/core/arm/interpreter/arm_interpreter.cpp
index 81f38f01..4045779d 100644
--- a/src/core/arm/interpreter/arm_interpreter.cpp
+++ b/src/core/arm/interpreter/arm_interpreter.cpp
@@ -31,30 +31,61 @@ ARM_Interpreter::ARM_Interpreter() {
m_state->Reg[13] = 0x10000000; // Set stack pointer to the top of the stack
}
+ARM_Interpreter::~ARM_Interpreter() {
+ delete m_state;
+}
+
+/**
+ * Set the Program Counter to an address
+ * @param addr Address to set PC to
+ */
void ARM_Interpreter::SetPC(u32 pc) {
m_state->pc = m_state->Reg[15] = pc;
}
+/*
+ * Get the current Program Counter
+ * @return Returns current PC
+ */
u32 ARM_Interpreter::GetPC() const {
return m_state->pc;
}
+/**
+ * Get an ARM register
+ * @param index Register index (0-15)
+ * @return Returns the value in the register
+ */
u32 ARM_Interpreter::GetReg(int index) const {
return m_state->Reg[index];
}
+/**
+ * Set an ARM register
+ * @param index Register index (0-15)
+ * @param value Value to set register to
+ */
+void ARM_Interpreter::SetReg(int index, u32 value) {
+ m_state->Reg[index] = value;
+}
+
+/**
+ * Get the current CPSR register
+ * @return Returns the value of the CPSR register
+ */
u32 ARM_Interpreter::GetCPSR() const {
return m_state->Cpsr;
}
+/**
+ * Returns the number of clock ticks since the last reset
+ * @return Returns number of clock ticks
+ */
u64 ARM_Interpreter::GetTicks() const {
return ARMul_Time(m_state);
}
-ARM_Interpreter::~ARM_Interpreter() {
- delete m_state;
-}
-
+/// Execture next instruction
void ARM_Interpreter::ExecuteInstruction() {
m_state->step++;
m_state->cycle++;
diff --git a/src/core/arm/interpreter/arm_interpreter.h b/src/core/arm/interpreter/arm_interpreter.h
index 932046d9..f3c86f8d 100644
--- a/src/core/arm/interpreter/arm_interpreter.h
+++ b/src/core/arm/interpreter/arm_interpreter.h
@@ -12,22 +12,55 @@
class ARM_Interpreter : virtual public ARM_Interface {
public:
+
ARM_Interpreter();
~ARM_Interpreter();
- void ExecuteInstruction();
-
+ /**
+ * Set the Program Counter to an address
+ * @param addr Address to set PC to
+ */
void SetPC(u32 pc);
+ /*
+ * Get the current Program Counter
+ * @return Returns current PC
+ */
u32 GetPC() const;
+ /**
+ * Get an ARM register
+ * @param index Register index (0-15)
+ * @return Returns the value in the register
+ */
u32 GetReg(int index) const;
+ /**
+ * Set an ARM register
+ * @param index Register index (0-15)
+ * @param value Value to set register to
+ */
+ void SetReg(int index, u32 value);
+
+ /**
+ * Get the current CPSR register
+ * @return Returns the value of the CPSR register
+ */
u32 GetCPSR() const;
+ /**
+ * Returns the number of clock ticks since the last reset
+ * @return Returns number of clock ticks
+ */
u64 GetTicks() const;
+protected:
+
+ /// Execture next instruction
+ void ExecuteInstruction();
+
private:
+
ARMul_State* m_state;
DISALLOW_COPY_AND_ASSIGN(ARM_Interpreter);