| 1 |
#include "SG1000Pause.hh" |
| 2 |
|
| 3 |
#include "Event.hh" |
| 4 |
#include "MSXCPU.hh" |
| 5 |
#include "MSXEventDistributor.hh" |
| 6 |
#include "MSXMotherBoard.hh" |
| 7 |
#include "SDLKey.hh" |
| 8 |
#include "serialize.hh" |
| 9 |
|
| 10 |
namespace openmsx { |
| 11 |
|
| 12 |
SG1000Pause::SG1000Pause(const DeviceConfig& config) |
| 13 |
: MSXDevice(config) |
| 14 |
, Schedulable(getMotherBoard().getScheduler()) |
| 15 |
{ |
| 16 |
getMotherBoard().getMSXEventDistributor().registerEventListener(*this); |
| 17 |
} |
| 18 |
|
| 19 |
SG1000Pause::~SG1000Pause() |
| 20 |
{ |
| 21 |
getMotherBoard().getMSXEventDistributor().unregisterEventListener(*this); |
| 22 |
} |
| 23 |
|
| 24 |
void SG1000Pause::signalMSXEvent(const Event& event, EmuTime time) noexcept |
| 25 |
{ |
| 26 |
visit(overloaded{ |
| 27 |
[&](const KeyDownEvent& keyEvent) { |
| 28 |
if (keyEvent.getKeyCode() == SDLK_F5) { |
| 29 |
setSyncPoint(time); |
| 30 |
} |
| 31 |
}, |
| 32 |
[](const EventBase&) { } |
| 33 |
}, event); |
| 34 |
} |
| 35 |
|
| 36 |
void SG1000Pause::executeUntil(EmuTime ) |
| 37 |
{ |
| 38 |
|
| 39 |
|
| 40 |
MSXCPU& cpu = getMotherBoard().getCPU(); |
| 41 |
cpu.raiseNMI(); |
| 42 |
cpu.lowerNMI(); |
| 43 |
} |
| 44 |
|
| 45 |
template<typename Archive> |
| 46 |
void SG1000Pause::serialize(Archive& ar, unsigned ) |
| 47 |
{ |
| 48 |
ar.template serializeBase<MSXDevice>(*this); |
| 49 |
} |
| 50 |
INSTANTIATE_SERIALIZE_METHODS(SG1000Pause); |
| 51 |
REGISTER_MSXDEVICE(SG1000Pause, "SG1000Pause"); |
| 52 |
|
| 53 |
} |