summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar bunnei2014-04-10 19:55:59 -0400
committerGravatar bunnei2014-04-10 19:55:59 -0400
commit95e5436f41a3cffaace7c48be72373bebcaf91e4 (patch)
treeae2b7f883872d38c69054ca9bb344be3ad22a6c3 /src/core
parentUpdate README.md (diff)
downloadyuzu-95e5436f41a3cffaace7c48be72373bebcaf91e4.tar.gz
yuzu-95e5436f41a3cffaace7c48be72373bebcaf91e4.tar.xz
yuzu-95e5436f41a3cffaace7c48be72373bebcaf91e4.zip
cleaned up arm_interface, added a setter to set registers for use with HLE return values
Diffstat (limited to 'src/core')
-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 81f38f016..4045779d7 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() {
31 m_state->Reg[13] = 0x10000000; // Set stack pointer to the top of the stack 31 m_state->Reg[13] = 0x10000000; // Set stack pointer to the top of the stack
32} 32}
33 33
34ARM_Interpreter::~ARM_Interpreter() {
35 delete m_state;
36}
37
38/**
39 * Set the Program Counter to an address
40 * @param addr Address to set PC to
41 */
34void ARM_Interpreter::SetPC(u32 pc) { 42void ARM_Interpreter::SetPC(u32 pc) {
35 m_state->pc = m_state->Reg[15] = pc; 43 m_state->pc = m_state->Reg[15] = pc;
36} 44}
37 45
46/*
47 * Get the current Program Counter
48 * @return Returns current PC
49 */
38u32 ARM_Interpreter::GetPC() const { 50u32 ARM_Interpreter::GetPC() const {
39 return m_state->pc; 51 return m_state->pc;
40} 52}
41 53
54/**
55 * Get an ARM register
56 * @param index Register index (0-15)
57 * @return Returns the value in the register
58 */
42u32 ARM_Interpreter::GetReg(int index) const { 59u32 ARM_Interpreter::GetReg(int index) const {
43 return m_state->Reg[index]; 60 return m_state->Reg[index];
44} 61}
45 62
63/**
64 * Set an ARM register
65 * @param index Register index (0-15)
66 * @param value Value to set register to
67 */
68void ARM_Interpreter::SetReg(int index, u32 value) {
69 m_state->Reg[index] = value;
70}
71
72/**
73 * Get the current CPSR register
74 * @return Returns the value of the CPSR register
75 */
46u32 ARM_Interpreter::GetCPSR() const { 76u32 ARM_Interpreter::GetCPSR() const {
47 return m_state->Cpsr; 77 return m_state->Cpsr;
48} 78}
49 79
80/**
81 * Returns the number of clock ticks since the last reset
82 * @return Returns number of clock ticks
83 */
50u64 ARM_Interpreter::GetTicks() const { 84u64 ARM_Interpreter::GetTicks() const {
51 return ARMul_Time(m_state); 85 return ARMul_Time(m_state);
52} 86}
53 87
54ARM_Interpreter::~ARM_Interpreter() { 88/// Execture next instruction
55 delete m_state;
56}
57
58void ARM_Interpreter::ExecuteInstruction() { 89void ARM_Interpreter::ExecuteInstruction() {
59 m_state->step++; 90 m_state->step++;
60 m_state->cycle++; 91 m_state->cycle++;
diff --git a/src/core/arm/interpreter/arm_interpreter.h b/src/core/arm/interpreter/arm_interpreter.h
index 932046d9a..f3c86f8dd 100644
--- a/src/core/arm/interpreter/arm_interpreter.h
+++ b/src/core/arm/interpreter/arm_interpreter.h
@@ -12,22 +12,55 @@
12 12
13class ARM_Interpreter : virtual public ARM_Interface { 13class ARM_Interpreter : virtual public ARM_Interface {
14public: 14public:
15
15 ARM_Interpreter(); 16 ARM_Interpreter();
16 ~ARM_Interpreter(); 17 ~ARM_Interpreter();
17 18
18 void ExecuteInstruction(); 19 /**
19 20 * Set the Program Counter to an address
21 * @param addr Address to set PC to
22 */
20 void SetPC(u32 pc); 23 void SetPC(u32 pc);
21 24
25 /*
26 * Get the current Program Counter
27 * @return Returns current PC
28 */
22 u32 GetPC() const; 29 u32 GetPC() const;
23 30
31 /**
32 * Get an ARM register
33 * @param index Register index (0-15)
34 * @return Returns the value in the register
35 */
24 u32 GetReg(int index) const; 36 u32 GetReg(int index) const;
25 37
38 /**
39 * Set an ARM register
40 * @param index Register index (0-15)
41 * @param value Value to set register to
42 */
43 void SetReg(int index, u32 value);
44
45 /**
46 * Get the current CPSR register
47 * @return Returns the value of the CPSR register
48 */
26 u32 GetCPSR() const; 49 u32 GetCPSR() const;
27 50
51 /**
52 * Returns the number of clock ticks since the last reset
53 * @return Returns number of clock ticks
54 */
28 u64 GetTicks() const; 55 u64 GetTicks() const;
29 56
57protected:
58
59 /// Execture next instruction
60 void ExecuteInstruction();
61
30private: 62private:
63
31 ARMul_State* m_state; 64 ARMul_State* m_state;
32 65
33 DISALLOW_COPY_AND_ASSIGN(ARM_Interpreter); 66 DISALLOW_COPY_AND_ASSIGN(ARM_Interpreter);