mirror of
https://github.com/JaCzekanski/Avocado.git
synced 2024-05-20 12:57:38 -04:00
cpu: don't store opcode in cpu struct
This commit is contained in:
parent
ea84c175d3
commit
bcb98952ff
|
@ -4,7 +4,7 @@
|
|||
#include "system.h"
|
||||
|
||||
namespace mips {
|
||||
CPU::CPU(System* sys) : sys(sys), _opcode(0) {
|
||||
CPU::CPU(System* sys) : sys(sys) {
|
||||
setPC(0xBFC00000);
|
||||
inBranchDelay = false;
|
||||
icacheEnabled = false;
|
||||
|
@ -90,13 +90,11 @@ bool CPU::executeInstructions(int count) {
|
|||
if (handleSoftwareBreakpoints()) return false;
|
||||
}
|
||||
|
||||
_opcode = Opcode(fetchInstruction(PC));
|
||||
const auto& op = instructions::OpcodeTable[_opcode.op];
|
||||
const auto opcode = Opcode(fetchInstruction(PC));
|
||||
const auto& op = instructions::OpcodeTable[opcode.op];
|
||||
|
||||
setPC(nextPC);
|
||||
|
||||
op.instruction(this, _opcode);
|
||||
|
||||
op.instruction(this, opcode);
|
||||
moveLoadDelaySlots();
|
||||
|
||||
sys->cycles++;
|
||||
|
|
|
@ -82,7 +82,6 @@ struct CPU {
|
|||
COP0 cop0;
|
||||
GTE gte;
|
||||
System* sys;
|
||||
Opcode _opcode;
|
||||
|
||||
bool icacheEnabled;
|
||||
CacheLine icache[1024];
|
||||
|
|
|
@ -177,7 +177,8 @@ void exception(CPU *cpu, COP0::CAUSE::Exception cause) {
|
|||
cpu->cop0.status.enterException();
|
||||
|
||||
if (cause != Exception::busErrorInstruction) {
|
||||
cpu->cop0.cause.coprocessorNumber = cpu->_opcode.op & 3;
|
||||
Opcode i(cpu->sys->readMemory32(cpu->exceptionPC));
|
||||
cpu->cop0.cause.coprocessorNumber = i.op & 3;
|
||||
}
|
||||
|
||||
if (cause == Exception::interrupt) {
|
||||
|
|
Loading…
Reference in a new issue