-
Notifications
You must be signed in to change notification settings - Fork 0
/
DisR5900asm.c
1651 lines (1584 loc) · 97.3 KB
/
DisR5900asm.c
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
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2003 Pcsx2 Team
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <string.h>
#include "R5900.h"
unsigned long opcode_addr;
//DECODE PROCUDURES
//cop0
#define DECODE_FS (DECODE_RD)
#define DECODE_FT (DECODE_RT)
#define DECODE_FD (DECODE_SA)
///********
#define DECODE_FUNCTION ((cpuRegs.code) & 0x3F)
#define DECODE_RD ((cpuRegs.code >> 11) & 0x1F) // The rd part of the instruction register
#define DECODE_RT ((cpuRegs.code >> 16) & 0x1F) // The rt part of the instruction register
#define DECODE_RS ((cpuRegs.code >> 21) & 0x1F) // The rs part of the instruction register
#define DECODE_SA ((cpuRegs.code >> 6) & 0x1F) // The sa part of the instruction register
#define DECODE_IMMED ( cpuRegs.code & 0xFFFF) // The immediate part of the instruction register
#define DECODE_OFFSET ((((short)DECODE_IMMED * 4) + opcode_addr + 4))
#define DECODE_JUMP (opcode_addr & 0xf0000000)|((cpuRegs.code&0x3ffffff)<<2)
#define DECODE_SYSCALL ((opcode_addr & 0x03FFFFFF) >> 6)
#define DECODE_BREAK (DECODE_SYSCALL)
#define DECODE_C0BC ((cpuRegs.code >> 16) & 0x03)
#define DECODE_C1BC ((cpuRegs.code >> 16) & 0x03)
#define DECODE_C2BC ((cpuRegs.code >> 16) & 0x03)
//*************************CPUS REGISTERS*************************
char *GPR_REG[32] = {
"zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
"s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
"t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra"
};
char *COP0_REG[32] ={
"Index","Random","EntryLo0","EntryLo1","Context","PageMask",
"Wired","C0r7","BadVaddr","Count","EntryHi","Compare","Status",
"Cause","EPC","PRId","Config","C0r17","C0r18","C0r19","C0r20",
"C0r21","C0r22","C0r23","Debug","Perf","C0r26","C0r27","TagLo",
"TagHi","ErrorPC","C0r31"
};
//floating point cop1 Floating point reg
char *COP1_REG_FP[32] ={
"f00","f01","f02","f03","f04","f05","f06","f07",
"f08","f09","f10","f11","f12","f13","f14","f15",
"f16","f17","f18","f19","f20","f21","f21","f23",
"f24","f25","f26","f27","f28","f29","f30","f31"
};
//floating point cop1 control registers
char *COP1_REG_FCR[32] ={
"fcr00","fcr01","fcr02","fcr03","fcr04","fcr05","fcr06","fcr07",
"fcr08","fcr09","fcr10","fcr11","fcr12","fcr13","fcr14","fcr15",
"fcr16","fcr17","fcr18","fcr19","fcr20","fcr21","fcr21","fcr23",
"fcr24","fcr25","fcr26","fcr27","fcr28","fcr29","fcr30","fcr31"
};
//floating point cop2 reg
char *COP2_REG_FP[32] ={
"vf00","vf01","vf02","vf03","vf04","vf05","vf06","vf07",
"vf08","vf09","vf10","vf11","vf12","vf13","vf14","vf15",
"vf16","vf17","vf18","vf19","vf20","vf21","vf21","vf23",
"vf24","vf25","vf26","vf27","vf28","vf29","vf30","vf31"
};
//cop2 control registers
char *COP2_REG_CTL[32] ={
"vi00","vi01","vi02","vi03","vi04","vi05","vi06","vi07",
"vi08","vi09","vi10","vi11","vi12","vi13","vi14","vi15",
"Status","MACflag","ClipFlag","c2c19","R","I","Q","c2c23",
"c2c24","c2c25","TPC","CMSAR0","FBRST","VPU-STAT","c2c30","CMSAR1"
};
//****************************************************************
void P_SpecialOpcode(char *buf);
void P_REGIMMOpcode(char *buf);
void P_UnknownOpcode(char *buf);
void P_COP0(char *buf);
void P_COP1(char *buf);
void P_COP2(char *buf);
void P_MMI_Unknown(char *buf);
void P_MMI(char *buf);
void P_MMI0(char *buf);
void P_MMI1(char *buf);
void P_MMI2(char *buf);
void P_MMI3(char *buf);
void P_COP0_Unknown(char *buf);
void P_COP0_BC0(char *buf);
void P_COP0_Func(char *buf);
void P_COP1_BC1(char *buf);
void P_COP1_S(char *buf);
void P_COP1_W(char *buf);
void P_COP1_Unknown(char *buf);
void P_COP2_BC2(char *buf);
void P_COP2_SPECIAL(char *buf);
void P_COP2_Unknown(char *buf);
void P_COP2_SPECIAL2(char *buf);
// **********************Standard Opcodes**************************
void P_J(char *buf);
void P_JAL(char *buf);
void P_BEQ(char *buf);
void P_BNE(char *buf);
void P_BLEZ(char *buf);
void P_BGTZ(char *buf);
void P_ADDI(char *buf);
void P_ADDIU(char *buf);
void P_SLTI(char *buf);
void P_SLTIU(char *buf);
void P_ANDI(char *buf);
void P_ORI(char *buf);
void P_XORI(char *buf);
void P_LUI(char *buf);
void P_BEQL(char *buf);
void P_BNEL(char *buf);
void P_BLEZL(char *buf);
void P_BGTZL(char *buf);
void P_DADDI(char *buf);
void P_DADDIU(char *buf);
void P_LDL(char *buf);
void P_LDR(char *buf);
void P_LB(char *buf);
void P_LH(char *buf);
void P_LWL(char *buf);
void P_LW(char *buf);
void P_LBU(char *buf);
void P_LHU(char *buf);
void P_LWR(char *buf);
void P_LWU(char *buf);
void P_SB(char *buf);
void P_SH(char *buf);
void P_SWL(char *buf);
void P_SW(char *buf);
void P_SDL(char *buf);
void P_SDR(char *buf);
void P_SWR(char *buf);
void P_CACHE(char *buf);
void P_LWC1(char *buf);
void P_PREF(char *buf);
void P_LQC2(char *buf);
void P_LD(char *buf);
void P_SQC2(char *buf);
void P_SD(char *buf);
void P_LQ(char *buf);
void P_SQ(char *buf);
void P_SWC1(char *buf);
//***************end of standard opcodes*************************
//***************SPECIAL OPCODES**********************************
void P_SLL(char *buf);
void P_SRL(char *buf);
void P_SRA(char *buf);
void P_SLLV(char *buf);
void P_SRLV(char *buf);
void P_SRAV(char *buf);
void P_JR(char *buf);
void P_JALR(char *buf);
void P_SYSCALL(char *buf);
void P_BREAK(char *buf);
void P_SYNC(char *buf);
void P_MFHI(char *buf);
void P_MTHI(char *buf);
void P_MFLO(char *buf);
void P_MTLO(char *buf);
void P_DSLLV(char *buf);
void P_DSRLV(char *buf);
void P_DSRAV(char *buf);
void P_MULT(char *buf);
void P_MULTU(char *buf);
void P_DIV(char *buf);
void P_DIVU(char *buf);
void P_ADD(char *buf);
void P_ADDU(char *buf);
void P_SUB(char *buf);
void P_SUBU(char *buf);
void P_AND(char *buf);
void P_OR(char *buf);
void P_XOR(char *buf);
void P_NOR(char *buf);
void P_SLT(char *buf);
void P_SLTU(char *buf);
void P_DADD(char *buf);
void P_DADDU(char *buf);
void P_DSUB(char *buf);
void P_DSUBU(char *buf);
void P_TGE(char *buf);
void P_TGEU(char *buf);
void P_TLT(char *buf);
void P_TLTU(char *buf);
void P_TEQ(char *buf);
void P_TNE(char *buf);
void P_DSLL(char *buf);
void P_DSRL(char *buf);
void P_DSRA(char *buf);
void P_DSLL32(char *buf);
void P_DSRL32(char *buf);
void P_DSRA32(char *buf);
void P_MOVZ(char *buf);
void P_MOVN(char *buf);
void P_MFSA(char *buf);
void P_MTSA(char *buf);
//******************END OF SPECIAL OPCODES**************************
//******************REGIMM OPCODES**********************************
void P_BLTZ(char *buf);
void P_BGEZ(char *buf);
void P_BLTZL(char *buf);
void P_BGEZL(char *buf);
void P_TGEI(char *buf);
void P_TGEIU(char *buf);
void P_TLTI(char *buf);
void P_TLTIU(char *buf);
void P_TEQI(char *buf);
void P_TNEI(char *buf);
void P_BLTZAL(char *buf);
void P_BGEZAL(char *buf);
void P_BLTZALL(char *buf);
void P_BGEZALL(char *buf);
void P_MTSAB(char *buf);
void P_MTSAH(char *buf);
//*****************END OF REGIMM OPCODES*****************************
//*****************MMI OPCODES*********************************
void P_MADD(char *buf);
void P_MADDU(char *buf);
void P_PLZCW(char *buf);
void P_MADD1(char *buf);
void P_MADDU1(char *buf);
void P_MFHI1(char *buf);
void P_MTHI1(char *buf);
void P_MFLO1(char *buf);
void P_MTLO1(char *buf);
void P_MULT1(char *buf);
void P_MULTU1(char *buf);
void P_DIV1(char *buf);
void P_DIVU1(char *buf);
void P_PMFHL(char *buf);
void P_PMTHL(char *buf);
void P_PSLLH(char *buf);
void P_PSRLH(char *buf);
void P_PSRAH(char *buf);
void P_PSLLW(char *buf);
void P_PSRLW(char *buf);
void P_PSRAW(char *buf);
//*****************END OF MMI OPCODES**************************
//*************************MMI0 OPCODES************************
void P_PADDW(char *buf);
void P_PSUBW(char *buf);
void P_PCGTW(char *buf);
void P_PMAXW(char *buf);
void P_PADDH(char *buf);
void P_PSUBH(char *buf);
void P_PCGTH(char *buf);
void P_PMAXH(char *buf);
void P_PADDB(char *buf);
void P_PSUBB(char *buf);
void P_PCGTB(char *buf);
void P_PADDSW(char *buf);
void P_PSUBSW(char *buf);
void P_PEXTLW(char *buf);
void P_PPACW(char *buf);
void P_PADDSH(char *buf);
void P_PSUBSH(char *buf);
void P_PEXTLH(char *buf);
void P_PPACH(char *buf);
void P_PADDSB(char *buf);
void P_PSUBSB(char *buf);
void P_PEXTLB(char *buf);
void P_PPACB(char *buf);
void P_PEXT5(char *buf);
void P_PPAC5(char *buf);
//***END OF MMI0 OPCODES******************************************
//**********MMI1 OPCODES**************************************
void P_PABSW(char *buf);
void P_PCEQW(char *buf);
void P_PMINW(char *buf);
void P_PADSBH(char *buf);
void P_PABSH(char *buf);
void P_PCEQH(char *buf);
void P_PMINH(char *buf);
void P_PCEQB(char *buf);
void P_PADDUW(char *buf);
void P_PSUBUW(char *buf);
void P_PEXTUW(char *buf);
void P_PADDUH(char *buf);
void P_PSUBUH(char *buf);
void P_PEXTUH(char *buf);
void P_PADDUB(char *buf);
void P_PSUBUB(char *buf);
void P_PEXTUB(char *buf);
void P_QFSRV(char *buf);
//********END OF MMI1 OPCODES***********************************
//*********MMI2 OPCODES***************************************
void P_PMADDW(char *buf);
void P_PSLLVW(char *buf);
void P_PSRLVW(char *buf);
void P_PMSUBW(char *buf);
void P_PMFHI(char *buf);
void P_PMFLO(char *buf);
void P_PINTH(char *buf);
void P_PMULTW(char *buf);
void P_PDIVW(char *buf);
void P_PCPYLD(char *buf);
void P_PMADDH(char *buf);
void P_PHMADH(char *buf);
void P_PAND(char *buf);
void P_PXOR(char *buf);
void P_PMSUBH(char *buf);
void P_PHMSBH(char *buf);
void P_PEXEH(char *buf);
void P_PREVH(char *buf);
void P_PMULTH(char *buf);
void P_PDIVBW(char *buf);
void P_PEXEW(char *buf);
void P_PROT3W(char *buf);
//*****END OF MMI2 OPCODES***********************************
//*************************MMI3 OPCODES************************
void P_PMADDUW(char *buf);
void P_PSRAVW(char *buf);
void P_PMTHI(char *buf);
void P_PMTLO(char *buf);
void P_PINTEH(char *buf);
void P_PMULTUW(char *buf);
void P_PDIVUW(char *buf);
void P_PCPYUD(char *buf);
void P_POR(char *buf);
void P_PNOR(char *buf);
void P_PEXCH(char *buf);
void P_PCPYH(char *buf);
void P_PEXCW(char *buf);
//**********************END OF MMI3 OPCODES********************
//****************************************************************************
//** COP0 **
//****************************************************************************
void P_MFC0(char *buf);
void P_MTC0(char *buf);
void P_BC0F(char *buf);
void P_BC0T(char *buf);
void P_BC0FL(char *buf);
void P_BC0TL(char *buf);
void P_TLBR(char *buf);
void P_TLBWI(char *buf);
void P_TLBWR(char *buf);
void P_TLBP(char *buf);
void P_ERET(char *buf);
void P_DI(char *buf);
void P_EI(char *buf);
//****************************************************************************
//** END OF COP0 **
//****************************************************************************
//****************************************************************************
//** COP1 - Floating Point Unit (FPU) **
//****************************************************************************
void P_MFC1(char *buf);
void P_CFC1(char *buf);
void P_MTC1(char *buf);
void P_CTC1(char *buf);
void P_BC1F(char *buf);
void P_BC1T(char *buf);
void P_BC1FL(char *buf);
void P_BC1TL(char *buf);
void P_ADD_S(char *buf);
void P_SUB_S(char *buf);
void P_MUL_S(char *buf);
void P_DIV_S(char *buf);
void P_SQRT_S(char *buf);
void P_ABS_S(char *buf);
void P_MOV_S(char *buf);
void P_NEG_S(char *buf);
void P_RSQRT_S(char *buf);
void P_ADDA_S(char *buf);
void P_SUBA_S(char *buf);
void P_MULA_S(char *buf);
void P_MADD_S(char *buf);
void P_MSUB_S(char *buf);
void P_MADDA_S(char *buf);
void P_MSUBA_S(char *buf);
void P_CVT_W(char *buf);
void P_MAX_S(char *buf);
void P_MIN_S(char *buf);
void P_C_F(char *buf);
void P_C_EQ(char *buf);
void P_C_LT(char *buf);
void P_C_LE(char *buf);
void P_CVT_S(char *buf);
//****************************************************************************
//** END OF COP1 **
//****************************************************************************
//****************************************************************************
//** COP2 - (VU0) **
//****************************************************************************
void P_QMFC2(char *buf);
void P_CFC2(char *buf);
void P_QMTC2(char *buf);
void P_CTC2(char *buf);
void P_BC2F(char *buf);
void P_BC2T(char *buf);
void P_BC2FL(char *buf);
void P_BC2TL(char *buf);
//*****************SPECIAL 1 VUO TABLE*******************************
void P_VADDx(char *buf);
void P_VADDy(char *buf);
void P_VADDz(char *buf);
void P_VADDw(char *buf);
void P_VSUBx(char *buf);
void P_VSUBy(char *buf);
void P_VSUBz(char *buf);
void P_VSUBw(char *buf);
void P_VMADDx(char *buf);
void P_VMADDy(char *buf);
void P_VMADDz(char *buf);
void P_VMADDw(char *buf);
void P_VMSUBx(char *buf);
void P_VMSUBy(char *buf);
void P_VMSUBz(char *buf);
void P_VMSUBw(char *buf);
void P_VMAXx(char *buf);
void P_VMAXy(char *buf);
void P_VMAXz(char *buf);
void P_VMAXw(char *buf);
void P_VMINIx(char *buf);
void P_VMINIy(char *buf);
void P_VMINIz(char *buf);
void P_VMINIw(char *buf);
void P_VMULx(char *buf);
void P_VMULy(char *buf);
void P_VMULz(char *buf);
void P_VMULw(char *buf);
void P_VMULq(char *buf);
void P_VMAXi(char *buf);
void P_VMULi(char *buf);
void P_VMINIi(char *buf);
void P_VADDq(char *buf);
void P_VMADDq(char *buf);
void P_VADDi(char *buf);
void P_VMADDi(char *buf);
void P_VSUBq(char *buf);
void P_VMSUBq(char *buf);
void P_VSUbi(char *buf);
void P_VMSUBi(char *buf);
void P_VADD(char *buf);
void P_VMADD(char *buf);
void P_VMUL(char *buf);
void P_VMAX(char *buf);
void P_VSUB(char *buf);
void P_VMSUB(char *buf);
void P_VOPMSUB(char *buf);
void P_VMINI(char *buf);
void P_VIADD(char *buf);
void P_VISUB(char *buf);
void P_VIADDI(char *buf);
void P_VIAND(char *buf);
void P_VIOR(char *buf);
void P_VCALLMS(char *buf);
void P_CALLMSR(char *buf);
//***********************************END OF SPECIAL1 VU0 TABLE*****************************
//******************************SPECIAL2 VUO TABLE*****************************************
void P_VADDAx(char *buf);
void P_VADDAy(char *buf);
void P_VADDAz(char *buf);
void P_VADDAw(char *buf);
void P_VSUBAx(char *buf);
void P_VSUBAy(char *buf);
void P_VSUBAz(char *buf);
void P_VSUBAw(char *buf);
void P_VMADDAx(char *buf);
void P_VMADDAy(char *buf);
void P_VMADDAz(char *buf);
void P_VMADDAw(char *buf);
void P_VMSUBAx(char *buf);
void P_VMSUBAy(char *buf);
void P_VMSUBAz(char *buf);
void P_VMSUBAw(char *buf);
void P_VITOF0(char *buf);
void P_VITOF4(char *buf);
void P_VITOF12(char *buf);
void P_VITOF15(char *buf);
void P_VFTOI0(char *buf);
void P_VFTOI4(char *buf);
void P_VFTOI12(char *buf);
void P_VFTOI15(char *buf);
void P_VMULAx(char *buf);
void P_VMULAy(char *buf);
void P_VMULAz(char *buf);
void P_VMULAw(char *buf);
void P_VMULAq(char *buf);
void P_VABS(char *buf);
void P_VMULAi(char *buf);
void P_VCLIPw(char *buf);
void P_VADDAq(char *buf);
void P_VMADDAq(char *buf);
void P_VADDAi(char *buf);
void P_VMADDAi(char *buf);
void P_VSUBAq(char *buf);
void P_VMSUBAq(char *buf);
void P_VSUBAi(char *buf);
void P_VMSUBAi(char *buf);
void P_VADDA(char *buf);
void P_VMADDA(char *buf);
void P_VMULA(char *buf);
void P_VSUBA(char *buf);
void P_VMSUBA(char *buf);
void P_VOPMULA(char *buf);
void P_VNOP(char *buf);
void P_VMONE(char *buf);
void P_VMR32(char *buf);
void P_VLQI(char *buf);
void P_VSQI(char *buf);
void P_VLQD(char *buf);
void P_VSQD(char *buf);
void P_VDIV(char *buf);
void P_VSQRT(char *buf);
void P_VRSQRT(char *buf);
void P_VWAITQ(char *buf);
void P_VMTIR(char *buf);
void P_VMFIR(char *buf);
void P_VILWR(char *buf);
void P_VISWR(char *buf);
void P_VRNEXT(char *buf);
void P_VRGET(char *buf);
void P_VRINIT(char *buf);
void P_VRXOR(char *buf);
//************************************END OF SPECIAL2 VUO TABLE****************************
/*
CPU: Instructions encoded by opcode field.
31---------26---------------------------------------------------0
| opcode | |
------6----------------------------------------------------------
|--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
000 | *1 | *2 | J | JAL | BEQ | BNE | BLEZ | BGTZ |
001 | ADDI | ADDIU | SLTI | SLTIU | ANDI | ORI | XORI | LUI |
010 | *3 | *4 | *5 | --- | BEQL | BNEL | BLEZL | BGTZL |
011 | DADDI |DADDIU | LDL | LDR | *6 | --- | LQ | SQ |
100 | LB | LH | LWL | LW | LBU | LHU | LWR | LWU |
101 | SB | SH | SWL | SW | SDL | SDR | SWR | CACHE |
110 | --- | LWC1 | --- | PREF | --- | --- | LQC2 | LD |
111 | --- | SWC1 | --- | --- | --- | --- | SQC2 | SD |
hi |-------|-------|-------|-------|-------|-------|-------|-------|
*1 = SPECIAL, see SPECIAL list *2 = REGIMM, see REGIMM list
*3 = COP0 *4 = COP1
*5 = COP2 *6 = MMI table
*/
void (*OpcodePrintTable[64])(char *buf) = {
P_SpecialOpcode, P_REGIMMOpcode, P_J, P_JAL, P_BEQ, P_BNE, P_BLEZ, P_BGTZ,
P_ADDI, P_ADDIU, P_SLTI, P_SLTIU, P_ANDI, P_ORI, P_XORI, P_LUI,
P_COP0, P_COP1, P_COP2, P_UnknownOpcode, P_BEQL, P_BNEL, P_BLEZL, P_BGTZL,
P_DADDI, P_DADDIU, P_LDL, P_LDR, P_MMI, P_UnknownOpcode, P_LQ, P_SQ,
P_LB, P_LH, P_LWL, P_LW, P_LBU, P_LHU, P_LWR, P_LWU,
P_SB, P_SH, P_SWL, P_SW, P_SDL, P_SDR, P_SWR, P_CACHE,
P_UnknownOpcode, P_LWC1, P_UnknownOpcode, P_PREF, P_UnknownOpcode,P_UnknownOpcode, P_LQC2, P_LD,
P_UnknownOpcode, P_SWC1, P_UnknownOpcode, P_UnknownOpcode, P_UnknownOpcode,P_UnknownOpcode, P_SQC2, P_SD
};
/*
SPECIAL: Instr. encoded by function field when opcode field = SPECIAL
31---------26------------------------------------------5--------0
| = SPECIAL | | function|
------6----------------------------------------------------6-----
|--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
000 | SLL | --- | SRL | SRA | SLLV | --- | SRLV | SRAV |
001 | JR | JALR | MOVZ | MOVN |SYSCALL| BREAK | --- | SYNC |
010 | MFHI | MTHI | MFLO | MTLO | DSLLV | --- | DSRLV | DSRAV |
011 | MULT | MULTU | DIV | DIVU | ---- | --- | ---- | ----- |
100 | ADD | ADDU | SUB | SUBU | AND | OR | XOR | NOR |
101 | MFSA | MTSA | SLT | SLTU | DADD | DADDU | DSUB | DSUBU |
110 | TGE | TGEU | TLT | TLTU | TEQ | --- | TNE | --- |
111 | DSLL | --- | DSRL | DSRA |DSLL32 | --- |DSRL32 |DSRA32 |
hi |-------|-------|-------|-------|-------|-------|-------|-------|
*/
void (*SpecialPrintTable[64])(char *buf) = {
P_SLL, P_UnknownOpcode, P_SRL, P_SRA, P_SLLV, P_UnknownOpcode, P_SRLV, P_SRAV,
P_JR, P_JALR, P_MOVZ, P_MOVN, P_SYSCALL, P_BREAK, P_UnknownOpcode, P_SYNC,
P_MFHI, P_MTHI, P_MFLO, P_MTLO, P_DSLLV, P_UnknownOpcode, P_DSRLV, P_DSRAV,
P_MULT, P_MULTU, P_DIV, P_DIVU, P_UnknownOpcode,P_UnknownOpcode,P_UnknownOpcode,P_UnknownOpcode,
P_ADD, P_ADDU, P_SUB, P_SUBU, P_AND, P_OR, P_XOR, P_NOR,
P_MFSA , P_MTSA , P_SLT, P_SLTU, P_DADD, P_DADDU, P_DSUB, P_DSUBU,
P_TGE, P_TGEU, P_TLT, P_TLTU, P_TEQ, P_UnknownOpcode, P_TNE, P_UnknownOpcode,
P_DSLL, P_UnknownOpcode, P_DSRL, P_DSRA, P_DSLL32, P_UnknownOpcode, P_DSRL32, P_DSRA32
};
/*
REGIMM: Instructions encoded by the rt field when opcode field = REGIMM.
31---------26----------20-------16------------------------------0
| = REGIMM | | rt | |
------6---------------------5------------------------------------
|--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
00 | BLTZ | BGEZ | BLTZL | BGEZL | --- | --- | --- | --- |
01 | TGEI | TGEIU | TLTI | TLTIU | TEQI | --- | TNEI | --- |
10 | BLTZAL| BGEZAL|BLTZALL|BGEZALL| --- | --- | --- | --- |
11 | MTSAB | MTSAH | --- | --- | --- | --- | --- | --- |
hi |-------|-------|-------|-------|-------|-------|-------|-------|
*/
void (*REGIMMPrintTable[32])(char *buf) = {
P_BLTZ, P_BGEZ, P_BLTZL, P_BGEZL, P_UnknownOpcode, P_UnknownOpcode, P_UnknownOpcode, P_UnknownOpcode,
P_TGEI, P_TGEIU, P_TLTI, P_TLTIU, P_TEQI, P_UnknownOpcode, P_TNEI, P_UnknownOpcode,
P_BLTZAL, P_BGEZAL, P_BLTZALL, P_BGEZALL, P_UnknownOpcode, P_UnknownOpcode, P_UnknownOpcode, P_UnknownOpcode,
P_MTSAB, P_MTSAH , P_UnknownOpcode, P_UnknownOpcode, P_UnknownOpcode, P_UnknownOpcode, P_UnknownOpcode, P_UnknownOpcode,
};
/*
MMI: Instr. encoded by function field when opcode field = MMI
31---------26------------------------------------------5--------0
| = MMI | | function|
------6----------------------------------------------------6-----
|--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
000 | MADD | MADDU | --- | --- | PLZCW | --- | --- | --- |
001 | *1 | *2 | --- | --- | --- | --- | --- | --- |
010 | MFHI1 | MTHI1 | MFLO1 | MTLO1 | --- | --- | --- | --- |
011 | MULT1 | MULTU1| DIV1 | DIVU1 | --- | --- | --- | --- |
100 | MADD1 | MADDU1| --- | --- | --- | --- | --- | --- |
101 | *3 | *4 | --- | --- | --- | --- | --- | --- |
110 | PMFHL | PMTHL | --- | --- | PSLLH | --- | PSRLH | PSRAH |
111 | --- | --- | --- | --- | PSLLW | --- | PSRLW | PSRAW |
hi |-------|-------|-------|-------|-------|-------|-------|-------|
*1 = see MMI0 table *2 = see MMI2 Table
*3 = see MMI1 table *4 = see MMI3 Table
*/
void (*MMIPrintTable[64])(char *buf) = {
P_MADD, P_MADDU, P_MMI_Unknown, P_MMI_Unknown, P_PLZCW, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown,
P_MMI0, P_MMI2, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown,
P_MFHI1, P_MTHI1, P_MFLO1, P_MTLO1, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown,
P_MULT1, P_MULTU1, P_DIV1, P_DIVU1, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown,
P_MADD1, P_MADDU1, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown,
P_MMI1 , P_MMI3, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown,
P_PMFHL, P_PMTHL, P_MMI_Unknown, P_MMI_Unknown, P_PSLLH, P_MMI_Unknown, P_PSRLH, P_PSRAH,
P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown, P_PSLLW, P_MMI_Unknown, P_PSRLW, P_PSRAW,
};
/*
MMI0: Instr. encoded by function field when opcode field = MMI & MMI0
31---------26------------------------------10--------6-5--------0
| | |function | MMI0 |
------6----------------------------------------------------6-----
|--000--|--001--|--010--|--011--| lo
000 |PADDW | PSUBW | PCGTW | PMAXW |
001 |PADDH | PSUBH | PCGTH | PMAXH |
010 |PADDB | PSUBB | PCGTB | --- |
011 | --- | --- | --- | --- |
100 |PADDSW |PSUBSW |PEXTLW | PPACW |
101 |PADDSH |PSUBSH |PEXTLH | PPACH |
110 |PADDSB |PSUBSB |PEXTLB | PPACB |
111 | --- | --- | PEXT5 | PPAC5 |
hi |-------|-------|-------|-------|
*/
void (*MMI0PrintTable[32])(char *buf) = {
P_PADDW, P_PSUBW, P_PCGTW, P_PMAXW,
P_PADDH, P_PSUBH, P_PCGTH, P_PMAXH,
P_PADDB, P_PSUBB, P_PCGTB, P_MMI_Unknown,
P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown,
P_PADDSW, P_PSUBSW, P_PEXTLW, P_PPACW,
P_PADDSH, P_PSUBSH, P_PEXTLH, P_PPACH,
P_PADDSB, P_PSUBSB, P_PEXTLB, P_PPACB,
P_MMI_Unknown, P_MMI_Unknown, P_PEXT5, P_PPAC5,
};
/*
MMI1: Instr. encoded by function field when opcode field = MMI & MMI1
31---------26------------------------------------------5--------0
| | |function | MMI1 |
------6----------------------------------------------------6-----
|--000--|--001--|--010--|--011--| lo
000 | --- | PABSW | PCEQW | PMINW |
001 |PADSBH | PABSH | PCEQH | PMINH |
010 | --- | --- | PCEQB | --- |
011 | --- | --- | --- | --- |
100 |PADDUW |PSUBUW |PEXTUW | --- |
101 |PADDUH |PSUBUH |PEXTUH | --- |
110 |PADDUB |PSUBUB |PEXTUB | QFSRV |
111 | --- | --- | --- | --- |
hi |-------|-------|-------|-------|
*/
void (*MMI1PrintTable[32])(char *buf) = {
P_MMI_Unknown, P_PABSW, P_PCEQW, P_PMINW,
P_PADSBH, P_PABSH, P_PCEQH, P_PMINH,
P_MMI_Unknown, P_MMI_Unknown, P_PCEQB, P_MMI_Unknown,
P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown,
P_PADDUW, P_PSUBUW, P_PEXTUW, P_MMI_Unknown,
P_PADDUH, P_PSUBUH, P_PEXTUH, P_MMI_Unknown,
P_PADDUB, P_PSUBUB, P_PEXTUB, P_QFSRV,
P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown,
};
/*
MMI2: Instr. encoded by function field when opcode field = MMI & MMI2
31---------26------------------------------------------5--------0
| | |function | MMI2 |
------6----------------------------------------------------6-----
|--000--|--001--|--010--|--011--| lo
000 |PMADDW | --- |PSLLVW |PSRLVW |
001 |PMSUBW | --- | --- | --- |
010 |PMFHI |PMFLO |PINTH | --- |
011 |PMULTW |PDIVW |PCPYLD | --- |
100 |PMADDH |PHMADH | PAND | PXOR |
101 |PMSUBH |PHMSBH | --- | --- |
110 | --- | --- | PEXEH | PREVH |
111 |PMULTH |PDIVBW | PEXEW |PROT3W |
hi |-------|-------|-------|-------|
*/
void (*MMI2PrintTable[32])(char *buf) = {
P_PMADDW, P_MMI_Unknown, P_PSLLVW, P_PSRLVW,
P_PMSUBW, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown,
P_PMFHI, P_PMFLO, P_PINTH, P_MMI_Unknown,
P_PMULTW, P_PDIVW, P_PCPYLD, P_MMI_Unknown,
P_PMADDH, P_PHMADH, P_PAND, P_PXOR,
P_PMSUBH, P_PHMSBH, P_MMI_Unknown, P_MMI_Unknown,
P_MMI_Unknown, P_MMI_Unknown, P_PEXEH, P_PREVH,
P_PMULTH, P_PDIVBW, P_PEXEW, P_PROT3W,
};
/*
MMI3: Instr. encoded by function field when opcode field = MMI & MMI3
31---------26------------------------------------------5--------0
| | |function | MMI3 |
------6----------------------------------------------------6-----
|--000--|--001--|--010--|--011--| lo
000 |PMADDUW| --- | --- |PSRAVW |
001 | --- | --- | --- | --- |
010 |PMTHI | PMTLO |PINTEH | --- |
011 |PMULTUW| PDIVUW|PCPYUD | --- |
100 | --- | --- | POR | PNOR |
101 | --- | --- | --- | --- |
110 | --- | --- | PEXCH | PCPYH |
111 | --- | --- | PEXCW | --- |
hi |-------|-------|-------|-------|
*/
void (*MMI3PrintTable[32])(char *buf) = {
P_PMADDUW, P_MMI_Unknown, P_MMI_Unknown, P_PSRAVW,
P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown,
P_PMTHI, P_PMTLO, P_PINTEH, P_MMI_Unknown,
P_PMULTUW, P_PDIVUW, P_PCPYUD, P_MMI_Unknown,
P_MMI_Unknown, P_MMI_Unknown, P_POR, P_PNOR,
P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown, P_MMI_Unknown,
P_MMI_Unknown, P_MMI_Unknown, P_PEXCH, P_PCPYH,
P_MMI_Unknown, P_MMI_Unknown, P_PEXCW, P_MMI_Unknown,
};
/*
COP0: Instructions encoded by the rs field when opcode = COP0.
31--------26-25------21 ----------------------------------------0
| = COP0 | fmt | |
------6----------5-----------------------------------------------
|--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
00 | MFC0 | --- | --- | --- | MTC0 | --- | --- | --- |
01 | *1 | --- | --- | --- | --- | --- | --- | --- |
10 | *2 | --- | --- | --- | --- | --- | --- | --- |
11 | --- | --- | --- | --- | --- | --- | --- | --- |
hi |-------|-------|-------|-------|-------|-------|-------|-------|
*1=BC See BC0 list *2 = TLB instr, see TLB list
*/
void (*COP0PrintTable[32])(char *buf) = {
P_MFC0, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_MTC0, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown,
P_COP0_BC0, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown,
P_COP0_Func, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown,
P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown,
};
/*
BC0: Instructions encoded by the rt field when opcode = COP0 & rs field=BC0
31--------26-25------21 ----------------------------------------0
| = COP0 | fmt | |
------6----------5-----------------------------------------------
|--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
00 | BC0F | BC0T | BC0FL | BC0TL | --- | --- | --- | --- |
01 | --- | --- | --- | --- | --- | --- | --- | --- |
10 | --- | --- | --- | --- | --- | --- | --- | --- |
11 | --- | --- | --- | --- | --- | --- | --- | --- |
hi |-------|-------|-------|-------|-------|-------|-------|-------|
*/
void (*COP0BC0PrintTable[32])(char *buf) = {
P_BC0F, P_BC0T, P_BC0FL, P_BC0TL, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown,
P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown,
P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown,
P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown,
};
/*
C0=Instructions encode by function field when Opcode field=COP0 & rs field=C0
31---------26------------------------------------------5--------0
| | | |
------6----------------------------------------------------6-----
|--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
000 | --- | TLBR | TLBWI | --- | --- | --- | TLBWR | --- |
001 | TLBP | --- | --- | --- | --- | --- | --- | --- |
010 | --- | --- | --- | --- | --- | --- | --- | --- |
011 | ERET | --- | --- | --- | --- | --- | --- | --- |
100 | --- | --- | --- | --- | --- | --- | --- | --- |
101 | --- | --- | --- | --- | --- | --- | --- | --- |
110 | --- | --- | --- | --- | --- | --- | --- | --- |
111 | EI | DI | --- | --- | --- | --- | --- | --- |
hi |-------|-------|-------|-------|-------|-------|-------|-------|
*/
void (*COP0C0PrintTable[64])(char *buf) = {
P_COP0_Unknown, P_TLBR, P_TLBWI, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_TLBWR, P_COP0_Unknown,
P_TLBP, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown,
P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown,
P_ERET, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown,
P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown,
P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown,
P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown,
P_EI, P_DI, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown, P_COP0_Unknown
};
/*
COP1: Instructions encoded by the fmt field when opcode = COP1.
31--------26-25------21 ----------------------------------------0
| = COP1 | fmt | |
------6----------5-----------------------------------------------
|--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
00 | MFC1 | --- | CFC1 | --- | MTC1 | --- | CTC1 | --- |
01 | *1 | --- | --- | --- | --- | --- | --- | --- |
10 | *2 | --- | --- | --- | *3 | --- | --- | --- |
11 | --- | --- | --- | --- | --- | --- | --- | --- |
hi |-------|-------|-------|-------|-------|-------|-------|-------|
*1 = BC instructions, see BC1 list *2 = S instr, see FPU list
*3 = W instr, see FPU list
*/
void (*COP1PrintTable[32])(char *buf) = {
P_MFC1, P_COP1_Unknown, P_CFC1, P_COP1_Unknown, P_MTC1, P_COP1_Unknown, P_CTC1, P_COP1_Unknown,
P_COP1_BC1, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown,
P_COP1_S, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_W, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown,
P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown,
};
/*
BC1: Instructions encoded by the rt field when opcode = COP1 & rs field=BC1
31--------26-25------21 ----------------------------------------0
| = COP1 | fmt | |
------6----------5-----------------------------------------------
|--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
00 | BC1F | BC1T | BC1FL | BC1TL | --- | --- | --- | --- |
01 | --- | --- | --- | --- | --- | --- | --- | --- |
10 | --- | --- | --- | --- | --- | --- | --- | --- |
11 | --- | --- | --- | --- | --- | --- | --- | --- |
hi |-------|-------|-------|-------|-------|-------|-------|-------|
*/
void (*COP1BC1PrintTable[32])(char *buf) = {
P_BC1F, P_BC1T, P_BC1FL, P_BC1TL, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown,
P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown,
P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown,
P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown, P_COP1_Unknown,
};
/*
FPU: Instructions encoded by the function field when opcode = COP1
and rs = S
31--------26-25------21 -------------------------------5--------0
| = COP1 | = S | | function|
------6----------5-----------------------------------------6-----
|--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
000 | ADD.S | SUB.S | MUL.S | DIV.S | SQRT.S| ABS.S | MOV.S | NEG.S |
001 | --- | --- | --- | --- | --- | --- | --- | --- |
010 | --- | --- | --- | --- | --- | --- |RSQRT.S| --- |
011 | ADDA.S| SUBA.S| MULA.S| --- | MADD.S| MSUB.S|MADDA.S|MSUBA.S|
100 | --- | --- | --- | --- | CVT.W | --- | --- | --- |
101 | MAX.S | MIN.S | --- | --- | --- | --- | --- | --- |
110 | C.F | --- | C.EQ | --- | C.LT | --- | C.LE | --- |
111 | --- | --- | --- | --- | --- | --- | --- | --- |
hi |-------|-------|-------|-------|-------|-------|-------|-------|
*/
void (*COP1SPrintTable[64])(char *buf) = {
P_ADD_S, P_SUB_S, P_MUL_S, P_DIV_S, P_SQRT_S, P_ABS_S, P_MOV_S, P_NEG_S,
P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,
P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_RSQRT_S, P_COP1_Unknown,
P_ADDA_S, P_SUBA_S, P_MULA_S, P_COP1_Unknown,P_MADD_S, P_MSUB_S, P_MADDA_S, P_MSUBA_S,
P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_CVT_W, P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,
P_MAX_S, P_MIN_S, P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,
P_C_F, P_COP1_Unknown,P_C_EQ, P_COP1_Unknown,P_C_LT, P_COP1_Unknown,P_C_LE, P_COP1_Unknown,
P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,
};
/*
FPU: Instructions encoded by the function field when opcode = COP1
and rs = W
31--------26-25------21 -------------------------------5--------0
| = COP1 | = W | | function|
------6----------5-----------------------------------------6-----
|--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
000 | --- | --- | --- | --- | --- | --- | --- | --- |
001 | --- | --- | --- | --- | --- | --- | --- | --- |
010 | --- | --- | --- | --- | --- | --- | --- | --- |
011 | --- | --- | --- | --- | --- | --- | --- | --- |
100 | CVT.S | --- | --- | --- | --- | --- | --- | --- |
101 | --- | --- | --- | --- | --- | --- | --- | --- |
110 | --- | --- | --- | --- | --- | --- | --- | --- |
111 | --- | --- | --- | --- | --- | --- | --- | --- |
hi |-------|-------|-------|-------|-------|-------|-------|-------|
*/
void (*COP1WPrintTable[64])(char *buf) = {
P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,
P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,
P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,
P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,
P_CVT_S, P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,
P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,
P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,
P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,P_COP1_Unknown,
};
//*************************************************************
//COP2 TABLES :)
//*************************************************************
/*
COP2: Instructions encoded by the fmt field when opcode = COP2.
31--------26-25------21 ----------------------------------------0
| = COP2 | fmt | |
------6----------5-----------------------------------------------
|--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
00 | --- | QMFC2 | CFC2 | --- | --- | QMTC2 | CTC2 | --- |
01 | *1 | --- | --- | --- | --- | --- | --- | --- |
10 | *2 | *2 | *2 | *2 | *2 | *2 | *2 | *2 |
11 | *2 | *2 | *2 | *2 | *2 | *2 | *2 | *2 |
hi |-------|-------|-------|-------|-------|-------|-------|-------|
*1 = BC instructions, see BC2 list *2 =see special1 table
*/
void (*COP2PrintTable[32])(char *buf) = {
P_COP2_Unknown, P_QMFC2, P_CFC2, P_COP2_Unknown, P_COP2_Unknown, P_QMTC2, P_CTC2, P_COP2_Unknown,
P_COP2_BC2, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown,
P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL,
P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL,
};
/*
BC2: Instructions encoded by the rt field when opcode = COP2 & rs field=BC1
31--------26-25------21 ----------------------------------------0
| = COP2 | rs=BC2| |
------6----------5-----------------------------------------------
|--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
00 | BC2F | BC2T | BC2FL | BC2TL | --- | --- | --- | --- |
01 | --- | --- | --- | --- | --- | --- | --- | --- |
10 | --- | --- | --- | --- | --- | --- | --- | --- |
11 | --- | --- | --- | --- | --- | --- | --- | --- |
hi |-------|-------|-------|-------|-------|-------|-------|-------|
*/
void (*COP2BC2PrintTable[32])(char *buf) = {
P_BC2F, P_BC2T, P_BC2FL, P_BC2TL, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown,
P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown,
P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown,
P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown,
};
/*
Special1 table : instructions encode by function field when opcode=COP2 & rs field=Special1
31---------26---------------------------------------------------0
| =COP2 | rs=Special |
------6----------------------------------------------------------
|--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
000 |VADDx |VADDy |VADDz |VADDw |VSUBx |VSUBy |VSUBz |VSUBw |
001 |VMADDx |VMADDy |VMADDz |VMADDw |VMSUBx |VMSUBy |VMSUBz |VMSUBw |
010 |VMAXx |VMAXy |VMAXz |VMAXw |VMINIx |VMINIy |VMINIz |VMINIw |
011 |VMULx |VMULy |VMULz |VMULw |VMULq |VMAXi |VMULi |VMINIi |
100 |VADDq |VMADDq |VADDi |VMADDi |VSUBq |VMSUBq |VSUbi |VMSUBi |
101 |VADD |VMADD |VMUL |VMAX |VSUB |VMSUB |VOPMSUB|VMINI |
110 |VIADD |VISUB |VIADDI | --- |VIAND |VIOR | --- | --- |
111 |VCALLMS|CALLMSR| --- | --- | *1 | *1 | *1 | *1 |
hi |-------|-------|-------|-------|-------|-------|-------|-------|
*1=see special2 table
*/
void (*COP2SPECIAL1PrintTable[64])(char *buf) =
{
P_VADDx, P_VADDy, P_VADDz, P_VADDw, P_VSUBx, P_VSUBy, P_VSUBz, P_VSUBw,
P_VMADDx, P_VMADDy, P_VMADDz, P_VMADDw, P_VMSUBx, P_VMSUBy, P_VMSUBz, P_VMSUBw,
P_VMAXx, P_VMAXy, P_VMAXz, P_VMAXw, P_VMINIx, P_VMINIy, P_VMINIz, P_VMINIw,
P_VMULx, P_VMULy, P_VMULz, P_VMULw, P_VMULq, P_VMAXi, P_VMULi, P_VMINIi,
P_VADDq, P_VMADDq, P_VADDi, P_VMADDi, P_VSUBq, P_VMSUBq, P_VSUbi, P_VMSUBi,
P_VADD, P_VMADD, P_VMUL, P_VMAX, P_VSUB, P_VMSUB, P_VOPMSUB, P_VMINI,
P_VIADD, P_VISUB, P_VIADDI, P_COP2_Unknown,P_VIAND, P_VIOR, P_COP2_Unknown, P_COP2_Unknown,
P_VCALLMS, P_CALLMSR, P_COP2_Unknown,P_COP2_Unknown,P_COP2_SPECIAL2,P_COP2_SPECIAL2,P_COP2_SPECIAL2,P_COP2_SPECIAL2,
};
/*
Special2 table : instructions encode by function field when opcode=COp2 & rs field=Special2
31---------26---------------------------------------------------0
| =COP2 | rs=Special2 |
------6----------------------------------------------------------
|--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
0000 |VADDAx |VADDAy |VADDAz |VADDAw |VSUBAx |VSUBAy |VSUBAz |VSUBAw |
0001 |VMADDAx|VMADDAy|VMADDAz|VMADDAw|VMSUBAx|VMSUBAy|VMSUBAz|VMSUBAw|
0010 |VITOF0 |VITOF4 |VITOF12|VITOF15|VFTOI0 |VFTOI4 |VFTOI12|VFTOI15|
0011 |VMULAx |VMULAy |VMULAz |VMULAw |VMULAq |VABS |VMULAi |VCLIPw |
0100 |VADDAq |VMADDAq|VADDAi |VMADDAi|VSUBAq |VMSUBAq|VSUBAi |VMSUBAi|