2016-01-18 21:46:41 +00:00
|
|
|
//
|
|
|
|
// TapeUEF.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 18/01/2016.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2016 Thomas Harte. All rights reserved.
|
2016-01-18 21:46:41 +00:00
|
|
|
//
|
|
|
|
|
2024-01-17 04:34:46 +00:00
|
|
|
#pragma once
|
2016-01-18 21:46:41 +00:00
|
|
|
|
2017-07-17 02:04:40 +00:00
|
|
|
#include "../PulseQueuedTape.hpp"
|
2017-08-27 19:43:09 +00:00
|
|
|
|
|
|
|
#include "../../TargetPlatforms.hpp"
|
|
|
|
|
2016-09-08 11:41:26 +00:00
|
|
|
#include <cstdint>
|
2018-04-06 21:42:24 +00:00
|
|
|
#include <string>
|
|
|
|
#include <zlib.h>
|
2016-01-18 21:46:41 +00:00
|
|
|
|
2023-05-10 21:02:18 +00:00
|
|
|
namespace Storage::Tape {
|
2016-01-18 23:06:09 +00:00
|
|
|
|
2016-08-01 10:04:55 +00:00
|
|
|
/*!
|
2016-08-01 10:54:57 +00:00
|
|
|
Provides a @c Tape containing a UEF tape image, a slightly-convoluted description of pulses.
|
2016-08-01 10:04:55 +00:00
|
|
|
*/
|
2017-08-27 19:43:09 +00:00
|
|
|
class UEF : public PulseQueuedTape, public TargetPlatform::TypeDistinguisher {
|
2024-12-02 02:44:14 +00:00
|
|
|
public:
|
|
|
|
/*!
|
|
|
|
Constructs a @c UEF containing content from the file with name @c file_name.
|
2016-08-01 10:04:55 +00:00
|
|
|
|
2024-12-02 02:44:14 +00:00
|
|
|
@throws ErrorNotUEF if this file could not be opened and recognised as a valid UEF.
|
|
|
|
*/
|
|
|
|
UEF(const std::string &file_name);
|
|
|
|
~UEF();
|
2016-01-18 23:06:09 +00:00
|
|
|
|
2024-12-02 02:44:14 +00:00
|
|
|
enum {
|
|
|
|
ErrorNotUEF
|
|
|
|
};
|
2016-01-20 03:05:34 +00:00
|
|
|
|
2024-12-02 02:44:14 +00:00
|
|
|
private:
|
|
|
|
void virtual_reset();
|
2016-09-11 21:09:00 +00:00
|
|
|
|
2024-12-02 02:44:14 +00:00
|
|
|
void set_platform_type();
|
|
|
|
TargetPlatform::Type target_platform_type();
|
|
|
|
TargetPlatform::Type platform_type_ = TargetPlatform::Acorn;
|
2017-08-27 19:43:09 +00:00
|
|
|
|
2024-12-02 02:44:14 +00:00
|
|
|
gzFile file_;
|
|
|
|
unsigned int time_base_ = 1200;
|
|
|
|
bool is_300_baud_ = false;
|
2016-01-19 01:37:36 +00:00
|
|
|
|
2024-12-02 02:44:14 +00:00
|
|
|
struct Chunk {
|
|
|
|
uint16_t id;
|
|
|
|
uint32_t length;
|
|
|
|
z_off_t start_of_next_chunk;
|
|
|
|
};
|
2017-08-27 19:43:09 +00:00
|
|
|
|
2024-12-02 02:44:14 +00:00
|
|
|
bool get_next_chunk(Chunk &);
|
|
|
|
void get_next_pulses();
|
2016-09-05 22:28:43 +00:00
|
|
|
|
2024-12-02 02:44:14 +00:00
|
|
|
void queue_implicit_bit_pattern(uint32_t length);
|
|
|
|
void queue_explicit_bit_pattern(uint32_t length);
|
2016-01-18 23:06:09 +00:00
|
|
|
|
2024-12-02 02:44:14 +00:00
|
|
|
void queue_integer_gap();
|
|
|
|
void queue_floating_point_gap();
|
2016-01-19 01:37:36 +00:00
|
|
|
|
2024-12-02 02:44:14 +00:00
|
|
|
void queue_carrier_tone();
|
|
|
|
void queue_carrier_tone_with_dummy();
|
2016-01-19 01:45:14 +00:00
|
|
|
|
2024-12-02 02:44:14 +00:00
|
|
|
void queue_security_cycles();
|
|
|
|
void queue_defined_data(uint32_t length);
|
2016-02-21 03:18:00 +00:00
|
|
|
|
2024-12-02 02:44:14 +00:00
|
|
|
void queue_bit(int bit);
|
|
|
|
void queue_implicit_byte(uint8_t byte);
|
2016-01-18 21:46:41 +00:00
|
|
|
};
|
|
|
|
|
2016-01-18 23:06:09 +00:00
|
|
|
}
|