-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscu.h
executable file
·248 lines (213 loc) · 5.02 KB
/
scu.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
/* Copyright 2003-2005 Guillaume Duhamel
Copyright 2005-2006 Theo Berkau
This file is part of Yabause.
Yabause is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Yabause is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Yabause; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef SCU_H
#define SCU_H
#include "core.h"
typedef struct
{
u32 addr;
} scucodebreakpoint_struct;
#define MAX_BREAKPOINTS 10
typedef struct
{
u8 vector;
u8 level;
u16 mask;
u32 statusbit;
} scuinterrupt_struct;
typedef struct
{
int mode;
u32 ReadAddress;
u32 WriteAddress;
s32 TransferNumber;
u32 AddValue;
u32 ModeAddressUpdate;
u32 ReadAdd;
u32 WriteAdd;
u32 InDirectAdress;
} scudmainfo_struct;
typedef struct
{
/* DMA registers */
u32 D0R;
u32 D0W;
u32 D0C;
u32 D0AD;
u32 D0EN;
u32 D0MD;
u32 D1R;
u32 D1W;
u32 D1C;
u32 D1AD;
u32 D1EN;
u32 D1MD;
u32 D2R;
u32 D2W;
u32 D2C;
u32 D2AD;
u32 D2EN;
u32 D2MD;
u32 DSTP;
u32 DSTA;
/* DSP registers */
u32 PPAF;
u32 PPD;
u32 PDA;
u32 PDD;
/* Timer registers */
u32 T0C;
u32 T1S;
u32 T1MD;
/* Interrupt registers */
u32 IMS;
u32 IST;
/* A-bus registers */
u32 AIACK;
u32 ASR0;
u32 ASR1;
u32 AREF;
/* SCU registers */
u32 RSEL;
u32 VER;
/* internal variables */
u32 timer0;
u32 timer1;
scuinterrupt_struct interrupts[30];
u32 NumberOfInterrupts;
s32 timer1_counter;
u32 timer0_set;
u32 timer1_set;
s32 timer1_preset;
scudmainfo_struct dma0;
scudmainfo_struct dma1;
scudmainfo_struct dma2;
} Scu;
extern Scu * ScuRegs;
typedef struct
{
scucodebreakpoint_struct codebreakpoint[MAX_BREAKPOINTS];
int numcodebreakpoints;
void(*BreakpointCallBack)(u32);
u8 inbreakpoint;
} scubp_struct;
typedef struct {
u32 ProgramRam[256];
u32 MD[4][64];
union {
struct {
u32 unused1 : 5;
u32 PR : 1; // Pause cancel flag
u32 EP : 1; // Temporary stop execution flag
u32 unused2 : 1;
u32 T0 : 1; // D0 bus use DMA execute flag
u32 S : 1; // Sine flag
u32 Z : 1; // Zero flag
u32 C : 1; // Carry flag
u32 V : 1; // Overflow flag
u32 E : 1; // Program end interrupt flag
u32 ES : 1; // Program step execute control bit
u32 EX : 1; // Program execute control bit
u32 LE : 1; // Program counter load enable bit
u32 unused3 : 7;
u32 P : 8; // Program Ram Address
} part;
u32 all;
} ProgControlPort;
u8 PC;
u8 TOP;
u16 LOP;
s32 jmpaddr;
int delayed;
u8 DataRamPage;
u8 DataRamReadAddress;
u8 CT[4];
s32 RX;
s32 RY;
u32 RA0;
u32 WA0;
union {
struct {
s64 unused : 16;
s64 H : 16;
s64 L : 32;
} part;
s64 all;
} AC;
union {
struct {
s64 unused : 16;
s64 H : 16;
s64 L : 32;
} part;
s64 all;
} P;
union {
struct {
s64 unused : 16;
s64 H : 16;
s64 L : 32;
} part;
s64 all;
} ALU;
union {
struct {
s64 unused : 16;
s64 H : 16;
s64 L : 32;
} part;
s64 all;
} MUL;
u32 dsp_dma_instruction;
s32 dsp_dma_wait;
u32 dsp_dma_size;
u32 WA0M;
u32 RA0M;
u32 dmy;
} scudspregs_struct;
int ScuInit(void);
void ScuDeInit(void);
void ScuReset(void);
void ScuExec(u32 timing);
u8 FASTCALL ScuReadByte(u32);
u16 FASTCALL ScuReadWord(u32);
u32 FASTCALL ScuReadLong(u32);
void FASTCALL ScuWriteByte(u32, u8);
void FASTCALL ScuWriteWord(u32, u16);
void FASTCALL ScuWriteLong(u32, u32);
void ScuSendVBlankIN(void);
void ScuSendVBlankOUT(void);
void ScuSendHBlankIN(void);
void ScuRemoveHBlankIN();
void ScuSendTimer0(void);
void ScuSendTimer1(void);
void ScuSendDSPEnd(void);
void ScuSendSoundRequest(void);
void ScuSendSystemManager(void);
void ScuSendPadInterrupt(void);
void ScuSendDMAEnd(u32 mode);
void ScuSendDMAIllegal(void);
void ScuSendDrawEnd(void);
void ScuDspStep(void);
void ScuDspGetRegisters(scudspregs_struct *regs);
void ScuDspSetRegisters(scudspregs_struct *regs);
void ScuDspSetBreakpointCallBack(void(*func)(u32));
int ScuDspAddCodeBreakpoint(u32 addr);
int ScuDspDelCodeBreakpoint(u32 addr);
scucodebreakpoint_struct *ScuDspGetBreakpointList(void);
void ScuDspClearCodeBreakpoints(void);
void ScuSendExternalInterrupt00(void);
#endif