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 {
|
2016-10-11 11:39:48 +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.
|
|
|
|
*/
|
2018-04-06 21:42:24 +00:00
|
|
|
OricTAP(const std::string &file_name);
|
2016-10-11 11:39:48 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
ErrorNotOricTAP
|
|
|
|
};
|
|
|
|
|
|
|
|
// implemented to satisfy @c Tape
|
|
|
|
bool is_at_end();
|
|
|
|
|
|
|
|
private:
|
2017-11-03 02:32:00 +00:00
|
|
|
Storage::FileHolder file_;
|
2016-10-11 11:39:48 +00:00
|
|
|
void virtual_reset();
|
|
|
|
Pulse virtual_get_next_pulse();
|
|
|
|
|
2016-10-25 01:59:06 +00:00
|
|
|
// byte serialisation and output
|
2016-11-21 12:14:09 +00:00
|
|
|
uint16_t current_value_;
|
|
|
|
int bit_count_;
|
|
|
|
int pulse_counter_;
|
2016-10-11 11:39:48 +00:00
|
|
|
|
|
|
|
enum Phase {
|
2016-10-11 12:07:51 +00:00
|
|
|
LeadIn, Header, Data, Gap, End
|
2016-11-21 12:14:09 +00:00
|
|
|
} phase_, next_phase_;
|
|
|
|
int phase_counter_;
|
|
|
|
uint16_t data_end_address_, data_start_address_;
|
2016-10-11 11:39:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|