openMSX
SG1000Pause.cc
Go to the documentation of this file.
1#include "SG1000Pause.hh"
2#include "Event.hh"
3#include "SDLKey.hh"
4#include "MSXCPU.hh"
6#include "MSXMotherBoard.hh"
7#include "checked_cast.hh"
8#include "serialize.hh"
9
10namespace openmsx {
11
13 : MSXDevice(config)
14 , Schedulable(getMotherBoard().getScheduler())
15{
17}
18
23
24void SG1000Pause::signalMSXEvent(const Event& event, EmuTime::param time) noexcept
25{
26 visit(overloaded{
27 [&](const KeyDownEvent& keyEvent) {
28 if (keyEvent.getKeyCode() == SDLK_F5) {
29 setSyncPoint(time);
30 }
31 },
32 [](const EventBase&) { /*ignore*/ }
33 }, event);
34}
35
36void SG1000Pause::executeUntil(EmuTime::param /*time*/)
37{
38 // We raise and then immediately lower the NMI request. This still triggers
39 // an interrupt, since our CPU core remembers the edge.
40 MSXCPU& cpu = getMotherBoard().getCPU();
41 cpu.raiseNMI();
42 cpu.lowerNMI();
43}
44
45template<typename Archive>
46void SG1000Pause::serialize(Archive& ar, unsigned /*version*/)
47{
48 ar.template serializeBase<MSXDevice>(*this);
49}
52
53} // namespace openmsx
#define REGISTER_MSXDEVICE(CLASS, NAME)
Definition MSXDevice.hh:356
void raiseNMI()
This method raises a non-maskable interrupt.
Definition MSXCPU.cc:303
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition MSXDevice.hh:36
MSXMotherBoard & getMotherBoard() const
Get the mother board this device belongs to.
Definition MSXDevice.cc:70
void registerEventListener(MSXEventListener &listener)
Registers a given object to receive certain events.
void unregisterEventListener(MSXEventListener &listener)
Unregisters a previously registered event listener.
MSXEventDistributor & getMSXEventDistributor()
This button is labeled "hold" on SG-1000, "pause" on SG-1000 mk 2 and "reset" on SC-3000.
~SG1000Pause() override
SG1000Pause(const DeviceConfig &config)
void serialize(Archive &ar, unsigned version)
Every class that wants to get scheduled at some point must inherit from this class.
This file implemented 3 utility functions:
Definition Autofire.cc:11
std::variant< KeyUpEvent, KeyDownEvent, MouseMotionEvent, MouseButtonUpEvent, MouseButtonDownEvent, MouseWheelEvent, JoystickAxisMotionEvent, JoystickHatEvent, JoystickButtonUpEvent, JoystickButtonDownEvent, OsdControlReleaseEvent, OsdControlPressEvent, WindowEvent, TextEvent, FileDropEvent, QuitEvent, FinishFrameEvent, CliCommandEvent, GroupEvent, BootEvent, FrameDrawnEvent, BreakEvent, SwitchRendererEvent, TakeReverseSnapshotEvent, AfterTimedEvent, MachineLoadedEvent, MachineActivatedEvent, MachineDeactivatedEvent, MidiInReaderEvent, MidiInWindowsEvent, MidiInCoreMidiEvent, MidiInCoreMidiVirtualEvent, MidiInALSAEvent, Rs232TesterEvent, Rs232NetEvent, ImGuiDelayedActionEvent, ImGuiActiveEvent > Event
Definition Event.hh:445
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)