2 * Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
4 * (c) Copyright 1996 - 2001 Gary Henderson (gary.henderson@ntlworld.com) and
5 * Jerremy Koot (jkoot@snes9x.com)
7 * Super FX C emulator code
8 * (c) Copyright 1997 - 1999 Ivar (ivar@snes9x.com) and
10 * Super FX assembler emulator code (c) Copyright 1998 zsKnight and _Demo_.
12 * DSP1 emulator code (c) Copyright 1998 Ivar, _Demo_ and Gary Henderson.
13 * C4 asm and some C emulation code (c) Copyright 2000 zsKnight and _Demo_.
14 * C4 C code (c) Copyright 2001 Gary Henderson (gary.henderson@ntlworld.com).
16 * DOS port code contains the works of other authors. See headers in
19 * Snes9x homepage: http://www.snes9x.com
21 * Permission to use, copy, modify and distribute Snes9x in both binary and
22 * source form, for non-commercial purposes, is hereby granted without fee,
23 * providing that this license information and copyright notice appear with
24 * all copies and any derived work.
26 * This software is provided 'as-is', without any express or implied
27 * warranty. In no event shall the authors be held liable for any damages
28 * arising from the use of this software.
30 * Snes9x is freeware for PERSONAL USE only. Commercial users should
31 * seek permission of the copyright holders first. Commercial use includes
32 * charging money for Snes9x or software derived from Snes9x.
34 * The copyright holders request that bug fixes and improvements to the code
35 * should be forwarded to them so everyone can benefit from the modifications
38 * Super NES and Super Nintendo Entertainment System are trademarks of
39 * Nintendo Co., Limited and its subsidiary companies.
48 #define ICPU SA1ICPU
\r
50 #define Registers SA1Registers
51 #define S9xGetByte S9xSA1GetByte
52 #define S9xGetWord S9xSA1GetWord
53 #define S9xSetByte S9xSA1SetByte
54 #define S9xSetWord S9xSA1SetWord
55 #define S9xSetPCBase S9xSA1SetPCBase
56 #define S9xOpcodesM1X1 S9xSA1OpcodesM1X1
57 #define S9xOpcodesM1X0 S9xSA1OpcodesM1X0
58 #define S9xOpcodesM0X1 S9xSA1OpcodesM0X1
59 #define S9xOpcodesM0X0 S9xSA1OpcodesM0X0
60 #define S9xOpcode_IRQ S9xSA1Opcode_IRQ
61 #define S9xOpcode_NMI S9xSA1Opcode_NMI
62 #define S9xUnpackStatus S9xSA1UnpackStatus
63 #define S9xPackStatus S9xSA1PackStatus
64 #define S9xFixCycles S9xSA1FixCycles
\r
65 //CSNES Not even used
\r
67 #define Immediate8 SA1Immediate8
68 #define Immediate16 SA1Immediate16
69 #define Relative SA1Relative
70 #define RelativeLong SA1RelativeLong
71 #define AbsoluteIndexedIndirect SA1AbsoluteIndexedIndirect
72 #define AbsoluteIndirectLong SA1AbsoluteIndirectLong
73 #define AbsoluteIndirect SA1AbsoluteIndirect
74 #define Absolute SA1Absolute
75 #define AbsoluteLong SA1AbsoluteLong
76 #define Direct SA1Direct
77 #define DirectIndirectIndexed SA1DirectIndirectIndexed
78 #define DirectIndirectIndexedLong SA1DirectIndirectIndexedLong
79 #define DirectIndexedIndirect SA1DirectIndexedIndirect
80 #define DirectIndexedX SA1DirectIndexedX
81 #define DirectIndexedY SA1DirectIndexedY
82 #define AbsoluteIndexedX SA1AbsoluteIndexedX
83 #define AbsoluteIndexedY SA1AbsoluteIndexedY
84 #define AbsoluteLongIndexedX SA1AbsoluteLongIndexedX
85 #define DirectIndirect SA1DirectIndirect
86 #define DirectIndirectLong SA1DirectIndirectLong
87 #define StackRelative SA1StackRelative
88 #define StackRelativeIndirectIndexed SA1StackRelativeIndirectIndexed
\r
97 void S9xSA1MainLoop ()
102 if (SA1.Flags & NMI_FLAG)
104 SA1.Flags &= ~NMI_FLAG;
105 if (SA1.WaitingForInterrupt)
107 SA1.WaitingForInterrupt = FALSE;
113 if (SA1.Flags & IRQ_PENDING_FLAG)
117 if (SA1.WaitingForInterrupt)
119 SA1.WaitingForInterrupt = FALSE;
122 if (!SA1CheckFlag (IRQ))
126 SA1.Flags &= ~IRQ_PENDING_FLAG;
129 if (SA1.Flags & TRACE_FLAG)
131 for (i = 0; i < 3 && SA1.Executing; i++)
135 SA1.PCAtOpcodeStart = SA1.PC;
137 (*SA1.S9xOpcodes [*SA1.PC++].S9xOpcode) (&SA1Registers, &SA1ICPU, &SA1);
142 for (i = 0; i < 3 && SA1.Executing; i++)
145 SA1.PCAtOpcodeStart = SA1.PC;
147 (*SA1ICPU.S9xOpcodes [*SA1.PC++].S9xOpcode) (&SA1Registers, &SA1ICPU, &SA1);