-
Notifications
You must be signed in to change notification settings - Fork 10
/
Cpu.h
136 lines (122 loc) · 3.47 KB
/
Cpu.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
* Project 64 - A Nintendo 64 emulator.
*
* (c) Copyright 2001 zilmar ([email protected]) and
* Jabo ([email protected]).
*
* pj64 homepage: www.pj64.net
*
* Permission to use, copy, modify and distribute Project64 in both binary and
* source form, for non-commercial purposes, is hereby granted without fee,
* providing that this license information and copyright notice appear with
* all copies and any derived work.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event shall the authors be held liable for any damages
* arising from the use of this software.
*
* Project64 is freeware for PERSONAL USE only. Commercial users should
* seek permission of the copyright holders first. Commercial use includes
* charging money for Project64 or software derived from Project64.
*
* The copyright holders request that bug fixes and improvements to the code
* should be forwarded to them so if they want them.
*
*/
#include "InterpreterCPU.h"
#include "InterpreterOps.h"
#include "RecompilerCPU.h"
#include "registers.h"
#include "RecompilerOps.h"
#include "tlb.h"
#include "SyncCPU.h"
#include "memory.h"
#include "DMA.h"
#include "eeprom.h"
#include "sram.h"
#include "flashram.h"
#include "mempak.h"
#include "Exception.h"
#include "pif.h"
#include "opcode.h"
#include "rom.h"
typedef struct {
HANDLE hStepping;
BOOL DoSomething;
BOOL CloseCPU;
BOOL ChangeWindow;
BOOL CheckInterrupts;
BOOL Pause;
BOOL SaveState;
BOOL RestoreState;
BOOL DoInterrupt;
BOOL Stepping;
} CPU_ACTION;
#define MaxTimers 5
#define CompareTimer 0
#define SiTimer 1
#define PiTimer 2
#define ViTimer 3
#define RspTimer 4
typedef struct {
int NextTimer[MaxTimers];
BOOL Active[MaxTimers];
int CurrentTimerType;
int Timer;
} SYSTEM_TIMERS;
void ChangeCompareTimer ( void );
void ChangeTimer ( int Type, int Value );
void CheckTimer ( void );
void CloseCpu ( void );
int DelaySlotEffectsCompare ( DWORD PC, DWORD Reg1, DWORD Reg2 );
int DelaySlotEffectsJump (DWORD JumpPC);
void DoSomething ( void );
void GetAutoSaveDir ( char * Directory );
void GetInstantSaveDir ( char * Directory );
void InPermLoop ( void );
void InitiliazeCPUFlags ( void );
BOOL Machine_LoadState ( void );
BOOL Machine_SaveState ( void );
void PauseCpu ( void );
void RefreshScreen ( void );
void RunRsp ( void );
void SetCoreToRunning ( void );
void SetCoreToStepping ( void );
void StartEmulation ( void );
void StepOpcode ( void );
void TimerDone ( void );
#define NORMAL 0
#define DO_DELAY_SLOT 1
#define DO_END_DELAY_SLOT 2
#define DELAY_SLOT 3
#define END_DELAY_SLOT 4
#define LIKELY_DELAY_SLOT 5
#define JUMP 6
#define DELAY_SLOT_DONE 7
#define LIKELY_DELAY_SLOT_DONE 8
#define END_BLOCK 9
enum SaveType {
Auto,
Eeprom_4K,
Eeprom_16K,
Sram,
FlashRam
};
#ifdef CFB_READ
extern DWORD CFBStart, CFBEnd;
void __cdecl SetFrameBuffer (DWORD Address, DWORD Length);
#endif
extern int NextInstruction, JumpToLocation, ManualPaused, CPU_Paused, CountPerOp;
extern char SaveAsFileName[255], LoadFileName[255];
extern int DlistCount, AlistCount, CurrentSaveSlot;
extern enum SaveType SaveUsing;
extern CPU_ACTION CPU_Action;
extern SYSTEM_TIMERS Timers;
extern HANDLE hPauseMutex;
extern OPCODE Opcode;
extern HANDLE hCPU;
extern BOOL inFullScreen, CPURunning, SPHack;
#ifdef Interpreter_StackTest
extern DWORD StackValue;
#endif
extern DWORD MemoryStack;