Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libmupen64plus/mupen64plus-core/src/r4300/ops.h
2 views
1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
* Mupen64plus - ops.h *
3
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
4
* Copyright (C) 2002 Hacktarux *
5
* *
6
* This program is free software; you can redistribute it and/or modify *
7
* it under the terms of the GNU General Public License as published by *
8
* the Free Software Foundation; either version 2 of the License, or *
9
* (at your option) any later version. *
10
* *
11
* This program is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU General Public License for more details. *
15
* *
16
* You should have received a copy of the GNU General Public License *
17
* along with this program; if not, write to the *
18
* Free Software Foundation, Inc., *
19
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
20
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
21
22
typedef struct _cpu_instruction_table
23
{
24
/* All jump/branch instructions (except JR and JALR) have three versions:
25
* - JUMPNAME() which for jumps inside the current block.
26
* - JUMPNAME_OUT() which jumps outside the current block.
27
* - JUMPNAME_IDLE() which does busy wait optimization.
28
*
29
* Busy wait optimization is used when a jump jumps to itself,
30
* and the instruction on the delay slot is a NOP.
31
* The program is waiting for the next interrupt, so we can just
32
* increase Count until the point where the next interrupt happens. */
33
34
// Load and store instructions
35
void (*LB)(void);
36
void (*LBU)(void);
37
void (*LH)(void);
38
void (*LHU)(void);
39
void (*LW)(void);
40
void (*LWL)(void);
41
void (*LWR)(void);
42
void (*SB)(void);
43
void (*SH)(void);
44
void (*SW)(void);
45
void (*SWL)(void);
46
void (*SWR)(void);
47
48
void (*LD)(void);
49
void (*LDL)(void);
50
void (*LDR)(void);
51
void (*LL)(void);
52
void (*LWU)(void);
53
void (*SC)(void);
54
void (*SD)(void);
55
void (*SDL)(void);
56
void (*SDR)(void);
57
void (*SYNC)(void);
58
59
// Arithmetic instructions (ALU immediate)
60
void (*ADDI)(void);
61
void (*ADDIU)(void);
62
void (*SLTI)(void);
63
void (*SLTIU)(void);
64
void (*ANDI)(void);
65
void (*ORI)(void);
66
void (*XORI)(void);
67
void (*LUI)(void);
68
69
void (*DADDI)(void);
70
void (*DADDIU)(void);
71
72
// Arithmetic instructions (3-operand)
73
void (*ADD)(void);
74
void (*ADDU)(void);
75
void (*SUB)(void);
76
void (*SUBU)(void);
77
void (*SLT)(void);
78
void (*SLTU)(void);
79
void (*AND)(void);
80
void (*OR)(void);
81
void (*XOR)(void);
82
void (*NOR)(void);
83
84
void (*DADD)(void);
85
void (*DADDU)(void);
86
void (*DSUB)(void);
87
void (*DSUBU)(void);
88
89
// Multiply and divide instructions
90
void (*MULT)(void);
91
void (*MULTU)(void);
92
void (*DIV)(void);
93
void (*DIVU)(void);
94
void (*MFHI)(void);
95
void (*MTHI)(void);
96
void (*MFLO)(void);
97
void (*MTLO)(void);
98
99
void (*DMULT)(void);
100
void (*DMULTU)(void);
101
void (*DDIV)(void);
102
void (*DDIVU)(void);
103
104
// Jump and branch instructions
105
void (*J)(void);
106
void (*J_OUT)(void);
107
void (*J_IDLE)(void);
108
void (*JAL)(void);
109
void (*JAL_OUT)(void);
110
void (*JAL_IDLE)(void);
111
void (*JR)(void);
112
void (*JALR)(void);
113
void (*BEQ)(void);
114
void (*BEQ_OUT)(void);
115
void (*BEQ_IDLE)(void);
116
void (*BNE)(void);
117
void (*BNE_OUT)(void);
118
void (*BNE_IDLE)(void);
119
void (*BLEZ)(void);
120
void (*BLEZ_OUT)(void);
121
void (*BLEZ_IDLE)(void);
122
void (*BGTZ)(void);
123
void (*BGTZ_OUT)(void);
124
void (*BGTZ_IDLE)(void);
125
void (*BLTZ)(void);
126
void (*BLTZ_OUT)(void);
127
void (*BLTZ_IDLE)(void);
128
void (*BGEZ)(void);
129
void (*BGEZ_OUT)(void);
130
void (*BGEZ_IDLE)(void);
131
void (*BLTZAL)(void);
132
void (*BLTZAL_OUT)(void);
133
void (*BLTZAL_IDLE)(void);
134
void (*BGEZAL)(void);
135
void (*BGEZAL_OUT)(void);
136
void (*BGEZAL_IDLE)(void);
137
138
void (*BEQL)(void);
139
void (*BEQL_OUT)(void);
140
void (*BEQL_IDLE)(void);
141
void (*BNEL)(void);
142
void (*BNEL_OUT)(void);
143
void (*BNEL_IDLE)(void);
144
void (*BLEZL)(void);
145
void (*BLEZL_OUT)(void);
146
void (*BLEZL_IDLE)(void);
147
void (*BGTZL)(void);
148
void (*BGTZL_OUT)(void);
149
void (*BGTZL_IDLE)(void);
150
void (*BLTZL)(void);
151
void (*BLTZL_OUT)(void);
152
void (*BLTZL_IDLE)(void);
153
void (*BGEZL)(void);
154
void (*BGEZL_OUT)(void);
155
void (*BGEZL_IDLE)(void);
156
void (*BLTZALL)(void);
157
void (*BLTZALL_OUT)(void);
158
void (*BLTZALL_IDLE)(void);
159
void (*BGEZALL)(void);
160
void (*BGEZALL_OUT)(void);
161
void (*BGEZALL_IDLE)(void);
162
void (*BC1TL)(void);
163
void (*BC1TL_OUT)(void);
164
void (*BC1TL_IDLE)(void);
165
void (*BC1FL)(void);
166
void (*BC1FL_OUT)(void);
167
void (*BC1FL_IDLE)(void);
168
169
// Shift instructions
170
void (*SLL)(void);
171
void (*SRL)(void);
172
void (*SRA)(void);
173
void (*SLLV)(void);
174
void (*SRLV)(void);
175
void (*SRAV)(void);
176
177
void (*DSLL)(void);
178
void (*DSRL)(void);
179
void (*DSRA)(void);
180
void (*DSLLV)(void);
181
void (*DSRLV)(void);
182
void (*DSRAV)(void);
183
void (*DSLL32)(void);
184
void (*DSRL32)(void);
185
void (*DSRA32)(void);
186
187
// COP0 instructions
188
void (*MTC0)(void);
189
void (*MFC0)(void);
190
191
void (*TLBR)(void);
192
void (*TLBWI)(void);
193
void (*TLBWR)(void);
194
void (*TLBP)(void);
195
void (*CACHE)(void);
196
void (*ERET)(void);
197
198
// COP1 instructions
199
void (*LWC1)(void);
200
void (*SWC1)(void);
201
void (*MTC1)(void);
202
void (*MFC1)(void);
203
void (*CTC1)(void);
204
void (*CFC1)(void);
205
void (*BC1T)(void);
206
void (*BC1T_OUT)(void);
207
void (*BC1T_IDLE)(void);
208
void (*BC1F)(void);
209
void (*BC1F_OUT)(void);
210
void (*BC1F_IDLE)(void);
211
212
void (*DMFC1)(void);
213
void (*DMTC1)(void);
214
void (*LDC1)(void);
215
void (*SDC1)(void);
216
217
void (*CVT_S_D)(void);
218
void (*CVT_S_W)(void);
219
void (*CVT_S_L)(void);
220
void (*CVT_D_S)(void);
221
void (*CVT_D_W)(void);
222
void (*CVT_D_L)(void);
223
void (*CVT_W_S)(void);
224
void (*CVT_W_D)(void);
225
void (*CVT_L_S)(void);
226
void (*CVT_L_D)(void);
227
228
void (*ROUND_W_S)(void);
229
void (*ROUND_W_D)(void);
230
void (*ROUND_L_S)(void);
231
void (*ROUND_L_D)(void);
232
233
void (*TRUNC_W_S)(void);
234
void (*TRUNC_W_D)(void);
235
void (*TRUNC_L_S)(void);
236
void (*TRUNC_L_D)(void);
237
238
void (*CEIL_W_S)(void);
239
void (*CEIL_W_D)(void);
240
void (*CEIL_L_S)(void);
241
void (*CEIL_L_D)(void);
242
243
void (*FLOOR_W_S)(void);
244
void (*FLOOR_W_D)(void);
245
void (*FLOOR_L_S)(void);
246
void (*FLOOR_L_D)(void);
247
248
void (*ADD_S)(void);
249
void (*ADD_D)(void);
250
251
void (*SUB_S)(void);
252
void (*SUB_D)(void);
253
254
void (*MUL_S)(void);
255
void (*MUL_D)(void);
256
257
void (*DIV_S)(void);
258
void (*DIV_D)(void);
259
260
void (*ABS_S)(void);
261
void (*ABS_D)(void);
262
263
void (*MOV_S)(void);
264
void (*MOV_D)(void);
265
266
void (*NEG_S)(void);
267
void (*NEG_D)(void);
268
269
void (*SQRT_S)(void);
270
void (*SQRT_D)(void);
271
272
void (*C_F_S)(void);
273
void (*C_F_D)(void);
274
void (*C_UN_S)(void);
275
void (*C_UN_D)(void);
276
void (*C_EQ_S)(void);
277
void (*C_EQ_D)(void);
278
void (*C_UEQ_S)(void);
279
void (*C_UEQ_D)(void);
280
void (*C_OLT_S)(void);
281
void (*C_OLT_D)(void);
282
void (*C_ULT_S)(void);
283
void (*C_ULT_D)(void);
284
void (*C_OLE_S)(void);
285
void (*C_OLE_D)(void);
286
void (*C_ULE_S)(void);
287
void (*C_ULE_D)(void);
288
void (*C_SF_S)(void);
289
void (*C_SF_D)(void);
290
void (*C_NGLE_S)(void);
291
void (*C_NGLE_D)(void);
292
void (*C_SEQ_S)(void);
293
void (*C_SEQ_D)(void);
294
void (*C_NGL_S)(void);
295
void (*C_NGL_D)(void);
296
void (*C_LT_S)(void);
297
void (*C_LT_D)(void);
298
void (*C_NGE_S)(void);
299
void (*C_NGE_D)(void);
300
void (*C_LE_S)(void);
301
void (*C_LE_D)(void);
302
void (*C_NGT_S)(void);
303
void (*C_NGT_D)(void);
304
305
// Special instructions
306
void (*SYSCALL)(void);
307
308
// Exception instructions
309
void (*TEQ)(void);
310
311
// Emulator helper functions
312
void (*NOP)(void); // No operation (used to nullify R0 writes)
313
void (*RESERVED)(void); // Reserved instruction handler
314
void (*NI)(void); // Not implemented instruction handler
315
316
void (*FIN_BLOCK)(void); // Handler for the end of a block
317
void (*NOTCOMPILED)(void); // Handler for not yet compiled code
318
void (*NOTCOMPILED2)(void); // TODOXXX
319
} cpu_instruction_table;
320
321
extern const cpu_instruction_table cached_interpreter_table;
322
extern cpu_instruction_table current_instruction_table;
323
324