-
Notifications
You must be signed in to change notification settings - Fork 1
/
Fpu Machine2.cpp
578 lines (495 loc) · 17 KB
/
Fpu Machine2.cpp
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
#include <math.h>
#include "WinMain.h"
#include "EmuMain.h"
#include "CpuMain.h"
void *FPRFloatLocation[32];
void *FPRDoubleLocation[32];
int RoundingModel = _RC_NEAR;
extern void (*opCOP1_S_OPS[0x40])();
extern void (*opCOP1_D_OPS[0x40])();
extern void (*opCOP1_W_OPS[0x40])();
extern void (*opCOP1_L_OPS[0x40])();
void doInstr();
//R4K_FPU_union FpuRegs2;
void ResetFPU () {
int count;
//memset (FpuRegs2.s, 0, sizeof(R4K_FPU_union));
memset (FpuRegs.s, 0, sizeof(R4K_FPU_union));
for (count = 0; count < 32; count ++) {
FPRFloatLocation[count] = (void *)(&FpuRegs.W[count >> 1][count & 1]);
FPRDoubleLocation[count] = (void *)(&FpuRegs.DW[count >> 1]);
}
}
void SetFpuLocations () {
int count;
if ((MmuRegs[12] & 0x04000000) == 0) {
for (count = 0; count < 32; count ++) {
FPRFloatLocation[count] = (void *)(&FpuRegs.W[count >> 1][count & 1]);
//FPRDoubleLocation[count] = FPRFloatLocation[count];
FPRDoubleLocation[count] = (void *)(&FpuRegs.DW[count >> 1]);
}
} else {
for (count = 0; count < 32; count ++) {
FPRFloatLocation[count] = (void *)(&FpuRegs.W[count][1]);
//FPRDoubleLocation[count] = FPRFloatLocation[count];
FPRDoubleLocation[count] = (void *)(&FpuRegs.DW[count]);
}
}
}
void opCOP1_BC (void) {
switch (sop.rt & 3){
case 0x0://BC1F
if (!(FpuControl[31] & 0x00800000)) {
u32 target = pc + ((s16(opcode)) << 2);
doInstr();
pc = target;
}
break;
case 0x1://BC1T
if (FpuControl[31] & 0x00800000) {
u32 target = pc + ((s16(opcode)) << 2);
doInstr();
pc = target;
}
break;
case 0x2://BC1FL
if (!(FpuControl[31] & 0x00800000)) {
u32 target = pc + ((s16(opcode)) << 2);
doInstr();
pc = target;
} else {
pc += 4;
}
break;
case 0x3://BC1TL
if (FpuControl[31] & 0x00800000) {
u32 target = pc + ((s16(opcode)) << 2);
doInstr();
pc = target;
} else {
pc += 4;
}
default:
break;
}
//((void (*)()) R4300i_CoP1_BC[ sop.rt ])();
// Debug (0, "Missing COP1_BC");
}
void opCOP1_S (void) {
_controlfp(RoundingModel,_MCW_RC);
((void (*)()) opCOP1_S_OPS[ sop.func ])();
}
void opCOP1_D (void) {
_controlfp(RoundingModel,_MCW_RC);
((void (*)()) opCOP1_D_OPS[ sop.func ])();
}
void opCOP1_W (void) {
((void (*)()) opCOP1_W_OPS[ sop.func ])();
}
void opCOP1_L (void) {
((void (*)()) opCOP1_L_OPS[ sop.func ])();
}
void opCOP1_MF (void) {
CpuRegs[sop.rt] = *(s32 *)FPRFloatLocation[sop.rd];
}
void opCOP1_DMF (void) {
CpuRegs[sop.rt] = *(s64 *)FPRDoubleLocation[sop.rd];
}
void opCOP1_CF (void) {
if (sop.rd != 31 && sop.rd != 0) {
Debug(0, "CFC1 what register are you writing to ?");
return;
}
CpuRegs[sop.rt] = (s32)FpuControl[sop.rd];
}
void opCOP1_MT (void) {
*(s32 *)FPRFloatLocation[sop.rd] = (s32)CpuRegs[sop.rt];
}
void opCOP1_DMT (void) {
*(s64 *)FPRDoubleLocation[sop.rd] = (s64)CpuRegs[sop.rt];
}
void opCOP1_CT (void) {
if (sop.rd == 31) {
FpuControl[sop.rd] = (s32)CpuRegs[sop.rt];
switch((FpuControl[sop.rd] & 3)) {
case 0: RoundingModel = _RC_NEAR; break;
case 1: RoundingModel = _RC_CHOP; break;
case 2: RoundingModel = _RC_UP; break;
case 3: RoundingModel = _RC_DOWN; break;
}
return;
}
Debug (0, "CTC1 what register are you writing to ?");
}
#ifdef USE_OLD_FPU
void opCOP1z(void) {
#else
void opCOP1(void) {
#endif
bool CopUnuseableException(u32 addr, u32 copx);
if (!(MmuRegs[12] & 0x20000000)) {
pc-=4;
CopUnuseableException(pc,1);
return;
}
switch (sop.rs) {
case 0:
opCOP1_MF ();
break;
case 1:
opCOP1_DMF ();
break;
case 2:
opCOP1_CF ();
break;
case 4:
opCOP1_MT ();
break;
case 5:
opCOP1_DMT ();
break;
case 6:
opCOP1_CT ();
break;
case 8:
opCOP1_BC ();
break;
case 16:
opCOP1_S ();
break;
case 17:
opCOP1_D ();
break;
case 20:
opCOP1_W ();
break;
case 21:
opCOP1_L ();
break;
default:
Debug (1, "Unknown COP1 op: %08X", sop.rs);
}
}
//************************** COP1: S functions ************************
__inline void Float_RoundToInteger32( int * Dest, float * Source ) {
_asm {
mov esi, [Source]
mov edi, [Dest]
fld dword ptr [esi]
fistp dword ptr [edi]
}
}
__inline void Float_RoundToInteger64( __int64 * Dest, float * Source ) {
_asm {
mov esi, [Source]
mov edi, [Dest]
fld dword ptr [esi]
fistp qword ptr [edi]
}
}
void opCOP1_S_ADD (void) {
_controlfp(RoundingModel,_MCW_RC);
*(float *)FPRFloatLocation[sop.sa] = (*(float *)FPRFloatLocation[sop.rd] + *(float *)FPRFloatLocation[sop.rt]);
}
void opCOP1_S_SUB (void) {
_controlfp(RoundingModel,_MCW_RC);
*(float *)FPRFloatLocation[sop.sa] = (*(float *)FPRFloatLocation[sop.rd] - *(float *)FPRFloatLocation[sop.rt]);
}
void opCOP1_S_MUL (void) {
_controlfp(RoundingModel,_MCW_RC);
*(float *)FPRFloatLocation[sop.sa] = (*(float *)FPRFloatLocation[sop.rd] * *(float *)FPRFloatLocation[sop.rt]);
}
void opCOP1_S_DIV (void) {
_controlfp(RoundingModel,_MCW_RC);
*(float *)FPRFloatLocation[sop.sa] = (*(float *)FPRFloatLocation[sop.rd] / *(float *)FPRFloatLocation[sop.rt]);
}
void opCOP1_S_SQRT (void) {
_controlfp(RoundingModel,_MCW_RC);
*(float *)FPRFloatLocation[sop.sa] = (float)sqrt(*(float *)FPRFloatLocation[sop.rd]);
}
void opCOP1_S_ABS (void) {
_controlfp(RoundingModel,_MCW_RC);
*(float *)FPRFloatLocation[sop.sa] = (float)fabs(*(float *)FPRFloatLocation[sop.rd]);
}
void opCOP1_S_MOV (void) {
_controlfp(RoundingModel,_MCW_RC);
*(float *)FPRFloatLocation[sop.sa] = *(float *)FPRFloatLocation[sop.rd];
}
void opCOP1_S_NEG (void) {
_controlfp(RoundingModel,_MCW_RC);
*(float *)FPRFloatLocation[sop.sa] = (*(float *)FPRFloatLocation[sop.rd] * -1.0f);
}
void opCOP1_S_TRUNC_L (void) {
_controlfp(_RC_CHOP,_MCW_RC);
Float_RoundToInteger64(&*(__int64 *)FPRDoubleLocation[sop.sa],&*(float *)FPRFloatLocation[sop.rd]);
}
void opCOP1_S_ROUND_W (void) {
_controlfp(_RC_NEAR,_MCW_RC);
Float_RoundToInteger32(&*(int *)FPRFloatLocation[sop.sa],&*(float *)FPRFloatLocation[sop.rd]);
}
void opCOP1_S_TRUNC_W (void) {
_controlfp(_RC_CHOP,_MCW_RC);
Float_RoundToInteger32(&*(int *)FPRFloatLocation[sop.sa],&*(float *)FPRFloatLocation[sop.rd]);
}
void opCOP1_S_FLOOR_W (void) {
_controlfp(_RC_DOWN,_MCW_RC);
Float_RoundToInteger32(&*(int *)FPRFloatLocation[sop.sa],&*(float *)FPRFloatLocation[sop.rd]);
}
void opCOP1_S_CVT_D (void) {
_controlfp(RoundingModel,_MCW_RC);
*(double *)FPRDoubleLocation[sop.sa] = (double)(*(float *)FPRFloatLocation[sop.rd]);
}
void opCOP1_S_CVT_W (void) {
_controlfp(RoundingModel,_MCW_RC);
Float_RoundToInteger32(&*(int *)FPRFloatLocation[sop.sa],&*(float *)FPRFloatLocation[sop.rd]);
}
void opCOP1_S_CVT_L (void) {
_controlfp(RoundingModel,_MCW_RC);
Float_RoundToInteger64(&*(__int64 *)FPRDoubleLocation[sop.sa],&*(float *)FPRFloatLocation[sop.rd]);
}
void opCOP1_S_CMP (void) {
int less, equal, unorded, condition;
float Temp0, Temp1;
Temp0 = *(float *)FPRFloatLocation[sop.rd];
Temp1 = *(float *)FPRFloatLocation[sop.rt];
if (_isnan(Temp0) || _isnan(Temp1)) {
Debug (0, "Nan ? - %X", sop.func);
less = FALSE;
equal = FALSE;
unorded = TRUE;
if ((sop.func & 8) != 0) {
Debug (0, "Signal InvalidOperationException\r\nin opCOP1_S_CMP\r\n%X %ff\r\n%X %ff",
Temp0,Temp0,Temp1,Temp1);
}
} else {
less = Temp0 < Temp1;
equal = Temp0 == Temp1;
unorded = FALSE;
}
condition = ((sop.func & 4) && less) | ((sop.func & 2) && equal) |
((sop.func & 1) && unorded);
if (condition) {
FpuControl[31] |= 0x00800000;
} else {
FpuControl[31] &= ~0x00800000;
}
}
void opCOP1_S_UNK () {
Debug (1, "Unknown S-Type FPU Opcode: %X", sop.func);
}
//************************** COP1: D functions ************************
__inline void Double_RoundToInteger32( int * Dest, double * Source ) {
_asm {
mov esi, [Source]
mov edi, [Dest]
fld qword ptr [esi]
fistp dword ptr [edi]
}
}
__inline void Double_RoundToInteger64( __int64 * Dest, double * Source ) {
_asm {
mov esi, [Source]
mov edi, [Dest]
fld qword ptr [esi]
fistp qword ptr [edi]
}
}
void opCOP1_D_ADD (void) {
*(double *)FPRDoubleLocation[sop.sa] = *(double *)FPRDoubleLocation[sop.rd] + *(double *)FPRDoubleLocation[sop.rt];
}
void opCOP1_D_SUB (void) {
*(double *)FPRDoubleLocation[sop.sa] = *(double *)FPRDoubleLocation[sop.rd] - *(double *)FPRDoubleLocation[sop.rt];
}
void opCOP1_D_MUL (void) {
*(double *)FPRDoubleLocation[sop.sa] = *(double *)FPRDoubleLocation[sop.rd] * *(double *)FPRDoubleLocation[sop.rt];
}
void opCOP1_D_DIV (void) {
*(double *)FPRDoubleLocation[sop.sa] = *(double *)FPRDoubleLocation[sop.rd] / *(double *)FPRDoubleLocation[sop.rt];
}
void opCOP1_D_SQRT (void) {
*(double *)FPRDoubleLocation[sop.sa] = (double)sqrt(*(double *)FPRDoubleLocation[sop.rd]);
}
void opCOP1_D_ABS (void) {
*(double *)FPRDoubleLocation[sop.sa] = fabs(*(double *)FPRDoubleLocation[sop.rd]);
}
void opCOP1_D_MOV (void) {
*(__int64 *)FPRDoubleLocation[sop.sa] = *(__int64 *)FPRDoubleLocation[sop.rd];
}
void opCOP1_D_NEG (void) {
*(double *)FPRDoubleLocation[sop.sa] = (*(double *)FPRDoubleLocation[sop.rd] * -1.0);
}
void opCOP1_D_ROUND_W (void) {
_controlfp(_RC_NEAR,_MCW_RC);
Double_RoundToInteger32(&*(int *)FPRFloatLocation[sop.sa],&*(double *)FPRDoubleLocation[sop.rd] );
}
void opCOP1_D_TRUNC_W (void) {// May need to be unsigned destination??
_controlfp(RC_CHOP,_MCW_RC);
Double_RoundToInteger32(&*(int *)FPRFloatLocation[sop.sa],&*(double *)FPRDoubleLocation[sop.rd] );
}
void opCOP1_D_CVT_S (void) {
_controlfp(RoundingModel,_MCW_RC);
*(float *)FPRFloatLocation[sop.sa] = (float)*(double *)FPRDoubleLocation[sop.rd];
}
void opCOP1_D_CVT_W (void) {// May need to be unsigned destination??
_controlfp(RoundingModel,_MCW_RC);
Double_RoundToInteger32(&*(int *)FPRFloatLocation[sop.sa],&*(double *)FPRDoubleLocation[sop.rd] );
}
void opCOP1_D_CVT_L (void) { // May need to be unsigned destination??
_controlfp(RoundingModel,_MCW_RC);
Double_RoundToInteger64(&*(__int64 *)FPRDoubleLocation[sop.sa],&*(double *)FPRDoubleLocation[sop.rd]);
}
void opCOP1_D_CMP (void) {
int less, equal, unorded, condition;
double Temp0, Temp1;
Temp0 = *(double *)FPRDoubleLocation[sop.rd];
Temp1 = *(double *)FPRDoubleLocation[sop.rt];
if (_isnan(Temp0) || _isnan(Temp1)) {
Debug(0, "Nan ?");
less = FALSE;
equal = FALSE;
unorded = TRUE;
if ((sop.func & 8) != 0) {
Debug (0, "Signal InvalidOperationException\nin opCOP1_D_CMP");
}
} else {
less = Temp0 < Temp1;
equal = Temp0 == Temp1;
unorded = FALSE;
}
condition = ((sop.func & 4) && less) | ((sop.func & 2) && equal) |
((sop.func & 1) && unorded);
if (condition) {
FpuControl[31] |= 0x00800000;
} else {
FpuControl[31] &= ~0x00800000;
}
}
void opCOP1_D_UNK () {
Debug (1, "Unknown D-Type FPU Opcode: %X", sop.func);
}
//************************** COP1: W functions ************************
void opCOP1_W_CVT_S (void) {
_controlfp(RoundingModel,_MCW_RC);
*(float *)FPRFloatLocation[sop.sa] = (float)*(int *)FPRFloatLocation[sop.rd];
}
void opCOP1_W_CVT_D (void) {
_controlfp(RoundingModel,_MCW_RC);
*(double *)FPRDoubleLocation[sop.sa] = (double)*(int *)FPRFloatLocation[sop.rd];
}
void opCOP1_W_UNK () {
Debug (1, "Unknown W-Type FPU Opcode: %X", sop.func);
}
//************************** COP1: L functions ***********************
void opCOP1_L_CVT_S (void) {
_controlfp(RoundingModel,_MCW_RC);
*(float *)FPRFloatLocation[sop.sa] = (float)*(__int64 *)FPRDoubleLocation[sop.rd];
}
void opCOP1_L_CVT_D (void) {
_controlfp(RoundingModel,_MCW_RC);
*(double *)FPRDoubleLocation[sop.sa] = (double)*(__int64 *)FPRDoubleLocation[sop.rd];
}
void opCOP1_L_UNK () {
Debug (1, "Unknown L-Type FPU Opcode: %X", sop.func);
}
void (*opCOP1_S_OPS[0x40])() =
{
opCOP1_S_ADD, opCOP1_S_SUB, opCOP1_S_MUL, opCOP1_S_DIV, opCOP1_S_SQRT, opCOP1_S_ABS, opCOP1_S_MOV, opCOP1_S_NEG,
opCOP1_S_UNK, opCOP1_S_TRUNC_L, opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_ROUND_W, opCOP1_S_TRUNC_W, opCOP1_S_UNK, opCOP1_S_FLOOR_W,
opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_UNK,
opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_UNK,
opCOP1_S_UNK, opCOP1_S_CVT_D, opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_CVT_W, opCOP1_S_CVT_L, opCOP1_S_UNK, opCOP1_S_UNK,
opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_UNK, opCOP1_S_UNK,
opCOP1_S_CMP, opCOP1_S_CMP, opCOP1_S_CMP, opCOP1_S_CMP, opCOP1_S_CMP, opCOP1_S_CMP, opCOP1_S_CMP, opCOP1_S_CMP,
opCOP1_S_CMP, opCOP1_S_CMP, opCOP1_S_CMP, opCOP1_S_CMP, opCOP1_S_CMP, opCOP1_S_CMP, opCOP1_S_CMP, opCOP1_S_CMP
};
void (*opCOP1_D_OPS[0x40])() =
{
opCOP1_D_ADD, opCOP1_D_SUB, opCOP1_D_MUL, opCOP1_D_DIV, opCOP1_D_SQRT, opCOP1_D_ABS, opCOP1_D_MOV, opCOP1_D_NEG,
opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_ROUND_W, opCOP1_D_TRUNC_W, opCOP1_D_UNK, opCOP1_D_UNK,
opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK,
opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK,
opCOP1_D_CVT_S, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_CVT_W, opCOP1_D_CVT_L, opCOP1_D_UNK, opCOP1_D_UNK,
opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK, opCOP1_D_UNK,
opCOP1_D_CMP, opCOP1_D_CMP, opCOP1_D_CMP, opCOP1_D_CMP, opCOP1_D_CMP, opCOP1_D_CMP, opCOP1_D_CMP, opCOP1_D_CMP,
opCOP1_D_CMP, opCOP1_D_CMP, opCOP1_D_CMP, opCOP1_D_CMP, opCOP1_D_CMP, opCOP1_D_CMP, opCOP1_D_CMP, opCOP1_D_CMP
};
void (*opCOP1_W_OPS[0x40])() =
{
opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK,
opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK,
opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK,
opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK,
opCOP1_W_CVT_S, opCOP1_W_CVT_D, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK,
opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK,
opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK,
opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK, opCOP1_W_UNK,
};
void (*opCOP1_L_OPS[0x40])() =
{
opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK,
opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK,
opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK,
opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK,
opCOP1_L_CVT_S, opCOP1_L_CVT_D, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK,
opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK,
opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK,
opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK, opCOP1_L_UNK,
};
/*
void (*FpuCommands20[0x40])() =
{
fpADD20, fpSUB20, fpMUL20, fpDIV20, fpSRT20, fpABS20, opNI, fpNEG20,
opNI, opNI, opNI, opNI, opNI, opNI, opNI, opNI,
opNI, opNI, opNI, opNI, opNI, opNI, opNI, opNI,
opNI, opNI, opNI, opNI, opNI, opNI, opNI, opNI,
fpCVTs20, fpCVTd20, opNI, opNI, opNI, opNI, opNI, opNI,
opNI, opNI, opNI, opNI, opNI, opNI, opNI, opNI,
opNI, opNI, opNI, opNI, opNI, opNI, opNI, opNI,
opNI, opNI, opNI, opNI, opNI, opNI, opNI, opNI
};
*/
/*
//************************* COP1: BC1 functions ***********************
void opCOP1_BCF (void) {
TEST_COP1_USABLE_EXCEPTION
NextInstruction = DELAY_SLOT;
if ((FpuControl[31] & 0x00800000) == 0) {
JumpToLocation = PROGRAM_COUNTER + ((short)Opcode.offset << 2) + 4;
} else {
JumpToLocation = PROGRAM_COUNTER + 8;
}
}
void opCOP1_BCT (void) {
TEST_COP1_USABLE_EXCEPTION
NextInstruction = DELAY_SLOT;
if ((FpuControl[31] & 0x00800000) != 0) {
JumpToLocation = PROGRAM_COUNTER + ((short)Opcode.offset << 2) + 4;
} else {
JumpToLocation = PROGRAM_COUNTER + 8;
}
}
void opCOP1_BCFL (void) {
TEST_COP1_USABLE_EXCEPTION
if ((FpuControl[31] & 0x00800000) == 0) {
NextInstruction = DELAY_SLOT;
JumpToLocation = PROGRAM_COUNTER + ((short)Opcode.offset << 2) + 4;
} else {
NextInstruction = JUMP;
JumpToLocation = PROGRAM_COUNTER + 8;
}
}
void opCOP1_BCTL (void) {
TEST_COP1_USABLE_EXCEPTION
if ((FpuControl[31] & 0x00800000) != 0) {
NextInstruction = DELAY_SLOT;
JumpToLocation = PROGRAM_COUNTER + ((short)Opcode.offset << 2) + 4;
} else {
NextInstruction = JUMP;
JumpToLocation = PROGRAM_COUNTER + 8;
}
}
*/