~random-stuff/random-stuff/snes9x-OLD

1 by OV2
Initial 1.52 import
1
/***********************************************************************************
2
  Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
3
4
  (c) Copyright 1996 - 2002  Gary Henderson (gary.henderson@ntlworld.com),
5
                             Jerremy Koot (jkoot@snes9x.com)
6
7
  (c) Copyright 2002 - 2004  Matthew Kendora
8
9
  (c) Copyright 2002 - 2005  Peter Bortas (peter@bortas.org)
10
11
  (c) Copyright 2004 - 2005  Joel Yliluoma (http://iki.fi/bisqwit/)
12
13
  (c) Copyright 2001 - 2006  John Weidman (jweidman@slip.net)
14
15
  (c) Copyright 2002 - 2006  funkyass (funkyass@spam.shaw.ca),
16
                             Kris Bleakley (codeviolation@hotmail.com)
17
18
  (c) Copyright 2002 - 2010  Brad Jorsch (anomie@users.sourceforge.net),
19
                             Nach (n-a-c-h@users.sourceforge.net),
87 by OV2
Update copyright in all files
20
21
  (c) Copyright 2002 - 2011  zones (kasumitokoduck@yahoo.com)
1 by OV2
Initial 1.52 import
22
23
  (c) Copyright 2006 - 2007  nitsuja
24
290 by Brandon Wright
Update some copyrights, bump version number.
25
  (c) Copyright 2009 - 2016  BearOso,
1 by OV2
Initial 1.52 import
26
                             OV2
27
28
29
  BS-X C emulator code
30
  (c) Copyright 2005 - 2006  Dreamer Nom,
31
                             zones
32
33
  C4 x86 assembler and some C emulation code
34
  (c) Copyright 2000 - 2003  _Demo_ (_demo_@zsnes.com),
35
                             Nach,
36
                             zsKnight (zsknight@zsnes.com)
37
38
  C4 C++ code
39
  (c) Copyright 2003 - 2006  Brad Jorsch,
40
                             Nach
41
42
  DSP-1 emulator code
43
  (c) Copyright 1998 - 2006  _Demo_,
44
                             Andreas Naive (andreasnaive@gmail.com),
45
                             Gary Henderson,
46
                             Ivar (ivar@snes9x.com),
47
                             John Weidman,
48
                             Kris Bleakley,
49
                             Matthew Kendora,
50
                             Nach,
51
                             neviksti (neviksti@hotmail.com)
52
53
  DSP-2 emulator code
54
  (c) Copyright 2003         John Weidman,
55
                             Kris Bleakley,
56
                             Lord Nightmare (lord_nightmare@users.sourceforge.net),
57
                             Matthew Kendora,
58
                             neviksti
59
60
  DSP-3 emulator code
61
  (c) Copyright 2003 - 2006  John Weidman,
62
                             Kris Bleakley,
63
                             Lancer,
64
                             z80 gaiden
65
66
  DSP-4 emulator code
67
  (c) Copyright 2004 - 2006  Dreamer Nom,
68
                             John Weidman,
69
                             Kris Bleakley,
70
                             Nach,
71
                             z80 gaiden
72
73
  OBC1 emulator code
74
  (c) Copyright 2001 - 2004  zsKnight,
75
                             pagefault (pagefault@zsnes.com),
76
                             Kris Bleakley
77
                             Ported from x86 assembler to C by sanmaiwashi
78
79
  SPC7110 and RTC C++ emulator code used in 1.39-1.51
80
  (c) Copyright 2002         Matthew Kendora with research by
81
                             zsKnight,
82
                             John Weidman,
83
                             Dark Force
84
85
  SPC7110 and RTC C++ emulator code used in 1.52+
86
  (c) Copyright 2009         byuu,
87
                             neviksti
88
89
  S-DD1 C emulator code
90
  (c) Copyright 2003         Brad Jorsch with research by
91
                             Andreas Naive,
92
                             John Weidman
93
94
  S-RTC C emulator code
95
  (c) Copyright 2001 - 2006  byuu,
96
                             John Weidman
97
98
  ST010 C++ emulator code
99
  (c) Copyright 2003         Feather,
100
                             John Weidman,
101
                             Kris Bleakley,
102
                             Matthew Kendora
103
104
  Super FX x86 assembler emulator code
105
  (c) Copyright 1998 - 2003  _Demo_,
106
                             pagefault,
107
                             zsKnight
108
109
  Super FX C emulator code
110
  (c) Copyright 1997 - 1999  Ivar,
111
                             Gary Henderson,
112
                             John Weidman
113
114
  Sound emulator code used in 1.5-1.51
115
  (c) Copyright 1998 - 2003  Brad Martin
116
  (c) Copyright 1998 - 2006  Charles Bilyue'
117
118
  Sound emulator code used in 1.52+
119
  (c) Copyright 2004 - 2007  Shay Green (gblargg@gmail.com)
120
295 by Brandon Wright
Add byuu copyright for his S-SMP
121
  S-SMP emulator code used in 1.54+
122
  (c) Copyright 2016         byuu
123
1 by OV2
Initial 1.52 import
124
  SH assembler code partly based on x86 assembler code
125
  (c) Copyright 2002 - 2004  Marcus Comstedt (marcus@mc.pp.se)
126
127
  2xSaI filter
128
  (c) Copyright 1999 - 2001  Derek Liauw Kie Fa
129
130
  HQ2x, HQ3x, HQ4x filters
131
  (c) Copyright 2003         Maxim Stepin (maxim@hiend3d.com)
132
133
  NTSC filter
134
  (c) Copyright 2006 - 2007  Shay Green
135
136
  GTK+ GUI code
290 by Brandon Wright
Update some copyrights, bump version number.
137
  (c) Copyright 2004 - 2016  BearOso
1 by OV2
Initial 1.52 import
138
139
  Win32 GUI code
140
  (c) Copyright 2003 - 2006  blip,
141
                             funkyass,
142
                             Matthew Kendora,
143
                             Nach,
144
                             nitsuja
298 by Brandon Wright
Bump OV2 Windows port copyright.
145
  (c) Copyright 2009 - 2016  OV2
1 by OV2
Initial 1.52 import
146
147
  Mac OS GUI code
148
  (c) Copyright 1998 - 2001  John Stiles
87 by OV2
Update copyright in all files
149
  (c) Copyright 2001 - 2011  zones
1 by OV2
Initial 1.52 import
150
151
152
  Specific ports contains the works of other authors. See headers in
153
  individual files.
154
155
156
  Snes9x homepage: http://www.snes9x.com/
157
158
  Permission to use, copy, modify and/or distribute Snes9x in both binary
159
  and source form, for non-commercial purposes, is hereby granted without
160
  fee, providing that this license information and copyright notice appear
161
  with all copies and any derived work.
162
163
  This software is provided 'as-is', without any express or implied
164
  warranty. In no event shall the authors be held liable for any damages
165
  arising from the use of this software or it's derivatives.
166
167
  Snes9x is freeware for PERSONAL USE only. Commercial users should
168
  seek permission of the copyright holders first. Commercial use includes,
169
  but is not limited to, charging money for Snes9x or software derived from
170
  Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
171
  using Snes9x as a promotion for your commercial product.
172
173
  The copyright holders request that bug fixes and improvements to the code
174
  should be forwarded to them so everyone can benefit from the modifications
175
  in future versions.
176
177
  Super NES and Super Nintendo Entertainment System are trademarks of
178
  Nintendo Co., Limited and its subsidiary companies.
179
 ***********************************************************************************/
