2016-10-11 11:39:48 +00:00
|
|
|
//
|
|
|
|
// OricTAP.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 10/10/2016.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2016 Thomas Harte. All rights reserved.
|
2016-10-11 11:39:48 +00:00
|
|
|
//
|
|
|
|
|
2024-01-17 04:34:46 +00:00
|
|
|
#pragma once
|
2016-10-11 11:39:48 +00:00
|
|
|
|
|
|
|
#include "../Tape.hpp"
|
2016-11-21 12:14:09 +00:00
|
|
|
#include "../../FileHolder.hpp"
|
2018-04-06 21:42:24 +00:00
|
|
|
|
2016-11-21 12:14:09 +00:00
|
|
|
#include <cstdint>
|
2018-04-06 21:42:24 +00:00
|
|
|
#include <string>
|
2016-10-11 11:39:48 +00:00
|
|
|
|
2023-05-10 21:02:18 +00:00
|
|
|
namespace Storage::Tape {
|
2016-10-11 11:39:48 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Provides a @c Tape containing an Oric-format tape image, which is a byte stream capture.
|
|
|
|
*/
|
2017-11-03 02:32:00 +00:00
|
|
|
class OricTAP: public Tape {
|
2024-12-02 02:44:14 +00:00
|
|
|
public:
|
|
|
|
/*!
|
|
|
|
Constructs an @c OricTAP containing content from the file with name @c file_name.
|
|
|
|
|
|
|
|
@throws ErrorNotOricTAP if this file could not be opened and recognised as a valid Oric-format TAP.
|
|
|
|
*/
|
|
|
|
OricTAP(const std::string &file_name);
|
|
|
|
|
|
|
|
enum {
|
|
|
|
ErrorNotOricTAP
|
|
|
|
};
|
|
|
|
|
|
|
|
// implemented to satisfy @c Tape
|
2024-12-03 22:33:09 +00:00
|
|
|
bool is_at_end() const override;
|
2024-12-02 02:44:14 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Storage::FileHolder file_;
|
2024-12-03 22:33:09 +00:00
|
|
|
void virtual_reset() override;
|
|
|
|
Pulse virtual_get_next_pulse() override;
|
2024-12-02 02:44:14 +00:00
|
|
|
|
|
|
|
// byte serialisation and output
|
|
|
|
uint16_t current_value_;
|
|
|
|
int bit_count_;
|
|
|
|
int pulse_counter_;
|
|
|
|
|
|
|
|
enum Phase {
|
|
|
|
LeadIn, Header, Data, Gap, End
|
|
|
|
} phase_, next_phase_;
|
|
|
|
int phase_counter_;
|
|
|
|
uint16_t data_end_address_, data_start_address_;
|
2016-10-11 11:39:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|