2013-12-19 17:10:14 +00:00
|
|
|
#pragma once
|
|
|
|
#include "types.h"
|
|
|
|
#include "sh4_if.h"
|
|
|
|
|
|
|
|
#undef sh4op
|
|
|
|
#define sh4op(str) void DYNACALL str (u32 op)
|
|
|
|
typedef void (DYNACALL OpCallFP) (u32 op);
|
|
|
|
|
|
|
|
enum OpcodeType
|
|
|
|
{
|
|
|
|
//basic
|
2013-12-24 00:56:44 +00:00
|
|
|
Normal = 0, // Heh , nothing special :P
|
|
|
|
ReadsPC = 1, // PC must be set upon calling it
|
|
|
|
WritesPC = 2, // It will write PC (branch)
|
|
|
|
Delayslot = 4, // Has a delayslot opcode , valid only when WritesPC is set
|
2013-12-19 17:10:14 +00:00
|
|
|
|
2013-12-24 00:56:44 +00:00
|
|
|
WritesSR = 8, // Writes to SR , and UpdateSR needs to be called
|
|
|
|
WritesFPSCR = 16, // Writes to FPSCR , and UpdateSR needs to be called
|
|
|
|
Invalid = 128, // Invalid
|
2013-12-19 17:10:14 +00:00
|
|
|
|
2013-12-24 00:56:44 +00:00
|
|
|
NO_FP = 256,
|
|
|
|
NO_GP = 512,
|
|
|
|
NO_SP = 1024,
|
2013-12-19 17:10:14 +00:00
|
|
|
|
2019-03-20 12:45:35 +00:00
|
|
|
UsesFPU = 2048, // Floating point op
|
|
|
|
FWritesFPSCR = UsesFPU | WritesFPSCR,
|
|
|
|
|
2013-12-24 00:56:44 +00:00
|
|
|
// Heh, not basic :P
|
|
|
|
ReadWritePC = ReadsPC|WritesPC, // Read and writes pc :P
|
|
|
|
WritesSRRWPC = WritesSR|ReadsPC|WritesPC,
|
2013-12-19 17:10:14 +00:00
|
|
|
|
2013-12-24 00:56:44 +00:00
|
|
|
// Branches (not delay slot):
|
|
|
|
Branch_dir = ReadWritePC, // Direct (eg , pc=r[xx]) -- this one is ReadWritePC b/c the delayslot may use pc ;)
|
|
|
|
Branch_rel = ReadWritePC, // Relative (rg pc+=10);
|
|
|
|
|
|
|
|
// Delay slot
|
|
|
|
Branch_dir_d = Delayslot|Branch_dir, // Direct (eg , pc=r[xx])
|
|
|
|
Branch_rel_d = Delayslot|Branch_rel, // Relative (rg pc+=10);
|
2013-12-19 17:10:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//interface
|
|
|
|
void Sh4_int_Run();
|
|
|
|
void Sh4_int_Stop();
|
2018-09-02 13:49:23 +00:00
|
|
|
void Sh4_int_Start();
|
2013-12-19 17:10:14 +00:00
|
|
|
void Sh4_int_Step();
|
|
|
|
void Sh4_int_Skip();
|
2019-07-10 15:25:11 +00:00
|
|
|
void Sh4_int_Reset(bool hard);
|
2013-12-19 17:10:14 +00:00
|
|
|
void Sh4_int_Init();
|
|
|
|
void Sh4_int_Term();
|
|
|
|
bool Sh4_int_IsCpuRunning();
|
|
|
|
u32 Sh4_int_GetRegister(Sh4RegType reg);
|
|
|
|
void Sh4_int_SetRegister(Sh4RegType reg,u32 regdata);
|
|
|
|
//Other things (mainly used by the cpu core
|
|
|
|
void ExecuteDelayslot();
|
|
|
|
void ExecuteDelayslot_RTE();
|
|
|
|
|
2019-03-19 20:35:55 +00:00
|
|
|
#define SH4_TIMESLICE (448) // at 112 Bangai-O doesn't start. 224 is ok
|
|
|
|
// at 448 Gundam Side Story hangs on Sega copyright screen, 224 ok, 672 ok(!)
|
2013-12-19 17:10:14 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
int UpdateSystem();
|
2019-04-12 20:59:39 +00:00
|
|
|
|
|
|
|
ATTR_USED int UpdateSystem_INTC();
|
2013-12-19 17:10:14 +00:00
|
|
|
|
|
|
|
}
|