20using namespace vc64::peddle;
24class CPU final :
public Peddle,
public Inspectable<CPUInfo> {
28 Descriptions descriptions = {{
31 .description =
"Central Processing Unit"
35 mutable CPUInfo info = { };
55 i64 dischargeCycleBit3;
56 i64 dischargeCycleBit6;
57 i64 dischargeCycleBit7;
63 static constexpr i64 dischargeCyclesVICE = 350000;
64 static constexpr i64 dischargeCyclesHOXS = 246312;
74 CPU(CPURevision cpuModel, C64& ref);
76 bool isC64CPU()
const {
return cpuModel == MOS_6510; }
77 bool isDriveCPU()
const {
return cpuModel == MOS_6502; }
79 void setID(isize
id) { this->
id = id; }
81 CPU& operator= (
const CPU& other) {
97 CLONE(dischargeCycleBit3)
98 CLONE(dischargeCycleBit6)
99 CLONE(dischargeCycleBit7)
114 void serialize(T& worker)
140 << reg.pport.direction
151 << dischargeCycleBit3
152 << dischargeCycleBit6
153 << dischargeCycleBit7;
155 if (isSoftResetter(worker))
return;
161 } SERIALIZERS(serialize);
170 const Descriptions &getDescriptions()
const override {
return descriptions; }
174 void _dump(Category category, std::ostream& os)
const override;
175 void _reset(
bool hard)
override;
176 void _trackOn()
override;
177 void _trackOff()
override;
186 void cacheInfo(CPUInfo &result)
const override;
195 virtual u8 read(u16 addr)
override;
196 virtual void write(u16 addr, u8 val)
override;
197 virtual u16 readResetVector()
override;
198 virtual u8 readDasm(u16 addr)
const override;
200 virtual void writePort(u8 val)
override;
201 virtual void writePortDir(u8 val)
override;
202 virtual u8 externalPortBits()
const override;
204 virtual void cpuDidJam()
override;
205 virtual void nmiWillTrigger()
override;
206 virtual void nmiDidTrigger()
override;
207 virtual void breakpointReached(u16 addr)
const override;
208 virtual void watchpointReached(u16 addr)
const override;
209 virtual void instructionLogged()
const override;
210 virtual void jumpedTo(u16 addr)
const override;
227 bool getLoram()
const {
return readPort() & 0x1; }
228 bool getHiram()
const {
return readPort() & 0x2; }
229 bool getCharen()
const {
return readPort() & 0x4; }
239 void processCommand(
const Cmd &cmd);
248 void setBreakpoint(u32 addr, isize ignores = 0) throws;
249 void moveBreakpoint(isize nr, u32 newAddr) throws;
251 void deleteBreakpoint(isize nr) throws;
252 void deleteBreakpointAt(u32 addr) throws;
253 void deleteAllBreakpoints() throws;
255 void enableBreakpoint(isize nr) throws { setEnableBreakpoint(nr,
true); }
256 void enableBreakpointAt(u32 addr)
throws { setEnableBreakpointAt(addr,
true); }
257 void enableAllBreakpoints() throws { setEnableAllBreakpoints(
true); }
259 void disableBreakpoint(isize nr)
throws { setEnableBreakpoint(nr,
false); }
260 void disableBreakpointAt(u32 addr)
throws { setEnableBreakpointAt(addr,
false); }
261 void disableAllBreakpoints() throws { setEnableAllBreakpoints(
false); }
263 void toggleBreakpoint(isize nr)
throws;
267 void setEnableBreakpoint(isize nr,
bool value)
throws;
268 void setEnableBreakpointAt(u32 addr,
bool value)
throws;
269 void setEnableAllBreakpoints(
bool value)
throws;
278 void setWatchpoint(u32 addr, isize ignores = 0) throws;
279 void moveWatchpoint(isize nr, u32 newAddr) throws;
281 void deleteWatchpoint(isize nr) throws;
282 void deleteWatchpointAt(u32 addr) throws;
283 void deleteAllWatchpoints() throws;
285 void enableWatchpoint(isize nr) throws { setEnableWatchpoint(nr,
true); }
286 void enableWatchpointAt(u32 addr)
throws { setEnableWatchpointAt(addr,
true); }
287 void enableAllWatchpoints() throws { setEnableAllWatchpoints(
true); }
289 void disableWatchpoint(isize nr)
throws { setEnableWatchpoint(nr,
false); }
290 void disableWatchpointAt(u32 addr)
throws { setEnableWatchpointAt(addr,
false); }
291 void disableAllWatchpoints() throws { setEnableAllWatchpoints(
false); }
293 void toggleWatchpoint(isize nr)
throws;
297 void setEnableWatchpoint(isize nr,
bool value)
throws;
298 void setEnableWatchpointAt(u32 addr,
bool value)
throws;
299 void setEnableAllWatchpoints(
bool value)
throws;
Inspection interface.
Definition Inspectable.h:32
VirtualC64 project namespace.
Definition CmdQueue.cpp:16