VirtualC64 v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
Isepic.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 Isepic final : public Cartridge {
20
21 CartridgeTraits traits = {
22
23 .type = CRT_ISEPIC,
24 .title = "Isepic",
25 .memory = KB(2),
26 .switches = 1,
27 .switchLeft = "Off",
28 .switchRight = "On"
29 };
30
31 virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; }
32
33 // Selected page inside the selected RAM bank
34 isize page;
35
36 // Original mapping of the uppermost memory page
37 MemoryType oldPeekSource;
38 MemoryType oldPokeTarget;
39
40
41 //
42 // Initialization
43 //
44
45public:
46
47 Isepic(C64 &ref);
48
49
50 //
51 // Methods from CoreObject
52 //
53
54 void _dump(Category category, std::ostream& os) const override;
55
56
57 //
58 // Methods from CoreComponent
59 //
60
61public:
62
63 Isepic& operator= (const Isepic& other) {
64
65 Cartridge::operator=(other);
66
67 CLONE(page)
68 CLONE(oldPeekSource)
69 CLONE(oldPokeTarget)
70
71 return *this;
72 }
73 virtual void clone(const Cartridge &other) override { *this = (const Isepic &)other; }
74
75 template <class T>
76 void serialize(T& worker)
77 {
78 worker
79
80 << page;
81
82 if (isResetter(worker)) return;
83
84 worker
85
86 << oldPeekSource
87 << oldPokeTarget;
88
89 } CARTRIDGE_SERIALIZERS(serialize);
90
91 void _reset(bool hard) override;
92
93
94 //
95 // Accessing cartridge memory
96 //
97
98 u8 peek(u16 addr) override;
99 u8 peekIO1(u16 addr) override;
100 u8 spypeekIO1(u16 addr) const override;
101 u8 peekIO2(u16 addr) override;
102 u8 spypeekIO2(u16 addr) const override;
103 void poke(u16 addr, u8 value) override;
104 void pokeIO1(u16 addr, u8 value) override;
105 void pokeIO2(u16 addr, u8 value) override;
106
107
108 //
109 // Operating switches
110 //
111
112 const char *getSwitchDescription(isize pos) const override;
113 void setSwitch(isize pos) override;
114 bool switchInOffPosition() const { return switchIsLeft(); }
115 bool switchInOnPosition() const { return switchIsRight(); }
116
117 bool cartIsVisible() const { return switchInOnPosition(); }
118 bool cartIsHidden() const { return !cartIsVisible(); }
119
120
121 //
122 // Handling delegation calls
123 //
124
125 void updatePeekPokeLookupTables() override;
126};
127
128}
VirtualC64 project namespace.
Definition CmdQueue.cpp:16