VirtualC64 v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
StarDos.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 StarDos final : public Cartridge {
20
21 CartridgeTraits traits = {
22
23 .type = CRT_STARDOS,
24 .title = "StarDOS",
25 };
26
27 virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; }
28
29 i64 voltage = 5000000;
30 i64 latestVoltageUpdate = 0;
31
32
33 //
34 // Initializing
35 //
36
37public:
38
39 using Cartridge::Cartridge;
40
41
42 //
43 // Methods from CoreObject
44 //
45
46private:
47
48 void _dump(Category category, std::ostream& os) const override;
49
50
51 //
52 // Methods from CoreComponent
53 //
54
55public:
56
57 StarDos& operator= (const StarDos& other) {
58
59 Cartridge::operator=(other);
60
61 CLONE(voltage)
62 CLONE(latestVoltageUpdate)
63
64 return *this;
65 }
66 virtual void clone(const Cartridge &other) override { *this = (const StarDos &)other; }
67
68 template <class T>
69 void serialize(T& worker)
70 {
71 worker
72
73 << voltage
74 << latestVoltageUpdate;
75
76 } CARTRIDGE_SERIALIZERS(serialize);
77
78
79 //
80 // Accessing cartridge memory
81 //
82
83 u8 peekIO1(u16 addr) override { charge(); return 0; }
84 u8 spypeekIO1(u16 addr) const override { return 0; }
85 u8 peekIO2(u16 addr) override { discharge(); return 0; }
86 u8 spypeekIO2(u16 addr) const override { return 0; }
87 void pokeIO1(u16 addr, u8 value) override { charge(); }
88 void pokeIO2(u16 addr, u8 value) override { discharge(); }
89
90 //
91 // Handling delegation calls
92 //
93
94public:
95
96 void updatePeekPokeLookupTables() override;
97
98
99 //
100 // Working with the capacitor
101 //
102
103private:
104
105 void updateVoltage();
106 void charge();
107 void discharge();
108 void enableROML();
109 void disableROML();
110};
111
112}
VirtualC64 project namespace.
Definition CmdQueue.cpp:16