diff --git a/Machines/Commodore/Vic-20/Typer.cpp b/Machines/Commodore/Vic-20/CharacterMapper.cpp similarity index 92% rename from Machines/Commodore/Vic-20/Typer.cpp rename to Machines/Commodore/Vic-20/CharacterMapper.cpp index 982651742..35fc4d11a 100644 --- a/Machines/Commodore/Vic-20/Typer.cpp +++ b/Machines/Commodore/Vic-20/CharacterMapper.cpp @@ -1,14 +1,17 @@ // -// Typer.cpp +// CharacterMapper.cpp // Clock Signal // -// Created by Thomas Harte on 05/11/2016. -// Copyright © 2016 Thomas Harte. All rights reserved. +// Created by Thomas Harte on 03/08/2017. +// Copyright © 2017 Thomas Harte. All rights reserved. // +#include "CharacterMapper.hpp" #include "Vic20.hpp" -uint16_t *Commodore::Vic20::Machine::sequence_for_character(Utility::Typer *typer, char character) { +using namespace Commodore::Vic20; + +uint16_t *CharacterMapper::sequence_for_character(char character) { #define KEYS(...) {__VA_ARGS__, EndSequence} #define SHIFT(...) {KeyLShift, __VA_ARGS__, EndSequence} #define X {NotMapped} diff --git a/Machines/Commodore/Vic-20/CharacterMapper.hpp b/Machines/Commodore/Vic-20/CharacterMapper.hpp new file mode 100644 index 000000000..15c6ecc5c --- /dev/null +++ b/Machines/Commodore/Vic-20/CharacterMapper.hpp @@ -0,0 +1,25 @@ +// +// CharacterMapper.hpp +// Clock Signal +// +// Created by Thomas Harte on 03/08/2017. +// Copyright © 2017 Thomas Harte. All rights reserved. +// + +#ifndef Machines_Commodore_Vic20_CharacterMapper_hpp +#define Machines_Commodore_Vic20_CharacterMapper_hpp + +#include "../../Typer.hpp" + +namespace Commodore { +namespace Vic20 { + +class CharacterMapper: public ::Utility::CharacterMapper { + public: + uint16_t *sequence_for_character(char character); +}; + +} +} + +#endif /* CharacterMapper_hpp */ diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp index 1babf5273..2c748af0e 100644 --- a/Machines/Commodore/Vic-20/Vic20.cpp +++ b/Machines/Commodore/Vic-20/Vic20.cpp @@ -12,6 +12,7 @@ #include "../../../Storage/Tape/Formats/TapePRG.hpp" #include "../../../Storage/Tape/Parsers/Commodore.hpp" #include "../../../StaticAnalyser/StaticAnalyser.hpp" +#include "CharacterMapper.hpp" using namespace Commodore::Vic20; @@ -306,6 +307,11 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target) { } } +void Machine::set_typer_for_string(const char *string) { + std::unique_ptr mapper(new CharacterMapper()); + Utility::TypeRecipient::set_typer_for_string(string, std::move(mapper)); +} + void Machine::tape_did_change_input(Storage::Tape::BinaryTapePlayer *tape) { keyboard_via_->set_control_line_input(KeyboardVIA::Port::A, KeyboardVIA::Line::One, !tape->get_input()); } diff --git a/Machines/Commodore/Vic-20/Vic20.hpp b/Machines/Commodore/Vic-20/Vic20.hpp index 10472f943..6e459a976 100644 --- a/Machines/Commodore/Vic-20/Vic20.hpp +++ b/Machines/Commodore/Vic-20/Vic20.hpp @@ -181,6 +181,7 @@ class Machine: // for Utility::TypeRecipient uint16_t *sequence_for_character(Utility::Typer *typer, char character); + void set_typer_for_string(const char *string); // for Tape::Delegate virtual void tape_did_change_input(Storage::Tape::BinaryTapePlayer *tape); diff --git a/Machines/Electron/Typer.cpp b/Machines/Electron/CharacterMapper.cpp similarity index 88% rename from Machines/Electron/Typer.cpp rename to Machines/Electron/CharacterMapper.cpp index ba619e5c0..91572f29a 100644 --- a/Machines/Electron/Typer.cpp +++ b/Machines/Electron/CharacterMapper.cpp @@ -1,22 +1,17 @@ // -// Typer.cpp +// CharacterMapper.cpp // Clock Signal // -// Created by Thomas Harte on 05/11/2016. -// Copyright © 2016 Thomas Harte. All rights reserved. +// Created by Thomas Harte on 03/08/2017. +// Copyright © 2017 Thomas Harte. All rights reserved. // +#include "CharacterMapper.hpp" #include "Electron.hpp" -HalfCycles Electron::Machine::get_typer_delay() { - return get_is_resetting() ? Cycles(625*25*128) : Cycles(0); // wait one second if resetting -} +using namespace Electron; -HalfCycles Electron::Machine::get_typer_frequency() { - return Cycles(625*128*2); // accept a new character every two frames -} - -uint16_t *Electron::Machine::sequence_for_character(Utility::Typer *typer, char character) { +uint16_t *CharacterMapper::sequence_for_character(char character) { #define KEYS(...) {__VA_ARGS__, EndSequence} #define SHIFT(...) {KeyShift, __VA_ARGS__, EndSequence} #define CTRL(...) {KeyControl, __VA_ARGS__, EndSequence} diff --git a/Machines/Electron/CharacterMapper.hpp b/Machines/Electron/CharacterMapper.hpp new file mode 100644 index 000000000..2bb157736 --- /dev/null +++ b/Machines/Electron/CharacterMapper.hpp @@ -0,0 +1,23 @@ +// +// CharacterMapper.hpp +// Clock Signal +// +// Created by Thomas Harte on 03/08/2017. +// Copyright © 2017 Thomas Harte. All rights reserved. +// + +#ifndef Machines_Electron_CharacterMapper_hpp +#define Machines_Electron_CharacterMapper_hpp + +#include "../Typer.hpp" + +namespace Electron { + +class CharacterMapper: public ::Utility::CharacterMapper { + public: + uint16_t *sequence_for_character(char character); +}; + +} + +#endif /* Machines_Electron_CharacterMapper_hpp */ diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index f705946f8..a3f578b63 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -8,6 +8,8 @@ #include "Electron.hpp" +#include "CharacterMapper.hpp" + using namespace Electron; #pragma mark - Lifecycle @@ -104,6 +106,11 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target) { } } +void Machine::set_typer_for_string(const char *string) { + std::unique_ptr mapper(new CharacterMapper()); + Utility::TypeRecipient::set_typer_for_string(string, std::move(mapper)); +} + void Machine::set_rom(ROMSlot slot, std::vector data, bool is_writeable) { uint8_t *target = nullptr; switch(slot) { @@ -395,3 +402,13 @@ void Machine::tape_did_change_interrupt_status(Tape *tape) { interrupt_status_ = (interrupt_status_ & ~(Interrupt::TransmitDataEmpty | Interrupt::ReceiveDataFull | Interrupt::HighToneDetect)) | tape_.get_interrupt_status(); evaluate_interrupts(); } + +#pragma mark - Typer timing + +HalfCycles Electron::Machine::get_typer_delay() { + return get_is_resetting() ? Cycles(625*25*128) : Cycles(0); // wait one second if resetting +} + +HalfCycles Electron::Machine::get_typer_frequency() { + return Cycles(625*128*2); // accept a new character every two frames +} diff --git a/Machines/Electron/Electron.hpp b/Machines/Electron/Electron.hpp index 56c5bc06c..8ce40b044 100644 --- a/Machines/Electron/Electron.hpp +++ b/Machines/Electron/Electron.hpp @@ -103,7 +103,7 @@ class Machine: // for Utility::TypeRecipient virtual HalfCycles get_typer_delay(); virtual HalfCycles get_typer_frequency(); - uint16_t *sequence_for_character(Utility::Typer *typer, char character); + virtual void set_typer_for_string(const char *string); private: inline void update_display(); diff --git a/Machines/Oric/Typer.cpp b/Machines/Oric/CharacterMapper.cpp similarity index 92% rename from Machines/Oric/Typer.cpp rename to Machines/Oric/CharacterMapper.cpp index 117665769..f8e0e649e 100644 --- a/Machines/Oric/Typer.cpp +++ b/Machines/Oric/CharacterMapper.cpp @@ -1,6 +1,17 @@ +// +// CharacterMapper.cpp +// Clock Signal +// +// Created by Thomas Harte on 03/08/2017. +// Copyright © 2017 Thomas Harte. All rights reserved. +// + +#include "CharacterMapper.hpp" #include "Oric.hpp" -uint16_t *Oric::Machine::sequence_for_character(Utility::Typer *typer, char character) { +using namespace Oric; + +uint16_t *CharacterMapper::sequence_for_character(char character) { #define KEYS(...) {__VA_ARGS__, EndSequence} #define SHIFT(...) {KeyLeftShift, __VA_ARGS__, EndSequence} #define X {NotMapped} diff --git a/Machines/Oric/CharacterMapper.hpp b/Machines/Oric/CharacterMapper.hpp new file mode 100644 index 000000000..95d9f34aa --- /dev/null +++ b/Machines/Oric/CharacterMapper.hpp @@ -0,0 +1,23 @@ +// +// CharacterMapper.hpp +// Clock Signal +// +// Created by Thomas Harte on 03/08/2017. +// Copyright © 2017 Thomas Harte. All rights reserved. +// + +#ifndef Machines_Oric_CharacterMapper_hpp +#define Machines_Oric_CharacterMapper_hpp + +#include "../Typer.hpp" + +namespace Oric { + +class CharacterMapper: public ::Utility::CharacterMapper { + public: + uint16_t *sequence_for_character(char character); +}; + +} + +#endif /* Machines_Oric_CharacterMapper_hpp */ diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index 74160be0d..b60cdcc91 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -7,8 +7,12 @@ // #include "Oric.hpp" + +#include "CharacterMapper.hpp" #include "../MemoryFuzzer.hpp" +#include + using namespace Oric; Machine::Machine() : @@ -32,7 +36,7 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target) { via_.tape->set_tape(target.tapes.front()); } - if(target.loadingCommand.length()) { // TODO: and automatic loading option enabled + if(target.loadingCommand.length()) { set_typer_for_string(target.loadingCommand.c_str()); } @@ -65,6 +69,11 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target) { } } +void Machine::set_typer_for_string(const char *string) { + std::unique_ptr mapper(new CharacterMapper); + Utility::TypeRecipient::set_typer_for_string(string, std::move(mapper)); +} + void Machine::set_rom(ROM rom, const std::vector &data) { switch(rom) { case BASIC11: basic11_rom_ = std::move(data); break; diff --git a/Machines/Oric/Oric.hpp b/Machines/Oric/Oric.hpp index 39ba9edc3..dd7ec48d9 100644 --- a/Machines/Oric/Oric.hpp +++ b/Machines/Oric/Oric.hpp @@ -94,7 +94,7 @@ class Machine: void tape_did_change_input(Storage::Tape::BinaryTapePlayer *tape_player); // for Utility::TypeRecipient::Delegate - uint16_t *sequence_for_character(Utility::Typer *typer, char character); + void set_typer_for_string(const char *string); // for Microdisc::Delegate void microdisc_did_change_paging_flags(class Microdisc *microdisc); diff --git a/Machines/Typer.cpp b/Machines/Typer.cpp index cf7676a6c..7ff39395d 100644 --- a/Machines/Typer.cpp +++ b/Machines/Typer.cpp @@ -11,8 +11,13 @@ using namespace Utility; -Typer::Typer(const char *string, HalfCycles delay, HalfCycles frequency, Delegate *delegate) : - counter_(-delay), frequency_(frequency), string_pointer_(0), delegate_(delegate), phase_(0) { +Typer::Typer(const char *string, HalfCycles delay, HalfCycles frequency, std::unique_ptr character_mapper, Delegate *delegate) : + counter_(-delay), + frequency_(frequency), + string_pointer_(0), + delegate_(delegate), + phase_(0), + character_mapper_(std::move(character_mapper)) { size_t string_size = strlen(string) + 3; string_ = (char *)malloc(string_size); snprintf(string_, string_size, "%c%s%c", Typer::BeginString, string, Typer::EndString); @@ -36,10 +41,26 @@ void Typer::run_for(const HalfCycles duration) { } } +bool Typer::try_type_next_character() { + uint16_t *sequence = character_mapper_->sequence_for_character(string_[string_pointer_]); + + if(!sequence || sequence[0] == CharacterMapper::NotMapped) { + return false; + } + + if(!phase_) delegate_->clear_all_keys(); + else { + delegate_->set_key_state(sequence[phase_ - 1], true); + return sequence[phase_] == CharacterMapper::EndSequence; + } + + return true; +} + bool Typer::type_next_character() { if(string_ == nullptr) return false; - if(delegate_->typer_set_next_character(this, string_[string_pointer_], phase_)) { + if(!try_type_next_character()) { phase_ = 0; if(!string_[string_pointer_]) { free(string_); @@ -59,26 +80,9 @@ Typer::~Typer() { free(string_); } -#pragma mark - Delegate +#pragma mark - Character mapper -bool Typer::Delegate::typer_set_next_character(Utility::Typer *typer, char character, int phase) { - uint16_t *sequence = sequence_for_character(typer, character); - if(!sequence) return true; - - if(!phase) clear_all_keys(); - else { - set_key_state(sequence[phase - 1], true); - return sequence[phase] == Typer::Delegate::EndSequence; - } - - return false; -} - -uint16_t *Typer::Delegate::sequence_for_character(Typer *typer, char character) { - return nullptr; -} - -uint16_t *Typer::Delegate::table_lookup_sequence_for_character(KeySequence *sequences, size_t length, char character) { +uint16_t *CharacterMapper::table_lookup_sequence_for_character(KeySequence *sequences, size_t length, char character) { size_t ucharacter = (size_t)((unsigned char)character); if(ucharacter > (length / sizeof(KeySequence))) return nullptr; if(sequences[ucharacter][0] == NotMapped) return nullptr; diff --git a/Machines/Typer.hpp b/Machines/Typer.hpp index 5b10b8fad..32cb25ce9 100644 --- a/Machines/Typer.hpp +++ b/Machines/Typer.hpp @@ -15,45 +15,96 @@ namespace Utility { +/*! + An interface that provides a mapping from logical characters to the sequence of keys + necessary to type that character on a given machine. +*/ +class CharacterMapper { + public: + /// @returns The EndSequence-terminated sequence of keys that would cause @c character to be typed. + virtual uint16_t *sequence_for_character(char character) = 0; + + /// Terminates a key sequence. + static const uint16_t EndSequence = 0xffff; + + /*! + If returned as the first entry in a key sequence, indicates that the requested character + cannot be mapped. + */ + static const uint16_t NotMapped = 0xfffe; + + protected: + typedef uint16_t KeySequence[16]; + + /*! + Provided in the base class as a convenience: given the lookup table of key sequences @c sequences, + with @c length entries, returns the sequence for character @c character if it exists; otherwise + returns @c nullptr. + */ + uint16_t *table_lookup_sequence_for_character(KeySequence *sequences, size_t length, char character); +}; + +/*! + Provides a stateful mechanism for typing a sequence of characters. Each character is mapped to a key sequence + by a character mapper. That key sequence is then replayed to a delegate. + + Being given a delay and frequency at construction, the run_for interface can be used to produce time-based + typing. Alternatively, an owner may decline to use run_for and simply call type_next_character each time a + fresh key transition is ready to be consumed. +*/ class Typer { public: class Delegate: public KeyboardMachine::Machine { public: - virtual bool typer_set_next_character(Typer *typer, char character, int phase); virtual void typer_reset(Typer *typer) = 0; - - virtual uint16_t *sequence_for_character(Typer *typer, char character); - - typedef uint16_t KeySequence[16]; - uint16_t *table_lookup_sequence_for_character(KeySequence *sequences, size_t length, char character); - - const uint16_t EndSequence = 0xffff; - const uint16_t NotMapped = 0xfffe; }; - Typer(const char *string, HalfCycles delay, HalfCycles frequency, Delegate *delegate); + Typer(const char *string, HalfCycles delay, HalfCycles frequency, std::unique_ptr character_mapper, Delegate *delegate); ~Typer(); + void run_for(const HalfCycles duration); bool type_next_character(); + bool is_completed(); + const char BeginString = 0x02; // i.e. ASCII start of text const char EndString = 0x03; // i.e. ASCII end of text private: char *string_; + size_t string_pointer_; + HalfCycles frequency_; HalfCycles counter_; int phase_; + Delegate *delegate_; - size_t string_pointer_; + std::unique_ptr character_mapper_; + + bool try_type_next_character(); }; +/*! + Provides a default base class for type recipients: classes that want to attach a single typer at a time and + which may or may not want to nominate an initial delay and typing frequency. +*/ class TypeRecipient: public Typer::Delegate { public: - void set_typer_for_string(const char *string) { - typer_.reset(new Typer(string, get_typer_delay(), get_typer_frequency(), this)); + /// Attaches a typer to this class that will type @c string using @c character_mapper as a source. + void set_typer_for_string(const char *string, std::unique_ptr character_mapper) { + typer_.reset(new Typer(string, get_typer_delay(), get_typer_frequency(), std::move(character_mapper), this)); } + /*! + Provided as a hook for subclasses to implement so that external callers can install a typer + without needing inside knowledge as to where the character mapper comes from. + */ + virtual void set_typer_for_string(const char *string) = 0; + + /*! + Provided in order to conform to that part of the Typer::Delegate interface that goes above and + beyond KeyboardMachine::Machine; responds to the end of typing by clearing all keys. + */ void typer_reset(Typer *typer) { clear_all_keys(); } diff --git a/Machines/ZX8081/CharacterMapper.cpp b/Machines/ZX8081/CharacterMapper.cpp new file mode 100644 index 000000000..07f1cf874 --- /dev/null +++ b/Machines/ZX8081/CharacterMapper.cpp @@ -0,0 +1,159 @@ +// +// CharacterMapper.cpp +// Clock Signal +// +// Created by Thomas Harte on 03/08/2017. +// Copyright © 2017 Thomas Harte. All rights reserved. +// + +#include "CharacterMapper.hpp" +#include "ZX8081.hpp" + +using namespace ZX8081; + +CharacterMapper::CharacterMapper(bool is_zx81) : is_zx81_(is_zx81) {} + +uint16_t *CharacterMapper::sequence_for_character(char character) { +#define KEYS(...) {__VA_ARGS__, EndSequence} +#define SHIFT(...) {KeyShift, __VA_ARGS__, EndSequence} +#define X {NotMapped} + static KeySequence zx81_key_sequences[] = { + /* NUL */ X, /* SOH */ X, + /* STX */ X, /* ETX */ X, + /* EOT */ X, /* ENQ */ X, + /* ACK */ X, /* BEL */ X, + /* BS */ SHIFT(Key0), /* HT */ X, + /* LF */ KEYS(KeyEnter), /* VT */ X, + /* FF */ X, /* CR */ X, + /* SO */ X, /* SI */ X, + /* DLE */ X, /* DC1 */ X, + /* DC2 */ X, /* DC3 */ X, + /* DC4 */ X, /* NAK */ X, + /* SYN */ X, /* ETB */ X, + /* CAN */ X, /* EM */ X, + /* SUB */ X, /* ESC */ X, + /* FS */ X, /* GS */ X, + /* RS */ X, /* US */ X, + /* space */ KEYS(KeySpace), /* ! */ X, + /* " */ SHIFT(KeyP), /* # */ X, + /* $ */ SHIFT(KeyU), /* % */ X, + /* & */ X, /* ' */ X, + /* ( */ SHIFT(KeyI), /* ) */ SHIFT(KeyO), + /* * */ SHIFT(KeyB), /* + */ SHIFT(KeyK), + /* , */ SHIFT(KeyDot), /* - */ SHIFT(KeyJ), + /* . */ KEYS(KeyDot), /* / */ SHIFT(KeyV), + /* 0 */ KEYS(Key0), /* 1 */ KEYS(Key1), + /* 2 */ KEYS(Key2), /* 3 */ KEYS(Key3), + /* 4 */ KEYS(Key4), /* 5 */ KEYS(Key5), + /* 6 */ KEYS(Key6), /* 7 */ KEYS(Key7), + /* 8 */ KEYS(Key8), /* 9 */ KEYS(Key9), + /* : */ SHIFT(KeyZ), /* ; */ SHIFT(KeyX), + /* < */ SHIFT(KeyN), /* = */ SHIFT(KeyL), + /* > */ SHIFT(KeyM), /* ? */ SHIFT(KeyC), + /* @ */ X, /* A */ KEYS(KeyA), + /* B */ KEYS(KeyB), /* C */ KEYS(KeyC), + /* D */ KEYS(KeyD), /* E */ KEYS(KeyE), + /* F */ KEYS(KeyF), /* G */ KEYS(KeyG), + /* H */ KEYS(KeyH), /* I */ KEYS(KeyI), + /* J */ KEYS(KeyJ), /* K */ KEYS(KeyK), + /* L */ KEYS(KeyL), /* M */ KEYS(KeyM), + /* N */ KEYS(KeyN), /* O */ KEYS(KeyO), + /* P */ KEYS(KeyP), /* Q */ KEYS(KeyQ), + /* R */ KEYS(KeyR), /* S */ KEYS(KeyS), + /* T */ KEYS(KeyT), /* U */ KEYS(KeyU), + /* V */ KEYS(KeyV), /* W */ KEYS(KeyW), + /* X */ KEYS(KeyX), /* Y */ KEYS(KeyY), + /* Z */ KEYS(KeyZ), /* [ */ X, + /* \ */ X, /* ] */ X, + /* ^ */ X, /* _ */ X, + /* ` */ X, /* a */ KEYS(KeyA), + /* b */ KEYS(KeyB), /* c */ KEYS(KeyC), + /* d */ KEYS(KeyD), /* e */ KEYS(KeyE), + /* f */ KEYS(KeyF), /* g */ KEYS(KeyG), + /* h */ KEYS(KeyH), /* i */ KEYS(KeyI), + /* j */ KEYS(KeyJ), /* k */ KEYS(KeyK), + /* l */ KEYS(KeyL), /* m */ KEYS(KeyM), + /* n */ KEYS(KeyN), /* o */ KEYS(KeyO), + /* p */ KEYS(KeyP), /* q */ KEYS(KeyQ), + /* r */ KEYS(KeyR), /* s */ KEYS(KeyS), + /* t */ KEYS(KeyT), /* u */ KEYS(KeyU), + /* v */ KEYS(KeyV), /* w */ KEYS(KeyW), + /* x */ KEYS(KeyX), /* y */ KEYS(KeyY), + /* z */ KEYS(KeyZ), /* { */ X, + /* | */ X, /* } */ X, + }; + + static KeySequence zx80_key_sequences[] = { + /* NUL */ X, /* SOH */ X, + /* STX */ X, /* ETX */ X, + /* EOT */ X, /* ENQ */ X, + /* ACK */ X, /* BEL */ X, + /* BS */ SHIFT(Key0), /* HT */ X, + /* LF */ KEYS(KeyEnter), /* VT */ X, + /* FF */ X, /* CR */ X, + /* SO */ X, /* SI */ X, + /* DLE */ X, /* DC1 */ X, + /* DC2 */ X, /* DC3 */ X, + /* DC4 */ X, /* NAK */ X, + /* SYN */ X, /* ETB */ X, + /* CAN */ X, /* EM */ X, + /* SUB */ X, /* ESC */ X, + /* FS */ X, /* GS */ X, + /* RS */ X, /* US */ X, + /* space */ KEYS(KeySpace), /* ! */ X, + /* " */ SHIFT(KeyY), /* # */ X, + /* $ */ SHIFT(KeyU), /* % */ X, + /* & */ X, /* ' */ X, + /* ( */ SHIFT(KeyI), /* ) */ SHIFT(KeyO), + /* * */ SHIFT(KeyP), /* + */ SHIFT(KeyK), + /* , */ SHIFT(KeyDot), /* - */ SHIFT(KeyJ), + /* . */ KEYS(KeyDot), /* / */ SHIFT(KeyV), + /* 0 */ KEYS(Key0), /* 1 */ KEYS(Key1), + /* 2 */ KEYS(Key2), /* 3 */ KEYS(Key3), + /* 4 */ KEYS(Key4), /* 5 */ KEYS(Key5), + /* 6 */ KEYS(Key6), /* 7 */ KEYS(Key7), + /* 8 */ KEYS(Key8), /* 9 */ KEYS(Key9), + /* : */ SHIFT(KeyZ), /* ; */ SHIFT(KeyX), + /* < */ SHIFT(KeyN), /* = */ SHIFT(KeyL), + /* > */ SHIFT(KeyM), /* ? */ SHIFT(KeyC), + /* @ */ X, /* A */ KEYS(KeyA), + /* B */ KEYS(KeyB), /* C */ KEYS(KeyC), + /* D */ KEYS(KeyD), /* E */ KEYS(KeyE), + /* F */ KEYS(KeyF), /* G */ KEYS(KeyG), + /* H */ KEYS(KeyH), /* I */ KEYS(KeyI), + /* J */ KEYS(KeyJ), /* K */ KEYS(KeyK), + /* L */ KEYS(KeyL), /* M */ KEYS(KeyM), + /* N */ KEYS(KeyN), /* O */ KEYS(KeyO), + /* P */ KEYS(KeyP), /* Q */ KEYS(KeyQ), + /* R */ KEYS(KeyR), /* S */ KEYS(KeyS), + /* T */ KEYS(KeyT), /* U */ KEYS(KeyU), + /* V */ KEYS(KeyV), /* W */ KEYS(KeyW), + /* X */ KEYS(KeyX), /* Y */ KEYS(KeyY), + /* Z */ KEYS(KeyZ), /* [ */ X, + /* \ */ X, /* ] */ X, + /* ^ */ X, /* _ */ X, + /* ` */ X, /* a */ KEYS(KeyA), + /* b */ KEYS(KeyB), /* c */ KEYS(KeyC), + /* d */ KEYS(KeyD), /* e */ KEYS(KeyE), + /* f */ KEYS(KeyF), /* g */ KEYS(KeyG), + /* h */ KEYS(KeyH), /* i */ KEYS(KeyI), + /* j */ KEYS(KeyJ), /* k */ KEYS(KeyK), + /* l */ KEYS(KeyL), /* m */ KEYS(KeyM), + /* n */ KEYS(KeyN), /* o */ KEYS(KeyO), + /* p */ KEYS(KeyP), /* q */ KEYS(KeyQ), + /* r */ KEYS(KeyR), /* s */ KEYS(KeyS), + /* t */ KEYS(KeyT), /* u */ KEYS(KeyU), + /* v */ KEYS(KeyV), /* w */ KEYS(KeyW), + /* x */ KEYS(KeyX), /* y */ KEYS(KeyY), + /* z */ KEYS(KeyZ), /* { */ X, + /* | */ X, /* } */ X, + }; +#undef KEYS +#undef SHIFT +#undef X + + if(is_zx81_) + return table_lookup_sequence_for_character(zx81_key_sequences, sizeof(zx81_key_sequences), character); + else + return table_lookup_sequence_for_character(zx80_key_sequences, sizeof(zx80_key_sequences), character); +} diff --git a/Machines/ZX8081/CharacterMapper.hpp b/Machines/ZX8081/CharacterMapper.hpp new file mode 100644 index 000000000..1d2b996da --- /dev/null +++ b/Machines/ZX8081/CharacterMapper.hpp @@ -0,0 +1,27 @@ +// +// CharacterMapper.hpp +// Clock Signal +// +// Created by Thomas Harte on 03/08/2017. +// Copyright © 2017 Thomas Harte. All rights reserved. +// + +#ifndef CharacterMapper_hpp +#define CharacterMapper_hpp + +#include "../Typer.hpp" + +namespace ZX8081 { + +class CharacterMapper: public ::Utility::CharacterMapper { + public: + CharacterMapper(bool is_zx81); + uint16_t *sequence_for_character(char character); + + private: + bool is_zx81_; +}; + +} + +#endif /* CharacterMapper_hpp */ diff --git a/Machines/ZX8081/Typer.cpp b/Machines/ZX8081/Typer.cpp deleted file mode 100644 index 1f315e996..000000000 --- a/Machines/ZX8081/Typer.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// -// Typer.cpp -// Clock Signal -// -// Created by Thomas Harte on 09/07/2017. -// Copyright © 2017 Thomas Harte. All rights reserved. -// - -#include "Typer.hpp" -#include "ZX8081.hpp" - -//Utility::KeySequence *ZX8081::SequenceForCharacter(char character, bool is_zx81) { -//#define KEYS(...) {__VA_ARGS__, Utility::EndSequence} -//#define SHIFT(...) {KeyShift, __VA_ARGS__, Utility::EndSequence} -//#define X {Utility::NotMapped} -// static Utility::KeySequence zx81_key_sequences[] = { -// /* NUL */ X, /* SOH */ X, -// /* STX */ X, /* ETX */ X, -// /* EOT */ X, /* ENQ */ X, -// /* ACK */ X, /* BEL */ X, -// /* BS */ SHIFT(Key0), /* HT */ X, -// /* LF */ KEYS(KeyEnter), /* VT */ X, -// /* FF */ X, /* CR */ X, -// /* SO */ X, /* SI */ X, -// /* DLE */ X, /* DC1 */ X, -// /* DC2 */ X, /* DC3 */ X, -// /* DC4 */ X, /* NAK */ X, -// /* SYN */ X, /* ETB */ X, -// /* CAN */ X, /* EM */ X, -// /* SUB */ X, /* ESC */ X, -// /* FS */ X, /* GS */ X, -// /* RS */ X, /* US */ X, -// /* space */ KEYS(KeySpace), /* ! */ X, -// /* " */ SHIFT(KeyP), /* # */ X, -// /* $ */ SHIFT(KeyU), /* % */ X, -// /* & */ X, /* ' */ X, -// /* ( */ SHIFT(KeyI), /* ) */ SHIFT(KeyO), -// /* * */ SHIFT(KeyB), /* + */ SHIFT(KeyK), -// /* , */ SHIFT(KeyDot), /* - */ SHIFT(KeyJ), -// /* . */ KEYS(KeyDot), /* / */ SHIFT(KeyV), -// /* 0 */ KEYS(Key0), /* 1 */ KEYS(Key1), -// /* 2 */ KEYS(Key2), /* 3 */ KEYS(Key3), -// /* 4 */ KEYS(Key4), /* 5 */ KEYS(Key5), -// /* 6 */ KEYS(Key6), /* 7 */ KEYS(Key7), -// /* 8 */ KEYS(Key8), /* 9 */ KEYS(Key9), -// /* : */ SHIFT(KeyZ), /* ; */ SHIFT(KeyX), -// /* < */ SHIFT(KeyN), /* = */ SHIFT(KeyL), -// /* > */ SHIFT(KeyM), /* ? */ SHIFT(KeyC), -// /* @ */ X, /* A */ KEYS(KeyA), -// /* B */ KEYS(KeyB), /* C */ KEYS(KeyC), -// /* D */ KEYS(KeyD), /* E */ KEYS(KeyE), -// /* F */ KEYS(KeyF), /* G */ KEYS(KeyG), -// /* H */ KEYS(KeyH), /* I */ KEYS(KeyI), -// /* J */ KEYS(KeyJ), /* K */ KEYS(KeyK), -// /* L */ KEYS(KeyL), /* M */ KEYS(KeyM), -// /* N */ KEYS(KeyN), /* O */ KEYS(KeyO), -// /* P */ KEYS(KeyP), /* Q */ KEYS(KeyQ), -// /* R */ KEYS(KeyR), /* S */ KEYS(KeyS), -// /* T */ KEYS(KeyT), /* U */ KEYS(KeyU), -// /* V */ KEYS(KeyV), /* W */ KEYS(KeyW), -// /* X */ KEYS(KeyX), /* Y */ KEYS(KeyY), -// /* Z */ KEYS(KeyZ), /* [ */ X, -// /* \ */ X, /* ] */ X, -// /* ^ */ X, /* _ */ X, -// /* ` */ X, /* a */ KEYS(KeyA), -// /* b */ KEYS(KeyB), /* c */ KEYS(KeyC), -// /* d */ KEYS(KeyD), /* e */ KEYS(KeyE), -// /* f */ KEYS(KeyF), /* g */ KEYS(KeyG), -// /* h */ KEYS(KeyH), /* i */ KEYS(KeyI), -// /* j */ KEYS(KeyJ), /* k */ KEYS(KeyK), -// /* l */ KEYS(KeyL), /* m */ KEYS(KeyM), -// /* n */ KEYS(KeyN), /* o */ KEYS(KeyO), -// /* p */ KEYS(KeyP), /* q */ KEYS(KeyQ), -// /* r */ KEYS(KeyR), /* s */ KEYS(KeyS), -// /* t */ KEYS(KeyT), /* u */ KEYS(KeyU), -// /* v */ KEYS(KeyV), /* w */ KEYS(KeyW), -// /* x */ KEYS(KeyX), /* y */ KEYS(KeyY), -// /* z */ KEYS(KeyZ), /* { */ X, -// /* | */ X, /* } */ X, -// }; -// -// static KeySequence zx80_key_sequences[] = { -// /* NUL */ X, /* SOH */ X, -// /* STX */ X, /* ETX */ X, -// /* EOT */ X, /* ENQ */ X, -// /* ACK */ X, /* BEL */ X, -// /* BS */ SHIFT(Key0), /* HT */ X, -// /* LF */ KEYS(KeyEnter), /* VT */ X, -// /* FF */ X, /* CR */ X, -// /* SO */ X, /* SI */ X, -// /* DLE */ X, /* DC1 */ X, -// /* DC2 */ X, /* DC3 */ X, -// /* DC4 */ X, /* NAK */ X, -// /* SYN */ X, /* ETB */ X, -// /* CAN */ X, /* EM */ X, -// /* SUB */ X, /* ESC */ X, -// /* FS */ X, /* GS */ X, -// /* RS */ X, /* US */ X, -// /* space */ KEYS(KeySpace), /* ! */ X, -// /* " */ SHIFT(KeyY), /* # */ X, -// /* $ */ SHIFT(KeyU), /* % */ X, -// /* & */ X, /* ' */ X, -// /* ( */ SHIFT(KeyI), /* ) */ SHIFT(KeyO), -// /* * */ SHIFT(KeyP), /* + */ SHIFT(KeyK), -// /* , */ SHIFT(KeyDot), /* - */ SHIFT(KeyJ), -// /* . */ KEYS(KeyDot), /* / */ SHIFT(KeyV), -// /* 0 */ KEYS(Key0), /* 1 */ KEYS(Key1), -// /* 2 */ KEYS(Key2), /* 3 */ KEYS(Key3), -// /* 4 */ KEYS(Key4), /* 5 */ KEYS(Key5), -// /* 6 */ KEYS(Key6), /* 7 */ KEYS(Key7), -// /* 8 */ KEYS(Key8), /* 9 */ KEYS(Key9), -// /* : */ SHIFT(KeyZ), /* ; */ SHIFT(KeyX), -// /* < */ SHIFT(KeyN), /* = */ SHIFT(KeyL), -// /* > */ SHIFT(KeyM), /* ? */ SHIFT(KeyC), -// /* @ */ X, /* A */ KEYS(KeyA), -// /* B */ KEYS(KeyB), /* C */ KEYS(KeyC), -// /* D */ KEYS(KeyD), /* E */ KEYS(KeyE), -// /* F */ KEYS(KeyF), /* G */ KEYS(KeyG), -// /* H */ KEYS(KeyH), /* I */ KEYS(KeyI), -// /* J */ KEYS(KeyJ), /* K */ KEYS(KeyK), -// /* L */ KEYS(KeyL), /* M */ KEYS(KeyM), -// /* N */ KEYS(KeyN), /* O */ KEYS(KeyO), -// /* P */ KEYS(KeyP), /* Q */ KEYS(KeyQ), -// /* R */ KEYS(KeyR), /* S */ KEYS(KeyS), -// /* T */ KEYS(KeyT), /* U */ KEYS(KeyU), -// /* V */ KEYS(KeyV), /* W */ KEYS(KeyW), -// /* X */ KEYS(KeyX), /* Y */ KEYS(KeyY), -// /* Z */ KEYS(KeyZ), /* [ */ X, -// /* \ */ X, /* ] */ X, -// /* ^ */ X, /* _ */ X, -// /* ` */ X, /* a */ KEYS(KeyA), -// /* b */ KEYS(KeyB), /* c */ KEYS(KeyC), -// /* d */ KEYS(KeyD), /* e */ KEYS(KeyE), -// /* f */ KEYS(KeyF), /* g */ KEYS(KeyG), -// /* h */ KEYS(KeyH), /* i */ KEYS(KeyI), -// /* j */ KEYS(KeyJ), /* k */ KEYS(KeyK), -// /* l */ KEYS(KeyL), /* m */ KEYS(KeyM), -// /* n */ KEYS(KeyN), /* o */ KEYS(KeyO), -// /* p */ KEYS(KeyP), /* q */ KEYS(KeyQ), -// /* r */ KEYS(KeyR), /* s */ KEYS(KeyS), -// /* t */ KEYS(KeyT), /* u */ KEYS(KeyU), -// /* v */ KEYS(KeyV), /* w */ KEYS(KeyW), -// /* x */ KEYS(KeyX), /* y */ KEYS(KeyY), -// /* z */ KEYS(KeyZ), /* { */ X, -// /* | */ X, /* } */ X, -// }; -//#undef KEYS -//#undef SHIFT -//#undef X -// -// if(is_zx81) -// return table_lookup_sequence_for_character(zx81_key_sequences, sizeof(zx81_key_sequences), character); -// else -// return table_lookup_sequence_for_character(zx80_key_sequences, sizeof(zx80_key_sequences), character); -//} diff --git a/Machines/ZX8081/Typer.hpp b/Machines/ZX8081/Typer.hpp deleted file mode 100644 index 433565445..000000000 --- a/Machines/ZX8081/Typer.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// -// Typer.hpp -// Clock Signal -// -// Created by Thomas Harte on 02/08/2017. -// Copyright © 2017 Thomas Harte. All rights reserved. -// - -#ifndef Typer_h -#define Typer_h - -#include -#include "../Typer.hpp" - -namespace ZX8081 { - -//Utility::KeySequence *ZX8081::SequenceForCharacter(char character, bool is_zx81); - -} - -#endif /* Typer_h */ diff --git a/Machines/ZX8081/ZX8081.cpp b/Machines/ZX8081/ZX8081.cpp index 52b2c8d9e..6b6089faf 100644 --- a/Machines/ZX8081/ZX8081.cpp +++ b/Machines/ZX8081/ZX8081.cpp @@ -15,8 +15,11 @@ #include "../MemoryFuzzer.hpp" #include "../Typer.hpp" +#include "CharacterMapper.hpp" #include "Video.hpp" +#include + namespace { // The clock rate is 3.25Mhz. const unsigned int ZX8081ClockRate = 3250000; @@ -274,6 +277,11 @@ class ConcreteMachine: } } + void set_typer_for_string(const char *string) { + std::unique_ptr mapper(new CharacterMapper(is_zx81_)); + Utility::TypeRecipient::set_typer_for_string(string, std::move(mapper)); + } + void set_rom(ROMType type, std::vector data) { switch(type) { case ZX80: zx80_rom_ = data; break; @@ -310,157 +318,11 @@ class ConcreteMachine: tape_player_.set_motor_control(is_playing); } -#pragma mark - Typer +#pragma mark - Typer timing - // for Utility::TypeRecipient::Delegate HalfCycles get_typer_delay() { return Cycles(7000000); } HalfCycles get_typer_frequency() { return Cycles(390000); } - uint16_t *sequence_for_character(Utility::Typer *typer, char character) { -#define KEYS(...) {__VA_ARGS__, EndSequence} -#define SHIFT(...) {KeyShift, __VA_ARGS__, EndSequence} -#define X {NotMapped} - static KeySequence zx81_key_sequences[] = { - /* NUL */ X, /* SOH */ X, - /* STX */ X, /* ETX */ X, - /* EOT */ X, /* ENQ */ X, - /* ACK */ X, /* BEL */ X, - /* BS */ SHIFT(Key0), /* HT */ X, - /* LF */ KEYS(KeyEnter), /* VT */ X, - /* FF */ X, /* CR */ X, - /* SO */ X, /* SI */ X, - /* DLE */ X, /* DC1 */ X, - /* DC2 */ X, /* DC3 */ X, - /* DC4 */ X, /* NAK */ X, - /* SYN */ X, /* ETB */ X, - /* CAN */ X, /* EM */ X, - /* SUB */ X, /* ESC */ X, - /* FS */ X, /* GS */ X, - /* RS */ X, /* US */ X, - /* space */ KEYS(KeySpace), /* ! */ X, - /* " */ SHIFT(KeyP), /* # */ X, - /* $ */ SHIFT(KeyU), /* % */ X, - /* & */ X, /* ' */ X, - /* ( */ SHIFT(KeyI), /* ) */ SHIFT(KeyO), - /* * */ SHIFT(KeyB), /* + */ SHIFT(KeyK), - /* , */ SHIFT(KeyDot), /* - */ SHIFT(KeyJ), - /* . */ KEYS(KeyDot), /* / */ SHIFT(KeyV), - /* 0 */ KEYS(Key0), /* 1 */ KEYS(Key1), - /* 2 */ KEYS(Key2), /* 3 */ KEYS(Key3), - /* 4 */ KEYS(Key4), /* 5 */ KEYS(Key5), - /* 6 */ KEYS(Key6), /* 7 */ KEYS(Key7), - /* 8 */ KEYS(Key8), /* 9 */ KEYS(Key9), - /* : */ SHIFT(KeyZ), /* ; */ SHIFT(KeyX), - /* < */ SHIFT(KeyN), /* = */ SHIFT(KeyL), - /* > */ SHIFT(KeyM), /* ? */ SHIFT(KeyC), - /* @ */ X, /* A */ KEYS(KeyA), - /* B */ KEYS(KeyB), /* C */ KEYS(KeyC), - /* D */ KEYS(KeyD), /* E */ KEYS(KeyE), - /* F */ KEYS(KeyF), /* G */ KEYS(KeyG), - /* H */ KEYS(KeyH), /* I */ KEYS(KeyI), - /* J */ KEYS(KeyJ), /* K */ KEYS(KeyK), - /* L */ KEYS(KeyL), /* M */ KEYS(KeyM), - /* N */ KEYS(KeyN), /* O */ KEYS(KeyO), - /* P */ KEYS(KeyP), /* Q */ KEYS(KeyQ), - /* R */ KEYS(KeyR), /* S */ KEYS(KeyS), - /* T */ KEYS(KeyT), /* U */ KEYS(KeyU), - /* V */ KEYS(KeyV), /* W */ KEYS(KeyW), - /* X */ KEYS(KeyX), /* Y */ KEYS(KeyY), - /* Z */ KEYS(KeyZ), /* [ */ X, - /* \ */ X, /* ] */ X, - /* ^ */ X, /* _ */ X, - /* ` */ X, /* a */ KEYS(KeyA), - /* b */ KEYS(KeyB), /* c */ KEYS(KeyC), - /* d */ KEYS(KeyD), /* e */ KEYS(KeyE), - /* f */ KEYS(KeyF), /* g */ KEYS(KeyG), - /* h */ KEYS(KeyH), /* i */ KEYS(KeyI), - /* j */ KEYS(KeyJ), /* k */ KEYS(KeyK), - /* l */ KEYS(KeyL), /* m */ KEYS(KeyM), - /* n */ KEYS(KeyN), /* o */ KEYS(KeyO), - /* p */ KEYS(KeyP), /* q */ KEYS(KeyQ), - /* r */ KEYS(KeyR), /* s */ KEYS(KeyS), - /* t */ KEYS(KeyT), /* u */ KEYS(KeyU), - /* v */ KEYS(KeyV), /* w */ KEYS(KeyW), - /* x */ KEYS(KeyX), /* y */ KEYS(KeyY), - /* z */ KEYS(KeyZ), /* { */ X, - /* | */ X, /* } */ X, - }; - - static KeySequence zx80_key_sequences[] = { - /* NUL */ X, /* SOH */ X, - /* STX */ X, /* ETX */ X, - /* EOT */ X, /* ENQ */ X, - /* ACK */ X, /* BEL */ X, - /* BS */ SHIFT(Key0), /* HT */ X, - /* LF */ KEYS(KeyEnter), /* VT */ X, - /* FF */ X, /* CR */ X, - /* SO */ X, /* SI */ X, - /* DLE */ X, /* DC1 */ X, - /* DC2 */ X, /* DC3 */ X, - /* DC4 */ X, /* NAK */ X, - /* SYN */ X, /* ETB */ X, - /* CAN */ X, /* EM */ X, - /* SUB */ X, /* ESC */ X, - /* FS */ X, /* GS */ X, - /* RS */ X, /* US */ X, - /* space */ KEYS(KeySpace), /* ! */ X, - /* " */ SHIFT(KeyY), /* # */ X, - /* $ */ SHIFT(KeyU), /* % */ X, - /* & */ X, /* ' */ X, - /* ( */ SHIFT(KeyI), /* ) */ SHIFT(KeyO), - /* * */ SHIFT(KeyP), /* + */ SHIFT(KeyK), - /* , */ SHIFT(KeyDot), /* - */ SHIFT(KeyJ), - /* . */ KEYS(KeyDot), /* / */ SHIFT(KeyV), - /* 0 */ KEYS(Key0), /* 1 */ KEYS(Key1), - /* 2 */ KEYS(Key2), /* 3 */ KEYS(Key3), - /* 4 */ KEYS(Key4), /* 5 */ KEYS(Key5), - /* 6 */ KEYS(Key6), /* 7 */ KEYS(Key7), - /* 8 */ KEYS(Key8), /* 9 */ KEYS(Key9), - /* : */ SHIFT(KeyZ), /* ; */ SHIFT(KeyX), - /* < */ SHIFT(KeyN), /* = */ SHIFT(KeyL), - /* > */ SHIFT(KeyM), /* ? */ SHIFT(KeyC), - /* @ */ X, /* A */ KEYS(KeyA), - /* B */ KEYS(KeyB), /* C */ KEYS(KeyC), - /* D */ KEYS(KeyD), /* E */ KEYS(KeyE), - /* F */ KEYS(KeyF), /* G */ KEYS(KeyG), - /* H */ KEYS(KeyH), /* I */ KEYS(KeyI), - /* J */ KEYS(KeyJ), /* K */ KEYS(KeyK), - /* L */ KEYS(KeyL), /* M */ KEYS(KeyM), - /* N */ KEYS(KeyN), /* O */ KEYS(KeyO), - /* P */ KEYS(KeyP), /* Q */ KEYS(KeyQ), - /* R */ KEYS(KeyR), /* S */ KEYS(KeyS), - /* T */ KEYS(KeyT), /* U */ KEYS(KeyU), - /* V */ KEYS(KeyV), /* W */ KEYS(KeyW), - /* X */ KEYS(KeyX), /* Y */ KEYS(KeyY), - /* Z */ KEYS(KeyZ), /* [ */ X, - /* \ */ X, /* ] */ X, - /* ^ */ X, /* _ */ X, - /* ` */ X, /* a */ KEYS(KeyA), - /* b */ KEYS(KeyB), /* c */ KEYS(KeyC), - /* d */ KEYS(KeyD), /* e */ KEYS(KeyE), - /* f */ KEYS(KeyF), /* g */ KEYS(KeyG), - /* h */ KEYS(KeyH), /* i */ KEYS(KeyI), - /* j */ KEYS(KeyJ), /* k */ KEYS(KeyK), - /* l */ KEYS(KeyL), /* m */ KEYS(KeyM), - /* n */ KEYS(KeyN), /* o */ KEYS(KeyO), - /* p */ KEYS(KeyP), /* q */ KEYS(KeyQ), - /* r */ KEYS(KeyR), /* s */ KEYS(KeyS), - /* t */ KEYS(KeyT), /* u */ KEYS(KeyU), - /* v */ KEYS(KeyV), /* w */ KEYS(KeyW), - /* x */ KEYS(KeyX), /* y */ KEYS(KeyY), - /* z */ KEYS(KeyZ), /* { */ X, - /* | */ X, /* } */ X, - }; -#undef KEYS -#undef SHIFT -#undef X - - if(is_zx81_) - return table_lookup_sequence_for_character(zx81_key_sequences, sizeof(zx81_key_sequences), character); - else - return table_lookup_sequence_for_character(zx80_key_sequences, sizeof(zx80_key_sequences), character); - } - private: CPU::Z80::Processor z80_; diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index e231ec0f5..e8dc5bf48 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -82,13 +82,16 @@ 4B69FB3D1C4D908A00B5F0AA /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B69FB3B1C4D908A00B5F0AA /* Tape.cpp */; }; 4B69FB441C4D941400B5F0AA /* TapeUEF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B69FB421C4D941400B5F0AA /* TapeUEF.cpp */; }; 4B69FB461C4D950F00B5F0AA /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B69FB451C4D950F00B5F0AA /* libz.tbd */; }; - 4B6A84BC1F130DA6001F28C9 /* Typer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6A84BB1F130DA6001F28C9 /* Typer.cpp */; }; 4B6C73BD1D387AE500AFCFCA /* DiskController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6C73BB1D387AE500AFCFCA /* DiskController.cpp */; }; 4B77069D1EC904570053B588 /* Z80.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B77069B1EC904570053B588 /* Z80.cpp */; }; 4B7913CC1DFCD80E00175A82 /* Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B7913CA1DFCD80E00175A82 /* Video.cpp */; }; 4B79E4441E3AF38600141F11 /* cassette.png in Resources */ = {isa = PBXBuildFile; fileRef = 4B79E4411E3AF38600141F11 /* cassette.png */; }; 4B79E4451E3AF38600141F11 /* floppy35.png in Resources */ = {isa = PBXBuildFile; fileRef = 4B79E4421E3AF38600141F11 /* floppy35.png */; }; 4B79E4461E3AF38600141F11 /* floppy525.png in Resources */ = {isa = PBXBuildFile; fileRef = 4B79E4431E3AF38600141F11 /* floppy525.png */; }; + 4B8378DC1F336631005CA9E4 /* CharacterMapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8378DA1F336631005CA9E4 /* CharacterMapper.cpp */; }; + 4B8378DF1F33675F005CA9E4 /* CharacterMapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8378DD1F33675F005CA9E4 /* CharacterMapper.cpp */; }; + 4B8378E21F336920005CA9E4 /* CharacterMapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8378E01F336920005CA9E4 /* CharacterMapper.cpp */; }; + 4B8378E51F3378C4005CA9E4 /* CharacterMapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8378E31F3378C4005CA9E4 /* CharacterMapper.cpp */; }; 4B8805F01DCFC99C003085B1 /* Acorn.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8805EE1DCFC99C003085B1 /* Acorn.cpp */; }; 4B8805F41DCFD22A003085B1 /* Commodore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8805F21DCFD22A003085B1 /* Commodore.cpp */; }; 4B8805F71DCFF6C9003085B1 /* Commodore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8805F51DCFF6C9003085B1 /* Commodore.cpp */; }; @@ -403,9 +406,6 @@ 4BC76E691C98E31700E6EF73 /* FIRFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC76E671C98E31700E6EF73 /* FIRFilter.cpp */; }; 4BC76E6B1C98F43700E6EF73 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BC76E6A1C98F43700E6EF73 /* Accelerate.framework */; }; 4BC830D11D6E7C690000A26F /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC830CF1D6E7C690000A26F /* Tape.cpp */; }; - 4BC8A62A1DCE4F2700DAC693 /* Typer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC8A6291DCE4F2700DAC693 /* Typer.cpp */; }; - 4BC8A62D1DCE60E000DAC693 /* Typer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC8A62B1DCE60E000DAC693 /* Typer.cpp */; }; - 4BC8A62F1DCE63CA00DAC693 /* Typer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC8A62E1DCE63CA00DAC693 /* Typer.cpp */; }; 4BC91B831D1F160E00884B76 /* CommodoreTAP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC91B811D1F160E00884B76 /* CommodoreTAP.cpp */; }; 4BC9DF451D044FCA00F44158 /* ROMImages in Resources */ = {isa = PBXBuildFile; fileRef = 4BC9DF441D044FCA00F44158 /* ROMImages */; }; 4BC9DF4F1D04691600F44158 /* 6560.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC9DF4D1D04691600F44158 /* 6560.cpp */; }; @@ -601,7 +601,6 @@ 4B69FB421C4D941400B5F0AA /* TapeUEF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TapeUEF.cpp; sourceTree = ""; }; 4B69FB431C4D941400B5F0AA /* TapeUEF.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TapeUEF.hpp; sourceTree = ""; }; 4B69FB451C4D950F00B5F0AA /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; - 4B6A84BB1F130DA6001F28C9 /* Typer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Typer.cpp; path = ZX8081/Typer.cpp; sourceTree = ""; }; 4B6C73BB1D387AE500AFCFCA /* DiskController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DiskController.cpp; sourceTree = ""; }; 4B6C73BC1D387AE500AFCFCA /* DiskController.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = DiskController.hpp; sourceTree = ""; }; 4B77069B1EC904570053B588 /* Z80.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Z80.cpp; path = Z80/Z80.cpp; sourceTree = ""; }; @@ -611,6 +610,14 @@ 4B79E4411E3AF38600141F11 /* cassette.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cassette.png; sourceTree = ""; }; 4B79E4421E3AF38600141F11 /* floppy35.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = floppy35.png; sourceTree = ""; }; 4B79E4431E3AF38600141F11 /* floppy525.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = floppy525.png; sourceTree = ""; }; + 4B8378DA1F336631005CA9E4 /* CharacterMapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CharacterMapper.cpp; path = Electron/CharacterMapper.cpp; sourceTree = ""; }; + 4B8378DB1F336631005CA9E4 /* CharacterMapper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = CharacterMapper.hpp; path = Electron/CharacterMapper.hpp; sourceTree = ""; }; + 4B8378DD1F33675F005CA9E4 /* CharacterMapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CharacterMapper.cpp; path = ZX8081/CharacterMapper.cpp; sourceTree = ""; }; + 4B8378DE1F33675F005CA9E4 /* CharacterMapper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = CharacterMapper.hpp; path = ZX8081/CharacterMapper.hpp; sourceTree = ""; }; + 4B8378E01F336920005CA9E4 /* CharacterMapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CharacterMapper.cpp; path = Oric/CharacterMapper.cpp; sourceTree = ""; }; + 4B8378E11F336920005CA9E4 /* CharacterMapper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = CharacterMapper.hpp; path = Oric/CharacterMapper.hpp; sourceTree = ""; }; + 4B8378E31F3378C4005CA9E4 /* CharacterMapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CharacterMapper.cpp; sourceTree = ""; }; + 4B8378E41F3378C4005CA9E4 /* CharacterMapper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CharacterMapper.hpp; sourceTree = ""; }; 4B8805EE1DCFC99C003085B1 /* Acorn.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Acorn.cpp; path = Parsers/Acorn.cpp; sourceTree = ""; }; 4B8805EF1DCFC99C003085B1 /* Acorn.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Acorn.hpp; path = Parsers/Acorn.hpp; sourceTree = ""; }; 4B8805F21DCFD22A003085B1 /* Commodore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Commodore.cpp; path = Parsers/Commodore.cpp; sourceTree = ""; }; @@ -960,7 +967,6 @@ 4BC3B74E1CD194CC00F86E85 /* Shader.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Shader.hpp; sourceTree = ""; }; 4BC3B7501CD1956900F86E85 /* OutputShader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OutputShader.cpp; sourceTree = ""; }; 4BC3B7511CD1956900F86E85 /* OutputShader.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = OutputShader.hpp; sourceTree = ""; }; - 4BC542621F32B985001FF613 /* Typer.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = Typer.hpp; path = ZX8081/Typer.hpp; sourceTree = ""; }; 4BC5E4901D7ED365008CF980 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StaticAnalyser.cpp; path = ../../StaticAnalyser/Commodore/StaticAnalyser.cpp; sourceTree = ""; }; 4BC5E4911D7ED365008CF980 /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = StaticAnalyser.hpp; path = ../../StaticAnalyser/Commodore/StaticAnalyser.hpp; sourceTree = ""; }; 4BC751B11D157E61006C31D9 /* 6522Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 6522Tests.swift; sourceTree = ""; }; @@ -969,9 +975,6 @@ 4BC76E6A1C98F43700E6EF73 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; 4BC830CF1D6E7C690000A26F /* Tape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Tape.cpp; path = ../../StaticAnalyser/Commodore/Tape.cpp; sourceTree = ""; }; 4BC830D01D6E7C690000A26F /* Tape.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Tape.hpp; path = ../../StaticAnalyser/Commodore/Tape.hpp; sourceTree = ""; }; - 4BC8A6291DCE4F2700DAC693 /* Typer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Typer.cpp; path = Oric/Typer.cpp; sourceTree = ""; }; - 4BC8A62B1DCE60E000DAC693 /* Typer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Typer.cpp; path = Electron/Typer.cpp; sourceTree = ""; }; - 4BC8A62E1DCE63CA00DAC693 /* Typer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Typer.cpp; sourceTree = ""; }; 4BC91B811D1F160E00884B76 /* CommodoreTAP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CommodoreTAP.cpp; sourceTree = ""; }; 4BC91B821D1F160E00884B76 /* CommodoreTAP.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CommodoreTAP.hpp; sourceTree = ""; }; 4BC9DF441D044FCA00F44158 /* ROMImages */ = {isa = PBXFileReference; lastKnownFileType = folder; name = ROMImages; path = ../../../../ROMImages; sourceTree = ""; }; @@ -1132,10 +1135,10 @@ 4B1497931EE4B5AC00CE2596 /* ZX8081 */ = { isa = PBXGroup; children = ( - 4B6A84BB1F130DA6001F28C9 /* Typer.cpp */, + 4B8378DD1F33675F005CA9E4 /* CharacterMapper.cpp */, 4BD3A3091EE755C800B5B501 /* Video.cpp */, 4B1497901EE4B5A800CE2596 /* ZX8081.cpp */, - 4BC542621F32B985001FF613 /* Typer.hpp */, + 4B8378DE1F33675F005CA9E4 /* CharacterMapper.hpp */, 4BD3A30A1EE755C800B5B501 /* Video.hpp */, 4B1497911EE4B5A800CE2596 /* ZX8081.hpp */, ); @@ -1242,12 +1245,13 @@ 4B2E2D9E1C3A070900138695 /* Electron */ = { isa = PBXGroup; children = ( + 4B8378DA1F336631005CA9E4 /* CharacterMapper.cpp */, 4B2E2D9B1C3A070400138695 /* Electron.cpp */, 4B30512E1D98ACC600B4FED8 /* Plus3.cpp */, 4BEA52611DF339D7007E74F2 /* Speaker.cpp */, 4BEA525D1DF33323007E74F2 /* Tape.cpp */, - 4BC8A62B1DCE60E000DAC693 /* Typer.cpp */, 4B7913CA1DFCD80E00175A82 /* Video.cpp */, + 4B8378DB1F336631005CA9E4 /* CharacterMapper.hpp */, 4B2E2D9C1C3A070400138695 /* Electron.hpp */, 4BEA52601DF3343A007E74F2 /* Interrupts.hpp */, 4B30512F1D98ACC600B4FED8 /* Plus3.hpp */, @@ -1340,8 +1344,9 @@ 4B4DC81E1D2C2425003C5BF8 /* Vic-20 */ = { isa = PBXGroup; children = ( - 4BC8A62E1DCE63CA00DAC693 /* Typer.cpp */, + 4B8378E31F3378C4005CA9E4 /* CharacterMapper.cpp */, 4B4DC81F1D2C2425003C5BF8 /* Vic20.cpp */, + 4B8378E41F3378C4005CA9E4 /* CharacterMapper.hpp */, 4B4DC8201D2C2425003C5BF8 /* Vic20.hpp */, ); path = "Vic-20"; @@ -2072,12 +2077,13 @@ 4BCF1FA51DADC3E10039D2E7 /* Oric */ = { isa = PBXGroup; children = ( + 4B8378E01F336920005CA9E4 /* CharacterMapper.cpp */, 4B5FADBE1DE3BF2B00AEC565 /* Microdisc.cpp */, - 4B5FADBF1DE3BF2B00AEC565 /* Microdisc.hpp */, 4BCF1FA21DADC3DD0039D2E7 /* Oric.cpp */, - 4BCF1FA31DADC3DD0039D2E7 /* Oric.hpp */, - 4BC8A6291DCE4F2700DAC693 /* Typer.cpp */, 4B2BFDB01DAEF5FF001A68B8 /* Video.cpp */, + 4B8378E11F336920005CA9E4 /* CharacterMapper.hpp */, + 4B5FADBF1DE3BF2B00AEC565 /* Microdisc.hpp */, + 4BCF1FA31DADC3DD0039D2E7 /* Oric.hpp */, 4B2BFDB11DAEF5FF001A68B8 /* Video.hpp */, ); name = Oric; @@ -2653,7 +2659,6 @@ buildActionMask = 2147483647; files = ( 4B2BFC5F1D613E0200BA3AA9 /* TapePRG.cpp in Sources */, - 4B6A84BC1F130DA6001F28C9 /* Typer.cpp in Sources */, 4BAB62AD1D3272D200DF5BA0 /* Disk.cpp in Sources */, 4BC9DF4F1D04691600F44158 /* 6560.cpp in Sources */, 4B59199C1DAC6C46005BB85C /* OricTAP.cpp in Sources */, @@ -2664,9 +2669,11 @@ 4BBF99151C8FBA6F0075DAFB /* CRTOpenGL.cpp in Sources */, 4B95FA9D1F11893B0008E395 /* ZX8081OptionsPanel.swift in Sources */, 4B0CCC451C62D0B3001CAC5F /* CRT.cpp in Sources */, + 4B8378DC1F336631005CA9E4 /* CharacterMapper.cpp in Sources */, + 4B8378E51F3378C4005CA9E4 /* CharacterMapper.cpp in Sources */, + 4B8378E21F336920005CA9E4 /* CharacterMapper.cpp in Sources */, 4BCF1FA41DADC3DD0039D2E7 /* Oric.cpp in Sources */, 4BEA525E1DF33323007E74F2 /* Tape.cpp in Sources */, - 4BC8A62D1DCE60E000DAC693 /* Typer.cpp in Sources */, 4B1497921EE4B5A800CE2596 /* ZX8081.cpp in Sources */, 4B643F3F1D77B88000D431D6 /* DocumentController.swift in Sources */, 4BA799951D8B656E0045123D /* StaticAnalyser.cpp in Sources */, @@ -2719,10 +2726,10 @@ 4B1E85751D170228001EF87D /* Typer.cpp in Sources */, 4BF829631D8F536B001BAE39 /* SSD.cpp in Sources */, 4B2E2D9D1C3A070400138695 /* Electron.cpp in Sources */, - 4BC8A62A1DCE4F2700DAC693 /* Typer.cpp in Sources */, 4B3940E71DA83C8300427841 /* AsyncTaskQueue.cpp in Sources */, 4BAB62B81D3302CA00DF5BA0 /* PCMTrack.cpp in Sources */, 4B69FB3D1C4D908A00B5F0AA /* Tape.cpp in Sources */, + 4B8378DF1F33675F005CA9E4 /* CharacterMapper.cpp in Sources */, 4B8FE2291DA1EDDF0090D3CE /* ElectronOptionsPanel.swift in Sources */, 4B55CE5D1C3B7D6F0093A61B /* CSOpenGLView.m in Sources */, 4BB697CB1D4B6D3E00248BDF /* TimedEventLoop.cpp in Sources */, @@ -2759,7 +2766,6 @@ 4BCF1FAB1DADD41B0039D2E7 /* StaticAnalyser.cpp in Sources */, 4B2A539F1D117D36003C6002 /* CSAudioQueue.m in Sources */, 4B37EE821D7345A6006A09A4 /* BinaryDump.cpp in Sources */, - 4BC8A62F1DCE63CA00DAC693 /* Typer.cpp in Sources */, 4BB73EA21B587A5100552FC2 /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0;