// // ZX8081.hpp // Clock Signal // // Created by Thomas Harte on 07/06/2017. // Copyright 2017 Thomas Harte. All rights reserved. // #pragma once #include "TapeParser.hpp" #include "../../Data/ZX8081.hpp" #include #include #include namespace Storage::Tape::ZX8081 { enum class WaveType { Pulse, Gap, LongGap, Unrecognised }; enum class SymbolType { One, Zero, FileGap, Unrecognised }; class Parser: public Storage::Tape::PulseClassificationParser { public: Parser(); /*! Reads and combines the next eight bits. Returns -1 if any errors are encountered. */ int get_next_byte(const std::shared_ptr &); /*! Waits for a long gap, reads all the bytes between that and the next long gap, then attempts to parse those as a valid ZX80 or ZX81 file. If no file is found, returns nullptr. */ std::shared_ptr get_next_file(const std::shared_ptr &); private: bool pulse_was_high_; Time pulse_time_; void post_pulse(); void process_pulse(const Storage::Tape::Pulse &pulse) override; void mark_end() override; void inspect_waves(const std::vector &waves) override; std::shared_ptr> get_next_file_data(const std::shared_ptr &); }; }