VirtualC64 v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
Expert.h
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// -----------------------------------------------------------------------------
12
13#pragma once
14
15#include "Cartridge.h"
16
17namespace vc64 {
18
19class Expert final : public Cartridge {
20
21 CartridgeTraits traits = {
22
23 .type = CRT_EXPERT,
24 .title = "Expert",
25
26 .memory = KB(8),
27 .battery = true,
28
29 .buttons = 2,
30 .button1 = "Reset",
31 .button2 = "ESM",
32
33 .switches = 1,
34 .switchLeft = "Prg",
35 .switchNeutral = "Off",
36 .switchRight = "On"
37 };
38
39 virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; }
40
41 // Flipflop deciding whether the cartridge is enabled or disabled
42 bool active = false;
43
44
45 //
46 // Initializing
47 //
48
49public:
50
51 using Cartridge::Cartridge;
52
53
54 //
55 // Methods from CoreObject
56 //
57
58 void _dump(Category category, std::ostream& os) const override;
59
60
61 //
62 // Methods from CoreComponent
63 //
64
65public:
66
67 Expert& operator= (const Expert& other) {
68
69 Cartridge::operator=(other);
70
71 CLONE(active)
72
73 return *this;
74 }
75 virtual void clone(const Cartridge &other) override { *this = (const Expert &)other; }
76
77 template <class T>
78 void serialize(T& worker)
79 {
80 if (isResetter(worker)) return;
81
82 worker
83
84 << active;
85
86 } CARTRIDGE_SERIALIZERS(serialize);
87
88
89 //
90 // Handling ROM packets
91 //
92
93 void loadChip(isize nr, const CRTFile &crt) override;
94
95
96 //
97 // Accessing cartridge memory
98 //
99
100 void updatePeekPokeLookupTables() override;
101 u8 peek(u16 addr) override;
102 u8 peekIO1(u16 addr) override;
103 u8 spypeekIO1(u16 addr) const override;
104 void poke(u16 addr, u8 value) override;
105 void pokeIO1(u16 addr, u8 value) override;
106
107 bool cartridgeRamIsVisible(u16 addr) const;
108 bool cartridgeRamIsWritable(u16 addr) const;
109
110
111 //
112 // Operating buttons
113 //
114
115 isize numButtons() const override { return 2; }
116 const char *getButtonTitle(isize nr) const override;
117 void pressButton(isize nr) override;
118
119
120 //
121 // Operating switches
122 //
123
124 const char *getSwitchDescription(isize pos) const override;
125 bool switchInPrgPosition() const { return switchIsLeft(); }
126 bool switchInOffPosition() const { return switchIsNeutral(); }
127 bool switchInOnPosition() const { return switchIsRight(); }
128
129
130 //
131 // Handling delegation calls
132 //
133
134 void nmiWillTrigger() override;
135};
136
137}
VirtualC64 project namespace.
Definition CmdQueue.cpp:16