mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-12 08:30:05 +00:00
60 lines
1.2 KiB
C++
60 lines
1.2 KiB
C++
//
|
|
// OricTAP.hpp
|
|
// Clock Signal
|
|
//
|
|
// Created by Thomas Harte on 10/10/2016.
|
|
// Copyright 2016 Thomas Harte. All rights reserved.
|
|
//
|
|
|
|
#pragma once
|
|
|
|
#include "../Tape.hpp"
|
|
#include "../../FileHolder.hpp"
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
namespace Storage::Tape {
|
|
|
|
/*!
|
|
Provides a @c Tape containing an Oric-format tape image, which is a byte stream capture.
|
|
*/
|
|
class OricTAP: public Tape {
|
|
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
|
|
};
|
|
|
|
private:
|
|
struct Serialiser: public TapeSerialiser {
|
|
Serialiser(const std::string &file_name);
|
|
|
|
private:
|
|
bool is_at_end() const override;
|
|
void reset() override;
|
|
Pulse get_next_pulse() override;
|
|
|
|
Storage::FileHolder file_;
|
|
|
|
// 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_;
|
|
} serialiser_;
|
|
};
|
|
|
|
}
|