VirtualC64 v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
Epyx.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 Epyx final : public Cartridge {
20
21 CartridgeTraits traits = {
22
23 .type = CRT_EPYX_FASTLOAD,
24 .title = "Epyx Fastload"
25 };
26
27 virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; }
28
29 // Indicates when the capacitor discharges. The Epyx cartridge utilizes a
30 // capacitor to switch the ROM on and off. During normal operation, the
31 // capacitor charges slowly. When it is completely charged, the ROM gets
32 // disabled. When the cartridge is attached, the capacitor is discharged
33 // and the ROM visible. To avoid the ROM to be disabled, the cartridge can
34 // either read from ROML or I/O space 1. Both operations discharge the
35 // capacitor and keep the ROM alive.
36
37 Cycle cycle = 0;
38
39
40 //
41 // Initializing
42 //
43
44public:
45
46 using Cartridge::Cartridge;
47
48
49 //
50 // Methods from CoreObject
51 //
52
53private:
54
55 void _dump(Category category, std::ostream& os) const override;
56
57
58 //
59 // Methods from CoreComponent
60 //
61
62public:
63
64 Epyx& operator= (const Epyx& other) {
65
66 Cartridge::operator=(other);
67
68 CLONE(cycle)
69
70 return *this;
71 }
72 virtual void clone(const Cartridge &other) override { *this = (const Epyx &)other; }
73
74 template <class T>
75 void serialize(T& worker)
76 {
77 if (isSoftResetter(worker)) return;
78
79 worker
80
81 << cycle;
82
83 } CARTRIDGE_SERIALIZERS(serialize);
84
85 void _reset(bool hard) override;
86
87 //
88 // Methods from Cartridge
89 //
90
91public:
92
93 void resetCartConfig() override;
94 u8 peekRomL(u16 addr) override;
95 u8 spypeekRomL(u16 addr) const override;
96 u8 peekIO1(u16 addr) override;
97 u8 spypeekIO1(u16 addr) const override;
98 u8 peekIO2(u16 addr) override;
99 u8 spypeekIO2(u16 addr) const override ;
100 void execute() override;
101
102private:
103
104 // Discharges the cartridge's capacitor
105 void dischargeCapacitor();
106};
107
108}
VirtualC64 project namespace.
Definition CmdQueue.cpp:16