VirtualC64 v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
DmaDebugger.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 "DmaDebuggerTypes.h"
16#include "SubComponent.h"
17#include "Colors.h"
18
19namespace vc64 {
20
21class DmaDebugger final : public SubComponent {
22
23 friend class VICII;
24
25 Descriptions descriptions = {{
26
27 .name = "DmaDebugger",
28 .description = "Bus Monitor"
29 }};
30
31 ConfigOptions options = {
32
50 };
51
52 // Current configuration
53 DmaDebuggerConfig config = { };
54
55 // Color lookup table. There are 6 colors with 4 different shades
56 u32 debugColor[6][4];
57
58
59 //
60 // Methods
61 //
62
63public:
64
65 DmaDebugger(C64 &ref);
66
67 DmaDebugger& operator= (const DmaDebugger& other) {
68
69 for (isize i = 0; i < 6; i++) CLONE_ARRAY(debugColor[i])
70 CLONE(config)
71
72 return *this;
73 }
74
75
76 //
77 // Methods from Serializable
78 //
79
80public:
81
82 template <class T>
83 void serialize(T& worker)
84 {
85 if (isResetter(worker)) return;
86
87 worker
88
89 << debugColor
90
91 << config.dmaDebug
92 << config.dmaChannel
93 << config.dmaColor
94 << config.dmaDisplayMode
95 << config.dmaOpacity;
96
97 } SERIALIZERS(serialize);
98
99
100 //
101 // Methods from CoreComponent
102 //
103
104public:
105
106 const Descriptions &getDescriptions() const override { return descriptions; }
107
108private:
109
110 void _dump(Category category, std::ostream& os) const override;
111
112
113 //
114 // Methods from Configurable
115 //
116
117public:
118
119 const DmaDebuggerConfig &getConfig() const { return config; }
120 const ConfigOptions &getOptions() const override { return options; }
121 i64 getOption(Option opt) const override;
122 void checkOption(Option opt, i64 value) override;
123 void setOption(Option opt, i64 value) override;
124
125
126 //
127 // Managing colors
128 //
129
130 void setDmaDebugColor(MemAccess type, GpuColor color);
131 void setDmaDebugColor(MemAccess type, RgbColor color);
132
133
134 //
135 // Visualizing DMA
136 //
137
138public:
139
140 // Visualizes a memory access by drawing into the DMA debuger texture
141 void visualizeDma(isize offset, u8 data, MemAccess type);
142 void visualizeDma(u32 *ptr, u8 data, MemAccess type);
143
144 // Superimposes the debug output onto the current scanline
145 void computeOverlay(u32 *emuTexture, u32 *dmaTexture);
146
147
148 //
149 // Cutting layers
150 //
151
152public:
153
154 // Cuts out certain graphics layers
155 void cutLayers();
156};
157
158}
VirtualC64 project namespace.
Definition CmdQueue.cpp:16
@ OPT_DMA_DEBUG_CHANNEL5
Enable or disable channel 5.
Definition OptionTypes.h:61
@ OPT_VICII_CUT_OPACITY
Cutout opacity.
Definition OptionTypes.h:48
@ OPT_DMA_DEBUG_CHANNEL3
Enable or disable channel 3.
Definition OptionTypes.h:59
@ OPT_DMA_DEBUG_COLOR4
Color for channel 4.
Definition OptionTypes.h:66
@ OPT_DMA_DEBUG_COLOR3
Color for channel 3.
Definition OptionTypes.h:65
@ OPT_DMA_DEBUG_COLOR5
Color for channel 5.
Definition OptionTypes.h:67
@ OPT_DMA_DEBUG_COLOR1
Color for channel 1.
Definition OptionTypes.h:63
@ OPT_DMA_DEBUG_CHANNEL2
Enable or disable channel 2.
Definition OptionTypes.h:58
@ OPT_DMA_DEBUG_MODE
DMA texture overlay mode.
Definition OptionTypes.h:54
@ OPT_VICII_CUT_LAYERS
Cutout some graphics layers.
Definition OptionTypes.h:47
@ OPT_DMA_DEBUG_CHANNEL1
Enable or disable channel 1.
Definition OptionTypes.h:57
@ OPT_DMA_DEBUG_OPACITY
DMA texture opacity.
Definition OptionTypes.h:55
@ OPT_DMA_DEBUG_CHANNEL0
Enable or disable channel 0.
Definition OptionTypes.h:56
@ OPT_DMA_DEBUG_COLOR2
Color for channel 2.
Definition OptionTypes.h:64
@ OPT_DMA_DEBUG_ENABLE
Global on/off switch for the DMA debugger.
Definition OptionTypes.h:53
@ OPT_DMA_DEBUG_COLOR0
Color for channel 0.
Definition OptionTypes.h:62
@ OPT_DMA_DEBUG_CHANNEL4
Enable or disable channel 4.
Definition OptionTypes.h:60