2022-01-24 12:43:10 +00:00
|
|
|
#pragma once
|
2022-06-20 04:51:32 +00:00
|
|
|
#include "MIPSInterfaceHandler.h"
|
2022-10-10 00:22:17 +00:00
|
|
|
#include "MemoryHandler.h"
|
2022-01-24 12:43:10 +00:00
|
|
|
#include <Project64-core\Logging.h>
|
2022-10-10 00:22:17 +00:00
|
|
|
#include <Project64-core\Settings\DebugSettings.h>
|
|
|
|
#include <Project64-core\Settings\GameSettings.h>
|
2022-01-24 12:43:10 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
class SPRegistersReg
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
SPRegistersReg(uint32_t * SignalProcessorInterface);
|
|
|
|
|
|
|
|
public:
|
|
|
|
uint32_t & SP_MEM_ADDR_REG;
|
|
|
|
uint32_t & SP_DRAM_ADDR_REG;
|
|
|
|
uint32_t & SP_RD_LEN_REG;
|
|
|
|
uint32_t & SP_WR_LEN_REG;
|
|
|
|
uint32_t & SP_STATUS_REG;
|
|
|
|
uint32_t & SP_DMA_FULL_REG;
|
|
|
|
uint32_t & SP_DMA_BUSY_REG;
|
|
|
|
uint32_t & SP_SEMAPHORE_REG;
|
|
|
|
uint32_t & SP_PC_REG;
|
|
|
|
uint32_t & SP_IBIST_REG;
|
|
|
|
|
|
|
|
private:
|
|
|
|
SPRegistersReg();
|
2022-10-10 00:22:17 +00:00
|
|
|
SPRegistersReg(const SPRegistersReg &);
|
|
|
|
SPRegistersReg & operator=(const SPRegistersReg &);
|
2022-01-24 12:43:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CRegisters;
|
|
|
|
class CMipsMemoryVM;
|
|
|
|
class CN64System;
|
|
|
|
|
|
|
|
class SPRegistersHandler :
|
|
|
|
public MemoryHandler,
|
|
|
|
public SPRegistersReg,
|
|
|
|
private CGameSettings,
|
2022-06-20 04:51:32 +00:00
|
|
|
private MIPSInterfaceReg,
|
2022-01-24 12:43:10 +00:00
|
|
|
private CDebugSettings,
|
2022-10-10 00:22:17 +00:00
|
|
|
private CLogging
|
2022-01-24 12:43:10 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
SPRegistersHandler(CN64System & N64System, CMipsMemoryVM & MMU, CRegisters & Reg);
|
|
|
|
bool Read32(uint32_t Address, uint32_t & Value);
|
|
|
|
bool Write32(uint32_t Address, uint32_t Value, uint32_t Mask);
|
|
|
|
|
2022-10-17 06:59:05 +00:00
|
|
|
uint8_t * Imem()
|
|
|
|
{
|
|
|
|
return &m_IMEM[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t * Dmem()
|
|
|
|
{
|
|
|
|
return &m_DMEM[0];
|
|
|
|
}
|
|
|
|
|
2022-01-24 12:43:10 +00:00
|
|
|
private:
|
|
|
|
SPRegistersHandler();
|
|
|
|
SPRegistersHandler(const SPRegistersHandler &);
|
|
|
|
SPRegistersHandler & operator=(const SPRegistersHandler &);
|
|
|
|
|
2022-10-10 00:22:17 +00:00
|
|
|
static void stSystemReset(SPRegistersHandler * _this)
|
|
|
|
{
|
|
|
|
_this->SystemReset();
|
|
|
|
}
|
|
|
|
static void stLoadedGameState(SPRegistersHandler * _this)
|
|
|
|
{
|
|
|
|
_this->LoadedGameState();
|
|
|
|
}
|
2022-06-20 04:51:32 +00:00
|
|
|
|
2022-02-01 02:54:25 +00:00
|
|
|
void SP_DMA_READ();
|
2022-06-13 02:16:06 +00:00
|
|
|
void SP_DMA_WRITE();
|
2022-06-20 04:51:32 +00:00
|
|
|
void SystemReset(void);
|
|
|
|
void LoadedGameState(void);
|
2022-02-01 02:54:25 +00:00
|
|
|
|
2022-10-17 06:59:05 +00:00
|
|
|
uint8_t m_IMEM[0x1000];
|
|
|
|
uint8_t m_DMEM[0x1000];
|
2022-06-20 04:51:32 +00:00
|
|
|
uint32_t m_SPMemAddrRegRead;
|
|
|
|
uint32_t m_SPDramAddrRegRead;
|
|
|
|
bool m_ExecutedDMARead;
|
2022-01-24 12:43:10 +00:00
|
|
|
CN64System & m_System;
|
|
|
|
CMipsMemoryVM & m_MMU;
|
|
|
|
CRegisters & m_Reg;
|
|
|
|
uint32_t & m_RspIntrReg;
|
|
|
|
uint32_t & m_PC;
|
|
|
|
};
|