Initialise GTE and CPU regsiters (invalidate)

This commit is contained in:
iCatButler 2016-06-30 11:49:11 +01:00
parent 6b78a14b0e
commit 485432c198
5 changed files with 25 additions and 2 deletions

View File

@ -20,6 +20,12 @@ PGXP_value* CP0_reg = CP0_reg_mem;
#define rs(_instr) ((_instr >> 21) & 0x1F) // The rs part of the instruction register
#define imm(_instr) (_instr & 0xFFFF) // The immediate part of the instruction register
void PGXP_InitCPU()
{
memset(CPU_reg_mem, 0, sizeof(CPU_reg_mem));
memset(CP0_reg_mem, 0, sizeof(CP0_reg_mem));
}
// invalidate register (invalid 8 bit read)
void InvalidLoad(u32 addr, u32 code, u32 value)
{

View File

@ -39,6 +39,8 @@ extern PGXP_value* CP0_reg;
#define CPU_Lo CPU_reg[34]
void PGXP_InitCPU();
// -- CPU functions
// Load 32-bit word

View File

@ -44,7 +44,11 @@ PGXP_value GTE_ctrl_reg_mem[32];
PGXP_value* GTE_data_reg = GTE_data_reg_mem;
PGXP_value* GTE_ctrl_reg = GTE_ctrl_reg_mem;
void PGXP_InitGTE()
{
memset(GTE_data_reg_mem, 0, sizeof(GTE_data_reg_mem));
memset(GTE_ctrl_reg_mem, 0, sizeof(GTE_ctrl_reg_mem));
}
// Instruction register decoding
#define op(_instr) (_instr >> 26) // The op part of the instruction register

View File

@ -36,6 +36,8 @@ typedef struct PGXP_value_Tag PGXP_value;
extern PGXP_value* GTE_data_reg;
extern PGXP_value* GTE_ctrl_reg;
void PGXP_InitGTE();
// -- GTE functions
// Transforms
void PGXP_pushSXYZ2f(float _x, float _y, float _z, unsigned int _v);

View File

@ -1,4 +1,6 @@
#include "pgxp_mem.h"
#include "pgxp_cpu.h"
#include "pgxp_gte.h"
#include "pgxp_value.h"
PGXP_value Mem[3 * 2048 * 1024 / 4]; // mirror 2MB in 32-bit words * 3
@ -7,11 +9,18 @@ const u32 ScratchOffset = 2048 * 1024 / 4;
const u32 RegisterOffset = 2 * 2048 * 1024 / 4;
const u32 InvalidAddress = 3 * 2048 * 1024 / 4;
void PGXP_Init()
void PGXP_InitMem()
{
memset(Mem, 0, sizeof(Mem));
}
void PGXP_Init()
{
PGXP_InitMem();
PGXP_InitCPU();
PGXP_InitGTE();
}
char* PGXP_GetMem()
{
return (char*)(Mem); // Config.PGXP_GTE ? (char*)(Mem) : NULL;