VirtualC64 v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
MemoryTypes.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
18namespace vc64 {
19
20//
21// Enumerations
22//
23
38typedef M_TYPE MemoryType;
39
40struct MemoryTypeEnum : util::Reflection<MemoryTypeEnum, MemoryType> {
41
42 static constexpr long minVal = 1;
43 static constexpr long maxVal = M_NONE;
44 static bool isValid(auto value) { return value >= minVal && value <= maxVal; }
45
46 static const char *prefix() { return "M"; }
47 static const char *key(long value)
48 {
49 switch (value) {
50
51 case M_RAM: return "RAM";
52 case M_CHAR: return "CHAR";
53 case M_KERNAL: return "KERNAL";
54 case M_BASIC: return "BASIC";
55 case M_IO: return "IO";
56 case M_CRTLO: return "CRTLO";
57 case M_CRTHI: return "CRTHI";
58 case M_PP: return "PP";
59 case M_NONE: return "NONE";
60 case M_COUNT: return "???";
61 }
62 return "???";
63 }
64};
65
75typedef RAM_PATTERN RamPattern;
76
77struct RamPatternEnum : util::Reflection<RamPatternEnum, RamPattern> {
78
79 static constexpr long minVal = 0;
80 static constexpr long maxVal = RAM_PATTERN_RANDOM;
81 static bool isValid(auto value) { return value >= minVal && value <= maxVal; }
82
83 static const char *prefix() { return "RAM_PATTERN"; }
84 static const char *key(long value)
85 {
86 switch (value) {
87
88 case RAM_PATTERN_VICE: return "VICE";
89 case RAM_PATTERN_CCS: return "CCS";
90 case RAM_PATTERN_ZEROES: return "ZEROES";
91 case RAM_PATTERN_ONES: return "ONES";
92 case RAM_PATTERN_RANDOM: return "RANDOM";
93 }
94 return "???";
95 }
96};
97
98enum_long(ROM_TYPE)
99{
100 ROM_TYPE_BASIC,
101 ROM_TYPE_CHAR,
102 ROM_TYPE_KERNAL,
103 ROM_TYPE_VC1541
104};
105typedef ROM_TYPE RomType;
106
107struct RomTypeEnum : util::Reflection<RomTypeEnum, RomType> {
108
109 static constexpr long minVal = 0;
110 static constexpr long maxVal = ROM_TYPE_VC1541;
111 static bool isValid(auto value) { return value >= minVal && value <= maxVal; }
112
113 static const char *prefix() { return "ROM_TYPE"; }
114 static const char *key(long value)
115 {
116 switch (value) {
117
118 case ROM_TYPE_BASIC: return "BASIC";
119 case ROM_TYPE_CHAR: return "CHAR";
120 case ROM_TYPE_KERNAL: return "KERNAL";
121 case ROM_TYPE_VC1541: return "VC1541";
122 }
123 return "???";
124 }
125};
126
127enum_long(ROM_VENDOR)
128{
129 ROM_VENDOR_COMMODORE,
130 ROM_VENDOR_MEGA65,
131 ROM_VENDOR_OTHER
132};
133typedef ROM_VENDOR RomVendor;
134
135struct RomVendorEnum : util::Reflection<RomVendorEnum, RomVendor> {
136
137 static constexpr long minVal = 0;
138 static constexpr long maxVal = ROM_VENDOR_OTHER;
139 static bool isValid(auto value) { return value >= minVal && value <= maxVal; }
140
141 static const char *prefix() { return "ROM_VENDOR"; }
142 static const char *key(long value)
143 {
144 switch (value) {
145
146 case ROM_VENDOR_COMMODORE: return "COMMODORE";
147 case ROM_VENDOR_MEGA65: return "MEGA65";
148 case ROM_VENDOR_OTHER: return "OTHER";
149 }
150 return "???";
151 }
152};
153
154
155//
156// Structures
157//
158
159typedef struct
160{
161 RamPattern ramPattern;
162 bool saveRoms;
163 bool heatmap;
164}
165MemConfig;
166
167typedef struct
168{
169 bool exrom;
170 bool game;
171 bool loram;
172 bool hiram;
173 bool charen;
174 u8 bankMap;
175
176 MemoryType peekSrc[16];
177 MemoryType vicPeekSrc[16];
178}
179MemInfo;
180
181typedef struct
182{
183 isize reads[65536];
184 isize writes[65536];
185}
186MemStats;
187
188typedef struct {
189
190 u64 fnv;
191 u32 crc;
192
193 const char *title;
194 const char *subtitle;
195 const char *revision;
196
197 RomVendor vendor;
198 RomType type;
199 bool patched;
200}
201RomTraits;
202
203}
VirtualC64 project namespace.
Definition CmdQueue.cpp:16
M_TYPE
Memory type.
Definition MemoryTypes.h:26
@ M_CRTHI
Cartridge Rom (high bank)
Definition MemoryTypes.h:33
@ M_BASIC
Basic Rom.
Definition MemoryTypes.h:30
@ M_CRTLO
Cartridge Rom (low bank)
Definition MemoryTypes.h:32
@ M_PP
Processor port.
Definition MemoryTypes.h:34
@ M_KERNAL
Kernal Rom.
Definition MemoryTypes.h:29
@ M_IO
IO space.
Definition MemoryTypes.h:31
@ M_NONE
Unmapped.
Definition MemoryTypes.h:35
@ M_CHAR
Character Rom.
Definition MemoryTypes.h:28
@ M_RAM
Ram.
Definition MemoryTypes.h:27
RAM_PATTERN
Ram startup pattern.
Definition MemoryTypes.h:68
@ RAM_PATTERN_ONES
Initialize with all ones.
Definition MemoryTypes.h:72
@ RAM_PATTERN_RANDOM
Initialize with pseudo-random values.
Definition MemoryTypes.h:73
@ RAM_PATTERN_CCS
Pattern used by the CCS emulator.
Definition MemoryTypes.h:70
@ RAM_PATTERN_ZEROES
Initialize with all zeroes.
Definition MemoryTypes.h:71
@ RAM_PATTERN_VICE
Pattern used by the VICE emulator.
Definition MemoryTypes.h:69