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.
58 #define Registers SA1Registers
59 #define S9xGetByte S9xSA1GetByte
60 #define S9xGetWord S9xSA1GetWord
61 #define S9xSetByte S9xSA1SetByte
62 #define S9xSetWord S9xSA1SetWord
63 #define S9xSetPCBase S9xSA1SetPCBase
64 #define S9xOpcodesM1X1 S9xSA1OpcodesM1X1
65 #define S9xOpcodesM1X0 S9xSA1OpcodesM1X0
66 #define S9xOpcodesM0X1 S9xSA1OpcodesM0X1
67 #define S9xOpcodesM0X0 S9xSA1OpcodesM0X0
68 #define S9xOpcode_IRQ S9xSA1Opcode_IRQ
69 #define S9xOpcode_NMI S9xSA1Opcode_NMI
70 #define S9xUnpackStatus S9xSA1UnpackStatus
71 #define S9xPackStatus S9xSA1PackStatus
72 #define S9xFixCycles S9xSA1FixCycles
75 #define Immediate8 SA1Immediate8
76 #define Immediate16 SA1Immediate16
77 #define Relative SA1Relative
78 #define RelativeLong SA1RelativeLong
79 #define AbsoluteIndexedIndirect SA1AbsoluteIndexedIndirect
80 #define AbsoluteIndirectLong SA1AbsoluteIndirectLong
81 #define AbsoluteIndirect SA1AbsoluteIndirect
82 #define Absolute SA1Absolute
83 #define AbsoluteLong SA1AbsoluteLong
84 #define Direct SA1Direct
85 #define DirectIndirectIndexed SA1DirectIndirectIndexed
86 #define DirectIndirectIndexedLong SA1DirectIndirectIndexedLong
87 #define DirectIndexedIndirect SA1DirectIndexedIndirect
88 #define DirectIndexedX SA1DirectIndexedX
89 #define DirectIndexedY SA1DirectIndexedY
90 #define AbsoluteIndexedX SA1AbsoluteIndexedX
91 #define AbsoluteIndexedY SA1AbsoluteIndexedY
92 #define AbsoluteLongIndexedX SA1AbsoluteLongIndexedX
93 #define DirectIndirect SA1DirectIndirect
94 #define DirectIndirectLong SA1DirectIndirectLong
95 #define StackRelative SA1StackRelative
96 #define StackRelativeIndirectIndexed SA1StackRelativeIndirectIndexed
103 #include "65c816ops.inc"
105 void S9xSA1MainLoop ()
110 if (SA1.Flags & NMI_FLAG)
112 SA1.Flags &= ~NMI_FLAG;
113 if (SA1.WaitingForInterrupt)
115 SA1.WaitingForInterrupt = FALSE;
121 if (SA1.Flags & IRQ_PENDING_FLAG)
125 if (SA1.WaitingForInterrupt)
127 SA1.WaitingForInterrupt = FALSE;
130 if (!SA1CheckFlag (IRQ))
134 SA1.Flags &= ~IRQ_PENDING_FLAG;
137 if (SA1.Flags & TRACE_FLAG)
139 for (i = 0; i < 3 && SA1.Executing; i++)
143 SA1.PCAtOpcodeStart = SA1.PC;
145 (*SA1.S9xOpcodes [*SA1.PC++].S9xOpcode)();
150 for (i = 0; i < 3 && SA1.Executing; i++)
153 SA1.PCAtOpcodeStart = SA1.PC;
155 (*SA1.S9xOpcodes [*SA1.PC++].S9xOpcode)();