1 //////////////////////////////////////////////////
2 //                                              //
3 // Emu64                                        //
4 // von Thorsten Kattanek                        //
5 //                                              //
6 // #file: structs.h                             //
7 //                                              //
8 // Dieser Sourcecode ist Copyright geschützt!   //
9 // Geistiges Eigentum von Th.Kattanek           //
10 //                                              //
11 // Letzte Änderung am 01.06.2021                //
12 // www.emu64.de                                 //
13 //                                              //
14 //////////////////////////////////////////////////
15 
16 #ifndef STRUCTS_H
17 #define STRUCTS_H
18 
19 #include <cstdint>
20 
21 #define REG_MASK_ALL 255
22 #define REG_MASK_PC 1
23 #define REG_MASK_AC 2
24 #define REG_MASK_XR 4
25 #define REG_MASK_YR 8
26 #define REG_MASK_SP 16
27 #define REG_MASK_SR 32
28 #define REG_MASK_IRQ 64
29 #define REG_MASK_NMI 128
30 
31 #define TAPE_KEY_STOP  1
32 #define TAPE_KEY_PLAY  2
33 #define TAPE_KEY_REW   4
34 #define TAPE_KEY_FFW   8
35 #define TAPE_KEY_REC   16
36 #define TAPE_KEY_PAUSE 32
37 
38 typedef unsigned char boolean;
39 
40 enum
41 {
42     MV_RAM,
43     MV_KERNAL_ROM,
44     MV_BASIC_ROM,
45     MV_VIC,
46     MV_FARB_RAM,
47     MV_SID,
48     MV_CIA1,
49     MV_CIA2,
50     MV_IO1,
51     MV_IO2,
52     MV_CHAR_ROM,
53     MV_CRT_1,
54     MV_CRT_2,
55     MV_CRT_3,
56     MV_OPEN
57 };
58 
59 enum
60 {
61     FMV_RAM,
62     FMV_VIA1,
63     FMV_VIA2,
64     FMV_DOS,
65     FMV_OPEN
66 };
67 
68 enum
69 {
70         TAPE_IS_STOP,
71         TAPE_IS_PLAY,
72         TAPE_IS_REW,
73         TAPE_IS_FFW,
74         TAPE_IS_REC,
75         TAPE_IS_PAUSE
76 };
77 
78 #define IntQuellenC64 10
79 
80 enum
81 {
82         VIC_IRQ,
83         CIA_IRQ,
84         CIA_NMI,
85         REU_IRQ,
86         CRT_NMI,
87         CRT_IRQ,
88         EXT_IRQ,
89         EXT_NMI,
90         RESTORE_NMI,
91         NOP_INT
92 };
93 
94 #define IntQuellenFloppy 2
95 
96 enum
97 {
98         VIA1_IRQ,
99         VIA2_IRQ
100 };
101 
102 typedef enum KeyStatus
103 {
104     KEY_UP,
105     KEY_DOWN,
106 }KeyStatus;
107 
108 struct REG_STRUCT
109 {
110     uint8_t     reg_mask;
111     uint16_t    pc;
112     uint8_t     ac;
113     uint8_t     xr;
114     uint8_t     yr;
115     uint8_t     sp;
116     uint8_t     sr;
117     uint16_t    irq;
118     uint16_t    nmi;
119     uint16_t    _0314;
120     uint16_t    _0318;
121 };
122 
123 struct IREG_STRUCT
124 {
125     uint8_t   pointer;
126     uint16_t  address;
127     uint16_t  branch_address;
128     uint16_t  current_opcode_pc;
129     uint16_t  current_opcode;
130     uint8_t   current_micro_code;
131     uint8_t   tmp_byte;
132     bool      irq;
133     bool      nmi;
134     bool      rdy;
135     bool      reset;
136     bool      cpu_wait;
137     bool      jam_flag;
138     uint32_t  cycle_counter;
139     bool      exrom;
140     bool      game;
141 };
142 
143 struct VIC_STRUCT
144 {
145     uint16_t  current_rasterline;
146     uint16_t  raster_latch;
147     uint16_t  current_cycle;
148     bool      irq;
149     uint16_t  sprite_x[8];
150     uint8_t   sprite_y[8];
151     bool      display_status;
152     uint8_t   graphic_mode;
153     uint8_t   vic_bank;
154     uint16_t  matrix_base;
155     uint16_t  char_base;
156 };
157 
158 struct CIA_STRUCT
159 {
160     unsigned short  TimerA;
161     unsigned short  TimerALatch;
162     unsigned short  TimerB;
163     unsigned short  TimerBLatch;
164     unsigned char   CtrlA;
165     unsigned char   CtrlB;
166     unsigned char   Tod10;
167     unsigned char   TodSec;
168     unsigned char   TodMin;
169     unsigned char   TodHr;
170     unsigned char   PRA;
171     unsigned char   PRB;
172     unsigned char   DDRA;
173     unsigned char   DDRB;
174     unsigned char   SDR;
175 
176     unsigned char   IntData;
177     unsigned char   IntMask;
178     bool            IRQ;
179 };
180 
181 struct BREAK_GROUP
182 {
183     char            Name[128];
184     boolean         Enable;
185     boolean         bPC;
186     unsigned short  iPC;
187     boolean         bAC;
188     unsigned short  iAC;
189     boolean         bXR;
190     unsigned short  iXR;
191     boolean         bYR;
192     unsigned short  iYR;
193     boolean         bRAdresse;
194     unsigned short  iRAdresse;
195     boolean         bWAdresse;
196     unsigned short  iWAdresse;
197     boolean         bRWert;
198     unsigned short  iRWert;
199     boolean         bWWert;
200     unsigned short  iWWert;
201     boolean         bRZ;
202     unsigned short  iRZ;
203     boolean         bRZZyklus;
204     unsigned short  iRZZyklus;
205     boolean         bTrue;
206 };
207 
208 struct FLOPPY_INFO
209 {
210     bool            Motor;
211     bool            Data;
212 	float			Data_RMS;
213     unsigned char   Spur;
214     unsigned char   Sektor;
215 };
216 
217 struct D64_FILES
218 {
219     char            Name[17];
220     unsigned char   Track;
221     unsigned char   Sektor;
222     unsigned short  Laenge;
223     unsigned char   Typ;
224     unsigned short  Adresse;
225 };
226 
227 struct T64_FILES
228 {
229     char Name[17];
230     unsigned short  StartAdresse;
231     unsigned short  EndAdresse;
232     unsigned char   Typ;
233 };
234 
235 struct PSID_STRUCT
236 {
237     unsigned short int	Version;
238     unsigned short int	DataOffset;
239     unsigned short int	LoadAdress;
240     unsigned short int	InitAdress;
241     unsigned short int  PlayAdress;
242     unsigned short int	Songs;
243     unsigned short int	StartSong;
244     unsigned long int	Speed;
245     unsigned char       Name[32];
246     unsigned char       Autor[32];
247     unsigned char       Copyright[32];
248     unsigned short int	DataSize;
249 };
250 
251 struct IEC_STRUCT
252 {
253     bool    ATN_OUT;
254     bool    DATA_OUT;
255     bool    CLOCK_OUT;
256     bool    DATA_IN;
257     bool    CLOCK_IN;
258 };
259 
260 struct CHIP_INFO_STRUCT
261 {
262     unsigned short Type;			// 0 = ROM 1 = RAM
263     unsigned short BankLocation;	// $0000 Normal Cartridge
264     unsigned short LoadAdress;
265     unsigned short ChipSize;
266     uint8_t* BufferPointer;
267 };
268 
269 struct CARTRIDGE_INFO_STRUCT
270 {
271     char                Name[32];
272     char                Version[10];
273     char*               HardwareTypeString;
274     unsigned short      HardwareType;
275     unsigned char       EXROM;
276     unsigned char       GAME;
277     int                 ChipCount;
278     CHIP_INFO_STRUCT    ChipInfo[128];
279     CHIP_INFO_STRUCT    ChipInfoHi[128];
280 };
281 
282 struct FREEZ_RETURN_STRUCT
283 {
284     bool    ReuInstert;
285 };
286 
287 struct CPU_TUNING_STRUCT
288 {
289     int     InterruptCounterMin;
290 };
291 
292 struct EMU_TUNING_STRUCT
293 {
294     CPU_TUNING_STRUCT	cpu;
295 };
296 
297 enum
298 {
299     VJOY_TYPE_UNDEF,
300     VJOY_TYPE_KEY,
301     VJOY_TYPE_BUTTON,
302     VJOY_TYPE_HAT,
303     VJOY_TYPE_AXIS
304 };
305 
306 struct VIRTUAL_JOY_STRUCT
307 {
308     char            Name[256];
309     unsigned char   Type[5];                // [0]=Keyboard [1]=JOYBUTTON [2]=JOYHAT [3]=JOYAXIS
310     unsigned char   JoyIndex[5];
311 
312     // VJOY_TYPE_KEY
313     unsigned char   KeyDown[5];             // [0]=Hoch [1]=Runter [2]=Links [3]=Rechts [4]=Feuer
314     unsigned char   KeyUp[5];               // [0]=Hoch [1]=Runter [2]=Links [3]=Rechts [4]=Feuer
315 
316     // VJOY_TYPE_BUTTON
317     unsigned char ButtonNr[5];
318 
319     // VJOY_TYPE_HAT
320     unsigned char HatNr[5];
321     unsigned char HatValue[5];
322 
323     // VJOY_TYPE_AXIS
324     unsigned char AxisNr[5];
325     unsigned char AxisValue[5];             // 0 = Plus Richtung // 1 = Minus Richtung
326 };
327 
328 struct POINT_STRUCT
329 {
330     float x;
331     float y;
332 };
333 
334 struct C64_KEYS
335 {
336     unsigned char MatrixCode;
337     int SDLKeyCode;
338     bool          Shift;
339 };
340 
341 #endif // STRUCTS_H
342