1//============================================================================
2//
3// MM MM 6666 555555 0000 2222
4// MMMM MMMM 66 66 55 00 00 22 22
5// MM MMM MM 66 55 00 00 22
6// MM M MM 66666 55555 00 00 22222 -- "A 6502 Microprocessor Emulator"
7// MM MM 66 66 55 00 00 22
8// MM MM 66 66 55 55 00 00 22
9// MM MM 6666 5555 0000 222222
10//
11// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
12// and the Stella Team
13//
14// See the file "License.txt" for information on usage and redistribution of
15// this file, and for a DISCLAIMER OF ALL WARRANTIES.
16//============================================================================
17
18#ifndef NULLDEVICE_HXX
19#define NULLDEVICE_HXX
20
21class System;
22
23#include "bspf.hxx"
24#include "Device.hxx"
25
26/**
27 Class that represents a "null" device. The basic idea is that a
28 null device is installed in a 6502 based system anywhere there are
29 holes in the address space (i.e. no real device attached).
30
31 @author Bradford W. Mott
32*/
33class NullDevice : public Device
34{
35 public:
36 NullDevice() = default;
37 virtual ~NullDevice() = default;
38
39 public:
40 /**
41 Install device in the specified system. Invoked by the system
42 when the device is attached to it.
43
44 @param system The system the device should install itself in
45 */
46 void install(System& system) override { mySystem = &system; }
47
48 /**
49 Reset device to its power-on state
50 */
51 void reset() override { }
52
53 /**
54 Save the current state of this device to the given Serializer.
55
56 @param out The Serializer object to use
57 @return False on any errors, else true
58 */
59 bool save(Serializer& out) const override { return true; }
60
61 /**
62 Load the current state of this device from the given Serializer.
63
64 @param in The Serializer object to use
65 @return False on any errors, else true
66 */
67 bool load(Serializer& in) override { return true; }
68
69 public:
70 /**
71 Get the byte at the specified address
72
73 @return The byte at the specified address
74 */
75 uInt8 peek(uInt16 address) override {
76 cerr << "NullDevice: peek(" << address << ")\n";
77 return 0;
78 }
79
80 /**
81 Change the byte at the specified address to the given value
82
83 @param address The address where the value should be stored
84 @param value The value to be stored at the address
85
86 @return True if the poke changed the device address space, else false
87 */
88 bool poke(uInt16 address, uInt8 value) override {
89 cerr << "NullDevice: poke(" << address << "," << value << ")\n";
90 return false;
91 }
92
93 private:
94 // Following constructors and assignment operators not supported
95 NullDevice(const NullDevice&) = delete;
96 NullDevice(NullDevice&&) = delete;
97 NullDevice& operator=(const NullDevice&) = delete;
98 NullDevice& operator=(NullDevice&&) = delete;
99};
100
101#endif
102