mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-25 01:32:55 +00:00
Increases const correctness, marks some additional constructors as constexpr, switches std::atomic construction style.
This commit is contained in:
parent
41fc6c20a0
commit
512a52e88d
@ -36,7 +36,7 @@ void MultiKeyboardMachine::type_string(const std::string &string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MultiKeyboardMachine::can_type(char c) {
|
bool MultiKeyboardMachine::can_type(char c) const {
|
||||||
bool can_type = true;
|
bool can_type = true;
|
||||||
for(const auto &machine: machines_) {
|
for(const auto &machine: machines_) {
|
||||||
can_type &= machine->can_type(c);
|
can_type &= machine->can_type(c);
|
||||||
@ -70,10 +70,10 @@ void MultiKeyboardMachine::MultiKeyboard::reset_all_keys() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::set<Inputs::Keyboard::Key> &MultiKeyboardMachine::MultiKeyboard::observed_keys() {
|
const std::set<Inputs::Keyboard::Key> &MultiKeyboardMachine::MultiKeyboard::observed_keys() const {
|
||||||
return observed_keys_;
|
return observed_keys_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MultiKeyboardMachine::MultiKeyboard::is_exclusive() {
|
bool MultiKeyboardMachine::MultiKeyboard::is_exclusive() const {
|
||||||
return is_exclusive_;
|
return is_exclusive_;
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@ class MultiKeyboardMachine: public MachineTypes::KeyboardMachine {
|
|||||||
|
|
||||||
bool set_key_pressed(Key key, char value, bool is_pressed) final;
|
bool set_key_pressed(Key key, char value, bool is_pressed) final;
|
||||||
void reset_all_keys() final;
|
void reset_all_keys() final;
|
||||||
const std::set<Key> &observed_keys() final;
|
const std::set<Key> &observed_keys() const final;
|
||||||
bool is_exclusive() final;
|
bool is_exclusive() const final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::vector<MachineTypes::KeyboardMachine *> &machines_;
|
const std::vector<MachineTypes::KeyboardMachine *> &machines_;
|
||||||
@ -51,7 +51,7 @@ class MultiKeyboardMachine: public MachineTypes::KeyboardMachine {
|
|||||||
void clear_all_keys() final;
|
void clear_all_keys() final;
|
||||||
void set_key_state(uint16_t key, bool is_pressed) final;
|
void set_key_state(uint16_t key, bool is_pressed) final;
|
||||||
void type_string(const std::string &) final;
|
void type_string(const std::string &) final;
|
||||||
bool can_type(char c) final;
|
bool can_type(char c) const final;
|
||||||
Inputs::Keyboard &get_keyboard() final;
|
Inputs::Keyboard &get_keyboard() final;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ template <typename TimeUnit> class DeferredQueue {
|
|||||||
@returns The amount of time until the next enqueued action will occur,
|
@returns The amount of time until the next enqueued action will occur,
|
||||||
or TimeUnit(-1) if the queue is empty.
|
or TimeUnit(-1) if the queue is empty.
|
||||||
*/
|
*/
|
||||||
TimeUnit time_until_next_action() {
|
TimeUnit time_until_next_action() const {
|
||||||
if(pending_actions_.empty()) return TimeUnit(-1);
|
if(pending_actions_.empty()) return TimeUnit(-1);
|
||||||
return pending_actions_.front().delay;
|
return pending_actions_.front().delay;
|
||||||
}
|
}
|
||||||
@ -95,7 +95,7 @@ template <typename TimeUnit> class DeferredQueue {
|
|||||||
template <typename TimeUnit> class DeferredQueuePerformer: public DeferredQueue<TimeUnit> {
|
template <typename TimeUnit> class DeferredQueuePerformer: public DeferredQueue<TimeUnit> {
|
||||||
public:
|
public:
|
||||||
/// Constructs a DeferredQueue that will call target(period) in between deferred actions.
|
/// Constructs a DeferredQueue that will call target(period) in between deferred actions.
|
||||||
DeferredQueuePerformer(std::function<void(TimeUnit)> &&target) : target_(std::move(target)) {}
|
constexpr DeferredQueuePerformer(std::function<void(TimeUnit)> &&target) : target_(std::move(target)) {}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Runs for @c length units of time.
|
Runs for @c length units of time.
|
||||||
|
@ -129,7 +129,7 @@ void TMS9918::set_display_type(Outputs::Display::DisplayType display_type) {
|
|||||||
crt_.set_display_type(display_type);
|
crt_.set_display_type(display_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
Outputs::Display::DisplayType TMS9918::get_display_type() {
|
Outputs::Display::DisplayType TMS9918::get_display_type() const {
|
||||||
return crt_.get_display_type();
|
return crt_.get_display_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class TMS9918: public Base {
|
|||||||
void set_display_type(Outputs::Display::DisplayType);
|
void set_display_type(Outputs::Display::DisplayType);
|
||||||
|
|
||||||
/*! Gets the type of display the CRT will request. */
|
/*! Gets the type of display the CRT will request. */
|
||||||
Outputs::Display::DisplayType get_display_type();
|
Outputs::Display::DisplayType get_display_type() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Runs the VCP for the number of cycles indicate; it is an implicit assumption of the code
|
Runs the VCP for the number of cycles indicate; it is an implicit assumption of the code
|
||||||
|
@ -30,7 +30,7 @@ bool Keyboard::set_key_pressed(Key key, char value, bool is_pressed) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::set<Inputs::Keyboard::Key> &Keyboard::get_essential_modifiers() {
|
const std::set<Inputs::Keyboard::Key> &Keyboard::get_essential_modifiers() const {
|
||||||
return essential_modifiers_;
|
return essential_modifiers_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,16 +43,16 @@ void Keyboard::set_delegate(Delegate *delegate) {
|
|||||||
delegate_ = delegate;
|
delegate_ = delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Keyboard::get_key_state(Key key) {
|
bool Keyboard::get_key_state(Key key) const {
|
||||||
const size_t key_offset = size_t(key);
|
const size_t key_offset = size_t(key);
|
||||||
if(key_offset >= key_states_.size()) return false;
|
if(key_offset >= key_states_.size()) return false;
|
||||||
return key_states_[key_offset];
|
return key_states_[key_offset];
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::set<Keyboard::Key> &Keyboard::observed_keys() {
|
const std::set<Keyboard::Key> &Keyboard::observed_keys() const {
|
||||||
return observed_keys_;
|
return observed_keys_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Keyboard::is_exclusive() {
|
bool Keyboard::is_exclusive() const {
|
||||||
return is_exclusive_;
|
return is_exclusive_;
|
||||||
}
|
}
|
||||||
|
@ -53,10 +53,10 @@ class Keyboard {
|
|||||||
virtual void reset_all_keys();
|
virtual void reset_all_keys();
|
||||||
|
|
||||||
/// @returns a set of all Keys that this keyboard responds to.
|
/// @returns a set of all Keys that this keyboard responds to.
|
||||||
virtual const std::set<Key> &observed_keys();
|
virtual const std::set<Key> &observed_keys() const;
|
||||||
|
|
||||||
/// @returns the list of modifiers that this keyboard considers 'essential' (i.e. both mapped and highly used).
|
/// @returns the list of modifiers that this keyboard considers 'essential' (i.e. both mapped and highly used).
|
||||||
virtual const std::set<Inputs::Keyboard::Key> &get_essential_modifiers();
|
virtual const std::set<Inputs::Keyboard::Key> &get_essential_modifiers() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@returns @c true if this keyboard, on its original machine, looked
|
@returns @c true if this keyboard, on its original machine, looked
|
||||||
@ -68,7 +68,7 @@ class Keyboard {
|
|||||||
which has some buttons that you'd expect an emulator to map to its host
|
which has some buttons that you'd expect an emulator to map to its host
|
||||||
keyboard but which does not offer a full keyboard.
|
keyboard but which does not offer a full keyboard.
|
||||||
*/
|
*/
|
||||||
virtual bool is_exclusive();
|
virtual bool is_exclusive() const;
|
||||||
|
|
||||||
// Delegate interface.
|
// Delegate interface.
|
||||||
struct Delegate {
|
struct Delegate {
|
||||||
@ -76,7 +76,7 @@ class Keyboard {
|
|||||||
virtual void reset_all_keys(Keyboard *keyboard) = 0;
|
virtual void reset_all_keys(Keyboard *keyboard) = 0;
|
||||||
};
|
};
|
||||||
void set_delegate(Delegate *delegate);
|
void set_delegate(Delegate *delegate);
|
||||||
bool get_key_state(Key key);
|
bool get_key_state(Key key) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::set<Key> observed_keys_;
|
std::set<Key> observed_keys_;
|
||||||
|
@ -111,8 +111,8 @@ class QuadratureMouse: public Mouse {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const int number_of_buttons_ = 0;
|
const int number_of_buttons_ = 0;
|
||||||
std::atomic<int> button_flags_;
|
std::atomic<int> button_flags_{0};
|
||||||
std::atomic<int> axes_[2];
|
std::atomic<int> axes_[2]{0, 0};
|
||||||
|
|
||||||
int primaries_[2] = {0, 0};
|
int primaries_[2] = {0, 0};
|
||||||
int secondaries_[2] = {0, 0};
|
int secondaries_[2] = {0, 0};
|
||||||
|
@ -346,7 +346,7 @@ class CRTCBusHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the type of display.
|
/// Gets the type of display.
|
||||||
Outputs::Display::DisplayType get_display_type() {
|
Outputs::Display::DisplayType get_display_type() const {
|
||||||
return crt_.get_display_type();
|
return crt_.get_display_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1044,7 +1044,7 @@ template <bool has_fdc> class ConcreteMachine:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A CRTMachine function; gets the output display type.
|
/// A CRTMachine function; gets the output display type.
|
||||||
Outputs::Display::DisplayType get_display_type() {
|
Outputs::Display::DisplayType get_display_type() const final {
|
||||||
return crtc_bus_handler_.get_display_type();
|
return crtc_bus_handler_.get_display_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1085,15 +1085,15 @@ template <bool has_fdc> class ConcreteMachine:
|
|||||||
Utility::TypeRecipient<CharacterMapper>::add_typer(string);
|
Utility::TypeRecipient<CharacterMapper>::add_typer(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool can_type(char c) final {
|
bool can_type(char c) const final {
|
||||||
return Utility::TypeRecipient<CharacterMapper>::can_type(c);
|
return Utility::TypeRecipient<CharacterMapper>::can_type(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
HalfCycles get_typer_delay() final {
|
HalfCycles get_typer_delay() const final {
|
||||||
return z80_.get_is_resetting() ? Cycles(3'400'000) : Cycles(0);
|
return z80_.get_is_resetting() ? Cycles(3'400'000) : Cycles(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
HalfCycles get_typer_frequency() final {
|
HalfCycles get_typer_frequency() const final {
|
||||||
return Cycles(80'000); // Perform one key transition per frame.
|
return Cycles(80'000); // Perform one key transition per frame.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
using namespace AmstradCPC;
|
using namespace AmstradCPC;
|
||||||
|
|
||||||
uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
|
uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) const {
|
||||||
#define BIND(source, dest) case Inputs::Keyboard::Key::source: return dest
|
#define BIND(source, dest) case Inputs::Keyboard::Key::source: return dest
|
||||||
switch(key) {
|
switch(key) {
|
||||||
default: break;
|
default: break;
|
||||||
@ -77,7 +77,7 @@ uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
|
|||||||
return MachineTypes::MappedKeyboardMachine::KeyNotMapped;
|
return MachineTypes::MappedKeyboardMachine::KeyNotMapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t *CharacterMapper::sequence_for_character(char character) {
|
const uint16_t *CharacterMapper::sequence_for_character(char character) const {
|
||||||
#define KEYS(...) {__VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
#define KEYS(...) {__VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
||||||
#define SHIFT(...) {KeyShift, __VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
#define SHIFT(...) {KeyShift, __VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
||||||
#define X {MachineTypes::MappedKeyboardMachine::KeyNotMapped}
|
#define X {MachineTypes::MappedKeyboardMachine::KeyNotMapped}
|
||||||
@ -154,6 +154,6 @@ uint16_t *CharacterMapper::sequence_for_character(char character) {
|
|||||||
return table_lookup_sequence_for_character(key_sequences, sizeof(key_sequences), character);
|
return table_lookup_sequence_for_character(key_sequences, sizeof(key_sequences), character);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CharacterMapper::needs_pause_after_key(uint16_t key) {
|
bool CharacterMapper::needs_pause_after_key(uint16_t key) const {
|
||||||
return key != KeyControl && key != KeyShift;
|
return key != KeyControl && key != KeyShift;
|
||||||
}
|
}
|
||||||
|
@ -34,14 +34,14 @@ enum Key: uint16_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
||||||
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key);
|
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CharacterMapper: public ::Utility::CharacterMapper {
|
struct CharacterMapper: public ::Utility::CharacterMapper {
|
||||||
uint16_t *sequence_for_character(char character) override;
|
const uint16_t *sequence_for_character(char character) const override;
|
||||||
|
|
||||||
bool needs_pause_after_reset_all_keys() override { return false; }
|
bool needs_pause_after_reset_all_keys() const override { return false; }
|
||||||
bool needs_pause_after_key(uint16_t key) override;
|
bool needs_pause_after_key(uint16_t key) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -423,7 +423,7 @@ template <Analyser::Static::AppleII::Target::Model model> class ConcreteMachine:
|
|||||||
video_.set_display_type(display_type);
|
video_.set_display_type(display_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
Outputs::Display::DisplayType get_display_type() final {
|
Outputs::Display::DisplayType get_display_type() const final {
|
||||||
return video_.get_display_type();
|
return video_.get_display_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -857,7 +857,7 @@ template <Analyser::Static::AppleII::Target::Model model> class ConcreteMachine:
|
|||||||
string_serialiser_ = std::make_unique<Utility::StringSerialiser>(string, true);
|
string_serialiser_ = std::make_unique<Utility::StringSerialiser>(string, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool can_type(char c) final {
|
bool can_type(char c) const final {
|
||||||
// Make an effort to type the entire printable ASCII range.
|
// Make an effort to type the entire printable ASCII range.
|
||||||
return c >= 32 && c < 127;
|
return c >= 32 && c < 127;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ void VideoBase::set_display_type(Outputs::Display::DisplayType display_type) {
|
|||||||
crt_.set_display_type(display_type);
|
crt_.set_display_type(display_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
Outputs::Display::DisplayType VideoBase::get_display_type() {
|
Outputs::Display::DisplayType VideoBase::get_display_type() const {
|
||||||
return crt_.get_display_type();
|
return crt_.get_display_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class VideoBase {
|
|||||||
void set_display_type(Outputs::Display::DisplayType);
|
void set_display_type(Outputs::Display::DisplayType);
|
||||||
|
|
||||||
/// Gets the type of output.
|
/// Gets the type of output.
|
||||||
Outputs::Display::DisplayType get_display_type();
|
Outputs::Display::DisplayType get_display_type() const;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Descriptions for the setters below are taken verbatim from
|
Descriptions for the setters below are taken verbatim from
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
using namespace Apple::Macintosh;
|
using namespace Apple::Macintosh;
|
||||||
|
|
||||||
uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
|
uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) const {
|
||||||
using Key = Inputs::Keyboard::Key;
|
using Key = Inputs::Keyboard::Key;
|
||||||
using MacKey = Apple::Macintosh::Key;
|
using MacKey = Apple::Macintosh::Key;
|
||||||
switch(key) {
|
switch(key) {
|
||||||
|
@ -291,7 +291,7 @@ class Keyboard {
|
|||||||
Provides a mapping from idiomatic PC keys to Macintosh keys.
|
Provides a mapping from idiomatic PC keys to Macintosh keys.
|
||||||
*/
|
*/
|
||||||
class KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
class KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
||||||
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key) final;
|
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key) const final;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ class ConcreteMachine:
|
|||||||
video_->set_display_type(display_type);
|
video_->set_display_type(display_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
Outputs::Display::DisplayType get_display_type() final {
|
Outputs::Display::DisplayType get_display_type() const final {
|
||||||
return video_->get_display_type();
|
return video_->get_display_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,11 +22,6 @@ IntelligentKeyboard::IntelligentKeyboard(Serial::Line &input, Serial::Line &outp
|
|||||||
// Add two joysticks into the mix.
|
// Add two joysticks into the mix.
|
||||||
joysticks_.emplace_back(new Joystick);
|
joysticks_.emplace_back(new Joystick);
|
||||||
joysticks_.emplace_back(new Joystick);
|
joysticks_.emplace_back(new Joystick);
|
||||||
|
|
||||||
mouse_button_state_ = 0;
|
|
||||||
mouse_button_events_ = 0;
|
|
||||||
mouse_movement_[0] = 0;
|
|
||||||
mouse_movement_[1] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IntelligentKeyboard::serial_line_did_produce_bit(Serial::Line *, int bit) {
|
bool IntelligentKeyboard::serial_line_did_produce_bit(Serial::Line *, int bit) {
|
||||||
@ -361,7 +356,7 @@ void IntelligentKeyboard::set_key_state(Key key, bool is_pressed) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t IntelligentKeyboard::KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
|
uint16_t IntelligentKeyboard::KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) const {
|
||||||
using Key = Inputs::Keyboard::Key;
|
using Key = Inputs::Keyboard::Key;
|
||||||
using STKey = Atari::ST::Key;
|
using STKey = Atari::ST::Key;
|
||||||
switch(key) {
|
switch(key) {
|
||||||
|
@ -63,7 +63,7 @@ class IntelligentKeyboard:
|
|||||||
|
|
||||||
void set_key_state(Key key, bool is_pressed);
|
void set_key_state(Key key, bool is_pressed);
|
||||||
class KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
class KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
||||||
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key) final;
|
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key) const final;
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::vector<std::unique_ptr<Inputs::Joystick>> &get_joysticks() {
|
const std::vector<std::unique_ptr<Inputs::Joystick>> &get_joysticks() {
|
||||||
@ -127,9 +127,9 @@ class IntelligentKeyboard:
|
|||||||
void post_relative_mouse_event(int x, int y);
|
void post_relative_mouse_event(int x, int y);
|
||||||
|
|
||||||
// Received mouse state.
|
// Received mouse state.
|
||||||
std::atomic<int> mouse_movement_[2];
|
std::atomic<int> mouse_movement_[2]{0, 0};
|
||||||
std::atomic<int> mouse_button_state_;
|
std::atomic<int> mouse_button_state_{0};
|
||||||
std::atomic<int> mouse_button_events_;
|
std::atomic<int> mouse_button_events_{0};
|
||||||
|
|
||||||
// MARK: - Joystick.
|
// MARK: - Joystick.
|
||||||
void disable_joysticks();
|
void disable_joysticks();
|
||||||
|
@ -146,7 +146,7 @@ void Video::set_display_type(Outputs::Display::DisplayType display_type) {
|
|||||||
crt_.set_display_type(display_type);
|
crt_.set_display_type(display_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
Outputs::Display::DisplayType Video::get_display_type() {
|
Outputs::Display::DisplayType Video::get_display_type() const {
|
||||||
return crt_.get_display_type();
|
return crt_.get_display_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class Video {
|
|||||||
/*!
|
/*!
|
||||||
Gets the type of output.
|
Gets the type of output.
|
||||||
*/
|
*/
|
||||||
Outputs::Display::DisplayType get_display_type();
|
Outputs::Display::DisplayType get_display_type() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Produces the next @c duration period of pixels.
|
Produces the next @c duration period of pixels.
|
||||||
|
@ -189,7 +189,7 @@ class ConcreteMachine:
|
|||||||
vdp_->set_display_type(display_type);
|
vdp_->set_display_type(display_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
Outputs::Display::DisplayType get_display_type() final {
|
Outputs::Display::DisplayType get_display_type() const final {
|
||||||
return vdp_->get_display_type();
|
return vdp_->get_display_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
using namespace Commodore::Vic20;
|
using namespace Commodore::Vic20;
|
||||||
|
|
||||||
uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
|
uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) const {
|
||||||
#define BIND(source, dest) case Inputs::Keyboard::Key::source: return Commodore::Vic20::dest
|
#define BIND(source, dest) case Inputs::Keyboard::Key::source: return Commodore::Vic20::dest
|
||||||
switch(key) {
|
switch(key) {
|
||||||
default: break;
|
default: break;
|
||||||
@ -79,7 +79,7 @@ uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
|
|||||||
return MachineTypes::MappedKeyboardMachine::KeyNotMapped;
|
return MachineTypes::MappedKeyboardMachine::KeyNotMapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t *CharacterMapper::sequence_for_character(char character) {
|
const uint16_t *CharacterMapper::sequence_for_character(char character) const {
|
||||||
#define KEYS(...) {__VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
#define KEYS(...) {__VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
||||||
#define SHIFT(...) {KeyLShift, __VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
#define SHIFT(...) {KeyLShift, __VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
||||||
#define X {MachineTypes::MappedKeyboardMachine::KeyNotMapped}
|
#define X {MachineTypes::MappedKeyboardMachine::KeyNotMapped}
|
||||||
|
@ -48,11 +48,11 @@ enum Key: uint16_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
||||||
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key);
|
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key) const final;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CharacterMapper: public ::Utility::CharacterMapper {
|
struct CharacterMapper: public ::Utility::CharacterMapper {
|
||||||
uint16_t *sequence_for_character(char character);
|
const uint16_t *sequence_for_character(char character) const final;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -646,7 +646,7 @@ class ConcreteMachine:
|
|||||||
mos6560_.set_display_type(display_type);
|
mos6560_.set_display_type(display_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
Outputs::Display::DisplayType get_display_type() final {
|
Outputs::Display::DisplayType get_display_type() const final {
|
||||||
return mos6560_.get_display_type();
|
return mos6560_.get_display_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -663,7 +663,7 @@ class ConcreteMachine:
|
|||||||
Utility::TypeRecipient<CharacterMapper>::add_typer(string);
|
Utility::TypeRecipient<CharacterMapper>::add_typer(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool can_type(char c) final {
|
bool can_type(char c) const final {
|
||||||
return Utility::TypeRecipient<CharacterMapper>::can_type(c);
|
return Utility::TypeRecipient<CharacterMapper>::can_type(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,7 +409,7 @@ class ConcreteMachine:
|
|||||||
video_output_.set_display_type(display_type);
|
video_output_.set_display_type(display_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
Outputs::Display::DisplayType get_display_type() final {
|
Outputs::Display::DisplayType get_display_type() const final {
|
||||||
return video_output_.get_display_type();
|
return video_output_.get_display_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,11 +426,11 @@ class ConcreteMachine:
|
|||||||
evaluate_interrupts();
|
evaluate_interrupts();
|
||||||
}
|
}
|
||||||
|
|
||||||
HalfCycles get_typer_delay() final {
|
HalfCycles get_typer_delay() const final {
|
||||||
return m6502_.get_is_resetting() ? Cycles(750'000) : Cycles(0);
|
return m6502_.get_is_resetting() ? Cycles(750'000) : Cycles(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
HalfCycles get_typer_frequency() final {
|
HalfCycles get_typer_frequency() const final {
|
||||||
return Cycles(60'000);
|
return Cycles(60'000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,7 +438,7 @@ class ConcreteMachine:
|
|||||||
Utility::TypeRecipient<CharacterMapper>::add_typer(string);
|
Utility::TypeRecipient<CharacterMapper>::add_typer(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool can_type(char c) final {
|
bool can_type(char c) const final {
|
||||||
return Utility::TypeRecipient<CharacterMapper>::can_type(c);
|
return Utility::TypeRecipient<CharacterMapper>::can_type(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
using namespace Electron;
|
using namespace Electron;
|
||||||
|
|
||||||
uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
|
uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) const {
|
||||||
#define BIND(source, dest) case Inputs::Keyboard::Key::source: return Electron::Key::dest
|
#define BIND(source, dest) case Inputs::Keyboard::Key::source: return Electron::Key::dest
|
||||||
switch(key) {
|
switch(key) {
|
||||||
default: break;
|
default: break;
|
||||||
@ -69,7 +69,7 @@ uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
|
|||||||
return MachineTypes::MappedKeyboardMachine::KeyNotMapped;
|
return MachineTypes::MappedKeyboardMachine::KeyNotMapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t *CharacterMapper::sequence_for_character(char character) {
|
const uint16_t *CharacterMapper::sequence_for_character(char character) const {
|
||||||
#define KEYS(...) {__VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
#define KEYS(...) {__VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
||||||
#define SHIFT(...) {KeyShift, __VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
#define SHIFT(...) {KeyShift, __VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
||||||
#define CTRL(...) {KeyControl, __VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
#define CTRL(...) {KeyControl, __VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
||||||
@ -147,6 +147,6 @@ uint16_t *CharacterMapper::sequence_for_character(char character) {
|
|||||||
return table_lookup_sequence_for_character(key_sequences, sizeof(key_sequences), character);
|
return table_lookup_sequence_for_character(key_sequences, sizeof(key_sequences), character);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CharacterMapper::needs_pause_after_key(uint16_t key) {
|
bool CharacterMapper::needs_pause_after_key(uint16_t key) const {
|
||||||
return key != KeyControl && key != KeyShift && key != KeyFunc;
|
return key != KeyControl && key != KeyShift && key != KeyFunc;
|
||||||
}
|
}
|
||||||
|
@ -37,14 +37,14 @@ enum Key: uint16_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
||||||
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key) final;
|
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key) const final;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CharacterMapper: public ::Utility::CharacterMapper {
|
struct CharacterMapper: public ::Utility::CharacterMapper {
|
||||||
uint16_t *sequence_for_character(char character) override;
|
const uint16_t *sequence_for_character(char character) const override;
|
||||||
|
|
||||||
bool needs_pause_after_reset_all_keys() override { return false; }
|
bool needs_pause_after_reset_all_keys() const override { return false; }
|
||||||
bool needs_pause_after_key(uint16_t key) override;
|
bool needs_pause_after_key(uint16_t key) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -64,7 +64,7 @@ void VideoOutput::set_display_type(Outputs::Display::DisplayType display_type) {
|
|||||||
crt_.set_display_type(display_type);
|
crt_.set_display_type(display_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
Outputs::Display::DisplayType VideoOutput::get_display_type() {
|
Outputs::Display::DisplayType VideoOutput::get_display_type() const {
|
||||||
return crt_.get_display_type();
|
return crt_.get_display_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class VideoOutput {
|
|||||||
void set_display_type(Outputs::Display::DisplayType);
|
void set_display_type(Outputs::Display::DisplayType);
|
||||||
|
|
||||||
/// Gets the type of output.
|
/// Gets the type of output.
|
||||||
Outputs::Display::DisplayType get_display_type();
|
Outputs::Display::DisplayType get_display_type() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Writes @c value to the register at @c address. May mutate the results of @c get_next_interrupt,
|
Writes @c value to the register at @c address. May mutate the results of @c get_next_interrupt,
|
||||||
|
@ -49,7 +49,7 @@ class KeyboardMachine: public KeyActions {
|
|||||||
/*!
|
/*!
|
||||||
@returns @c true if this machine can type the character @c c as part of a @c type_string; @c false otherwise.
|
@returns @c true if this machine can type the character @c c as part of a @c type_string; @c false otherwise.
|
||||||
*/
|
*/
|
||||||
virtual bool can_type(char c) { return false; }
|
virtual bool can_type(char c) const { return false; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Provides a destination for keyboard input.
|
Provides a destination for keyboard input.
|
||||||
@ -117,7 +117,7 @@ class MappedKeyboardMachine: public Inputs::Keyboard::Delegate, public KeyboardM
|
|||||||
*/
|
*/
|
||||||
class KeyboardMapper {
|
class KeyboardMapper {
|
||||||
public:
|
public:
|
||||||
virtual uint16_t mapped_key_for_key(Inputs::Keyboard::Key key) = 0;
|
virtual uint16_t mapped_key_for_key(Inputs::Keyboard::Key key) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Terminates a key sequence from the character mapper.
|
/// Terminates a key sequence from the character mapper.
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "Keyboard.hpp"
|
#include "Keyboard.hpp"
|
||||||
|
|
||||||
uint16_t MSX::KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
|
uint16_t MSX::KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) const {
|
||||||
#define BIND(source, dest) case Inputs::Keyboard::Key::source: return MSX::Key::dest
|
#define BIND(source, dest) case Inputs::Keyboard::Key::source: return MSX::Key::dest
|
||||||
switch(key) {
|
switch(key) {
|
||||||
BIND(k0, Key0); BIND(k1, Key1); BIND(k2, Key2); BIND(k3, Key3); BIND(k4, Key4);
|
BIND(k0, Key0); BIND(k1, Key1); BIND(k2, Key2); BIND(k3, Key3); BIND(k4, Key4);
|
||||||
|
@ -34,7 +34,7 @@ enum Key: uint16_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
||||||
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key);
|
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key) const final;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -284,7 +284,7 @@ class ConcreteMachine:
|
|||||||
vdp_->set_display_type(display_type);
|
vdp_->set_display_type(display_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
Outputs::Display::DisplayType get_display_type() final {
|
Outputs::Display::DisplayType get_display_type() const final {
|
||||||
return vdp_->get_display_type();
|
return vdp_->get_display_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,7 +367,7 @@ class ConcreteMachine:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool can_type(char c) final {
|
bool can_type(char c) const final {
|
||||||
// Make an effort to type the entire printable ASCII range.
|
// Make an effort to type the entire printable ASCII range.
|
||||||
return c >= 32 && c < 127;
|
return c >= 32 && c < 127;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ class ConcreteMachine:
|
|||||||
vdp_->set_display_type(display_type);
|
vdp_->set_display_type(display_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
Outputs::Display::DisplayType get_display_type() final {
|
Outputs::Display::DisplayType get_display_type() const final {
|
||||||
return vdp_->get_display_type();
|
return vdp_->get_display_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
using namespace Oric;
|
using namespace Oric;
|
||||||
|
|
||||||
uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
|
uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) const {
|
||||||
#define BIND(source, dest) case Inputs::Keyboard::Key::source: return Oric::dest
|
#define BIND(source, dest) case Inputs::Keyboard::Key::source: return Oric::dest
|
||||||
switch(key) {
|
switch(key) {
|
||||||
default: break;
|
default: break;
|
||||||
@ -54,7 +54,7 @@ uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
|
|||||||
return MachineTypes::MappedKeyboardMachine::KeyNotMapped;
|
return MachineTypes::MappedKeyboardMachine::KeyNotMapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t *CharacterMapper::sequence_for_character(char character) {
|
const uint16_t *CharacterMapper::sequence_for_character(char character) const {
|
||||||
#define KEYS(...) {__VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
#define KEYS(...) {__VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
||||||
#define SHIFT(...) {KeyLeftShift, __VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
#define SHIFT(...) {KeyLeftShift, __VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
||||||
#define X {MachineTypes::MappedKeyboardMachine::KeyNotMapped}
|
#define X {MachineTypes::MappedKeyboardMachine::KeyNotMapped}
|
||||||
|
@ -37,11 +37,11 @@ enum Key: uint16_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
||||||
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key);
|
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key) const final;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CharacterMapper: public ::Utility::CharacterMapper {
|
struct CharacterMapper: public ::Utility::CharacterMapper {
|
||||||
uint16_t *sequence_for_character(char character);
|
const uint16_t *sequence_for_character(char character) const final;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -555,7 +555,7 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface> class Co
|
|||||||
video_output_.set_display_type(display_type);
|
video_output_.set_display_type(display_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
Outputs::Display::DisplayType get_display_type() final {
|
Outputs::Display::DisplayType get_display_type() const final {
|
||||||
return video_output_.get_display_type();
|
return video_output_.get_display_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,7 +583,7 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface> class Co
|
|||||||
string_serialiser_ = std::make_unique<Utility::StringSerialiser>(string, true);
|
string_serialiser_ = std::make_unique<Utility::StringSerialiser>(string, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool can_type(char c) final {
|
bool can_type(char c) const final {
|
||||||
// Make an effort to type the entire printable ASCII range.
|
// Make an effort to type the entire printable ASCII range.
|
||||||
return c >= 32 && c < 127;
|
return c >= 32 && c < 127;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ void VideoOutput::set_display_type(Outputs::Display::DisplayType display_type) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Outputs::Display::DisplayType VideoOutput::get_display_type() {
|
Outputs::Display::DisplayType VideoOutput::get_display_type() const {
|
||||||
return crt_.get_display_type();
|
return crt_.get_display_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class VideoOutput {
|
|||||||
|
|
||||||
void set_scan_target(Outputs::Display::ScanTarget *scan_target);
|
void set_scan_target(Outputs::Display::ScanTarget *scan_target);
|
||||||
void set_display_type(Outputs::Display::DisplayType display_type);
|
void set_display_type(Outputs::Display::DisplayType display_type);
|
||||||
Outputs::Display::DisplayType get_display_type();
|
Outputs::Display::DisplayType get_display_type() const;
|
||||||
Outputs::Display::ScanStatus get_scaled_scan_status() const;
|
Outputs::Display::ScanStatus get_scaled_scan_status() const;
|
||||||
|
|
||||||
void register_crt_frequency_mismatch();
|
void register_crt_frequency_mismatch();
|
||||||
|
@ -78,7 +78,7 @@ class ScanProducer {
|
|||||||
Maps back from Outputs::Display::VideoSignal to Configurable::Display,
|
Maps back from Outputs::Display::VideoSignal to Configurable::Display,
|
||||||
calling @c get_display_type for the input.
|
calling @c get_display_type for the input.
|
||||||
*/
|
*/
|
||||||
Configurable::Display get_video_signal_configurable() {
|
Configurable::Display get_video_signal_configurable() const {
|
||||||
switch(get_display_type()) {
|
switch(get_display_type()) {
|
||||||
default:
|
default:
|
||||||
case Outputs::Display::DisplayType::RGB: return Configurable::Display::RGB;
|
case Outputs::Display::DisplayType::RGB: return Configurable::Display::RGB;
|
||||||
@ -96,7 +96,7 @@ class ScanProducer {
|
|||||||
/*!
|
/*!
|
||||||
Gets the display type.
|
Gets the display type.
|
||||||
*/
|
*/
|
||||||
virtual Outputs::Display::DisplayType get_display_type() { return Outputs::Display::DisplayType::RGB; }
|
virtual Outputs::Display::DisplayType get_display_type() const { return Outputs::Display::DisplayType::RGB; }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ bool Typer::type_next_character() {
|
|||||||
|
|
||||||
// MARK: - Character mapper
|
// MARK: - Character mapper
|
||||||
|
|
||||||
uint16_t *CharacterMapper::table_lookup_sequence_for_character(KeySequence *sequences, std::size_t length, char character) {
|
uint16_t *CharacterMapper::table_lookup_sequence_for_character(KeySequence *sequences, std::size_t length, char character) const {
|
||||||
std::size_t ucharacter = size_t((unsigned char)character);
|
std::size_t ucharacter = size_t((unsigned char)character);
|
||||||
if(ucharacter >= (length / sizeof(KeySequence))) return nullptr;
|
if(ucharacter >= (length / sizeof(KeySequence))) return nullptr;
|
||||||
if(sequences[ucharacter][0] == MachineTypes::MappedKeyboardMachine::KeyNotMapped) return nullptr;
|
if(sequences[ucharacter][0] == MachineTypes::MappedKeyboardMachine::KeyNotMapped) return nullptr;
|
||||||
|
@ -26,19 +26,19 @@ class CharacterMapper {
|
|||||||
virtual ~CharacterMapper() {}
|
virtual ~CharacterMapper() {}
|
||||||
|
|
||||||
/// @returns The EndSequence-terminated sequence of keys that would cause @c character to be typed.
|
/// @returns The EndSequence-terminated sequence of keys that would cause @c character to be typed.
|
||||||
virtual uint16_t *sequence_for_character(char character) = 0;
|
virtual const uint16_t *sequence_for_character(char character) const = 0;
|
||||||
|
|
||||||
/// The typer will automatically reset all keys in between each sequence that it types.
|
/// The typer will automatically reset all keys in between each sequence that it types.
|
||||||
/// By default it will pause for one key's duration when doing so. Character mappers
|
/// By default it will pause for one key's duration when doing so. Character mappers
|
||||||
/// can eliminate that pause by overriding this method.
|
/// can eliminate that pause by overriding this method.
|
||||||
/// @returns @c true if the typer should pause after performing a reset; @c false otherwise.
|
/// @returns @c true if the typer should pause after performing a reset; @c false otherwise.
|
||||||
virtual bool needs_pause_after_reset_all_keys() { return true; }
|
virtual bool needs_pause_after_reset_all_keys() const { return true; }
|
||||||
|
|
||||||
/// The typer will pause between every entry in a keyboard sequence. On some machines
|
/// The typer will pause between every entry in a keyboard sequence. On some machines
|
||||||
/// that may not be necessary — it'll often depends on whether the machine needs time to
|
/// that may not be necessary — it'll often depends on whether the machine needs time to
|
||||||
/// observe a modifier like shift before it sees the actual keypress.
|
/// observe a modifier like shift before it sees the actual keypress.
|
||||||
/// @returns @c true if the typer should pause after forwarding @c key; @c false otherwise.
|
/// @returns @c true if the typer should pause after forwarding @c key; @c false otherwise.
|
||||||
virtual bool needs_pause_after_key(uint16_t key) { return true; }
|
virtual bool needs_pause_after_key(uint16_t key) const { return true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef uint16_t KeySequence[16];
|
typedef uint16_t KeySequence[16];
|
||||||
@ -48,7 +48,7 @@ class CharacterMapper {
|
|||||||
with @c length entries, returns the sequence for character @c character if it exists; otherwise
|
with @c length entries, returns the sequence for character @c character if it exists; otherwise
|
||||||
returns @c nullptr.
|
returns @c nullptr.
|
||||||
*/
|
*/
|
||||||
uint16_t *table_lookup_sequence_for_character(KeySequence *sequences, std::size_t length, char character);
|
uint16_t *table_lookup_sequence_for_character(KeySequence *sequences, std::size_t length, char character) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -118,7 +118,7 @@ class TypeRecipient: public Typer::Delegate {
|
|||||||
/*!
|
/*!
|
||||||
@returns @c true if the character mapper provides a mapping for @c c; @c false otherwise.
|
@returns @c true if the character mapper provides a mapping for @c c; @c false otherwise.
|
||||||
*/
|
*/
|
||||||
bool can_type(char c) {
|
bool can_type(char c) const {
|
||||||
const auto sequence = character_mapper.sequence_for_character(c);
|
const auto sequence = character_mapper.sequence_for_character(c);
|
||||||
return sequence && sequence[0] != MachineTypes::MappedKeyboardMachine::KeyNotMapped;
|
return sequence && sequence[0] != MachineTypes::MappedKeyboardMachine::KeyNotMapped;
|
||||||
}
|
}
|
||||||
@ -137,8 +137,8 @@ class TypeRecipient: public Typer::Delegate {
|
|||||||
typer_ = nullptr;
|
typer_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual HalfCycles get_typer_delay() { return HalfCycles(0); }
|
virtual HalfCycles get_typer_delay() const { return HalfCycles(0); }
|
||||||
virtual HalfCycles get_typer_frequency() { return HalfCycles(0); }
|
virtual HalfCycles get_typer_frequency() const { return HalfCycles(0); }
|
||||||
std::unique_ptr<Typer> typer_;
|
std::unique_ptr<Typer> typer_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
using namespace ZX8081;
|
using namespace ZX8081;
|
||||||
|
|
||||||
uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
|
uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) const {
|
||||||
#define BIND(source, dest) case Inputs::Keyboard::Key::source: return ZX8081::dest
|
#define BIND(source, dest) case Inputs::Keyboard::Key::source: return ZX8081::dest
|
||||||
switch(key) {
|
switch(key) {
|
||||||
default: break;
|
default: break;
|
||||||
@ -44,7 +44,7 @@ uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
|
|||||||
|
|
||||||
CharacterMapper::CharacterMapper(bool is_zx81) : is_zx81_(is_zx81) {}
|
CharacterMapper::CharacterMapper(bool is_zx81) : is_zx81_(is_zx81) {}
|
||||||
|
|
||||||
uint16_t *CharacterMapper::sequence_for_character(char character) {
|
const uint16_t *CharacterMapper::sequence_for_character(char character) const {
|
||||||
#define KEYS(...) {__VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
#define KEYS(...) {__VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
||||||
#define SHIFT(...) {KeyShift, __VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
#define SHIFT(...) {KeyShift, __VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
||||||
#define X {MachineTypes::MappedKeyboardMachine::KeyNotMapped}
|
#define X {MachineTypes::MappedKeyboardMachine::KeyNotMapped}
|
||||||
@ -189,6 +189,6 @@ uint16_t *CharacterMapper::sequence_for_character(char character) {
|
|||||||
return table_lookup_sequence_for_character(zx80_key_sequences, sizeof(zx80_key_sequences), character);
|
return table_lookup_sequence_for_character(zx80_key_sequences, sizeof(zx80_key_sequences), character);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CharacterMapper::needs_pause_after_key(uint16_t key) {
|
bool CharacterMapper::needs_pause_after_key(uint16_t key) const {
|
||||||
return key != KeyShift;
|
return key != KeyShift;
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,15 @@ enum Key: uint16_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
||||||
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key);
|
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CharacterMapper: public ::Utility::CharacterMapper {
|
class CharacterMapper: public ::Utility::CharacterMapper {
|
||||||
public:
|
public:
|
||||||
CharacterMapper(bool is_zx81);
|
CharacterMapper(bool is_zx81);
|
||||||
uint16_t *sequence_for_character(char character) override;
|
const uint16_t *sequence_for_character(char character) const override;
|
||||||
|
|
||||||
bool needs_pause_after_key(uint16_t key) override;
|
bool needs_pause_after_key(uint16_t key) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool is_zx81_;
|
bool is_zx81_;
|
||||||
|
@ -337,7 +337,7 @@ template<bool is_zx81> class ConcreteMachine:
|
|||||||
Utility::TypeRecipient<CharacterMapper>::add_typer(string);
|
Utility::TypeRecipient<CharacterMapper>::add_typer(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool can_type(char c) final {
|
bool can_type(char c) const final {
|
||||||
return Utility::TypeRecipient<CharacterMapper>::can_type(c);
|
return Utility::TypeRecipient<CharacterMapper>::can_type(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,11 +393,11 @@ template<bool is_zx81> class ConcreteMachine:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Typer timing
|
// MARK: - Typer timing
|
||||||
HalfCycles get_typer_delay() final {
|
HalfCycles get_typer_delay() const final {
|
||||||
return z80_.get_is_resetting() ? Cycles(7'000'000) : Cycles(0);
|
return z80_.get_is_resetting() ? Cycles(7'000'000) : Cycles(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
HalfCycles get_typer_frequency() final {
|
HalfCycles get_typer_frequency() const final {
|
||||||
return Cycles(146'250);
|
return Cycles(146'250);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ template <typename IntType, IntType reset_value, IntType output_xor, bool reflec
|
|||||||
Instantiates a CRC16 that will compute the CRC16 specified by the supplied
|
Instantiates a CRC16 that will compute the CRC16 specified by the supplied
|
||||||
@c polynomial and @c reset_value.
|
@c polynomial and @c reset_value.
|
||||||
*/
|
*/
|
||||||
Generator(IntType polynomial): value_(reset_value) {
|
constexpr Generator(IntType polynomial) noexcept: value_(reset_value) {
|
||||||
const IntType top_bit = IntType(~(IntType(~0) >> 1));
|
const IntType top_bit = IntType(~(IntType(~0) >> 1));
|
||||||
for(int c = 0; c < 256; c++) {
|
for(int c = 0; c < 256; c++) {
|
||||||
IntType shift_value = IntType(c << multibyte_shift);
|
IntType shift_value = IntType(c << multibyte_shift);
|
||||||
|
@ -43,7 +43,7 @@ template <typename IntType = uint64_t, IntType polynomial = LSFRPolynomial<IntTy
|
|||||||
/*!
|
/*!
|
||||||
Constructs an LFSR with a random initial value.
|
Constructs an LFSR with a random initial value.
|
||||||
*/
|
*/
|
||||||
LFSR() {
|
constexpr LFSR() noexcept {
|
||||||
// Randomise the value, ensuring it doesn't end up being 0;
|
// Randomise the value, ensuring it doesn't end up being 0;
|
||||||
// don't set any top bits, in case this is a signed type.
|
// don't set any top bits, in case this is a signed type.
|
||||||
while(!value_) {
|
while(!value_) {
|
||||||
|
@ -104,7 +104,7 @@ struct MachineRunner {
|
|||||||
Stopping,
|
Stopping,
|
||||||
Stopped
|
Stopped
|
||||||
};
|
};
|
||||||
std::atomic<State> state_ = State::Running;
|
std::atomic<State> state_{State::Running};
|
||||||
|
|
||||||
Time::ScanSynchroniser scan_synchroniser_;
|
Time::ScanSynchroniser scan_synchroniser_;
|
||||||
|
|
||||||
|
@ -34,13 +34,13 @@ void Metrics::add_line_total(int total) {
|
|||||||
line_total_history_pointer_ = (line_total_history_pointer_ + 1) % line_total_history_.size();
|
line_total_history_pointer_ = (line_total_history_pointer_ + 1) % line_total_history_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
float Metrics::visible_lines_per_frame_estimate() {
|
float Metrics::visible_lines_per_frame_estimate() const {
|
||||||
// Just average the number of records contained in line_total_history_ to provide this estimate;
|
// Just average the number of records contained in line_total_history_ to provide this estimate;
|
||||||
// that array should be an even number, to allow for potential interlaced sources.
|
// that array should be an even number, to allow for potential interlaced sources.
|
||||||
return float(std::accumulate(line_total_history_.begin(), line_total_history_.end(), 0)) / float(line_total_history_.size());
|
return float(std::accumulate(line_total_history_.begin(), line_total_history_.end(), 0)) / float(line_total_history_.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
int Metrics::current_line() {
|
int Metrics::current_line() const {
|
||||||
return lines_this_frame_;
|
return lines_this_frame_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ void Metrics::announce_draw_status(size_t lines, std::chrono::high_resolution_cl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Metrics::should_lower_resolution() {
|
bool Metrics::should_lower_resolution() const {
|
||||||
// If less than 100 frames are on record, return no opinion; otherwise
|
// If less than 100 frames are on record, return no opinion; otherwise
|
||||||
// suggest a lower resolution if more than 10 frames in the last 100-200
|
// suggest a lower resolution if more than 10 frames in the last 100-200
|
||||||
// took too long to produce.
|
// took too long to produce.
|
||||||
|
@ -29,17 +29,18 @@ class Metrics {
|
|||||||
|
|
||||||
/// Notifies Metrics that the size of the output buffer has changed.
|
/// Notifies Metrics that the size of the output buffer has changed.
|
||||||
void announce_did_resize();
|
void announce_did_resize();
|
||||||
|
|
||||||
/// Provides Metrics with a new data point for output speed estimation.
|
/// Provides Metrics with a new data point for output speed estimation.
|
||||||
void announce_draw_status(size_t lines, std::chrono::high_resolution_clock::duration duration, bool complete);
|
void announce_draw_status(size_t lines, std::chrono::high_resolution_clock::duration duration, bool complete);
|
||||||
|
|
||||||
/// @returns @c true if Metrics thinks a lower output buffer resolution is desirable in the abstract; @c false otherwise.
|
/// @returns @c true if Metrics thinks a lower output buffer resolution is desirable in the abstract; @c false otherwise.
|
||||||
bool should_lower_resolution();
|
bool should_lower_resolution() const;
|
||||||
|
|
||||||
/// @returns An estimate of the number of lines being produced per frame, excluding vertical sync.
|
/// @returns An estimate of the number of lines being produced per frame, excluding vertical sync.
|
||||||
float visible_lines_per_frame_estimate();
|
float visible_lines_per_frame_estimate() const;
|
||||||
|
|
||||||
/// @returns The number of lines since vertical retrace ended.
|
/// @returns The number of lines since vertical retrace ended.
|
||||||
int current_line();
|
int current_line() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int lines_this_frame_ = 0;
|
int lines_this_frame_ = 0;
|
||||||
|
@ -31,8 +31,8 @@ struct Rect {
|
|||||||
float width, height;
|
float width, height;
|
||||||
} size;
|
} size;
|
||||||
|
|
||||||
Rect() : origin({0.0f, 0.0f}), size({1.0f, 1.0f}) {}
|
constexpr Rect() : origin({0.0f, 0.0f}), size({1.0f, 1.0f}) {}
|
||||||
Rect(float x, float y, float width, float height) :
|
constexpr Rect(float x, float y, float width, float height) :
|
||||||
origin({x, y}), size({width, height}) {}
|
origin({x, y}), size({width, height}) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ class Speaker {
|
|||||||
}
|
}
|
||||||
delegate->speaker_did_complete_samples(this, mix_buffer_);
|
delegate->speaker_did_complete_samples(this, mix_buffer_);
|
||||||
}
|
}
|
||||||
std::atomic<Delegate *> delegate_ = nullptr;
|
std::atomic<Delegate *> delegate_{nullptr};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void compute_output_rate() {
|
void compute_output_rate() {
|
||||||
@ -131,7 +131,7 @@ class Speaker {
|
|||||||
float input_rate_multiplier_ = 1.0f;
|
float input_rate_multiplier_ = 1.0f;
|
||||||
float output_cycles_per_second_ = 1.0f;
|
float output_cycles_per_second_ = 1.0f;
|
||||||
int output_buffer_size_ = 1;
|
int output_buffer_size_ = 1;
|
||||||
std::atomic<bool> stereo_output_ = false;
|
std::atomic<bool> stereo_output_{false};
|
||||||
std::vector<int16_t> mix_buffer_;
|
std::vector<int16_t> mix_buffer_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ void ProcessorBase::reset_power_on() {
|
|||||||
last_request_status_ &= ~Interrupt::PowerOn;
|
last_request_status_ &= ~Interrupt::PowerOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ProcessorBase::get_value_of_register(Register r) {
|
uint16_t ProcessorBase::get_value_of_register(Register r) const {
|
||||||
switch (r) {
|
switch (r) {
|
||||||
case Register::ProgramCounter: return pc_.full;
|
case Register::ProgramCounter: return pc_.full;
|
||||||
case Register::StackPointer: return sp_.full;
|
case Register::StackPointer: return sp_.full;
|
||||||
|
@ -907,7 +907,7 @@ template < class T,
|
|||||||
template < class T,
|
template < class T,
|
||||||
bool uses_bus_request,
|
bool uses_bus_request,
|
||||||
bool uses_wait_line> bool Processor <T, uses_bus_request, uses_wait_line>
|
bool uses_wait_line> bool Processor <T, uses_bus_request, uses_wait_line>
|
||||||
::get_bus_request_line() {
|
::get_bus_request_line() const {
|
||||||
return bus_request_line_;
|
return bus_request_line_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -922,7 +922,7 @@ template < class T,
|
|||||||
template < class T,
|
template < class T,
|
||||||
bool uses_bus_request,
|
bool uses_bus_request,
|
||||||
bool uses_wait_line> bool Processor <T, uses_bus_request, uses_wait_line>
|
bool uses_wait_line> bool Processor <T, uses_bus_request, uses_wait_line>
|
||||||
::get_wait_line() {
|
::get_wait_line() const {
|
||||||
return wait_line_;
|
return wait_line_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1013,7 +1013,7 @@ template < class T,
|
|||||||
|
|
||||||
#undef isTerminal
|
#undef isTerminal
|
||||||
|
|
||||||
bool ProcessorBase::get_halt_line() {
|
bool ProcessorBase::get_halt_line() const {
|
||||||
return halt_mask_ == 0x00;
|
return halt_mask_ == 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1036,7 +1036,7 @@ void ProcessorBase::set_interrupt_line(bool value, HalfCycles offset) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProcessorBase::get_interrupt_line() {
|
bool ProcessorBase::get_interrupt_line() const {
|
||||||
return irq_line_;
|
return irq_line_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1065,7 +1065,7 @@ void ProcessorBase::set_non_maskable_interrupt_line(bool value, HalfCycles offse
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProcessorBase::get_non_maskable_interrupt_line() {
|
bool ProcessorBase::get_non_maskable_interrupt_line() const {
|
||||||
return nmi_line_;
|
return nmi_line_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,12 +545,12 @@ void ProcessorStorage::assemble_fetch_decode_execute(InstructionPage &target, in
|
|||||||
target.fetch_decode_execute_data = target.fetch_decode_execute.data();
|
target.fetch_decode_execute_data = target.fetch_decode_execute.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProcessorBase::is_starting_new_instruction() {
|
bool ProcessorBase::is_starting_new_instruction() const {
|
||||||
return
|
return
|
||||||
current_instruction_page_ == &base_page_ &&
|
current_instruction_page_ == &base_page_ &&
|
||||||
scheduled_program_counter_ == &base_page_.fetch_decode_execute[0];
|
scheduled_program_counter_ == &base_page_.fetch_decode_execute[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProcessorBase::get_is_resetting() {
|
bool ProcessorBase::get_is_resetting() const {
|
||||||
return request_status_ & (Interrupt::PowerOn | Interrupt::Reset);
|
return request_status_ & (Interrupt::PowerOn | Interrupt::Reset);
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ class ProcessorBase: public ProcessorStorage {
|
|||||||
@param r The register to set.
|
@param r The register to set.
|
||||||
@returns The value of the register. 8-bit registers will be returned as unsigned.
|
@returns The value of the register. 8-bit registers will be returned as unsigned.
|
||||||
*/
|
*/
|
||||||
uint16_t get_value_of_register(Register r);
|
uint16_t get_value_of_register(Register r) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets the value of a register.
|
Sets the value of a register.
|
||||||
@ -186,7 +186,7 @@ class ProcessorBase: public ProcessorStorage {
|
|||||||
/*!
|
/*!
|
||||||
Gets the value of the HALT output line.
|
Gets the value of the HALT output line.
|
||||||
*/
|
*/
|
||||||
inline bool get_halt_line();
|
inline bool get_halt_line() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets the logical value of the interrupt line.
|
Sets the logical value of the interrupt line.
|
||||||
@ -200,7 +200,7 @@ class ProcessorBase: public ProcessorStorage {
|
|||||||
/*!
|
/*!
|
||||||
Gets the value of the interrupt line.
|
Gets the value of the interrupt line.
|
||||||
*/
|
*/
|
||||||
inline bool get_interrupt_line();
|
inline bool get_interrupt_line() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets the logical value of the non-maskable interrupt line.
|
Sets the logical value of the non-maskable interrupt line.
|
||||||
@ -212,7 +212,7 @@ class ProcessorBase: public ProcessorStorage {
|
|||||||
/*!
|
/*!
|
||||||
Gets the value of the non-maskable interrupt line.
|
Gets the value of the non-maskable interrupt line.
|
||||||
*/
|
*/
|
||||||
inline bool get_non_maskable_interrupt_line();
|
inline bool get_non_maskable_interrupt_line() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets the logical value of the reset line.
|
Sets the logical value of the reset line.
|
||||||
@ -224,7 +224,7 @@ class ProcessorBase: public ProcessorStorage {
|
|||||||
|
|
||||||
@returns @c true if the line is logically active; @c false otherwise.
|
@returns @c true if the line is logically active; @c false otherwise.
|
||||||
*/
|
*/
|
||||||
bool get_is_resetting();
|
bool get_is_resetting() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
This emulation automatically sets itself up in power-on state at creation, which has the effect of triggering a
|
This emulation automatically sets itself up in power-on state at creation, which has the effect of triggering a
|
||||||
@ -237,7 +237,7 @@ class ProcessorBase: public ProcessorStorage {
|
|||||||
|
|
||||||
This is not a speedy operation.
|
This is not a speedy operation.
|
||||||
*/
|
*/
|
||||||
bool is_starting_new_instruction();
|
bool is_starting_new_instruction() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -271,7 +271,7 @@ template <class T, bool uses_bus_request, bool uses_wait_line> class Processor:
|
|||||||
/*!
|
/*!
|
||||||
Gets the logical value of the bus request line.
|
Gets the logical value of the bus request line.
|
||||||
*/
|
*/
|
||||||
bool get_bus_request_line();
|
bool get_bus_request_line() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets the logical value of the wait line, having asserted that this Z80 supports the wait line.
|
Sets the logical value of the wait line, having asserted that this Z80 supports the wait line.
|
||||||
@ -281,7 +281,7 @@ template <class T, bool uses_bus_request, bool uses_wait_line> class Processor:
|
|||||||
/*!
|
/*!
|
||||||
Gets the logical value of the bus request line.
|
Gets the logical value of the bus request line.
|
||||||
*/
|
*/
|
||||||
bool get_wait_line();
|
bool get_wait_line() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T &bus_handler_;
|
T &bus_handler_;
|
||||||
|
@ -84,7 +84,7 @@ class Track {
|
|||||||
int rhs_largest_position = rhs.position.as_largest();
|
int rhs_largest_position = rhs.position.as_largest();
|
||||||
return std::tie(head, largest_position) < std::tie(rhs.head, rhs_largest_position);
|
return std::tie(head, largest_position) < std::tie(rhs.head, rhs_largest_position);
|
||||||
}
|
}
|
||||||
Address(int head, HeadPosition position) : head(head), position(position) {}
|
constexpr Address(int head, HeadPosition position) : head(head), position(position) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -22,11 +22,11 @@ namespace Storage {
|
|||||||
*/
|
*/
|
||||||
struct Time {
|
struct Time {
|
||||||
unsigned int length, clock_rate;
|
unsigned int length, clock_rate;
|
||||||
Time() : length(0), clock_rate(1) {}
|
constexpr Time() : length(0), clock_rate(1) {}
|
||||||
Time(unsigned int unsigned_int_value) : length(unsigned_int_value), clock_rate(1) {}
|
constexpr Time(unsigned int unsigned_int_value) : length(unsigned_int_value), clock_rate(1) {}
|
||||||
Time(int int_value) : Time(unsigned(int_value)) {}
|
constexpr Time(int int_value) : Time(unsigned(int_value)) {}
|
||||||
Time(unsigned int length, unsigned int clock_rate) : length(length), clock_rate(clock_rate) {}
|
constexpr Time(unsigned int length, unsigned int clock_rate) : length(length), clock_rate(clock_rate) {}
|
||||||
Time(int length, int clock_rate) : Time(unsigned(length), unsigned(clock_rate)) {}
|
constexpr Time(int length, int clock_rate) : Time(unsigned(length), unsigned(clock_rate)) {}
|
||||||
Time(uint64_t length, uint64_t clock_rate) {
|
Time(uint64_t length, uint64_t clock_rate) {
|
||||||
install_result(length, clock_rate);
|
install_result(length, clock_rate);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user