180
181
182
#ifdef DEBUGGER
183
184
#include "snes9x.h"
185
#include "fxinst.h"
186
#include "fxemu.h"
187
188
/*
189
  When printing a line from the pipe, it could look like this:
190
191
  01:8006 f4 fb 86 iwt r4, #$86fb
192
193
  The values are:
194
  program bank                  : 01
195
  adress                        : 8006
196
  values at memory address 8006 : f4 fb 86
197
  instruction in the pipe       : iwt r4, #$86fb
198
199
  Note! If the instruction has more than one byte (like in 'iwt') and the instruction is in a delay slot,
200
  the second and third byte displayed will not be the same as those used.
201
  Since the instrction is in a delay slot,
202
  the first byte of the instruction will be taken from the pipe at the address after the branch instruction,
203
  and the next one or two bytes will be taken from the address that the branch points to.
204
  This is a bit complicated, but I've taken this into account, in this debug function.
205
  (See the diffrence of how the values vPipe1 and vPipe2 are read, compared to the values vByte1 and vByte2)
206
*/
207
208
/*
209
static const char	*fx_apvMnemonicTable[] =
210
{
211
	// ALT0 Table
212
213
	// 00 - 0f
214
	"stop",
215
	"nop",
216
	"cache",
217
	"lsr",
218
	"rol",
219
	"bra $%04x",
220
	"blt $%04x",
221
	"bge $%04x",
222
	"bne $%04x",
223
	"beq $%04x",
224
	"bpl $%04x",
225
	"bmi $%04x",
226
	"bcc $%04x",
227
	"bcs $%04x",
228
	"bvc $%04x",
229
	"bvs $%04x",
230
231
	// 10 - 1f
232
	"to r0",
233
	"to r1",
234
	"to r2",
235
	"to r3",
236
	"to r4",
237
	"to r5",
238
	"to r6",
239
	"to r7",
240
	"to r8",
241
	"to r9",
242
	"to r10",
243
	"to r11",
244
	"to r12",
245
	"to r13",
246
	"to r14",
247
	"to r15",
248
249
	// 20 - 2f
250
	"with r0",
251
	"with r1",
252
	"with r2",
253
	"with r3",
254
	"with r4",
255
	"with r5",
256
	"with r6",
257
	"with r7",
258
	"with r8",
259
	"with r9",
260
	"with r10",
261
	"with r11",
262
	"with r12",
263
	"with r13",
264
	"with r14",
265
	"with r15",
266
267
	// 30 - 3f
268
	"stw (r0)",
269
	"stw (r1)",
270
	"stw (r2)",
271
	"stw (r3)",
272
	"stw (r4)",
273
	"stw (r5)",
274
	"stw (r6)",
275
	"stw (r7)",
276
	"stw (r8)",
277
	"stw (r9)",
278
	"stw (r10)",
279
	"stw (r11)",
280
	"loop",
281
	"alt1",
282
	"alt2",
283
	"alt3",
284
285
	// 40 - 4f
286
	"ldw (r0)",
287
	"ldw (r1)",
288
	"ldw (r2)",
289
	"ldw (r3)",
290
	"ldw (r4)",
291
	"ldw (r5)",
292
	"ldw (r6)",
293
	"ldw (r7)",
294
	"ldw (r8)",
295
	"ldw (r9)",
296
	"ldw (r10)",
297
	"ldw (r11)",
298
	"plot",
299
	"swap",
300
	"color",
301
	"not",
302
303
	// 50 - 5f
304
	"add r0",
305
	"add r1",
306
	"add r2",
307
	"add r3",
308
	"add r4",
309
	"add r5",
310
	"add r6",
311
	"add r7",
312
	"add r8",
313
	"add r9",
314
	"add r10",
315
	"add r11",
316
	"add r12",
317
	"add r13",
318
	"add r14",
319
	"add r15",
320
321
	// 60 - 6f
322
	"sub r0",
323
	"sub r1",
324
	"sub r2",
325
	"sub r3",
326
	"sub r4",
327
	"sub r5",
328
	"sub r6",
329
	"sub r7",
330
	"sub r8",
331
	"sub r9",
332
	"sub r10",
333
	"sub r11",
334
	"sub r12",
335
	"sub r13",
336
	"sub r14",
337
	"sub r15",
338
339
	// 70 - 7f
340
	"merge",
341
	"and r1",
342
	"and r2",
343
	"and r3",
344
	"and r4",
345
	"and r5",
346
	"and r6",
347
	"and r7",
348
	"and r8",
349
	"and r9",
350
	"and r10",
351
	"and r11",
352
	"and r12",
353
	"and r13",
354
	"and r14",
355
	"and r15",
356
357
	// 80 - 8f
358
	"mult r0",
359
	"mult r1",
360
	"mult r2",
361
	"mult r3",
362
	"mult r4",
363
	"mult r5",
364
	"mult r6",
365
	"mult r7",
366
	"mult r8",
367
	"mult r9",
368
	"mult r10",
369
	"mult r11",
370
	"mult r12",
371
	"mult r13",
372
	"mult r14",
373
	"mult r15",
374
375
	// 90 - 9f
376
	"sbk",
377
	"link #1",
378
	"link #2",
379
	"link #3",
380
	"link #4",
381
	"sex",
382
	"asr",
383
	"ror",
384
	"jmp (r8)",
385
	"jmp (r9)",
386
	"jmp (r10)",
387
	"jmp (r11)",
388
	"jmp (r12)",
389
	"jmp (r13)",
390
	"lob",
391
	"fmult",
392
393
	// a0 - af
394
	"ibt r0, #$%02x",
395
	"ibt r1, #$%02x",
396
	"ibt r2, #$%02x",
397
	"ibt r3, #$%02x",
398
	"ibt r4, #$%02x",
399
	"ibt r5, #$%02x",
400
	"ibt r6, #$%02x",
401
	"ibt r7, #$%02x",
402
	"ibt r8, #$%02x",
403
	"ibt r9, #$%02x",
404
	"ibt r10, #$%02x",
405
	"ibt r11, #$%02x",
406
	"ibt r12, #$%02x",
407
	"ibt r13, #$%02x",
408
	"ibt r14, #$%02x",
409
	"ibt r15, #$%02x",
410
411
	// b0 - bf
412
	"from r0",
413
	"from r1",
414
	"from r2",
415
	"from r3",
416
	"from r4",
417
	"from r5",
418
	"from r6",
419
	"from r7",
420
	"from r8",
421
	"from r9",
422
	"from r10",
423
	"from r11",
424
	"from r12",
425
	"from r13",
426
	"from r14",
427
	"from r15",
428
429
	// c0 - cf
430
	"hib",
431
	"or r1",
432
	"or r2",
433
	"or r3",
434
	"or r4",
435
	"or r5",
436
	"or r6",
437
	"or r7",
438
	"or r8",
439
	"or r9",
440
	"or r10",
441
	"or r11",
442
	"or r12",
443
	"or r13",
444
	"or r14",
445
	"or r15",
446
447
	// d0 - df
448
	"inc r0",
449
	"inc r1",
450
	"inc r2",
451
	"inc r3",
452
	"inc r4",
453
	"inc r5",
454
	"inc r6",
455
	"inc r7",
456
	"inc r8",
457
	"inc r9",
458
	"inc r10",
459
	"inc r11",
460
	"inc r12",
461
	"inc r13",
462
	"inc r14",
463
	"getc",
464
465
	// e0 - ef
466
	"dec r0",
467
	"dec r1",
468
	"dec r2",
469
	"dec r3",
470
	"dec r4",
471
	"dec r5",
472
	"dec r6",
473
	"dec r7",
474
	"dec r8",
475
	"dec r9",
476
	"dec r10",
477
	"dec r11",
478
	"dec r12",
479
	"dec r13",
480
	"dec r14",
481
	"getb",
482
483
	// f0 - ff
484
	"iwt r0, #$%04x",
485
	"iwt r1, #$%04x",
486
	"iwt r2, #$%04x",
487
	"iwt r3, #$%04x",
488
	"iwt r4, #$%04x",
489
	"iwt r5, #$%04x",
490
	"iwt r6, #$%04x",
491
	"iwt r7, #$%04x",
492
	"iwt r8, #$%04x",
493
	"iwt r9, #$%04x",
494
	"iwt r10, #$%04x",
495
	"iwt r11, #$%04x",
496
	"iwt r12, #$%04x",
497
	"iwt r13, #$%04x",
498
	"iwt r14, #$%04x",
499
	"iwt r15, #$%04x",
500
501
	// ALT1 Table
502
503
	// 00 - 0f
504
	"stop",
505
	"nop",
506
	"cache",
507
	"lsr",
508
	"rol",
509
	"bra $%04x",
510
	"blt $%04x",
511
	"bge $%04x",
512
	"bne $%04x",
513
	"beq $%04x",
514
	"bpl $%04x",
515
	"bmi $%04x",
516
	"bcc $%04x",
517
	"bcs $%04x",
518
	"bvc $%04x",
519
	"bvs $%04x",
520
521
	// 10 - 1f
522
	"to r0",
523
	"to r1",
524
	"to r2",
525
	"to r3",
526
	"to r4",
527
	"to r5",
528
	"to r6",
529
	"to r7",
530
	"to r8",
531
	"to r9",
532
	"to r10",
533
	"to r11",
534
	"to r12",
535
	"to r13",
536
	"to r14",
537
	"to r15",
538
539
	// 20 - 2f
540
	"with r0",
541
	"with r1",
542
	"with r2",
543
	"with r3",
544
	"with r4",
545
	"with r5",
546
	"with r6",
547
	"with r7",
548
	"with r8",
549
	"with r9",
550
	"with r10",
551
	"with r11",
552
	"with r12",
553
	"with r13",
554
	"with r14",
555
	"with r15",
556
557
	// 30 - 3f
558
	"stb (r0)",
559
	"stb (r1)",
560
	"stb (r2)",
561
	"stb (r3)",
562
	"stb (r4)",
563
	"stb (r5)",
564
	"stb (r6)",
565
	"stb (r7)",
566
	"stb (r8)",
567
	"stb (r9)",
568
	"stb (r10)",
569
	"stb (r11)",
570
	"loop",
571
	"alt1",
572
	"alt2",
573
	"alt3",
574
575
	// 40 - 4f
576
	"ldb (r0)",
577
	"ldb (r1)",
578
	"ldb (r2)",
579
	"ldb (r3)",
580
	"ldb (r4)",
581
	"ldb (r5)",
582
	"ldb (r6)",
583
	"ldb (r7)",
584
	"ldb (r8)",
585
	"ldb (r9)",
586
	"ldb (r10)",
587
	"ldb (r11)",
588
	"rpix",
589
	"swap",
590
	"cmode",
591
	"not",
592
593
	// 50 - 5f
594
	"adc r0",
595
	"adc r1",
596
	"adc r2",
597
	"adc r3",
598
	"adc r4",
599
	"adc r5",
600
	"adc r6",
601
	"adc r7",
602
	"adc r8",
603
	"adc r9",
604
	"adc r10",
605
	"adc r11",
606
	"adc r12",
607
	"adc r13",
608
	"adc r14",
609
	"adc r15",
610
611
	// 60 - 6f
612
	"sbc r0",
613
	"sbc r1",
614
	"sbc r2",
615
	"sbc r3",
616
	"sbc r4",
617
	"sbc r5",
618
	"sbc r6",
619
	"sbc r7",
620
	"sbc r8",
621
	"sbc r9",
622
	"sbc r10",
623
	"sbc r11",
624
	"sbc r12",
625
	"sbc r13",
626
	"sbc r14",
627
	"sbc r15",
628
629
	// 70 - 7f
630
	"merge",
631
	"bic r1",
632
	"bic r2",
633
	"bic r3",
634
	"bic r4",
635
	"bic r5",
636
	"bic r6",
637
	"bic r7",
638
	"bic r8",
639
	"bic r9",
640
	"bic r10",
641
	"bic r11",
642
	"bic r12",
643
	"bic r13",
644
	"bic r14",
645
	"bic r15",
646
647
	// 80 - 8f
648
	"umult r0",
649
	"umult r1",
650
	"umult r2",
651
	"umult r3",
652
	"umult r4",
653
	"umult r5",
654
	"umult r6",
655
	"umult r7",
656
	"umult r8",
657
	"umult r9",
658
	"umult r10",
659
	"umult r11",
660
	"umult r12",
661
	"umult r13",
662
	"umult r14",
663
	"umult r15",
664
665
	// 90 - 9f
666
	"sbk",
667
	"link #1",
668
	"link #2",
669
	"link #3",
670
	"link #4",
671
	"sex",
672
	"div2",
673
	"ror",
674
	"ljmp (r8)",
675
	"ljmp (r9)",
676
	"ljmp (r10)",
677
	"ljmp (r11)",
678
	"ljmp (r12)",
679
	"ljmp (r13)",
680
	"lob",
681
	"lmult",
682
683
	// a0 - af
684
	"lms r0, ($%04x)",
685
	"lms r1, ($%04x)",
686
	"lms r2, ($%04x)",
687
	"lms r3, ($%04x)",
688
	"lms r4, ($%04x)",
689
	"lms r5, ($%04x)",
690
	"lms r6, ($%04x)",
691
	"lms r7, ($%04x)",
692
	"lms r8, ($%04x)",
693
	"lms r9, ($%04x)",
694
	"lms r10, ($%04x)",
695
	"lms r11, ($%04x)",
696
	"lms r12, ($%04x)",
697
	"lms r13, ($%04x)",
698
	"lms r14, ($%04x)",
699
	"lms r15, ($%04x)",
700
701
	// b0 - bf
702
	"from r0",
703
	"from r1",
704
	"from r2",
705
	"from r3",
706
	"from r4",
707
	"from r5",
708
	"from r6",
709
	"from r7",
710
	"from r8",
711
	"from r9",
712
	"from r10",
713
	"from r11",
714
	"from r12",
715
	"from r13",
716
	"from r14",
717
	"from r15",
718
719
	// c0 - cf
720
	"hib",
721
	"xor r1",
722
	"xor r2",
723
	"xor r3",
724
	"xor r4",
725
	"xor r5",
726
	"xor r6",
727
	"xor r7",
728
	"xor r8",
729
	"xor r9",
730
	"xor r10",
731
	"xor r11",
732
	"xor r12",
733
	"xor r13",
734
	"xor r14",
735
	"xor r15",
736
737
	// d0 - df
738
	"inc r0",
739
	"inc r1",
740
	"inc r2",
741
	"inc r3",
742
	"inc r4",
743
	"inc r5",
744
	"inc r6",
745
	"inc r7",
746
	"inc r8",
747
	"inc r9",
748
	"inc r10",
749
	"inc r11",
750
	"inc r12",
751
	"inc r13",
752
	"inc r14",
753
	"getc",
754
755
	// e0 - ef
756
	"dec r0",
757
	"dec r1",
758
	"dec r2",
759
	"dec r3",
760
	"dec r4",
761
	"dec r5",
762
	"dec r6",
763
	"dec r7",
764
	"dec r8",
765
	"dec r9",
766
	"dec r10",
767
	"dec r11",
768
	"dec r12",
769
	"dec r13",
770
	"dec r14",
771
	"getbh",
772
773
	// f0 - ff
774
	"lm r0, ($%04x)",
775
	"lm r1, ($%04x)",
776
	"lm r2, ($%04x)",
777
	"lm r3, ($%04x)",
778
	"lm r4, ($%04x)",
779
	"lm r5, ($%04x)",
780
	"lm r6, ($%04x)",
781
	"lm r7, ($%04x)",
782
	"lm r8, ($%04x)",
783
	"lm r9, ($%04x)",
784
	"lm r10, ($%04x)",
785
	"lm r11, ($%04x)",
786
	"lm r12, ($%04x)",
787
	"lm r13, ($%04x)",
788
	"lm r14, ($%04x)",
789
	"lm r15, ($%04x)",
790
791
	// ALT2 Table
792
793
	// 00 - 0f
794
	"stop",
795
	"nop",
796
	"cache",
797
	"lsr",
798
	"rol",
799
	"bra $%04x",
800
	"blt $%04x",
801
	"bge $%04x",
802
	"bne $%04x",
803
	"beq $%04x",
804
	"bpl $%04x",
805
	"bmi $%04x",
806
	"bcc $%04x",
807
	"bcs $%04x",
808
	"bvc $%04x",
809
	"bvs $%04x",
810
811
	// 10 - 1f
812
	"to r0",
813
	"to r1",
814
	"to r2",
815
	"to r3",
816
	"to r4",
817
	"to r5",
818
	"to r6",
819
	"to r7",
820
	"to r8",
821
	"to r9",
822
	"to r10",
823
	"to r11",
824
	"to r12",
825
	"to r13",
826
	"to r14",
827
	"to r15",
828
829
	// 20 - 2f
830
	"with r0",
831
	"with r1",
832
	"with r2",
833
	"with r3",
834
	"with r4",
835
	"with r5",
836
	"with r6",
837
	"with r7",
838
	"with r8",
839
	"with r9",
840
	"with r10",
841
	"with r11",
842
	"with r12",
843
	"with r13",
844
	"with r14",
845
	"with r15",
846
847
	// 30 - 3f
848
	"stw (r0)",
849
	"stw (r1)",
850
	"stw (r2)",
851
	"stw (r3)",
852
	"stw (r4)",
853
	"stw (r5)",
854
	"stw (r6)",
855
	"stw (r7)",
856
	"stw (r8)",
857
	"stw (r9)",
858
	"stw (r10)",
859
	"stw (r11)",
860
	"loop",
861
	"alt1",
862
	"alt2",
863
	"alt3",
864
865
	// 40 - 4f
866
	"ldw (r0)",
867
	"ldw (r1)",
868
	"ldw (r2)",
869
	"ldw (r3)",
870
	"ldw (r4)",
871
	"ldw (r5)",
872
	"ldw (r6)",
873
	"ldw (r7)",
874
	"ldw (r8)",
875
	"ldw (r9)",
876
	"ldw (r10)",
877
	"ldw (r11)",
878
	"plot",
879
	"swap",
880
	"color",
881
	"not",
882
883
	// 50 - 5f
884
	"add #0",
885
	"add #1",
886
	"add #2",
887
	"add #3",
888
	"add #4",
889
	"add #5",
890
	"add #6",
891
	"add #7",
892
	"add #8",
893
	"add #9",
894
	"add #10",
895
	"add #11",
896
	"add #12",
897
	"add #13",
898
	"add #14",
899
	"add #15",
900
901
	// 60 - 6f
902
	"sub #0",
903
	"sub #1",
904
	"sub #2",
905
	"sub #3",
906
	"sub #4",
907
	"sub #5",
908
	"sub #6",
909
	"sub #7",
910
	"sub #8",
911
	"sub #9",
912
	"sub #10",
913
	"sub #11",
914
	"sub #12",
915
	"sub #13",
916
	"sub #14",
917
	"sub #15",
918
919
	// 70 - 7f
920
	"merge",
921
	"and #1",
922
	"and #2",
923
	"and #3",
924
	"and #4",
925
	"and #5",
926
	"and #6",
927
	"and #7",
928
	"and #8",
929
	"and #9",
930
	"and #10",
931
	"and #11",
932
	"and #12",
933
	"and #13",
934
	"and #14",
935
	"and #15",
936
937
	// 80 - 8f
938
	"mult #0",
939
	"mult #1",
940
	"mult #2",
941
	"mult #3",
942
	"mult #4",
943
	"mult #5",
944
	"mult #6",
945
	"mult #7",
946
	"mult #8",
947
	"mult #9",
948
	"mult #10",
949
	"mult #11",
950
	"mult #12",
951
	"mult #13",
952
	"mult #14",
953
	"mult #15",
954
955
	// 90 - 9f
956
	"sbk",
957
	"link #1",
958
	"link #2",
959
	"link #3",
960
	"link #4",
961
	"sex",
962
	"asr",
963
	"ror",
964
	"jmp (r8)",
965
	"jmp (r9)",
966
	"jmp (r10)",
967
	"jmp (r11)",
968
	"jmp (r12)",
969
	"jmp (r13)",
970
	"lob",
971
	"fmult",
972
973
	// a0 - af
974
	"sms ($%04x), r0",
975
	"sms ($%04x), r1",
976
	"sms ($%04x), r2",
977
	"sms ($%04x), r3",
978
	"sms ($%04x), r4",
979
	"sms ($%04x), r5",
980
	"sms ($%04x), r6",
981
	"sms ($%04x), r7",
982
	"sms ($%04x), r8",
983
	"sms ($%04x), r9",
984
	"sms ($%04x), r10",
985
	"sms ($%04x), r11",
986
	"sms ($%04x), r12",
987
	"sms ($%04x), r13",
988
	"sms ($%04x), r14",
989
	"sms ($%04x), r15",
990
991
	// b0 - bf
992
	"from r0",
993
	"from r1",
994
	"from r2",
995
	"from r3",
996
	"from r4",
997
	"from r5",
998
	"from r6",
999
	"from r7",
1000
	"from r8",
1001
	"from r9",
1002
	"from r10",
1003
	"from r11",
1004
	"from r12",
1005
	"from r13",
1006
	"from r14",
1007
	"from r15",
1008
1009
	// c0 - cf
1010
	"hib",
1011
	"or #1",
1012
	"or #2",
1013
	"or #3",
1014
	"or #4",
1015
	"or #5",
1016
	"or #6",
1017
	"or #7",
1018
	"or #8",
1019
	"or #9",
1020
	"or #10",
1021
	"or #11",
1022
	"or #12",
1023
	"or #13",
1024
	"or #14",
1025
	"or #15",
1026
1027
	// d0 - df
1028
	"inc r0",
1029
	"inc r1",
1030
	"inc r2",
1031
	"inc r3",
1032
	"inc r4",
1033
	"inc r5",
1034
	"inc r6",
1035
	"inc r7",
1036
	"inc r8",
1037
	"inc r9",
1038
	"inc r10",
1039
	"inc r11",
1040
	"inc r12",
1041
	"inc r13",
1042
	"inc r14",
1043
	"ramb",
1044
1045
	// e0 - ef
1046
	"dec r0",
1047
	"dec r1",
1048
	"dec r2",
1049
	"dec r3",
1050
	"dec r4",
1051
	"dec r5",
1052
	"dec r6",
1053
	"dec r7",
1054
	"dec r8",
1055
	"dec r9",
1056
	"dec r10",
1057
	"dec r11",
1058
	"dec r12",
1059
	"dec r13",
1060
	"dec r14",
1061
	"getbl",
1062
1063
	// f0 - ff
1064
	"sm ($%04x), r0",
1065
	"sm ($%04x), r1",
1066
	"sm ($%04x), r2",
1067
	"sm ($%04x), r3",
1068
	"sm ($%04x), r4",
1069
	"sm ($%04x), r5",
1070
	"sm ($%04x), r6",
1071
	"sm ($%04x), r7",
1072
	"sm ($%04x), r8",
1073
	"sm ($%04x), r9",
1074
	"sm ($%04x), r10",
1075
	"sm ($%04x), r11",
1076
	"sm ($%04x), r12",
1077
	"sm ($%04x), r13",
1078
	"sm ($%04x), r14",
1079
	"sm ($%04x), r15",
1080
1081
	// ALT3 Table
1082
1083
	// 00 - 0f
1084
	"stop",
1085
	"nop",
1086
	"cache",
1087
	"lsr",
1088
	"rol",
1089
	"bra $%04x",
1090
	"blt $%04x",
1091
	"bge $%04x",
1092
	"bne $%04x",
1093
	"beq $%04x",
1094
	"bpl $%04x",
1095
	"bmi $%04x",
1096
	"bcc $%04x",
1097
	"bcs $%04x",
1098
	"bvc $%04x",
1099
	"bvs $%04x",
1100
1101
	// 10 - 1f
1102
	"to r0",
1103
	"to r1",
1104
	"to r2",
1105
	"to r3",
1106
	"to r4",
1107
	"to r5",
1108
	"to r6",
1109
	"to r7",
1110
	"to r8",
1111
	"to r9",
1112
	"to r10",
1113
	"to r11",
1114
	"to r12",
1115
	"to r13",
1116
	"to r14",
1117
	"to r15",
1118
1119
	// 20 - 2f
1120
	"with r0",
1121
	"with r1",
1122
	"with r2",
1123
	"with r3",
1124
	"with r4",
1125
	"with r5",
1126
	"with r6",
1127
	"with r7",
1128
	"with r8",
1129
	"with r9",
1130
	"with r10",
1131
	"with r11",
1132
	"with r12",
1133
	"with r13",
1134
	"with r14",
1135
	"with r15",
1136
1137
	// 30 - 3f
1138
	"stb (r0)",
1139
	"stb (r1)",
1140
	"stb (r2)",
1141
	"stb (r3)",
1142
	"stb (r4)",
1143
	"stb (r5)",
1144
	"stb (r6)",
1145
	"stb (r7)",
1146
	"stb (r8)",
1147
	"stb (r9)",
1148
	"stb (r10)",
1149
	"stb (r11)",
1150
	"loop",
1151
	"alt1",
1152
	"alt2",
1153
	"alt3",
1154
1155
	// 40 - 4f
1156
	"ldb (r0)",
1157
	"ldb (r1)",
1158
	"ldb (r2)",
1159
	"ldb (r3)",
1160
	"ldb (r4)",
1161
	"ldb (r5)",
1162
	"ldb (r6)",
1163
	"ldb (r7)",
1164
	"ldb (r8)",
1165
	"ldb (r9)",
1166
	"ldb (r10)",
1167
	"ldb (r11)",
1168
	"rpix",
1169
	"swap",
1170
	"cmode",
1171
	"not",
1172
1173
	// 50 - 5f
1174
	"adc #0",
1175
	"adc #1",
1176
	"adc #2",
1177
	"adc #3",
1178
	"adc #4",
1179
	"adc #5",
1180
	"adc #6",
1181
	"adc #7",
1182
	"adc #8",
1183
	"adc #9",
1184
	"adc #10",
1185
	"adc #11",
1186
	"adc #12",
1187
	"adc #13",
1188
	"adc #14",
1189
	"adc #15",
1190
1191
	// 60 - 6f
1192
	"cmp r0",
1193
	"cmp r1",
1194
	"cmp r2",
1195
	"cmp r3",
1196
	"cmp r4",
1197
	"cmp r5",
1198
	"cmp r6",
1199
	"cmp r7",
1200
	"cmp r8",
1201
	"cmp r9",
1202
	"cmp r10",
1203
	"cmp r11",
1204
	"cmp r12",
1205
	"cmp r13",
1206
	"cmp r14",
1207
	"cmp r15",
1208
1209
	// 70 - 7f
1210
	"merge",
1211
	"bic #1",
1212
	"bic #2",
1213
	"bic #3",
1214
	"bic #4",
1215
	"bic #5",
1216
	"bic #6",
1217
	"bic #7",
1218
	"bic #8",
1219
	"bic #9",
1220
	"bic #10",
1221
	"bic #11",
1222
	"bic #12",
1223
	"bic #13",
1224
	"bic #14",
1225
	"bic #15",
1226
1227
	// 80 - 8f
1228
	"umult #0",
1229
	"umult #1",
1230
	"umult #2",
1231
	"umult #3",
1232
	"umult #4",
1233
	"umult #5",
1234
	"umult #6",
1235
	"umult #7",
1236
	"umult #8",
1237
	"umult #9",
1238
	"umult #10",
1239
	"umult #11",
1240
	"umult #12",
1241
	"umult #13",
1242
	"umult #14",
1243
	"umult #15",
1244
1245
	// 90 - 9f
1246
	"sbk",
1247
	"link #1",
1248
	"link #2",
1249
	"link #3",
1250
	"link #4",
1251
	"sex",
1252
	"div2",
1253
	"ror",
1254
	"ljmp (r8)",
1255
	"ljmp (r9)",
1256
	"ljmp (r10)",
1257
	"ljmp (r11)",
1258
	"ljmp (r12)",
1259
	"ljmp (r13)",
1260
	"lob",
1261
	"lmult",
1262
1263
	// a0 - af
1264
	"lms r0, ($%04x)",
1265
	"lms r1, ($%04x)",
1266
	"lms r2, ($%04x)",
1267
	"lms r3, ($%04x)",
1268
	"lms r4, ($%04x)",
1269
	"lms r5, ($%04x)",
1270
	"lms r6, ($%04x)",
1271
	"lms r7, ($%04x)",
1272
	"lms r8, ($%04x)",
1273
	"lms r9, ($%04x)",
1274
	"lms r10, ($%04x)",
1275
	"lms r11, ($%04x)",
1276
	"lms r12, ($%04x)",
1277
	"lms r13, ($%04x)",
1278
	"lms r14, ($%04x)",
1279
	"lms r15, ($%04x)",
1280
1281
	// b0 - bf
1282
	"from r0",
1283
	"from r1",
1284
	"from r2",
1285
	"from r3",
1286
	"from r4",
1287
	"from r5",
1288
	"from r6",
1289
	"from r7",
1290
	"from r8",
1291
	"from r9",
1292
	"from r10",
1293
	"from r11",
1294
	"from r12",
1295
	"from r13",
1296
	"from r14",
1297
	"from r15",
1298
1299
	// c0 - cf
1300
	"hib",
1301
	"xor #1",
1302
	"xor #2",
1303
	"xor #3",
1304
	"xor #4",
1305
	"xor #5",
1306
	"xor #6",
1307
	"xor #7",
1308
	"xor #8",
1309
	"xor #9",
1310
	"xor #10",
1311
	"xor #11",
1312
	"xor #12",
1313
	"xor #13",
1314
	"xor #14",
1315
	"xor #15",
1316
1317
	// d0 - df
1318
	"inc r0",
1319
	"inc r1",
1320
	"inc r2",
1321
	"inc r3",
1322
	"inc r4",
1323
	"inc r5",
1324
	"inc r6",
1325
	"inc r7",
1326
	"inc r8",
1327
	"inc r9",
1328
	"inc r10",
1329
	"inc r11",
1330
	"inc r12",
1331
	"inc r13",
1332
	"inc r14",
1333
	"romb",
1334
1335
	// e0 - ef
1336
	"dec r0",
1337
	"dec r1",
1338
	"dec r2",
1339
	"dec r3",
1340
	"dec r4",
1341
	"dec r5",
1342
	"dec r6",
1343
	"dec r7",
1344
	"dec r8",
1345
	"dec r9",
1346
	"dec r10",
1347
	"dec r11",
1348
	"dec r12",
1349
	"dec r13",
1350
	"dec r14",
1351
	"getbs",
1352
1353
	// f0 - ff
1354
	"lm r0, ($%04x)",
1355
	"lm r1, ($%04x)",
1356
	"lm r2, ($%04x)",
1357
	"lm r3, ($%04x)",
1358
	"lm r4, ($%04x)",
1359
	"lm r5, ($%04x)",
1360
	"lm r6, ($%04x)",
1361
	"lm r7, ($%04x)",
1362
	"lm r8, ($%04x)",
1363
	"lm r9, ($%04x)",
1364
	"lm r10, ($%04x)",
1365
	"lm r11, ($%04x)",
1366
	"lm r12, ($%04x)",
1367
	"lm r13, ($%04x)",
1368
	"lm r14, ($%04x)",
1369
	"lm r15, ($%04x)"
1370
};
1371
*/
1372
1373
/*
1374
static void FxPipeString (char *pvString)
1375
{
1376
	uint32		vOpcode = (GSU.vStatusReg & 0x300) | ((uint32) PIPE);
1377
	const char	*m = fx_apvMnemonicTable[vOpcode];
1378
	uint8		vPipe1, vPipe2, vByte1, vByte2;
1379
	uint8		vPipeBank = GSU.vPipeAdr >> 16;
1380
	char		*p;
1381
1382
	// The next two bytes after the pipe's address
1383
	vPipe1 = GSU.apvRomBank[vPipeBank][USEX16(GSU.vPipeAdr + 1)];
1384
	vPipe2 = GSU.apvRomBank[vPipeBank][USEX16(GSU.vPipeAdr + 2)];
1385
1386
	// The actual next two bytes to be read
1387
	vByte1 = PRGBANK(USEX16(R15));
1388
	vByte2 = PRGBANK(USEX16(R15 + 1));
1389
1390
	// Print ROM address of the pipe
1391
	sprintf(pvString, "%02x:%04x %02x       ", USEX8(vPipeBank), USEX16(GSU.vPipeAdr), USEX8(PIPE));
1392
	p = &pvString[strlen(pvString)];
1393
1394
	if (PIPE >= 0x05 && PIPE <= 0x0f)			// Check if it's a branch instruction
1395
	{
1396
		sprintf(&pvString[11], "%02x    ", USEX8(vPipe1));
1397
	#ifdef BRANCH_DELAY_RELATIVE
1398
		sprintf(p, m, USEX16(R15 + SEX8(vByte1) + 1));
1399
	#else
1400
		sprintf(p, m, USEX16(R15 + SEX8(vByte1) - 1));
1401
	#endif
1402
	}
1403
	else
1404
	if (PIPE >= 0x10 && PIPE <= 0x1f && TF(B))	// Check for 'move' instruction
1405
		sprintf(p, "move r%d, r%d", USEX8(PIPE & 0x0f), (uint32) (GSU.pvSreg - GSU.avReg));
1406
	else
1407
	if (PIPE >= 0xa0 && PIPE <= 0xaf)			// Check for 'ibt', 'lms' or 'sms'
1408
	{
1409
		sprintf(&pvString[11], "%02x    ", USEX8(vPipe1));
1410
		if ((GSU.vStatusReg & 0x300) == 0x100 || (GSU.vStatusReg & 0x300) == 0x200)
1411
			sprintf(p, m, USEX16(vByte1) << 1);
1412
		else
1413
			sprintf(p, m, USEX16(vByte1));
1414
	}
1415
	else
1416
	if (PIPE >= 0xb0 && PIPE <= 0xbf && TF(B))	// Check for 'moves'
1417
		sprintf(p, "moves r%d, r%d", (uint32) (GSU.pvDreg - GSU.avReg), USEX8(PIPE & 0x0f));
1418
	else
1419
	if (PIPE >= 0xf0)							// Check for 'iwt', 'lm' or 'sm'
1420
	{
1421
		sprintf(&pvString[11], "%02x %02x ", USEX8(vPipe1), USEX8(vPipe2));
1422
		sprintf(p, m, USEX8(vByte1) | (USEX16(vByte2) << 8));
1423
	}
1424
	else										// Normal instruction
1425
		strcpy(p, m);
1426
}
1427
*/
1428
1429
#endif