VirtualC64 v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
EmulatorTypes.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2// This file is part of VirtualC64
3//
4// Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de
5// This FILE is dual-licensed. You are free to choose between:
6//
7// - The GNU General Public License v3 (or any later version)
8// - The Mozilla Public License v2
9//
10// SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0
11// -----------------------------------------------------------------------------
13
14#pragma once
15
16#include "Reflection.h"
17#include "ThreadTypes.h"
18#include "C64Types.h"
19
20namespace vc64 {
21
22//
23// Enumerations
24//
25
26enum_long(DEBUG_FLAG)
27{
28 // General
32
33 // Emulator
40
41 // Run ahead
44
45 // CPU
48
49 // Memory
51
52 // CIAs
56
57 // VICII
63
64 // SID
70
71 // Drive
80
81 // Media
84
85 // Peripherals
93
94 // Other components
97
100 FLAG_FORCE_MEGA64_MISMATCH,
101 FLAG_FORCE_SNAP_TOO_OLD,
102 FLAG_FORCE_SNAP_TOO_NEW,
103 FLAG_FORCE_SNAP_IS_BETA,
104 FLAG_FORCE_SNAP_CORRUPTED,
105 FLAG_FORCE_CRT_UNKNOWN,
106 FLAG_FORCE_CRT_UNSUPPORTED,
107 FLAG_FORCE_RECORDING_ERROR,
108 FLAG_FORCE_NO_FFMPEG
109};
110typedef DEBUG_FLAG DebugFlag;
111
112struct DebugFlagEnum : util::Reflection<DebugFlagEnum, DebugFlag>
113{
114 static constexpr long minVal = 0;
115 static constexpr long maxVal = FLAG_FORCE_NO_FFMPEG;
116 static bool isValid(auto val) { return val >= minVal && val <= maxVal; }
117
118 static const char *prefix() { return "FLAG"; }
119 static const char *key(long value)
120 {
121 switch (value) {
122
123 case FLAG_XFILES: return "XFILES";
124 case FLAG_CNF_DEBUG: return "CNF_DEBUG";
125 case FLAG_DEF_DEBUG: return "DEF_DEBUG";
126
127 // Emulator
128 case FLAG_RUN_DEBUG: return "RUN_DEBUG";
129 case FLAG_TIM_DEBUG: return "TIM_DEBUG";
130 case FLAG_WARP_DEBUG: return "WARP_DEBUG";
131 case FLAG_CMD_DEBUG: return "CMD_DEBUG";
132 case FLAG_MSG_DEBUG: return "MSG_DEBUG";
133 case FLAG_SNP_DEBUG: return "SNP_DEBUG";
134
135 // Run ahead
136 case FLAG_RUA_DEBUG: return "RUA_DEBUG";
137 case FLAG_RUA_ON_STEROIDS: return "RUA_ON_STEROIDS";
138
139 // CPU
140 case FLAG_CPU_DEBUG: return "CPU_DEBUG";
141 case FLAG_IRQ_DEBUG: return "IRQ_DEBUG";
142
143 // Memory
144 case FLAG_MEM_DEBUG: return "MEM_DEBUG";
145
146 // CIAs
147 case FLAG_CIA_DEBUG: return "CIA_DEBUG";
148 case FLAG_CIAREG_DEBUG: return "CIAREG_DEBUG";
149 case FLAG_CIA_ON_STEROIDS: return "CIA_ON_STEROIDS";
150
151 // VICII
152 case FLAG_VICII_DEBUG: return "VICII_DEBUG";
153 case FLAG_VICII_REG_DEBUG: return "VICII_REG_DEBUG";
154 case FLAG_VICII_SAFE_MODE: return "VICII_SAFE_MODE";
155 case FLAG_VICII_STATS: return "VICII_STATS";
156 case FLAG_RASTERIRQ_DEBUG: return "RASTERIRQ_DEBUG";
157
158 // SID
159 case FLAG_SID_DEBUG: return "SID_DEBUG";
160 case FLAG_SID_EXEC: return "SID_EXEC";
161 case FLAG_SIDREG_DEBUG: return "SIDREG_DEBUG";
162 case FLAG_AUDBUF_DEBUG: return "AUDBUF_DEBUG";
163 case FLAG_AUDVOL_DEBUG: return "AUDVOL_DEBUG";
164
165 // Drive
166 case FLAG_VIA_DEBUG: return "VIA_DEBUG";
167 case FLAG_PIA_DEBUG: return "PIA_DEBUG";
168 case FLAG_SER_DEBUG: return "SER_DEBUG";
169 case FLAG_DSK_DEBUG: return "DSK_DEBUG";
170 case FLAG_DSKCHG_DEBUG: return "DSKCHG_DEBUG";
171 case FLAG_GCR_DEBUG: return "GCR_DEBUG";
172 case FLAG_FS_DEBUG: return "FS_DEBUG";
173 case FLAG_PAR_DEBUG: return "PAR_DEBUG";
174
175 // Media
176 case FLAG_CRT_DEBUG: return "CRT_DEBUG";
177 case FLAG_FILE_DEBUG: return "FILE_DEBUG";
178
179 // Peripherals
180 case FLAG_JOY_DEBUG: return "JOY_DEBUG";
181 case FLAG_DRV_DEBUG: return "DRV_DEBUG";
182 case FLAG_TAP_DEBUG: return "TAP_DEBUG";
183 case FLAG_KBD_DEBUG: return "KBD_DEBUG";
184 case FLAG_PRT_DEBUG: return "PRT_DEBUG";
185 case FLAG_EXP_DEBUG: return "EXP_DEBUG";
186 case FLAG_LIP_DEBUG: return "LIP_DEBUG";
187
188 // Other components
189 case FLAG_REC_DEBUG: return "REC_DEBUG";
190 case FLAG_REU_DEBUG: return "REU_DEBUG";
191
192 // Forced error conditions
193 case FLAG_FORCE_ROM_MISSING: return "FORCE_ROM_MISSING";
194 case FLAG_FORCE_MEGA64_MISMATCH: return "FORCE_MEGA64_MISMATCH";
195 case FLAG_FORCE_SNAP_TOO_OLD: return "FORCE_SNAP_TOO_OLD";
196 case FLAG_FORCE_SNAP_TOO_NEW: return "FORCE_SNAP_TOO_NEW";
197 case FLAG_FORCE_SNAP_IS_BETA: return "FORCE_SNAP_IS_BETA";
198 case FLAG_FORCE_SNAP_CORRUPTED: return "FORCE_SNAP_CORRUPTE";
199 case FLAG_FORCE_CRT_UNKNOWN: return "FORCE_CRT_UNKNOWN";
200 case FLAG_FORCE_CRT_UNSUPPORTED: return "FORCE_CRT_UNSUPPORTED";
201 case FLAG_FORCE_RECORDING_ERROR: return "FORCE_RECORDING_ERROR";
202 case FLAG_FORCE_NO_FFMPEG: return "FORCE_NO_FFMPEG";
203 }
204 return "???";
205 }
206
207 static const char *help(long value)
208 {
209 switch (value) {
210
211 case FLAG_XFILES: return "Report paranormal activity";
212 case FLAG_CNF_DEBUG: return "Configuration";
213 case FLAG_DEF_DEBUG: return "User defaults";
214
215 // Emulator
216 case FLAG_RUN_DEBUG: return "Run loop, component states";
217 case FLAG_TIM_DEBUG: return "Thread synchronization";
218 case FLAG_WARP_DEBUG: return "Warp mode";
219 case FLAG_CMD_DEBUG: return "Command queue";
220 case FLAG_MSG_DEBUG: return "Message queue";
221 case FLAG_SNP_DEBUG: return "Serializing (snapshots)";
222
223 // Run ahead
224 case FLAG_RUA_DEBUG: return "Run-ahead mode";
225 case FLAG_RUA_ON_STEROIDS: return "Update the run-ahead instance in every frame";
226
227 // CPU
228 case FLAG_CPU_DEBUG: return "CPU";
229 case FLAG_IRQ_DEBUG: return "Interrupts";
230
231 // Memory
232 case FLAG_MEM_DEBUG: return "RAM and ROM";
233
234 // CIAs
235 case FLAG_CIA_DEBUG: return "Complex Interface Adapter";
236 case FLAG_CIAREG_DEBUG: return "CIA registers";
237 case FLAG_CIA_ON_STEROIDS: return "Keep CIAs awake all the time";
238
239 // VICII
240 case FLAG_VICII_DEBUG: return "Video Interface Controller";
241 case FLAG_VICII_REG_DEBUG: return "VICII registers";
242 case FLAG_VICII_SAFE_MODE: return "Disable performance optimizations";
243 case FLAG_VICII_STATS: return "Collect statistical information";
244 case FLAG_RASTERIRQ_DEBUG: return "Raster interrupt";
245
246 // SID
247 case FLAG_SID_DEBUG: return "Sound Interface Device";
248 case FLAG_SID_EXEC: return "Sound Interface Device (Execution)";
249 case FLAG_SIDREG_DEBUG: return "Sound Interface Device (Registers)";
250 case FLAG_AUDBUF_DEBUG: return "Audio buffers";
251
252 // Drive
253 case FLAG_VIA_DEBUG: return "Versatile Interface Adapter";
254 case FLAG_PIA_DEBUG: return "Peripheral Interface Adapter";
255 case FLAG_SER_DEBUG: return "Serial port (IEC bus)";
256 case FLAG_DSK_DEBUG: return "Disk controller execution";
257 case FLAG_DSKCHG_DEBUG: return "Disk change procedure";
258 case FLAG_GCR_DEBUG: return "Disk encoding / decoding";
259 case FLAG_FS_DEBUG: return "File System Classes";
260 case FLAG_PAR_DEBUG: return "Parallel cable";
261
262 // Media
263 case FLAG_CRT_DEBUG: return "Cartridges";
264 case FLAG_FILE_DEBUG: return "Media files (D64,T64,...)";
265
266 // Peripherals
267 case FLAG_JOY_DEBUG: return "Joystick";
268 case FLAG_DRV_DEBUG: return "Floppy drives";
269 case FLAG_TAP_DEBUG: return "Datasette";
270 case FLAG_KBD_DEBUG: return "Keyboard";
271 case FLAG_PRT_DEBUG: return "Control ports and connected devices";
272 case FLAG_EXP_DEBUG: return "Expansion port";
273 case FLAG_LIP_DEBUG: return "Light pen";
274
275 // Other components
276 case FLAG_REC_DEBUG: return "Screen recorder";
277 case FLAG_REU_DEBUG: return "REU memory expansion";
278
279 // Forced error conditions
280 case FLAG_FORCE_ROM_MISSING: return "";
281 case FLAG_FORCE_MEGA64_MISMATCH: return "";
282 case FLAG_FORCE_SNAP_TOO_OLD: return "";
283 case FLAG_FORCE_SNAP_TOO_NEW: return "";
284 case FLAG_FORCE_SNAP_IS_BETA: return "";
285 case FLAG_FORCE_SNAP_CORRUPTED: return "";
286 case FLAG_FORCE_CRT_UNKNOWN: return "";
287 case FLAG_FORCE_CRT_UNSUPPORTED: return "";
288 case FLAG_FORCE_RECORDING_ERROR: return "";
289 case FLAG_FORCE_NO_FFMPEG: return "";
290 }
291 return "???";
292 }
293};
294
295
296//
297// Structures
298//
299
301typedef struct
302{
303
304}
306
308typedef struct
309{
312 bool powered;
313 bool paused;
314 bool running;
316 bool warping;
317 bool tracking;
318}
320
322typedef struct
323{
324 double cpuLoad;
325 double fps;
326 isize resyncs;
327}
329
330}
VirtualC64 project namespace.
Definition CmdQueue.cpp:16
DEBUG_FLAG
Definition EmulatorTypes.h:27
@ FLAG_FILE_DEBUG
Debug the handling of media files.
Definition EmulatorTypes.h:83
@ FLAG_CIA_DEBUG
Debug the Complex Interface Adapters.
Definition EmulatorTypes.h:53
@ FLAG_GCR_DEBUG
Debug the GCR encoder and decoder.
Definition EmulatorTypes.h:77
@ FLAG_KBD_DEBUG
Debug the keyboard.
Definition EmulatorTypes.h:89
@ FLAG_SID_DEBUG
Debug the Sound Interface Device.
Definition EmulatorTypes.h:65
@ FLAG_DEF_DEBUG
Debug the user defaults storage.
Definition EmulatorTypes.h:31
@ FLAG_CRT_DEBUG
Debug cartridges.
Definition EmulatorTypes.h:82
@ FLAG_RUA_DEBUG
Debug run-ahead mode.
Definition EmulatorTypes.h:42
@ FLAG_PIA_DEBUG
Debug the Peripheral Interface Adapter.
Definition EmulatorTypes.h:73
@ FLAG_TIM_DEBUG
Debug thread synchronization.
Definition EmulatorTypes.h:35
@ FLAG_SID_EXEC
Debug SID execution.
Definition EmulatorTypes.h:66
@ FLAG_PRT_DEBUG
Debug the control port and connected devices.
Definition EmulatorTypes.h:90
@ FLAG_XFILES
Report paranormal activity.
Definition EmulatorTypes.h:29
@ FLAG_AUDBUF_DEBUG
Debug the audio buffers.
Definition EmulatorTypes.h:68
@ FLAG_WARP_DEBUG
Debug warp mode.
Definition EmulatorTypes.h:36
@ FLAG_LIP_DEBUG
Debug the light pen.
Definition EmulatorTypes.h:92
@ FLAG_RASTERIRQ_DEBUG
Debug raster interrupts.
Definition EmulatorTypes.h:62
@ FLAG_REU_DEBUG
Debug the REU memory expansion.
Definition EmulatorTypes.h:96
@ FLAG_TAP_DEBUG
Debug the datasette.
Definition EmulatorTypes.h:88
@ FLAG_DRV_DEBUG
Debug the floppy drives.
Definition EmulatorTypes.h:87
@ FLAG_VIA_DEBUG
Debug the Versatile Interface Adapter.
Definition EmulatorTypes.h:72
@ FLAG_CNF_DEBUG
Debug configuration code.
Definition EmulatorTypes.h:30
@ FLAG_IRQ_DEBUG
Debug interrupts.
Definition EmulatorTypes.h:47
@ FLAG_VICII_DEBUG
Debug the Video Interface Controller.
Definition EmulatorTypes.h:58
@ FLAG_VICII_SAFE_MODE
Disable performance optimizations.
Definition EmulatorTypes.h:60
@ FLAG_FS_DEBUG
Debug files system related code.
Definition EmulatorTypes.h:78
@ FLAG_SIDREG_DEBUG
Debug SID register accesses.
Definition EmulatorTypes.h:67
@ FLAG_PAR_DEBUG
Debug the parallel drive cable.
Definition EmulatorTypes.h:79
@ FLAG_VICII_REG_DEBUG
Debug VICII register accesses.
Definition EmulatorTypes.h:59
@ FLAG_JOY_DEBUG
Debug the joysticks.
Definition EmulatorTypes.h:86
@ FLAG_CIA_ON_STEROIDS
Keep the CIAs awake all the time.
Definition EmulatorTypes.h:55
@ FLAG_VICII_STATS
Collect statistical information.
Definition EmulatorTypes.h:61
@ FLAG_EXP_DEBUG
Debug the expansion port.
Definition EmulatorTypes.h:91
@ FLAG_MSG_DEBUG
Debug the message queue.
Definition EmulatorTypes.h:38
@ FLAG_CPU_DEBUG
Debug the CPU.
Definition EmulatorTypes.h:46
@ FLAG_RUN_DEBUG
Debug the run loop and component states.
Definition EmulatorTypes.h:34
@ FLAG_AUDVOL_DEBUG
Debug the audio volumes.
Definition EmulatorTypes.h:69
@ FLAG_SER_DEBUG
Debug the serial port (IEC bus)
Definition EmulatorTypes.h:74
@ FLAG_DSK_DEBUG
Debug the disk controller execution.
Definition EmulatorTypes.h:75
@ FLAG_DSKCHG_DEBUG
Debug the disk change procedure.
Definition EmulatorTypes.h:76
@ FLAG_SNP_DEBUG
Debug snapshots.
Definition EmulatorTypes.h:39
@ FLAG_CMD_DEBUG
Debug the command queue.
Definition EmulatorTypes.h:37
@ FLAG_RUA_ON_STEROIDS
Update the run-ahead instance in every frame.
Definition EmulatorTypes.h:43
@ FLAG_MEM_DEBUG
Debug memory accesses.
Definition EmulatorTypes.h:50
@ FLAG_CIAREG_DEBUG
Debug the CIA register accesses.
Definition EmulatorTypes.h:54
@ FLAG_REC_DEBUG
Debug the screen recorder.
Definition EmulatorTypes.h:95
@ FLAG_FORCE_ROM_MISSING
Forced error condition.
Definition EmulatorTypes.h:99
EXEC_STATE
Execution state.
Definition ThreadTypes.h:22
The current emulator configuration.
Definition EmulatorTypes.h:302
The current emulator state.
Definition EmulatorTypes.h:309
bool paused
Indicates if emulation is paused.
Definition EmulatorTypes.h:313
bool running
Indicates if the emulator is running.
Definition EmulatorTypes.h:314
bool powered
Indicates if the emulator is powered on.
Definition EmulatorTypes.h:312
isize refreshRate
Screen refresh rate of the virtual C64.
Definition EmulatorTypes.h:311
ExecState state
The current emulator state.
Definition EmulatorTypes.h:310
bool suspended
Indicates if the emulator is in suspended state.
Definition EmulatorTypes.h:315
bool warping
Indicates if warp mode is currently on.
Definition EmulatorTypes.h:316
bool tracking
Indicates if track mode is enabled.
Definition EmulatorTypes.h:317
Collected run-time data.
Definition EmulatorTypes.h:323
isize resyncs
Number of out-of-sync conditions.
Definition EmulatorTypes.h:326
double fps
Measured frames per seconds.
Definition EmulatorTypes.h:325
double cpuLoad
Measured CPU load.
Definition EmulatorTypes.h:324