Import Debian changes 1.23-11
[debian-dgen.git] / starcpu.h
blobe2515fe2230c88ed2196c15fab23730c1876cd0b
1 /*
2 ** Starscream 680x0 emulation library
3 ** Copyright 1997, 1998, 1999 Neill Corlett
4 **
5 ** Refer to STARDOC.TXT for terms of use, API reference, and directions on
6 ** how to compile.
7 */
9 #ifndef __STARCPU_H__
10 #define __STARCPU_H__
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
16 /* Remember to byte-swap these regions. (read STARDOC.TXT for details) */
17 struct STARSCREAM_PROGRAMREGION {
18 unsigned lowaddr;
19 unsigned highaddr;
20 unsigned offset;
23 struct STARSCREAM_DATAREGION {
24 unsigned lowaddr;
25 unsigned highaddr;
26 void *memorycall;
27 void *userdata;
30 /* Memory structures for 16-bit data path */
31 #define STARSCREAM_CONTEXTINFO_MEM16 \
32 struct STARSCREAM_PROGRAMREGION *fetch; \
33 struct STARSCREAM_DATAREGION *readbyte; \
34 struct STARSCREAM_DATAREGION *readword; \
35 struct STARSCREAM_DATAREGION *writebyte; \
36 struct STARSCREAM_DATAREGION *writeword; \
37 struct STARSCREAM_PROGRAMREGION *s_fetch; \
38 struct STARSCREAM_DATAREGION *s_readbyte; \
39 struct STARSCREAM_DATAREGION *s_readword; \
40 struct STARSCREAM_DATAREGION *s_writebyte; \
41 struct STARSCREAM_DATAREGION *s_writeword; \
42 struct STARSCREAM_PROGRAMREGION *u_fetch; \
43 struct STARSCREAM_DATAREGION *u_readbyte; \
44 struct STARSCREAM_DATAREGION *u_readword; \
45 struct STARSCREAM_DATAREGION *u_writebyte; \
46 struct STARSCREAM_DATAREGION *u_writeword; \
48 /* Memory structures for 16-bit data path with function code support */
49 #define STARSCREAM_CONTEXTINFO_MEM16FC \
50 unsigned (*f_readbyte) (unsigned f, unsigned a); \
51 unsigned (*f_readword) (unsigned f, unsigned a); \
52 unsigned (*f_writebyte)(unsigned f, unsigned a); \
53 unsigned (*f_writeword)(unsigned f, unsigned a); \
55 /* Memory structures for 32-bit sizable data path */
56 #define STARSCREAM_CONTEXTINFO_MEM32 \
57 struct STARSCREAM_PROGRAMREGION *fetch; \
58 struct STARSCREAM_DATAREGION *readbus; \
59 struct STARSCREAM_DATAREGION *writebus; \
60 struct STARSCREAM_PROGRAMREGION *s_fetch; \
61 struct STARSCREAM_DATAREGION *s_readbus; \
62 struct STARSCREAM_DATAREGION *s_writebus; \
63 struct STARSCREAM_PROGRAMREGION *u_fetch; \
64 struct STARSCREAM_DATAREGION *u_readbus; \
65 struct STARSCREAM_DATAREGION *u_writebus; \
66 unsigned (*f_readbus) (unsigned f, unsigned a); \
67 unsigned (*f_writebus)(unsigned f, unsigned a); \
69 /* Common context info for all 680x0 types */
70 #define STARSCREAM_CONTEXTINFO_COMMON \
71 void (*resethandler)(void); \
72 unsigned dreg[8]; \
73 unsigned areg[8]; \
74 unsigned asp; \
75 unsigned pc; \
76 unsigned odometer; \
77 unsigned char interrupts[8]; \
78 unsigned short sr; \
80 /* 68000-specific context info */
81 #define STARSCREAM_CONTEXTINFO_68000SPECIFIC \
82 unsigned short contextfiller00; \
84 /* Context info for 68010 and higher */
85 #define STARSCREAM_CONTEXTINFO_68010 \
86 unsigned char sfc; \
87 unsigned char dfc; \
88 unsigned vbr; \
89 void (*bkpthandler)(void); \
91 /* 68010-specific context info */
92 #define STARSCREAM_CONTEXTINFO_68010SPECIFIC \
93 unsigned char loopmode; \
94 unsigned char contextfiller10[3]; \
96 /* Context info for 68020 and higher */
97 #define STARSCREAM_CONTEXTINFO_68020 \
98 unsigned asp2; \
100 struct S68000CONTEXT {
101 STARSCREAM_CONTEXTINFO_MEM16
102 STARSCREAM_CONTEXTINFO_COMMON
103 STARSCREAM_CONTEXTINFO_68000SPECIFIC
106 struct S68010CONTEXT {
107 STARSCREAM_CONTEXTINFO_MEM16
108 STARSCREAM_CONTEXTINFO_MEM16FC
109 STARSCREAM_CONTEXTINFO_COMMON
110 STARSCREAM_CONTEXTINFO_68010
111 STARSCREAM_CONTEXTINFO_68010SPECIFIC
114 struct S68020CONTEXT {
115 STARSCREAM_CONTEXTINFO_MEM32
116 STARSCREAM_CONTEXTINFO_COMMON
117 STARSCREAM_CONTEXTINFO_68010
118 STARSCREAM_CONTEXTINFO_68020
121 #define STARSCREAM_IDENTIFIERS(SNC,SN) \
123 extern struct SNC##CONTEXT SN##context; \
125 int SN##init (void); \
126 unsigned SN##reset (void); \
127 unsigned SN##exec (int n); \
128 int SN##interrupt (int level, int vector); \
129 void SN##flushInterrupts (void); \
130 int SN##GetContextSize (void); \
131 void SN##GetContext (void *context); \
132 void SN##SetContext (void *context); \
133 int SN##fetch (unsigned address); \
134 unsigned SN##readOdometer (void); \
135 unsigned SN##tripOdometer (void); \
136 unsigned SN##controlOdometer (int n); \
137 void SN##releaseTimeslice (void); \
138 unsigned SN##readPC (void); \
140 STARSCREAM_IDENTIFIERS(S68000,s68000)
141 STARSCREAM_IDENTIFIERS(S68010,s68010)
142 STARSCREAM_IDENTIFIERS(S68020,s68020)
144 #ifdef __cplusplus
146 #endif
148 #endif