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.
44 /* Types used by structures and code */
45 #ifndef snes9x_types_defined
46 #define snes9x_types_defined
48 typedef unsigned char uint8;
49 typedef unsigned short uint16;
50 typedef unsigned int uint32;
51 typedef unsigned char bool8;
52 typedef signed char int8;
65 /* The FxInfo_s structure, the link between the FxEmulator and the Snes Emulator */
69 uint8 * pvRegisters; /* 768 bytes located in the memory at address 0x3000 */
70 uint32 nRamBanks; /* Number of 64kb-banks in GSU-RAM/BackupRAM (banks 0x70-0x73) */
71 uint8 * pvRam; /* Pointer to GSU-RAM */
72 uint32 nRomBanks; /* Number of 32kb-banks in Cart-ROM */
73 uint8 * pvRom; /* Pointer to Cart-ROM */
76 /* Reset the FxChip */
77 extern void FxReset(struct FxInit_s *psFxInfo);
79 /* Execute until the next stop instruction */
80 extern int FxEmulate(uint32 nInstructions);
82 /* Write access to the cache */
83 extern void FxCacheWriteAccess(uint16 vAddress);
84 extern void FxFlushCache(); /* Callled when the G flag in SFR is set to zero */
87 extern void FxBreakPointSet(uint32 vAddress);
88 extern void FxBreakPointClear();
90 /* Step by step execution */
91 extern int FxStepOver(uint32 nInstructions);
94 extern int FxGetErrorCode();
95 extern int FxGetIllegalAddress();
97 /* Access to internal registers */
98 extern uint32 FxGetColorRegister();
99 extern uint32 FxGetPlotOptionRegister();
100 extern uint32 FxGetSourceRegisterIndex();
101 extern uint32 FxGetDestinationRegisterIndex();
103 /* Get string for opcode currently in the pipe */
104 extern void FxPipeString(char * pvString);
106 /* Get the byte currently in the pipe */
107 extern uint8 FxPipe();
110 #define FX_FLAG_ADDRESS_CHECKING 0x01
111 #define FX_FLAG_ROM_BUFFER 0x02
113 /* Return codes from FxEmulate(), FxStepInto() or FxStepOver() */
114 #define FX_BREAKPOINT -1
115 #define FX_ERROR_ILLEGAL_ADDRESS -2
117 /* Return the number of bytes in an opcode */
118 #define OPCODE_BYTES(op) ((((op)>=0x05&&(op)<=0xf)||((op)>=0xa0&&(op)<=0xaf))?2:(((op)>=0xf0)?3:1))
120 extern void fx_computeScreenPointers ();