workaround a problem with the harmattan gcc
[drnoksnes] / fxemu.h
1 /*
2  * Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
3  *
4  * (c) Copyright 1996 - 2001 Gary Henderson (gary.henderson@ntlworld.com) and
5  *                           Jerremy Koot (jkoot@snes9x.com)
6  *
7  * Super FX C emulator code 
8  * (c) Copyright 1997 - 1999 Ivar (ivar@snes9x.com) and
9  *                           Gary Henderson.
10  * Super FX assembler emulator code (c) Copyright 1998 zsKnight and _Demo_.
11  *
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).
15  *
16  * DOS port code contains the works of other authors. See headers in
17  * individual files.
18  *
19  * Snes9x homepage: http://www.snes9x.com
20  *
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.
25  *
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.
29  *
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.
33  *
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
36  * in future versions.
37  *
38  * Super NES and Super Nintendo Entertainment System are trademarks of
39  * Nintendo Co., Limited and its subsidiary companies.
40  */
41 #ifndef _FXEMU_H_
42 #define _FXEMU_H_ 1
43
44 /* Types used by structures and code */
45 #ifndef snes9x_types_defined
46 #define snes9x_types_defined
47
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;
53 typedef short int16;
54 typedef int int32;
55 #endif
56
57 #ifndef TRUE
58 #define TRUE 1
59 #endif
60
61 #ifndef FALSE
62 #define FALSE 0
63 #endif
64
65 /* The FxInfo_s structure, the link between the FxEmulator and the Snes Emulator */
66 struct FxInit_s
67 {
68     uint32      vFlags;
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 */
74 };
75
76 /* Reset the FxChip */
77 extern void FxReset(struct FxInit_s *psFxInfo);
78
79 /* Execute until the next stop instruction */
80 extern int FxEmulate(uint32 nInstructions);
81
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 */
85
86 /* Breakpoint */
87 extern void FxBreakPointSet(uint32 vAddress);
88 extern void FxBreakPointClear();
89
90 /* Step by step execution */
91 extern int FxStepOver(uint32 nInstructions);
92
93 /* Errors */
94 extern int FxGetErrorCode();
95 extern int FxGetIllegalAddress();
96
97 /* Access to internal registers */
98 extern uint32 FxGetColorRegister();
99 extern uint32 FxGetPlotOptionRegister();
100 extern uint32 FxGetSourceRegisterIndex();
101 extern uint32 FxGetDestinationRegisterIndex();
102
103 /* Get string for opcode currently in the pipe */
104 extern void FxPipeString(char * pvString);
105
106 /* Get the byte currently in the pipe */
107 extern uint8 FxPipe();
108
109 /* Option flags */
110 #define FX_FLAG_ADDRESS_CHECKING        0x01
111 #define FX_FLAG_ROM_BUFFER              0x02
112
113 /* Return codes from FxEmulate(), FxStepInto() or FxStepOver() */
114 #define FX_BREAKPOINT                   -1
115 #define FX_ERROR_ILLEGAL_ADDRESS        -2
116
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))
119
120 extern void fx_computeScreenPointers ();
121
122 #endif